forked from tari-project/universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: block win sound and CSP (tari-project#1497)
Description --- Fix bug introduced from merging tari-project#372 Adds CSP for inline styling to allow rendering tower animation. Also changes loading audio file to bundle it with FE assets from public/assets instead of bundling it from BE and exposing for FE to fetch it. Some explanations regarding CSP: - `"dangerousDisableAssetCspModification": ["style-src"],` and ` "style-src": "'self' 'unsafe-inline'",` are required to use CSS-in-JS styled components to update components styling at runtime - `"script-src": "'wasm-unsafe-eval'", and the `http://ipc.localhost https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm https://unpkg.com/@lottiefiles/[email protected]/dist/dotlottie-player.wasm` inside ` "connect-src"` are required by animation libraries - `"default-src": "'self' asset: tauri: URL: blob: data:",` is the fallback for non-defined entries and it's just allows to access local assets, read them as a file and `"connect-src": "tauri: ipc: http://ipc.localhost ..."` allows to use commands - `"https:"` in `"default-src"` and `"connect-src"` is required by Windows to load assets (looks like Windows doesn't support custom protocols like `asset:` or `tuari:`) ```js "security": { "dangerousDisableAssetCspModification": ["style-src"], "csp": { "default-src": "'self' asset: tauri: URL: blob: data: https:", "script-src": "'wasm-unsafe-eval'", "style-src": "'self' 'unsafe-inline'", "connect-src": "https: tauri: ipc: http://ipc.localhost https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm https://unpkg.com/@lottiefiles/[email protected]/dist/dotlottie-player.wasm" }, }, ``` Motivation and Context --- Fix P0 bug and simplify handling of sound effect. How Has This Been Tested? --- What process can a PR reviewer use to test or verify this change? --- Few things to test: - sound effect when winning block mine - sound effect when replay won block - disabling and enabling audio from general settings - right click and toggle 'inspect' and check for any warning or error logs coming from lack of any CSP. All above should be done on release mode since previously this issues didn't occur on dev build. Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced audio playback functionality with interactive feedback on key events. - Added an audio toggle in settings for enabling or disabling sound. - Expanded multi-language support with a new “audio enabled” label across supported locales. - **Chores** - Updated Linux build processes to include essential audio libraries. - Improved configuration and security settings to enhance overall performance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Brian Pearce <[email protected]>
- Loading branch information
1 parent
d0ba475
commit da9a9ee
Showing
28 changed files
with
207 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
{ | ||
"identifier": "desktop-capability", | ||
"platforms": [ | ||
"macOS", | ||
"windows", | ||
"linux" | ||
], | ||
"windows": [ | ||
"main", | ||
"splashscreen" | ||
], | ||
"permissions": [ | ||
"updater:default" | ||
] | ||
} | ||
"identifier": "desktop-capability", | ||
"platforms": ["macOS", "windows", "linux"], | ||
"windows": ["main"], | ||
"permissions": [ | ||
"updater:default", | ||
"core:path:default", | ||
"core:event:default", | ||
"core:window:default", | ||
"core:app:default", | ||
"core:resources:default", | ||
"core:menu:default", | ||
"core:tray:default", | ||
"core:window:allow-close", | ||
"core:window:allow-destroy", | ||
"core:window:allow-minimize", | ||
"core:window:allow-unminimize", | ||
"shell:allow-open", | ||
"sentry:default", | ||
"process:allow-restart", | ||
"process:default", | ||
"clipboard-manager:allow-write-text" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,11 @@ | |
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"linux": { | ||
"appimage": { | ||
"bundleMediaFramework": true | ||
} | ||
}, | ||
"macOS": { | ||
"providerShortName": "Tari Labs, LLC" | ||
}, | ||
|
@@ -35,12 +40,14 @@ | |
}, | ||
"app": { | ||
"security": { | ||
"capabilities": [ | ||
"desktop-capability", | ||
"default", | ||
"migrated" | ||
], | ||
"csp": null, | ||
"capabilities": ["desktop-capability", "default", "migrated"], | ||
"dangerousDisableAssetCspModification": ["style-src"], | ||
"csp": { | ||
"default-src": "'self' asset: tauri: URL: blob: data: https:", | ||
"script-src": "'wasm-unsafe-eval'", | ||
"style-src": "'self' 'unsafe-inline'", | ||
"connect-src": "https: tauri: ipc: http://ipc.localhost https://cdn.jsdelivr.net/npm/@lottiefiles/[email protected]/dist/dotlottie-player.wasm https://unpkg.com/@lottiefiles/[email protected]/dist/dotlottie-player.wasm" | ||
}, | ||
"pattern": { | ||
"use": "isolation", | ||
"options": { | ||
|
@@ -75,9 +82,7 @@ | |
"plugins": { | ||
"updater": { | ||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEYxNUJBOEFEQkQ4RjJBMjYKUldRbUtvKzlyYWhiOFJIUmFFditENVV3d3hRbjNlZm1DMi9aMjluRUpVdHhQTytadTV3ODN3bUMK", | ||
"endpoints": [ | ||
"https://raw.githubusercontent.com/tari-project/universe/main/.updater/alpha-latest.json" | ||
], | ||
"endpoints": ["https://raw.githubusercontent.com/tari-project/universe/main/.updater/alpha-latest.json"], | ||
"windows": { | ||
"installMode": "passive" | ||
} | ||
|
@@ -92,4 +97,4 @@ | |
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.