Compress audio and clean links

This commit is contained in:
djmaze 2021-03-16 17:07:29 +01:00
parent 0b64083543
commit b7c02321fa
5 changed files with 6 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View file

@ -108,7 +108,7 @@ export const SMAudio = new class {
if ('running' == audioCtx.state && (this.supportedMp3 || this.supportedOgg)) { if ('running' == audioCtx.state && (this.supportedMp3 || this.supportedOgg)) {
if (!notificator) { if (!notificator) {
notificator = createNewObject(); notificator = createNewObject();
notificator.src = Links.sound('new-mail.'+ (this.supportedMp3 ? 'mp3' : 'ogg')); notificator.src = Links.staticLink('sounds/new-mail.'+ (this.supportedMp3 ? 'mp3' : 'ogg'));
} }
if (notificator) { if (notificator) {
notificator.volume = silent ? 0.01 : 1; notificator.volume = silent ? 0.01 : 1;

View file

@ -93,37 +93,22 @@ export function langLink(lang, isAdmin) {
* @param {string} path * @param {string} path
* @returns {string} * @returns {string}
*/ */
export function staticPrefix(path) { export function staticLink(path) {
return VERSION_PREFIX + 'static/' + path; return VERSION_PREFIX + 'static/' + path;
} }
/**
* @param {string} fileName
* @returns {string}
*/
export function sound(fileName) {
return staticPrefix('sounds/' + fileName);
}
/**
* @returns {string}
*/
export function notificationMailIcon() {
return staticPrefix('css/images/icon-message-notification.png');
}
/** /**
* @returns {string} * @returns {string}
*/ */
export function openPgpJs() { export function openPgpJs() {
return staticPrefix('js/min/openpgp.min.js'); return staticLink('js/min/openpgp.min.js');
} }
/** /**
* @returns {string} * @returns {string}
*/ */
export function openPgpWorkerJs() { export function openPgpWorkerJs() {
return staticPrefix('js/min/openpgp.worker.min.js'); return staticLink('js/min/openpgp.worker.min.js');
} }
/** /**

View file

@ -69,7 +69,7 @@ export const NotificationUserStore = new class {
if (DesktopNotifications && NotificationsGranted()) { if (DesktopNotifications && NotificationsGranted()) {
const options = { const options = {
body: text, body: text,
icon: imageSrc || Links.notificationMailIcon(), icon: imageSrc || Links.staticLink('css/images/icon-message-notification.png'),
data: messageData data: messageData
}; };
if (messageData && messageData.Uid) { if (messageData && messageData.Uid) {
@ -78,7 +78,7 @@ export const NotificationUserStore = new class {
if (WorkerNotifications) { if (WorkerNotifications) {
// Service-Worker-Allowed HTTP header to allow the scope. // Service-Worker-Allowed HTTP header to allow the scope.
WorkerNotifications.register('/serviceworker.js') WorkerNotifications.register('/serviceworker.js')
// WorkerNotifications.register(Links.staticPrefix('js/serviceworker.js'), {scope:'/'}) // WorkerNotifications.register(Links.staticLink('js/serviceworker.js'), {scope:'/'})
.then(() => .then(() =>
WorkerNotifications.ready.then(registration => WorkerNotifications.ready.then(registration =>
/* Show the notification */ /* Show the notification */