Correctly feature detect localStorage (fixes #1632)

This commit is contained in:
Jakob Borg 2015-04-13 06:50:07 +09:00
parent 270649535e
commit a027a60f5d
2 changed files with 18 additions and 3 deletions

View File

@ -32,8 +32,23 @@ angular.module('syncthing.core')
}
function autoConfigLocale() {
// Feature detect localStorage; https://mathiasbynens.be/notes/localstorage-pattern
var storage;
var fail;
var uid;
try {
uid = new Date;
(storage = window.localStorage).setItem(uid, uid);
fail = storage.getItem(uid) != uid;
storage.removeItem(uid);
fail && (storage = false);
} catch (exception) {}
var params = $location.search();
var savedLang = typeof(localStorage) != 'undefined' && localStorage[_SYNLANG];
var savedLang;
if (storage) {
savedLang = storage[_SYNLANG];
}
if(params.lang) {
useLocale(params.lang, true);

View File

@ -5,7 +5,7 @@ import (
)
const (
AssetsBuildDate = "Fri, 10 Apr 2015 11:32:14 GMT"
AssetsBuildDate = "Sun, 12 Apr 2015 21:49:29 GMT"
)
func Assets() map[string][]byte {
@ -109,7 +109,7 @@ func Assets() map[string][]byte {
assets["scripts/syncthing/core/module.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/0rMSy/NSSzSy81PKc1J1VAvrsxLLsnIzEvXS84vSlXXUYiO1bTmAgAAAP//AQAA//+OUhsnJgAAAA==")
assets["scripts/syncthing/core/services/localeService.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/6w5e3PbNvL/51Pg5+nUcmvLelCSmfxyU76Uy9S1O5Fv2kvS8UASJKKiSBUAZSudfPfbXZAi9Yjtmzn+AUOLxe5i34B5Os8TrprLbJononGqN+nExDKdNyeZEqdnrxh8zZXK1nIqVOP0OpvwRIyEWsuJOD1nsxzwZZayxhn7m5DxO821YNooOTGnb15twWuu2P1UzHieGEvofLuG3z1fc5nwcSLsqt7fO/r3zbV38469ZScwvcf5yRt2eckmWaoNW4gNm2WKJbh7ZDLF56KiAGgpN3It4M9SaJbNLCJM/wTGeqLkyjChJ3wlprt8r28D7zoa3d94v0Qj4P43O+Gzk9fsxJspueA81Sf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tg+CdEvxS6LV/gu1/1Ultei2j0v29VidfVGnU2NQhNg59SidbUNyqOgy8+XfWIev6pSbwKHCbkIwp43j/0w8wqUuCbZCL+iYzp6vKge9VJH0UcL/kX6L+Dk83H5n+foAclgWtzZ6XU0PsaDnDXKloHkokUs1o5a3/fGuYc7Y16OU9i9kx4kdXsGOUytWQ6lXCd/c4H9lv0Fw9x+w+yrezsrajHb5DwAAAP//AQAA//+C/H8Z2h4AAA==")
assets["scripts/syncthing/core/services/localeService.js"], _ = base64.StdEncoding.DecodeString("H4sIAAAJbogA/5Q5e3Mat/b/51Po5+nUuLV5LmDiX+50H5Cbqet0gu+0N0knI0CAyrJLJS026eS733OOtOwCayfVH7I4OjovnZfWPFlkMVf1dTrLYlE717tkapYyWdSnqRLnFy8YjPpGpVs5E6p2fptOeSzGQm3lVJxfsnkG+DJNWO2C/U3IOM4zLZg2Sk7N+c2LPXjLFfs0E3OexcYSutzv4fjEt1zGfBILu6uPz47/e3fr371mr9gZLD/h+uyGNRpsmibasJXYsXmqWIynxyZVfCEKCoCWcCO3Av6shWbp3CLC8k9grKdKbgwTeso3YnbI9/Zt6N8Ox5/u/F+GY+D+Nzvj87OX7MyfK7niPNFnlwBaI+hj1mr7TZxbAc7tCOdBQBjKYjR77T7OnodzZ0Bzi+DXBPdpPaAz2p0ZXHdxDhBj4A9xDpu0HhE8pHlozxiSTptMSZ5kCJsIR8drISev06U5oBnpeJ6dOzRbHL+0OyIqi0Mqnl+i0jmhVaZyTeeTXBvfyUuatWndLjSYJFdv7r6Oymq0HxX7gTWJd0FUUkdi1O3h3A9pjVKNmijzqEfrPpIbeW06Q3cUKPF5mSZiYUGPuShtEsULaN2ya0KhWwpSDb6wkgiZcoSE3PAY0JrDpgVebcHjkqk83mU1t/Hxcdgk4af5xbeakcA/vZaRCaetHW79JmK9bIS7teJWzhkRjVAE+kk3HonM6OmSAIt0r0er0KOFvjigext4JObsc263HlnGDwrrkc8663ktxBaxw+4M0Kc6QVCa+zRHNA9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