Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h2 class="text-center mb-4">🔐 OpenList Token 获取工具</h2>
<label for="sharepoint-url"></label><input type="text" id="sharepoint-url" class="form-control">
</div>
<div class="d-grid gap-2 mb-3" id="sharepoint-btn-view">
<button class="btn btn-primary" onclick="getSiteID()">获取 SharePoint 站点ID</button>
<button class="btn btn-primary" onclick="getSiteID(document.getElementById('server-use-input').checked)">获取 SharePoint 站点ID</button>
</div>
<div class="mb-3" id="sharepoint-uid-view">
<label for="sharepoint-id" class="form-label">SharePoint Site ID</label>
Expand Down
18 changes: 8 additions & 10 deletions public/static/spoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -92,23 +92,21 @@ function getSiteID() {
DEFAULT: "请求发生错误"
};

// 验证
if (!client_uid || !client_key) {
idElement.value = ERROR_MESSAGES.MISSING_CREDENTIALS;
// OneDrive 类型校验:仅允许 OneDrive 相关驱动执行站点 ID 查询
if (!site_type.includes("onedrive")) {
idElement.value = ERROR_MESSAGES.NOT_SUPPORTED;
return;
}
if (!access_token || !refresh_token) {

// 验证访问令牌和站点 URL
if (!access_token) {
idElement.value = ERROR_MESSAGES.MISSING_TOKENS;
return;
}
if (!siteUrl) {
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;
Expand Down Expand Up @@ -168,4 +166,4 @@ function getSiteID() {
idElement.value = ERROR_MESSAGES.BAD_REQUEST;
console.error("URL解析失败:", error);
}
}
}