mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update storage
This commit is contained in:
parent
c50d82e592
commit
781f63d9ac
7 changed files with 94 additions and 64 deletions
|
@ -16,12 +16,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.1.74",
|
||||
"_release": "1.1.74",
|
||||
"version": "1.1.75",
|
||||
"_release": "1.1.75",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.1.74",
|
||||
"commit": "3899ca26b73cbca2779ca2ff62c1063bf058ee4c"
|
||||
"tag": "1.1.75",
|
||||
"commit": "5518536e19fe1efdb8cb149833320017c051e751"
|
||||
},
|
||||
"_source": "https://github.com/MediaBrowser/Emby.ApiClient.Javascript.git",
|
||||
"_target": "^1.1.51",
|
||||
|
|
50
dashboard-ui/bower_components/emby-apiclient/appstorage-localstorage.js
vendored
Normal file
50
dashboard-ui/bower_components/emby-apiclient/appstorage-localstorage.js
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
define([], function () {
|
||||
|
||||
var myStore = {};
|
||||
var cache;
|
||||
var localData;
|
||||
|
||||
function updateCache() {
|
||||
cache.put('data', new Response(JSON.stringify(localData)));
|
||||
}
|
||||
|
||||
myStore.setItem = function (name, value) {
|
||||
localStorage.setItem(name, value);
|
||||
|
||||
if (localData) {
|
||||
var changed = localData[name] != value;
|
||||
|
||||
if (changed) {
|
||||
localData[name] = value;
|
||||
updateCache();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
myStore.getItem = function (name) {
|
||||
return localStorage.getItem(name);
|
||||
};
|
||||
|
||||
myStore.removeItem = function (name) {
|
||||
localStorage.removeItem(name);
|
||||
|
||||
if (localData) {
|
||||
localData[name] = null;
|
||||
delete localData[name];
|
||||
updateCache();
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
|
||||
caches.open('embydata').then(function (result) {
|
||||
cache = result;
|
||||
localData = {};
|
||||
});
|
||||
|
||||
} catch (err) {
|
||||
console.log('Error opening cache: ' + err);
|
||||
}
|
||||
|
||||
return myStore;
|
||||
});
|
21
dashboard-ui/bower_components/emby-apiclient/appstorage-memory.js
vendored
Normal file
21
dashboard-ui/bower_components/emby-apiclient/appstorage-memory.js
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
define([], function () {
|
||||
|
||||
function myStore(defaultObject) {
|
||||
|
||||
this.localData = {};
|
||||
}
|
||||
|
||||
myStore.prototype.setItem = function (name, value) {
|
||||
this.localData[name] = value;
|
||||
};
|
||||
|
||||
myStore.prototype.getItem = function (name) {
|
||||
return this.localData[name];
|
||||
};
|
||||
|
||||
myStore.prototype.removeItem = function (name) {
|
||||
this.localData[name] = null;
|
||||
};
|
||||
|
||||
return new myStore();
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
define([], function () {
|
||||
|
||||
function myStore(defaultObject) {
|
||||
|
||||
var self = this;
|
||||
self.localData = {};
|
||||
|
||||
var isDefaultAvailable;
|
||||
|
||||
if (defaultObject) {
|
||||
try {
|
||||
defaultObject.setItem('_test', '0');
|
||||
defaultObject.removeItem('_test');
|
||||
isDefaultAvailable = true;
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
self.setItem = function (name, value) {
|
||||
|
||||
if (isDefaultAvailable) {
|
||||
defaultObject.setItem(name, value);
|
||||
} else {
|
||||
self.localData[name] = value;
|
||||
}
|
||||
};
|
||||
|
||||
self.getItem = function (name) {
|
||||
|
||||
if (isDefaultAvailable) {
|
||||
return defaultObject.getItem(name);
|
||||
}
|
||||
|
||||
return self.localData[name];
|
||||
};
|
||||
|
||||
self.removeItem = function (name) {
|
||||
|
||||
if (isDefaultAvailable) {
|
||||
defaultObject.removeItem(name);
|
||||
} else {
|
||||
self.localData[name] = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
return new myStore(localStorage);
|
||||
} catch (err) {
|
||||
return new myStore();
|
||||
}
|
||||
});
|
|
@ -198,8 +198,8 @@
|
|||
}
|
||||
|
||||
.visualCardBox .cardFooter {
|
||||
border-bottom-left-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
-moz-box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
-ms-box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
-webkit-box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"main": "iron-meta.html",
|
||||
"homepage": "https://github.com/PolymerElements/iron-meta",
|
||||
"homepage": "https://github.com/polymerelements/iron-meta",
|
||||
"_release": "1.1.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-meta.git",
|
||||
"_source": "git://github.com/polymerelements/iron-meta.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-meta"
|
||||
"_originalSource": "polymerelements/iron-meta"
|
||||
}
|
|
@ -1295,6 +1295,17 @@ var AppInfo = {};
|
|||
return layoutManager;
|
||||
}
|
||||
|
||||
function getAppStorage(basePath) {
|
||||
|
||||
try {
|
||||
localStorage.setItem('_test', '0');
|
||||
localStorage.removeItem('_test');
|
||||
return basePath + "/appstorage-localstorage";
|
||||
} catch (e) {
|
||||
return basePath + "/appstorage-memory";
|
||||
}
|
||||
}
|
||||
|
||||
function initRequire() {
|
||||
|
||||
var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate());
|
||||
|
@ -1439,7 +1450,7 @@ var AppInfo = {};
|
|||
if (Dashboard.isRunningInCordova() && window.MainActivity) {
|
||||
paths.appStorage = "cordova/android/appstorage";
|
||||
} else {
|
||||
paths.appStorage = apiClientBowerPath + "/appstorage";
|
||||
paths.appStorage = getAppStorage(apiClientBowerPath);
|
||||
}
|
||||
|
||||
paths.syncDialog = "scripts/sync";
|
||||
|
@ -2969,3 +2980,4 @@ pageClassOn('viewshow', "page", function () {
|
|||
|
||||
Dashboard.ensureHeader(page);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue