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

Fix "Download Meshes" functionality #7577

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fixed the initialization of the mapping list for agglomerate views if json mappings are present. [#7537](https://github.com/scalableminds/webknossos/pull/7537)
- Fixed a bug where uploading ND volume annotations would lead to errors due to parsing of the chunk paths. [#7547](https://github.com/scalableminds/webknossos/pull/7547)
- Fixed a bug where listing the annotations of other users would result in empty lists even if there are annotations and you should be allowed to see them. [#7563](https://github.com/scalableminds/webknossos/pull/7563)
- Fixed the "Download Meshes" functionality which was affected by the recent introduction of the CSP. [#7577](https://github.com/scalableminds/webknossos/pull/7577)

### Removed
- Removed several unused frontend libraries. [#7521](https://github.com/scalableminds/webknossos/pull/7521)
Expand Down
9 changes: 9 additions & 0 deletions frontend/javascripts/libs/zipjs_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@ if (!global.window) {

const Zip = require("@zip.js/zip.js") as typeof ZipType;

Zip.configure({
// Avoid that zip.js dynamically creates a web worker using new Blob(...) which would violate the CSP,
// see https://gildas-lormeau.github.io/zip.js/api/interfaces/Configuration.html#workerScripts
workerScripts: {
deflate: ["z-worker.js"],
inflate: ["z-worker.js"],
},
});

export default Zip;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"@types/pixelmatch": "^5.2.4",
"@types/pngjs": "^6.0.1",
"@types/three": "^0.142.0",
"@zip.js/zip.js": "^2.6.81",
"@zip.js/zip.js": "^2.7.32",
"ansi-to-react": "^6.1.6",
"antd": "^4.24.15",
"ball-morphology": "^0.1.0",
Expand Down
4 changes: 3 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ module.exports = function (env = {}) {
chunkFilename: "[name].css",
}),
new CopyPlugin({
// Use copy plugin to copy *.wasm to output folder.
patterns: [
// Use copy plugin to copy *.wasm to output folder.
{ from: "node_modules/onnxruntime-web/dist/*.wasm", to: "[name][ext]" },
{ from: "public/models/*.*", to: "models/[name][ext]" },
// For CSP, see https://gildas-lormeau.github.io/zip.js/api/interfaces/Configuration.html#workerScripts
{ from: "node_modules/@zip.js/zip.js/dist/z-worker.js", to: "[name][ext]" },
],
}),
];
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2453,10 +2453,10 @@
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

"@zip.js/zip.js@^2.6.81":
version "2.6.81"
resolved "https://registry.yarnpkg.com/@zip.js/zip.js/-/zip.js-2.6.81.tgz#c3c9618a8e02f3a24d359a0a14d46985fea971f5"
integrity sha512-VXrwa5fthYq74sIZsHarCFVSwnKdispTd/WQBgcNEuB9X0N3L5s8odRCjx9Zw6XsvpG5krqB4ZN4X0lLMyjgDA==
"@zip.js/zip.js@^2.7.32":
version "2.7.32"
resolved "https://registry.yarnpkg.com/@zip.js/zip.js/-/zip.js-2.7.32.tgz#54b1d4b2e6dcfc9cd75fd487d5831f8d983e55a6"
integrity sha512-9Ox1meDIvIKE23LLA7Fxd/ewJpKjj2KryH92doHRqx2406LmIzorsiMawL0qIK7dvwN9K+mfk47lauoIE0o1zQ==

abab@^2.0.0:
version "2.0.5"
Expand Down