mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
define(['appSettings', 'connectionManager'], function (appSettings, connectionManager) {
|
|
'use strict';
|
|
|
|
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';
|
|
}
|
|
};
|
|
|
|
}); |