From 37849aaef03d7394cfb53dd7bbf6d3836d3c13f2 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 10 Jan 2025 22:33:46 +0800 Subject: [PATCH] :art: Improve S3/WebDAV endpoint setting https://ld246.com/article/1736518497899 --- app/src/config/repos.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index 53b144695..5df808bb7 100644 --- a/app/src/config/repos.ts +++ b/app/src/config/repos.ts @@ -316,8 +316,13 @@ const bindProviderEvent = () => { concurrentReqs = 16; } (providerPanelElement.querySelector("#timeout") as HTMLInputElement).value = timeout.toString(); + let endpoint = (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value; + endpoint = endpoint.replace("http://http(s)://", "http://"); + if (!endpoint.startsWith("http")) { + endpoint = "http://" + endpoint; + } const s3 = { - endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value, + endpoint: endpoint, accessKey: (providerPanelElement.querySelector("#accessKey") as HTMLInputElement).value, secretKey: (providerPanelElement.querySelector("#secretKey") as HTMLInputElement).value, bucket: (providerPanelElement.querySelector("#bucket") as HTMLInputElement).value, @@ -346,8 +351,13 @@ const bindProviderEvent = () => { concurrentReqs = 16; } (providerPanelElement.querySelector("#timeout") as HTMLInputElement).value = timeout.toString(); + let endpoint = (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value; + endpoint = endpoint.replace("http://http(s)://", "http://"); + if (!endpoint.startsWith("http")) { + endpoint = "http://" + endpoint; + } const webdav = { - endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value, + endpoint: endpoint, username: (providerPanelElement.querySelector("#username") as HTMLInputElement).value, password: (providerPanelElement.querySelector("#password") as HTMLInputElement).value, skipTlsVerify: (providerPanelElement.querySelector("#webdavSkipTlsVerify") as HTMLInputElement).value === "true",