Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve hotkeys-iframe.js from a path from Hedgedoc to circumvent CSP #87

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions front/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ server {
add_header Pragma "no-cache";
}

# Due to the CSP of Hedgedoc, we need to serve the hotkeys-iframe.js file from here to allow execution
location /pad/js/hotkeys-iframe.js {
root /usr/share/nginx/html;
try_files $uri /hotkeys-iframe.js =404;
}

location /pad/ {
proxy_pass http://hedgedoc:3000/;
proxy_http_version 1.1;
Expand Down
2 changes: 1 addition & 1 deletion front/src/pages/Task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineComponent({
// inject hotkey script with some CTFNote code to catch hotkey for search dialog
// and communicate that with the parent window
const hotkeyScript = taskFrame.document.createElement('script');
hotkeyScript.src = '/hotkeys-iframe.js';
hotkeyScript.src = '/pad/js/hotkeys-iframe.js'; // this won't exist in development but will in production
taskFrame.document.body.appendChild(hotkeyScript);
});
});
Expand Down
Loading