diff --git a/CHANGELOG.md b/CHANGELOG.md index 8855737ee..1ade2e529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Libupload path in docker files - Fix hiding the pagination of data tables - Fix shared objects functionality: visibility, deleting, editing tags +- URL does not strip the path, when that is present. Also small fixes to make it deployable under the same URL. ### Removed diff --git a/swift_browser_ui_frontend/src/common/download.js b/swift_browser_ui_frontend/src/common/download.js index aacadd1f6..ed451864c 100644 --- a/swift_browser_ui_frontend/src/common/download.js +++ b/swift_browser_ui_frontend/src/common/download.js @@ -64,7 +64,7 @@ export class DecryptedDownloadSession { let reader = response.body.getReader(); this.reader = reader; let { value: chunk, done: readerDone } = await this.reader.read(); - + this.chunk = chunk; this.readerDone = readerDone; @@ -165,7 +165,7 @@ export class DecryptedDownloadSession { signatureUrl.searchParams.append("path", headerPath); signed = await GET(signatureUrl); signed = await signed.json(); - let headerUrl = new URL(headerPath, this.endpoint); + let headerUrl = new URL(this.endpoint.concat(headerPath)); headerUrl.searchParams.append("valid", signed.valid); headerUrl.searchParams.append("signature", signed.signature); headerUrl.searchParams.append( @@ -185,14 +185,14 @@ export class DecryptedDownloadSession { initServiceWorker() { navigator.serviceWorker.addEventListener("message", (e) => { e.stopImmediatePropagation(); - switch(e.data.eventType) { + switch (e.data.eventType) { case "downloadSessionOpened": this.object = this.objects.pop(); this.currentFinished = false; if (this.object == undefined) { this.finished = true; } - this.getHeader(e.data.pubKey).then(() => {}); + this.getHeader(e.data.pubKey).then(() => { }); break; case "beginDecryption": window.open(new URL("/file", document.location.origin), "_blank"); @@ -203,7 +203,7 @@ export class DecryptedDownloadSession { }); break; case "nextDecryptChunk": - this.getSlice().then(() => {}); + this.getSlice().then(() => { }); break; case "streamClosed": (async () => { @@ -211,7 +211,9 @@ export class DecryptedDownloadSession { signatureUrl.searchParams.append("path", this.whitelistPath); let signed = await GET(signatureUrl); signed = await signed.json(); - let whitelistUrl = new URL(this.whitelistPath, this.endpoint); + let whitelistUrl = new URL( + this.endpoint.concat(this.whitelistPath), + ); whitelistUrl.searchParams.append("valid", signed.valid); whitelistUrl.searchParams.append("signature", signed.signature); await DELETE(whitelistUrl); diff --git a/swift_browser_ui_frontend/src/common/swift_sharing_request_bind.js b/swift_browser_ui_frontend/src/common/swift_sharing_request_bind.js index 20cb0e05c..4e35af68f 100644 --- a/swift_browser_ui_frontend/src/common/swift_sharing_request_bind.js +++ b/swift_browser_ui_frontend/src/common/swift_sharing_request_bind.js @@ -1,7 +1,7 @@ // Swift cross account container sharing API JavaScript bindings module. -import { +import { GET, } from "@/common/api"; @@ -39,8 +39,9 @@ class SwiftSharingRequest { owner, ) { // Add a request for container access. - let url = new URL("/request/user/".concat(username, "/", container), - this.address); + let url = new URL(this.address.concat("/request/user/", + username, + "/", container)); url.searchParams.append("owner", owner); let signed = await this._getSignature( @@ -62,8 +63,8 @@ class SwiftSharingRequest { async listMadeRequests( username, ) { - let url = new URL("/request/user/".concat(username), - this.address); + let url = new URL(this.address.concat("/request/user/", username), + ); let signed = await this._getSignature( 60, @@ -83,8 +84,8 @@ class SwiftSharingRequest { async listOwnedRequests( username, ) { - let url = new URL("/request/owner/".concat(username), - this.address); + let url = new URL(this.address.concat("/request/owner/", username), + ); let signed = await this._getSignature( 60, @@ -104,8 +105,8 @@ class SwiftSharingRequest { async listContainerRequests( container, ) { - let url = new URL("/request/container/".concat(container), - this.address); + let url = new URL(this.address.concat("/request/container/", container), + ); let signed = await this._getSignature( 60, @@ -129,7 +130,7 @@ class SwiftSharingRequest { ) { // Delete the details of an existing share action. let url = new URL( - "/request/user/".concat(username, "/", container), this.address, + this.address.concat("/request/user/", username, "/", container), ); url.searchParams.append("owner", owner); diff --git a/swift_browser_ui_frontend/src/common/swift_x_account_sharing_bind.js b/swift_browser_ui_frontend/src/common/swift_x_account_sharing_bind.js index 20fbcc0b0..312431c55 100644 --- a/swift_browser_ui_frontend/src/common/swift_x_account_sharing_bind.js +++ b/swift_browser_ui_frontend/src/common/swift_x_account_sharing_bind.js @@ -47,7 +47,7 @@ class SwiftXAccountSharing { username, ) { // List the containers the user has been given access to. - let url = new URL("/access/".concat(username), this.address); + let url = new URL(this.address.concat("/access/", username)); let signed = await this._getSignature( 60, @@ -71,7 +71,7 @@ class SwiftXAccountSharing { ) { // Get details from a container the user has been given access to. let url = new URL( - "/access/".concat(username, "/", container), this.address, + this.address.concat("/access/", username, "/", container), ); let signed = await this._getSignature( @@ -94,7 +94,7 @@ class SwiftXAccountSharing { username, ) { // List the containers the user has shared to another user / users. - let url = new URL("/share/".concat(username), this.address); + let url = new URL(this.address.concat("/share/", username)); let signed = await this._getSignature( 60, @@ -117,7 +117,7 @@ class SwiftXAccountSharing { ) { // Get details from a container the user has given access to. let url = new URL( - "/share/".concat(username, "/", container), this.address, + this.address.concat("/share/", username, "/", container), ); let signed = await this._getSignature( @@ -144,7 +144,7 @@ class SwiftXAccountSharing { ) { // Upload details about a new share action. let url = new URL( - "/share/".concat(username, "/", container), this.address, + this.address.concat("/share/", username, "/", container), ); url.searchParams.append("user", this._parseListString(userlist)); url.searchParams.append("access", this._parseListString(accesslist)); @@ -173,7 +173,7 @@ class SwiftXAccountSharing { ) { // Edit the details of an existing share action. let url = new URL( - "/share/".concat(username, "/", container), this.address, + this.address.concat("/share/", username, "/", container), ); url.searchParams.append("user", this._parseListString(userlist)); url.searchParams.append("access", this._parseListString(accesslist)); @@ -200,7 +200,7 @@ class SwiftXAccountSharing { ) { // Delete the details of an existing share action. let url = new URL( - "/share/".concat(username, "/", container), this.address, + this.address.concat("/share/", username, "/", container), ); let signed = await this._getSignature( @@ -228,7 +228,7 @@ class SwiftXAccountSharing { ) { // Delete all shares on a container let url = new URL( - "/share/".concat(username, "/", container), this.address, + this.address.concat("/share/", username, "/", container), ); let signed = await this._getSignature( diff --git a/swift_browser_ui_frontend/src/entries/main.js b/swift_browser_ui_frontend/src/entries/main.js index 6889d3013..5f9340475 100644 --- a/swift_browser_ui_frontend/src/entries/main.js +++ b/swift_browser_ui_frontend/src/entries/main.js @@ -79,11 +79,11 @@ if ("serviceWorker" in navigator) { if(DEV) console.log(err); }); } else { - if(DEV) console.log("Did not register Service Worker."); + if (DEV) console.log("Did not register Service Worker."); } -window.onerror = function(error) { - if(DEV) console.log("Global error", error); +window.onerror = function (error) { + if (DEV) console.log("Global error", error); }; window.addEventListener("unhandledrejection", function (event) { if (DEV) console.log("unhandledrejection", event); @@ -217,7 +217,7 @@ new Vue({ get() { return this.$store.state.openShareModal; }, - set() {}, + set() { }, }, }, watch: { @@ -347,8 +347,7 @@ new Vue({ let signed = await GET(signatureUrl); signed = await signed.json(); let keyURL = new URL( - keyPath, - discovery.upload_endpoint, + discovery.upload_endpoint.concat(keyPath), ); keyURL.searchParams.append("valid", signed.valid); keyURL.searchParams.append("signature", signed.signature);