diff --git a/public/index.html b/public/index.html index 49f4338..0d4facb 100644 --- a/public/index.html +++ b/public/index.html @@ -88,7 +88,7 @@

🔐 OpenList Token 获取工具

- +
diff --git a/public/static/spoid.js b/public/static/spoid.js index 210f390..25fbcdb 100644 --- a/public/static/spoid.js +++ b/public/static/spoid.js @@ -64,7 +64,7 @@ function getWebdav() { // 获取站点ID -function getSiteID() { +function getSiteID(server_use_input = false) { const siteUrl = document.getElementById("sharepoint-url").value.trim(); const access_token = document.getElementById("access-token").value.trim(); const refresh_token = document.getElementById("refresh-token").value.trim(); @@ -91,12 +91,21 @@ function getSiteID() { BAD_REQUEST: "获取出现问题,请检查权限和站点URL,站点URL示例:https://demo.sharepoint.com/site/demo", DEFAULT: "请求发生错误" }; - - // 验证 - if (!client_uid || !client_key) { - idElement.value = ERROR_MESSAGES.MISSING_CREDENTIALS; + + // 使用服务器提供的uid和key获取站点ID + if (site_type.includes("onedrive")){ + if (!client_uid || !client_key){ + if (!server_use_input) { + idElement.value = ERROR_MESSAGES.MISSING_CREDENTIALS; + return; + } + } + }else{ + idElement.value = ERROR_MESSAGES.NOT_SUPPORTED; return; } + + // 验证 if (!access_token || !refresh_token) { idElement.value = ERROR_MESSAGES.MISSING_TOKENS; return; @@ -105,10 +114,6 @@ function getSiteID() { idElement.value = ERROR_MESSAGES.MISSING_URL; return; } - if (!site_type.includes("onedrive")) { - idElement.value = ERROR_MESSAGES.NOT_SUPPORTED; - return; - } if (!GATEWAYS[site_type]) { idElement.value = ERROR_MESSAGES.DEFAULT; return; @@ -168,4 +173,4 @@ function getSiteID() { idElement.value = ERROR_MESSAGES.BAD_REQUEST; console.error("URL解析失败:", error); } -} \ No newline at end of file +}