TODO: 推翻整个项目重新建立根基

This commit is contained in:
CrescentLeaf
2025-12-06 00:18:10 +08:00
parent faf594b2f6
commit a549773eb2
79 changed files with 359 additions and 3589 deletions

26
client/performAuth.ts Normal file
View File

@@ -0,0 +1,26 @@
import data from "./Data.ts";
import getClient from "./getClient.ts"
/**
* 客户端上线
*
* 优先级: 账号密码 > 提供刷新令牌 > 储存的刷新令牌
*
* 不会逐一尝试
*/
export default async function performAuth(args: {
refresh_token?: string
account?: string
password?: string
}) {
if (args.account && args.password)
await getClient().authOrThrow({
account: args.account,
password: args.password,
})
else {
await getClient().authOrThrow({ refresh_token: args.refresh_token ? args.refresh_token : data.refresh_token })
}
data.refresh_token = getClient().getCachedRefreshToken()
data.access_token = getClient().getCachedAccessToken()
}