2025-06-12 15:13:36 +08:00
|
|
|
|
<!DOCTYPE html>
|
2025-06-12 20:24:14 +08:00
|
|
|
|
<html lang="zh-CN" data-theme="light" xmlns="http://www.w3.org/1999/html">
|
2025-06-12 00:13:57 +08:00
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2025-06-12 13:47:00 +08:00
|
|
|
|
<title>OpenList Token 获取工具</title>
|
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
<style>
|
2025-06-12 13:47:00 +08:00
|
|
|
|
:root {
|
|
|
|
|
--bg-color-light: #ffffff;
|
|
|
|
|
--text-color-light: #000000;
|
|
|
|
|
--bg-color-dark: #1e1e2f;
|
|
|
|
|
--text-color-dark: #f0f0f0;
|
|
|
|
|
--accent-color: #00d1b2;
|
2025-06-12 15:13:36 +08:00
|
|
|
|
}
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
[data-theme="light"] body {
|
|
|
|
|
background-color: var(--bg-color-light);
|
|
|
|
|
color: var(--text-color-light);
|
|
|
|
|
}
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
[data-theme="dark"] body {
|
|
|
|
|
background-color: var(--bg-color-dark);
|
|
|
|
|
color: var(--text-color-dark);
|
|
|
|
|
}
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
.form-container {
|
|
|
|
|
max-width: 800px;
|
|
|
|
|
margin: 3rem auto;
|
|
|
|
|
padding: 2rem;
|
|
|
|
|
border-radius: 1rem;
|
|
|
|
|
box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
|
|
|
|
|
background: inherit;
|
|
|
|
|
backdrop-filter: blur(10px);
|
|
|
|
|
}
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
label {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
.form-control:read-only {
|
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.toggle-theme {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 1rem;
|
|
|
|
|
right: 1rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
}
|
2025-06-12 17:21:53 +08:00
|
|
|
|
|
2025-06-12 15:40:45 +08:00
|
|
|
|
[data-theme="dark"] body {
|
|
|
|
|
background-color: var(--bg-color-dark);
|
|
|
|
|
color: var(--text-color-dark);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[data-theme="dark"] .form-control {
|
|
|
|
|
background-color: #2a2a3b;
|
|
|
|
|
color: #f0f0f0;
|
|
|
|
|
border-color: #444;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[data-theme="dark"] .form-control:read-only {
|
|
|
|
|
background-color: #2a2a3b;
|
|
|
|
|
color: #ccc;
|
|
|
|
|
border-color: #444;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[data-theme="dark"] .form-select {
|
|
|
|
|
background-color: #2a2a3b;
|
|
|
|
|
color: #f0f0f0;
|
|
|
|
|
border-color: #444;
|
|
|
|
|
}
|
2025-06-12 00:13:57 +08:00
|
|
|
|
|
2025-06-12 15:40:45 +08:00
|
|
|
|
[data-theme="dark"] .btn {
|
|
|
|
|
background-color: #00bfa5;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[data-theme="dark"] .btn:hover {
|
|
|
|
|
background-color: #00a58e;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
2025-06-12 17:21:53 +08:00
|
|
|
|
|
2025-06-12 15:40:45 +08:00
|
|
|
|
[data-theme="dark"] p {
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2025-06-12 13:47:00 +08:00
|
|
|
|
<div class="toggle-theme">
|
|
|
|
|
<button class="btn btn-outline-secondary" onclick="toggleTheme()">切换主题</button>
|
2025-06-12 15:10:28 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="container form-container">
|
|
|
|
|
<h2 class="text-center mb-4">🔐 OpenList Token 获取工具</h2>
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="site-select" class="form-label">网盘名称</label>
|
|
|
|
|
<select id="site-select" class="form-select">
|
|
|
|
|
<option value="onedrive_go" selected>OneDrive 官方站点</option>
|
|
|
|
|
<option value="onedrive_cn">OneDrive 世纪互联</option>
|
|
|
|
|
<option value="onedrive_us">OneDrive 美国版本</option>
|
|
|
|
|
<option value="onedrive_de">OneDrive 德国版本</option>
|
2025-06-12 17:21:53 +08:00
|
|
|
|
<option value="alicloud_qr">阿里网盘 扫码登录</option>
|
2025-06-12 15:13:36 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="client-id" class="form-label">客户端 ID</label>
|
|
|
|
|
<input type="text" id="client-id" class="form-control">
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="app-secret" class="form-label">应用机密</label>
|
|
|
|
|
<input type="text" id="app-secret" class="form-control">
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="callback-url" class="form-label">回调地址</label>
|
|
|
|
|
<input type="text" id="callback-url" class="form-control" value="https://api.oplist.org/onedrive/callback"
|
|
|
|
|
readonly
|
|
|
|
|
onclick="autoCopy(this)">
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="d-grid gap-2 mb-3">
|
|
|
|
|
<button class="btn btn-primary" onclick="getLogin()">获取 Token</button>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="access-token" class="form-label">访问秘钥</label>
|
|
|
|
|
<textarea id="access-token" class="form-control" rows="3" readonly onclick="autoCopy(this)"></textarea>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="refresh-token" class="form-label">刷新秘钥</label>
|
|
|
|
|
<textarea id="refresh-token" class="form-control" rows="3" readonly onclick="autoCopy(this)"></textarea>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
2025-06-12 20:24:14 +08:00
|
|
|
|
<div class="mb-3">
|
2025-06-13 03:29:12 +08:00
|
|
|
|
<label for="sharepoint-url" class="form-label">SharePoint Site URL</label>
|
2025-06-12 20:24:14 +08:00
|
|
|
|
<label for="sharepoint-url"></label><input type="text" id="sharepoint-url" class="form-control">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-grid gap-2 mb-3">
|
|
|
|
|
<button class="btn btn-primary" onclick="getSiteID()">获取 SharePoint 站点ID</button>
|
|
|
|
|
</div>
|
2025-06-13 03:29:12 +08:00
|
|
|
|
<div class="mb-3">
|
|
|
|
|
<label for="sharepoint-id" class="form-label">SharePoint Site URL</label>
|
|
|
|
|
<textarea id="sharepoint-id" class="form-control" rows="3" readonly onclick="autoCopy(this)"></textarea>
|
|
|
|
|
</div>
|
2025-06-12 15:13:36 +08:00
|
|
|
|
<div class="text-muted text-center">
|
|
|
|
|
<p style="text-align:center">
|
|
|
|
|
本工具所有信息只以Cookie形式存储于浏览器本地<br>
|
2025-06-12 15:41:40 +08:00
|
|
|
|
开源于 <a href="https://github.com/OpenListTeam/cf-worker-api" target="_blank">GitHub</a> | By <a
|
2025-06-12 15:40:45 +08:00
|
|
|
|
href="https://github.com/OpenListTeam"
|
|
|
|
|
target="_blank">OpenListTeam</a>
|
2025-06-12 15:13:36 +08:00
|
|
|
|
</p>
|
2025-06-12 13:15:37 +08:00
|
|
|
|
</div>
|
2025-06-12 00:13:57 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
let intervalId;
|
|
|
|
|
|
2025-06-12 13:01:25 +08:00
|
|
|
|
// 获取登录秘钥 #######################################################
|
2025-06-12 00:13:57 +08:00
|
|
|
|
async function getLogin() {
|
|
|
|
|
let apps_uuid = document.getElementById("client-id").value;
|
|
|
|
|
let apps_keys = document.getElementById("app-secret").value;
|
2025-06-12 15:08:01 +08:00
|
|
|
|
let apps_type = document.getElementById("site-select").value;
|
2025-06-12 13:01:25 +08:00
|
|
|
|
if (apps_uuid === "" || apps_keys === "") {
|
|
|
|
|
Swal.fire({
|
|
|
|
|
position: 'top',
|
|
|
|
|
icon: 'info',
|
|
|
|
|
title: '获取失败',
|
|
|
|
|
text: '请先填写客户端ID和应用机密',
|
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-06-12 17:21:53 +08:00
|
|
|
|
let apps_subs = apps_type.split("_")[0]
|
|
|
|
|
let post_urls = "/" + apps_subs + "/requests?client_uid=" + apps_uuid
|
2025-06-12 15:08:01 +08:00
|
|
|
|
+ "&client_key=" + apps_keys + "&apps_type=" + apps_type;
|
2025-06-12 00:13:57 +08:00
|
|
|
|
try {
|
|
|
|
|
const response = await fetch(post_urls, {
|
|
|
|
|
method: 'GET', headers: {'Content-Type': 'application/json'}
|
|
|
|
|
});
|
|
|
|
|
// 解析响应内容 ===============================================
|
|
|
|
|
const response_data = await response.json();
|
|
|
|
|
if (response.status === 200) {
|
2025-06-12 17:21:53 +08:00
|
|
|
|
if (apps_subs === "onedrive") {
|
|
|
|
|
window.location.href = response_data.text;
|
|
|
|
|
}
|
|
|
|
|
if (apps_type === "alicloud_qr") {
|
|
|
|
|
let sid = response_data.sid;
|
|
|
|
|
await Swal.fire({
|
|
|
|
|
position: 'top',
|
|
|
|
|
icon: 'info',
|
|
|
|
|
title: '扫码登录',
|
|
|
|
|
html: `<div>请扫码登录,完成后点确定</div>` +
|
|
|
|
|
`<img src="${response_data.text}" alt="">`,
|
|
|
|
|
showConfirmButton: true
|
|
|
|
|
});
|
|
|
|
|
post_urls = "/alicloud/callback" +
|
|
|
|
|
"?client_id=" + apps_uuid +
|
|
|
|
|
"&client_secret=" + apps_keys +
|
|
|
|
|
"&grant_type=" + "authorization_code" +
|
|
|
|
|
"&code=" + sid
|
|
|
|
|
let auth_post = await fetch(post_urls, {method: 'GET'});
|
|
|
|
|
let auth_data = await auth_post.json();
|
|
|
|
|
if (auth_post.status === 200) {
|
|
|
|
|
window.location.href = `/?access_token=${auth_data.access_token}`
|
|
|
|
|
+ `&refresh_token=${auth_data.refresh_token}`
|
|
|
|
|
+ `&client_uid=${apps_uuid}`
|
|
|
|
|
+ `&client_key=${apps_keys}`;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-12 00:13:57 +08:00
|
|
|
|
} else Swal.fire({
|
|
|
|
|
icon: 'error',
|
|
|
|
|
title: "获取秘钥失败: " + response_data.text,
|
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
timer: 1000
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
Swal.fire({
|
|
|
|
|
icon: 'error',
|
|
|
|
|
title: '获取秘钥失败: ' + error,
|
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
timer: 1000
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-12 13:01:25 +08:00
|
|
|
|
// 自动复制内容 #####################################################
|
|
|
|
|
function autoCopy(on_element) {
|
|
|
|
|
// if (on_element.innerText === "") return;
|
|
|
|
|
navigator.clipboard.writeText(on_element.value).then(() => {
|
|
|
|
|
// 显示复制成功的提示
|
|
|
|
|
Swal.fire({
|
|
|
|
|
position: 'top',
|
|
|
|
|
icon: 'success',
|
|
|
|
|
title: '内容已复制',
|
|
|
|
|
showConfirmButton: false,
|
|
|
|
|
timer: 700
|
|
|
|
|
});
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
// 复制失败时的处理
|
|
|
|
|
console.error('无法复制文本:', err);
|
2025-06-12 00:13:57 +08:00
|
|
|
|
Swal.fire({
|
2025-06-12 13:01:25 +08:00
|
|
|
|
position: 'top',
|
2025-06-12 00:13:57 +08:00
|
|
|
|
icon: 'error',
|
2025-06-12 13:01:25 +08:00
|
|
|
|
title: '复制失败',
|
|
|
|
|
text: '请手动复制',
|
2025-06-12 00:13:57 +08:00
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
});
|
2025-06-12 13:01:25 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2025-06-12 00:13:57 +08:00
|
|
|
|
|
2025-06-12 13:01:25 +08:00
|
|
|
|
async function getToken() {
|
|
|
|
|
const strSearch = window.location.search;
|
|
|
|
|
const urlParams = new URLSearchParams(strSearch);
|
|
|
|
|
const client_uid = urlParams.get("client_uid");
|
|
|
|
|
const client_key = urlParams.get("client_key");
|
|
|
|
|
const access_token = urlParams.get("access_token");
|
|
|
|
|
const refresh_token = urlParams.get("refresh_token");
|
2025-06-12 15:40:45 +08:00
|
|
|
|
const message_err = urlParams.get("message_err");
|
|
|
|
|
if (message_err && client_uid) {
|
|
|
|
|
Swal.fire({
|
|
|
|
|
position: 'top',
|
|
|
|
|
icon: 'error',
|
|
|
|
|
title: '授权失败',
|
2025-06-12 15:55:03 +08:00
|
|
|
|
html: message_err,
|
2025-06-12 15:40:45 +08:00
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-06-12 13:01:25 +08:00
|
|
|
|
document.getElementById("client-id").value = client_uid;
|
|
|
|
|
document.getElementById("app-secret").value = client_key;
|
|
|
|
|
document.getElementById("access-token").value = access_token;
|
|
|
|
|
document.getElementById("refresh-token").value = refresh_token;
|
2025-06-12 00:13:57 +08:00
|
|
|
|
}
|
2025-06-12 13:01:25 +08:00
|
|
|
|
|
|
|
|
|
getToken();
|
2025-06-13 03:29:12 +08:00
|
|
|
|
// 获取站点ID
|
|
|
|
|
function getSiteID() {
|
|
|
|
|
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();
|
|
|
|
|
const client_uid = document.getElementById("client-id").value.trim();
|
|
|
|
|
const client_key = document.getElementById("app-secret").value.trim();
|
|
|
|
|
const site_type = document.getElementById("site-select").value;
|
|
|
|
|
const idElement = document.getElementById("sharepoint-id");
|
|
|
|
|
|
|
|
|
|
// 定义站点的API Endpoint
|
|
|
|
|
const GATEWAYS = {
|
|
|
|
|
"onedrive_go": "https://graph.microsoft.com/v1.0/sites/",
|
|
|
|
|
"onedrive_cn": "https://microsoftgraph.chinacloudapi.cn/v1.0/sites/",
|
|
|
|
|
"onedrive_us": "https://graph.microsoft.us/v1.0/sites/",
|
|
|
|
|
"onedrive_de": "https://graph.microsoft.de/v1.0/sites/"
|
|
|
|
|
};
|
2025-06-12 13:47:00 +08:00
|
|
|
|
|
2025-06-13 03:29:12 +08:00
|
|
|
|
// 定义错误信息
|
|
|
|
|
const ERROR_MESSAGES = {
|
|
|
|
|
MISSING_CREDENTIALS: "请先填写客户端ID和应用机密",
|
|
|
|
|
MISSING_TOKENS: "请获取Token",
|
|
|
|
|
MISSING_URL: "请填写您的SharePoint URL",
|
|
|
|
|
NOT_SUPPORTED: "仅支持OneDrive相关API",
|
|
|
|
|
NOT_FOUND: "站点不存在",
|
|
|
|
|
BAD_REQUEST: "获取出现问题,请检查权限和站点URL,站点URL示例:https://demo.sharepoint.com/site/demo",
|
|
|
|
|
DEFAULT: "请求发生错误"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 验证
|
|
|
|
|
if (!client_uid || !client_key) {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.MISSING_CREDENTIALS;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!access_token || !refresh_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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取ID
|
|
|
|
|
try {
|
|
|
|
|
const urlParts = siteUrl.replace("https://", "").split("/");
|
|
|
|
|
const site_hostname = urlParts[0];
|
|
|
|
|
const site_sub_path = urlParts[1];
|
|
|
|
|
const site_name = urlParts[2];
|
|
|
|
|
const site_path = site_sub_path + "/" +site_name;
|
|
|
|
|
const reqUrl = `${GATEWAYS[site_type]}${site_hostname}:/${site_path}`;
|
|
|
|
|
const headers = {
|
|
|
|
|
"Accept": "application/json",
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
"Authorization": `Bearer ${access_token}`
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fetch(reqUrl, {
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: headers
|
|
|
|
|
})
|
|
|
|
|
.then(async (res) => {
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
if (res.status === 404) {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.NOT_FOUND;
|
|
|
|
|
return;
|
|
|
|
|
} else if (res.status === 400) {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.BAD_REQUEST;
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
idElement.value = `${ERROR_MESSAGES.DEFAULT} (HTTP ${res.status})`;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const result = await res.json();
|
|
|
|
|
if (result.id) {
|
|
|
|
|
idElement.value = result.id;
|
|
|
|
|
} else if (result.error) {
|
|
|
|
|
idElement.value = result.error.message || ERROR_MESSAGES.DEFAULT;
|
|
|
|
|
} else {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.DEFAULT;
|
|
|
|
|
console.error("处理响应时出错:", error);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.BAD_REQUEST;
|
|
|
|
|
console.error("请求失败:", error);
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
idElement.value = ERROR_MESSAGES.BAD_REQUEST;
|
|
|
|
|
console.error("URL解析失败:", error);
|
|
|
|
|
}
|
2025-06-12 20:24:14 +08:00
|
|
|
|
}
|
2025-06-13 03:29:12 +08:00
|
|
|
|
|
2025-06-12 13:47:00 +08:00
|
|
|
|
//手动切换主题模式
|
|
|
|
|
function toggleTheme() {
|
|
|
|
|
const html = document.documentElement;
|
|
|
|
|
const current = html.getAttribute("data-theme");
|
|
|
|
|
html.setAttribute("data-theme", current === "dark" ? "light" : "dark");
|
|
|
|
|
}
|
2025-06-12 15:13:36 +08:00
|
|
|
|
|
2025-06-12 13:47:00 +08:00
|
|
|
|
// 自动切换暗黑模式
|
|
|
|
|
(function () {
|
|
|
|
|
const hour = new Date().getHours();
|
|
|
|
|
if (hour < 6 || hour >= 18) document.documentElement.setAttribute("data-theme", "dark");
|
|
|
|
|
getToken();
|
|
|
|
|
})();
|
2025-06-12 15:13:36 +08:00
|
|
|
|
</script>
|
|
|
|
|
</body>
|
2025-06-12 13:47:00 +08:00
|
|
|
|
</html>
|