Skip to content

Commit

Permalink
Allow mailspring:// for sounds / other media elements
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed Jul 29, 2023
1 parent 31a8b59 commit 2b75347
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
13 changes: 4 additions & 9 deletions app/internal_packages/custom-sounds/lib/main.ts
@@ -1,15 +1,10 @@
import { SoundRegistry } from 'mailspring-exports';

export function activate() {
// FIXME: Use the mailspring:// protocol handlers once we upgrade Electron past
// v30.0
// See: https://github.com/atom/electron/issues/1123
SoundRegistry.register({
send: ['internal_packages', 'custom-sounds', 'CUSTOM_UI_Send_v1.ogg'],
confirm: ['internal_packages', 'custom-sounds', 'CUSTOM_UI_Confirm_v1.ogg'],
'hit-send': ['internal_packages', 'custom-sounds', 'CUSTOM_UI_HitSend_v1.ogg'],
'new-mail': ['internal_packages', 'custom-sounds', 'CUSTOM_UI_NewMail_v1.ogg'],
});
SoundRegistry.register('send', 'mailspring://custom-sounds/CUSTOM_UI_Send_v1.ogg');
SoundRegistry.register('confirm', 'mailspring://custom-sounds/CUSTOM_UI_Confirm_v1.ogg');
SoundRegistry.register('hit-send', 'mailspring://custom-sounds/CUSTOM_UI_HitSend_v1.ogg');
SoundRegistry.register('new-mail', 'mailspring://custom-sounds/CUSTOM_UI_NewMail_v1.ogg');
}

export function deactivate() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/browser/main.js
Expand Up @@ -352,7 +352,7 @@ const start = () => {
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [
"default-src * mailspring:; script-src 'self' 'unsafe-inline' chrome-extension://react-developer-tools; style-src * 'unsafe-inline' mailspring:; img-src * data: mailspring: file:; object-src none; media-src none; manifest-src none;",
"default-src * mailspring:; script-src 'self' 'unsafe-inline' chrome-extension://react-developer-tools; style-src * 'unsafe-inline' mailspring:; img-src * data: mailspring: file:; object-src none; media-src mailspring:; manifest-src none;",
],
},
});
Expand Down
2 changes: 1 addition & 1 deletion app/static/index.html
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Mailspring</title>

<meta http-equiv="Content-Security-Policy" content="default-src * mailspring:; script-src 'self' chrome-extension://react-developer-tools; style-src * 'unsafe-inline' mailspring:; img-src * data: mailspring: file:; object-src none; media-src none; manifest-src none;">
<meta http-equiv="Content-Security-Policy" content="default-src * mailspring:; script-src 'self' chrome-extension://react-developer-tools; style-src * 'unsafe-inline' mailspring:; img-src * data: mailspring: file:; object-src none; media-src mailspring:; manifest-src none;">

<script src="index.js"></script>
</head>
Expand Down

0 comments on commit 2b75347

Please sign in to comment.