From da5abba5b9758fab18d1c1f33a2af090852a24ac Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 1 Apr 2024 22:32:41 +0200 Subject: [PATCH] Added /public to public endpoints. Updated version --- build.gradle | 2 +- frontend/src/app/credits/credits.component.ts | 2 +- frontend/src/app/download/download.component.ts | 6 +++--- frontend/src/app/upload/upload.component.ts | 6 +++--- .../java/de/w665/sharepulse/rest/ApiRestController.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 5784301..e75d748 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group = 'de.w665' -version = '1.1.1' +version = '1.1.2' java { sourceCompatibility = '21' diff --git a/frontend/src/app/credits/credits.component.ts b/frontend/src/app/credits/credits.component.ts index 2aacf5b..35df6f2 100644 --- a/frontend/src/app/credits/credits.component.ts +++ b/frontend/src/app/credits/credits.component.ts @@ -32,7 +32,7 @@ export class CreditsComponent { } getVersion() { - axios.get(this.developmentStore.getBaseUrl() + 'api/v1/version') + axios.get(this.developmentStore.getBaseUrl() + 'api/v1/public/version') .then((response) => { this.version = response.data; }) diff --git a/frontend/src/app/download/download.component.ts b/frontend/src/app/download/download.component.ts index 8e23240..9e7d243 100644 --- a/frontend/src/app/download/download.component.ts +++ b/frontend/src/app/download/download.component.ts @@ -99,7 +99,7 @@ export class DownloadComponent { axios({ method: 'get', - url: this.developmentStore.getBaseUrl() + 'api/v1/speed-test', + url: this.developmentStore.getBaseUrl() + 'api/v1/public/speed-test', responseType: 'arraybuffer', }) .then(response => { @@ -119,7 +119,7 @@ export class DownloadComponent { private getDownloadInfo() { axios({ method: 'get', - url: this.developmentStore.getBaseUrl() + 'api/v1/download-info?fileId=' + this.fileId, + url: this.developmentStore.getBaseUrl() + 'api/v1/public/download-info?fileId=' + this.fileId, responseType: 'json', }) .then(response => { @@ -138,7 +138,7 @@ export class DownloadComponent { this.fileDownloadStarted = true; axios({ method: 'get', - url: this.developmentStore.getBaseUrl() + 'api/v1/download?fileId=' + this.fileId + '&password=' + this.filePassword, + url: this.developmentStore.getBaseUrl() + 'api/v1/public/download?fileId=' + this.fileId + '&password=' + this.filePassword, responseType: 'arraybuffer', onDownloadProgress: (progressEvent) => { const endTime = new Date().getTime(); diff --git a/frontend/src/app/upload/upload.component.ts b/frontend/src/app/upload/upload.component.ts index df1cce8..a62099a 100644 --- a/frontend/src/app/upload/upload.component.ts +++ b/frontend/src/app/upload/upload.component.ts @@ -97,7 +97,7 @@ export class UploadComponent { } }; - axios.post(this.developmentStore.getBaseUrl() + 'api/v1/upload', formData, config) + axios.post(this.developmentStore.getBaseUrl() + 'api/v1/public/upload', formData, config) .then(response => { console.log('Upload completed successfully!'); console.log(response.data); @@ -119,7 +119,7 @@ export class UploadComponent { passwordUrlPart = `&password=${fileDetails.password}`; } const downloadUrl = `${baseUrl}download?fileId=${fileId}${passwordUrlPart}`; - const deleteUrl = `${baseUrl}api/v1/deletefile?fileId=${fileId}${passwordUrlPart}`; + const deleteUrl = `${baseUrl}api/v1/public/deletefile?fileId=${fileId}${passwordUrlPart}`; const statusUrl = `${baseUrl}status?fileId=${fileId}${passwordUrlPart}`; return { downloadUrl, @@ -151,7 +151,7 @@ export class UploadComponent { axios({ method: 'post', - url: this.developmentStore.getBaseUrl() + 'api/v1/upload-speed-test', + url: this.developmentStore.getBaseUrl() + 'api/v1/public/upload-speed-test', data: uint8View, headers: { 'Content-Type': 'application/octet-stream', diff --git a/src/main/java/de/w665/sharepulse/rest/ApiRestController.java b/src/main/java/de/w665/sharepulse/rest/ApiRestController.java index 828a67e..508b4ba 100644 --- a/src/main/java/de/w665/sharepulse/rest/ApiRestController.java +++ b/src/main/java/de/w665/sharepulse/rest/ApiRestController.java @@ -4,6 +4,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController -@RequestMapping("/api/v1") +@RequestMapping("/api/v1/public") public abstract class ApiRestController { }