mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
define(['appSettings'], function (appSettings) {
|
|
|
|
var syncPromise;
|
|
|
|
window.LocalSync = {
|
|
|
|
isSupported: function () {
|
|
return AppInfo.isNativeApp && Dashboard.capabilities().SupportsSync;
|
|
},
|
|
|
|
sync: function (options) {
|
|
|
|
if (syncPromise) {
|
|
return syncPromise.promise();
|
|
}
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
require(['multiserversync'], function () {
|
|
|
|
options = options || {};
|
|
|
|
LocalSync.normalizeSyncOptions(options);
|
|
|
|
options.cameraUploadServers = appSettings.cameraUploadServers();
|
|
|
|
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).then(function () {
|
|
|
|
syncPromise = null;
|
|
resolve();
|
|
|
|
}, function () {
|
|
|
|
syncPromise = null;
|
|
});
|
|
});
|
|
|
|
});
|
|
},
|
|
|
|
normalizeSyncOptions: function (options) {
|
|
|
|
},
|
|
|
|
getSyncStatus: function () {
|
|
|
|
if (syncPromise != null) {
|
|
return 'Syncing';
|
|
}
|
|
return 'Idle';
|
|
}
|
|
};
|
|
|
|
}); |