ui: sw: handle events for streamsaver

This commit is contained in:
undefined committed 2022-10-13 11:46:04 +08:00
1 parent 27bf54ed34
commit e8b6459e01
3 files changed
+6 -8

No files matched your search

@@ -16,11 +16,7 @@ function onBeforeUnload(e) {
} }
e.returnValue = ''; e.returnValue = '';
} }
if (window.location.protocol === 'https:' streamsaver.mitm = `${window.isSecureContext ? '' : 'https://hydro.ac'}/streamsaver/mitm.html`;
|| window.location.protocol === 'chrome-extension:'
|| window.location.hostname === 'localhost') {
streamsaver.mitm = '/streamsaver/mitm.html';
}
const waitForWritableStream = window.WritableStream const waitForWritableStream = window.WritableStream
? Promise.resolve() ? Promise.resolve()
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.41.12", "version": "4.41.13",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "index.ts", "main": "index.ts",
+4 -2
View File
@@ -2,8 +2,10 @@
/// <reference lib="ES2015" /> /// <reference lib="ES2015" />
/// <reference types="@types/serviceworker" /> /// <reference types="@types/serviceworker" />
/* global clients */ /* global clients */
// eslint-disable-next-line no-restricted-globals /* eslint-disable no-restricted-globals */
addEventListener('notificationclick', (event) => { import 'streamsaver/sw.js';
self.addEventListener('notificationclick', (event) => {
console.log('On notification click: ', event.notification.tag); console.log('On notification click: ', event.notification.tag);
event.notification.close(); event.notification.close();
if (!event.notification.tag.startsWith('message-')) return; if (!event.notification.tag.startsWith('message-')) return;