Skip to content

Commit 6ef91ef

Browse files
xiaoman1221PIKACHUIMCopilot
authored
fix(func): 勾选使用 OpenList 提供的参数的时候,企业版Onedrive无法正常获取SharePoint Site ID的修改 (#73)
* Add: SharePoint SiteId在使用服务器内置uid和key的时候可以正常获取 功能: 勾选`使用 OpenList 提供的参数`时,可在完成授权的情况下进行SiteID的读取 Signed-off-by: 小满1221 <im@manjiuqi.com> * 获取SharePoint WebSite ID的时候传递勾选状态 `使用 OpenList 提供的参数` Signed-off-by: 小满1221 <im@manjiuqi.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> * Update public/index.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> * Update public/static/spoid.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> --------- Signed-off-by: 小满1221 <im@manjiuqi.com> Signed-off-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c6780b9 commit 6ef91ef

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h2 class="text-center mb-4">🔐 OpenList Token 获取工具</h2>
8888
<label for="sharepoint-url"></label><input type="text" id="sharepoint-url" class="form-control">
8989
</div>
9090
<div class="d-grid gap-2 mb-3" id="sharepoint-btn-view">
91-
<button class="btn btn-primary" onclick="getSiteID()">获取 SharePoint 站点ID</button>
91+
<button class="btn btn-primary" onclick="getSiteID(document.getElementById('server-use-input').checked)">获取 SharePoint 站点ID</button>
9292
</div>
9393
<div class="mb-3" id="sharepoint-uid-view">
9494
<label for="sharepoint-id" class="form-label">SharePoint Site ID</label>

public/static/spoid.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function getWebdav() {
6464

6565

6666
// 获取站点ID
67-
function getSiteID() {
67+
function getSiteID(server_use_input = false) {
6868
const siteUrl = document.getElementById("sharepoint-url").value.trim();
6969
const access_token = document.getElementById("access-token").value.trim();
7070
const refresh_token = document.getElementById("refresh-token").value.trim();
@@ -92,23 +92,21 @@ function getSiteID() {
9292
DEFAULT: "请求发生错误"
9393
};
9494

95-
// 验证
96-
if (!client_uid || !client_key) {
97-
idElement.value = ERROR_MESSAGES.MISSING_CREDENTIALS;
95+
// OneDrive 类型校验:仅允许 OneDrive 相关驱动执行站点 ID 查询
96+
if (!site_type.includes("onedrive")) {
97+
idElement.value = ERROR_MESSAGES.NOT_SUPPORTED;
9898
return;
9999
}
100-
if (!access_token || !refresh_token) {
100+
101+
// 验证访问令牌和站点 URL
102+
if (!access_token) {
101103
idElement.value = ERROR_MESSAGES.MISSING_TOKENS;
102104
return;
103105
}
104106
if (!siteUrl) {
105107
idElement.value = ERROR_MESSAGES.MISSING_URL;
106108
return;
107109
}
108-
if (!site_type.includes("onedrive")) {
109-
idElement.value = ERROR_MESSAGES.NOT_SUPPORTED;
110-
return;
111-
}
112110
if (!GATEWAYS[site_type]) {
113111
idElement.value = ERROR_MESSAGES.DEFAULT;
114112
return;
@@ -168,4 +166,4 @@ function getSiteID() {
168166
idElement.value = ERROR_MESSAGES.BAD_REQUEST;
169167
console.error("URL解析失败:", error);
170168
}
171-
}
169+
}

0 commit comments

Comments
 (0)