mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
138611efb5
commit
11615f4399
72 changed files with 829 additions and 623 deletions
|
@ -1,48 +1,52 @@
|
|||
var connectionManager;
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function getApiClient(serverId) {
|
||||
var connectionManager;
|
||||
|
||||
if (connectionManager) {
|
||||
return Promise.resolve(connectionManager.getApiClient(serverId));
|
||||
}
|
||||
function getApiClient(serverId) {
|
||||
|
||||
//importScripts('serviceworker-cache-polyfill.js');
|
||||
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
function executeAction(action, data, serverId) {
|
||||
|
||||
return getApiClient(serverId).then(function (apiClient) {
|
||||
|
||||
switch (action) {
|
||||
case 'cancel-install':
|
||||
var id = data.id;
|
||||
return apiClient.cancelPackageInstallation(id);
|
||||
case 'restart':
|
||||
return apiClient.restartServer();
|
||||
default:
|
||||
clients.openWindow("/");
|
||||
return Promise.resolve();
|
||||
if (connectionManager) {
|
||||
return Promise.resolve(connectionManager.getApiClient(serverId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
//importScripts('serviceworker-cache-polyfill.js');
|
||||
|
||||
var notification = event.notification;
|
||||
notification.close();
|
||||
|
||||
var data = notification.data;
|
||||
var serverId = data.serverId;
|
||||
var action = event.action;
|
||||
|
||||
if (!action) {
|
||||
clients.openWindow("/");
|
||||
event.waitUntil(Promise.resolve());
|
||||
return;
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
event.waitUntil(executeAction(action, data, serverId));
|
||||
function executeAction(action, data, serverId) {
|
||||
|
||||
}, false);
|
||||
return getApiClient(serverId).then(function (apiClient) {
|
||||
|
||||
switch (action) {
|
||||
case 'cancel-install':
|
||||
var id = data.id;
|
||||
return apiClient.cancelPackageInstallation(id);
|
||||
case 'restart':
|
||||
return apiClient.restartServer();
|
||||
default:
|
||||
clients.openWindow("/");
|
||||
return Promise.resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
|
||||
var notification = event.notification;
|
||||
notification.close();
|
||||
|
||||
var data = notification.data;
|
||||
var serverId = data.serverId;
|
||||
var action = event.action;
|
||||
|
||||
if (!action) {
|
||||
clients.openWindow("/");
|
||||
event.waitUntil(Promise.resolve());
|
||||
return;
|
||||
}
|
||||
|
||||
event.waitUntil(executeAction(action, data, serverId));
|
||||
|
||||
}, false);
|
||||
})();
|
|
@ -1,4 +1,6 @@
|
|||
self.addEventListener('sync', function (event) {
|
||||
if (event.tag == 'emby-sync') {
|
||||
'use strict';
|
||||
|
||||
if (event.tag === 'emby-sync') {
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue