mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
44 lines
1.0 KiB
JavaScript
44 lines
1.0 KiB
JavaScript
define(['appSettings', 'connectionManager'], function (appSettings, connectionManager) {
|
|
|
|
var syncPromise;
|
|
|
|
return {
|
|
|
|
sync: function (options) {
|
|
|
|
if (syncPromise) {
|
|
return syncPromise.promise();
|
|
}
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
require(['multiserversync'], function (MultiServerSync) {
|
|
|
|
options = options || {};
|
|
|
|
options.cameraUploadServers = appSettings.cameraUploadServers();
|
|
|
|
syncPromise = new MultiServerSync(connectionManager).sync(options).then(function () {
|
|
|
|
syncPromise = null;
|
|
resolve();
|
|
|
|
}, function () {
|
|
|
|
syncPromise = null;
|
|
});
|
|
});
|
|
|
|
});
|
|
},
|
|
|
|
getSyncStatus: function () {
|
|
|
|
if (syncPromise != null) {
|
|
return 'Syncing';
|
|
}
|
|
return 'Idle';
|
|
}
|
|
};
|
|
|
|
}); |