mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-18 18:07:35 +00:00
better hasLocalStorage detection; removed legacy VCS localStorage conversion
This commit is contained in:
parent
ec6ce6b448
commit
eabcd5e8b0
@ -107,8 +107,9 @@ var hasLocalStorage : boolean = function() {
|
||||
try {
|
||||
const key = "__some_random_key_you_are_not_going_to_use__";
|
||||
localStorage.setItem(key, key);
|
||||
var has = localStorage.getItem(key) == key;
|
||||
localStorage.removeItem(key);
|
||||
return true;
|
||||
return has;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
@ -1928,8 +1929,6 @@ export function startUI(loadplatform : boolean) {
|
||||
loadImportedURL(qs['importURL']);
|
||||
return;
|
||||
}
|
||||
// is vcs? convert legacy stuff
|
||||
convertLegacyVCS(store);
|
||||
// load and start platform object
|
||||
if (loadplatform) {
|
||||
loadAndStartPlatform();
|
||||
@ -1960,24 +1959,6 @@ function loadAndStartPlatform() {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: remove eventually
|
||||
function convertLegacyVCS(store) {
|
||||
if (platform_id == 'vcs' && hasLocalStorage && !localStorage.getItem("__migratevcs")) {
|
||||
store.keys().then((keys:string[]) => {
|
||||
keys.forEach((key) => {
|
||||
if (key.startsWith('examples/') && !key.endsWith('.a')) {
|
||||
store.getItem(key).then( (val) => {
|
||||
if (val) {
|
||||
return store.setItem(key+'.a', val);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
localStorage.setItem("__migratevcs", "1");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// HTTPS REDIRECT
|
||||
|
||||
const useHTTPSCookieName = "__use_https";
|
||||
|
Loading…
Reference in New Issue
Block a user