mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-25 06:57:22 +00:00
Don't fail hard when SecurityException is thrown.
This commit is contained in:
parent
f33a51e61f
commit
c8cdb5a7e8
@ -177,7 +177,7 @@ export default {
|
|||||||
{ code: "ml", name: "Malayalam" },
|
{ code: "ml", name: "Malayalam" },
|
||||||
{ code: "nb_NO", name: "Norwegian Bokmål" },
|
{ code: "nb_NO", name: "Norwegian Bokmål" },
|
||||||
{ code: "tr", name: "Turkish" },
|
{ code: "tr", name: "Turkish" },
|
||||||
{ code: 'bn', name: 'Bengali' }
|
{ code: "bn", name: "Bengali" },
|
||||||
],
|
],
|
||||||
enabledCodecs: ["av1", "vp9", "avc"],
|
enabledCodecs: ["av1", "vp9", "avc"],
|
||||||
};
|
};
|
||||||
@ -217,7 +217,7 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (localStorage) {
|
if (this.testLocalStorage) {
|
||||||
this.selectedInstance = this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
|
this.selectedInstance = this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
|
||||||
|
|
||||||
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
|
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
|
||||||
@ -270,7 +270,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onChange() {
|
onChange() {
|
||||||
if (localStorage) {
|
if (this.testLocalStorage) {
|
||||||
var shouldReload = false;
|
var shouldReload = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
14
src/main.js
14
src/main.js
@ -108,7 +108,7 @@ const mixin = {
|
|||||||
var value;
|
var value;
|
||||||
if (
|
if (
|
||||||
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
||||||
(localStorage && (value = localStorage.getItem(key)) !== null)
|
(this.testLocalStorage && (value = localStorage.getItem(key)) !== null)
|
||||||
) {
|
) {
|
||||||
switch (String(value).toLowerCase()) {
|
switch (String(value).toLowerCase()) {
|
||||||
case "true":
|
case "true":
|
||||||
@ -125,7 +125,7 @@ const mixin = {
|
|||||||
var value;
|
var value;
|
||||||
if (
|
if (
|
||||||
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
||||||
(localStorage && (value = localStorage.getItem(key)) !== null)
|
(this.testLocalStorage && (value = localStorage.getItem(key)) !== null)
|
||||||
) {
|
) {
|
||||||
return value;
|
return value;
|
||||||
} else return defaultVal;
|
} else return defaultVal;
|
||||||
@ -134,7 +134,7 @@ const mixin = {
|
|||||||
var value;
|
var value;
|
||||||
if (
|
if (
|
||||||
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
(value = new URLSearchParams(window.location.search).get(key)) !== null ||
|
||||||
(localStorage && (value = localStorage.getItem(key)) !== null)
|
(this.testLocalStorage && (value = localStorage.getItem(key)) !== null)
|
||||||
) {
|
) {
|
||||||
return Number(value);
|
return Number(value);
|
||||||
} else return defaultVal;
|
} else return defaultVal;
|
||||||
@ -202,6 +202,14 @@ const mixin = {
|
|||||||
authenticated(_this) {
|
authenticated(_this) {
|
||||||
return _this.getAuthToken() !== undefined;
|
return _this.getAuthToken() !== undefined;
|
||||||
},
|
},
|
||||||
|
testLocalStorage() {
|
||||||
|
try {
|
||||||
|
if (window.localStorage !== undefined) localStorage;
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user