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

Drawio image #1295

Merged
merged 29 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
304fc6e
Upgrade draw.io to 21.7.5
wginolas Sep 14, 2023
8d6942b
WIP play with open dialog
wginolas Sep 22, 2023
2dbd2b6
openFilePicker now also returns fileType
wginolas Sep 27, 2023
d1b2da8
Can add image from CryptPad. Size is missing.
wginolas Sep 27, 2023
62770db
Clean up code
wginolas Sep 27, 2023
f4aa373
Fix npm lint
wginolas Sep 29, 2023
2945e6f
Pass blobs to draw.io
wginolas Oct 10, 2023
bd0ace1
Adding an image from Nextcloud works
wginolas Oct 12, 2023
b1e8122
Move image dialog to its own module
wginolas Oct 16, 2023
2d63fec
Fix image import from cryptpad
wginolas Oct 17, 2023
2611785
Fix draw.io dependency
wginolas Oct 17, 2023
7f55498
Update draw.io dependency and remove unneeded CSP headers
wginolas Oct 17, 2023
e714296
Fix package-lock after rebase
wginolas Oct 17, 2023
dc0bf55
Correct wording for integrated diagram
wginolas Oct 18, 2023
98735a2
Fix lint warnings
wginolas Oct 19, 2023
049fa08
WIP build cryptpad: urls for images
wginolas Nov 8, 2023
3d02201
WIP pass urls instead of blobs to draw.io
wginolas Nov 9, 2023
4924c86
Simplify CryptPad URLs
wginolas Nov 16, 2023
4407b5c
Handle old version Nextcloud image import
wginolas Nov 28, 2023
d42539b
Merge remote-tracking branch 'origin/staging' into drawio-image
wginolas Dec 6, 2023
15c3d94
Embed images in diagrams when exporting them
wginolas Dec 6, 2023
5c8e8c5
Fix eslint warnings
wginolas Dec 7, 2023
3fedc35
Disable internal diagram export which is broken for images
wginolas Dec 7, 2023
4385a9d
WIP
wginolas Dec 8, 2023
a96856b
Allow loading diagram images from Nextcloud
wginolas Dec 22, 2023
e681525
Upgrade to draw.io 21.8.2+4
wginolas Dec 22, 2023
31c509d
Prevent draw.io from embedding images.
wginolas Jan 18, 2024
ebcbf45
Remove custom HTTP headers for diagrams
yflory Jan 29, 2024
d225204
Update example nginx
yflory Jan 29, 2024
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
5 changes: 0 additions & 5 deletions docs/example-advanced.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ server {
# We've applied other sandboxing techniques to mitigate the risk of running WebAssembly in this privileged scope
if ($uri ~ ^\/unsafeiframe\/inner\.html.*$) { set $unsafe 1; }

# draw.io uses inline script tags in it's index.html. The hashes are added here.
if ($uri ~ ^\/components\/drawio\/src\/main\/webapp\/index.html.*$) {
set $scriptSrc "'self' 'sha256-dLMFD7ijAw6AVaqecS7kbPcFFzkxQ+yeZSsKpOdLxps=' 'sha256-6g514VrT/cZFZltSaKxIVNFF46+MFaTSDTPB8WfYK+c=' resource: https://${main_domain}";
}

# privileged contexts allow a few more rights than unprivileged contexts, though limits are still applied
if ($unsafe) {
set $scriptSrc "'self' 'unsafe-eval' 'unsafe-inline' resource: https://${main_domain}";
Expand Down
4 changes: 0 additions & 4 deletions lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ Default.padContentSecurity = function (Env) {
return (Default.commonCSP(Env).join('; ') + "script-src 'self' 'unsafe-eval' 'unsafe-inline' resource: " + Env.httpUnsafeOrigin).replace(/\s+/g, ' ');
};

Default.diagramContentSecurity = function (Env) {
return (Default.commonCSP(Env).join('; ') + "script-src 'self' 'sha256-dLMFD7ijAw6AVaqecS7kbPcFFzkxQ+yeZSsKpOdLxps=' 'sha256-6g514VrT/cZFZltSaKxIVNFF46+MFaTSDTPB8WfYK+c=' resource: " + Env.httpUnsafeOrigin).replace(/\s+/g, ' ');
};

Default.httpHeaders = function (Env) {
return {
"X-XSS-Protection": "1; mode=block",
Expand Down
4 changes: 0 additions & 4 deletions lib/http-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ var getHeaders = function (Env, type) {
var csp;
if (type === 'office') {
csp = Default.padContentSecurity(Env);
} else if (type === 'diagram') {
csp = Default.diagramContentSecurity(Env);
} else {
csp = Default.contentSecurity(Env);
}
Expand All @@ -151,8 +149,6 @@ var setHeaders = function (req, res) {
type = 'office';
} else if (/^\/api\/(broadcast|config)/.test(req.url)) {
type = 'api';
} else if (/^\/components\/drawio\/src\/main\/webapp\/index.html.*$/.test(req.url)) {
type = 'diagram';
} else {
type = 'standard';
}
Expand Down
Loading