Skip to content

Commit

Permalink
Update _worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jyx04 authored Jun 9, 2024
1 parent ebb008c commit 0b6031a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ async function addToAliveAccountList(accessToken, accountNumber) {
const accountType = await checkAccountType(accessToken);
const aliveAccountsKey = `${accountType}AliveAccounts`;

let aliveAccount = await KV.get(aliveAccountsKey);
let aliveAccount = await KV.get(aliveAccountsKey) || '';
let aliveAccountList = aliveAccount ? aliveAccount.split(',') : [];
if (!aliveAccountList.includes(accountNumber)) {
aliveAccountList.push(accountNumber);
Expand Down Expand Up @@ -707,7 +707,7 @@ async function handleExportGetRequest(request) {
const html = await getExportHTML();
return new Response(html, { headers: { 'Content-Type': 'text/html' } });
}
const adminusers = await KV.get('Admin');
const adminusers = await KV.get('Admin') || '';
if (adminusers.split(',').includes(adminUserName)) {
const validTokenTypes = ['rt', 'at'];
const validAccountTypes = ['Free', 'Plus'];
Expand All @@ -724,7 +724,7 @@ async function exportToken(tokenType, accountType) {
const accountTypeKey = `${accountType}AliveAccounts`;

// 获取对应类型的账户列表
let aliveAccount = await KV.get(accountTypeKey);
let aliveAccount = await KV.get(accountTypeKey) || '';
if (!aliveAccount) {
return new Response('No accounts found', { status: 404 });
}
Expand Down Expand Up @@ -929,7 +929,7 @@ async function handleAdminPostRequest(request) {
}

// Get adminusers list
const adminusers = await KV.get('Admin');
const adminusers = await KV.get('Admin') || '';
if (!adminusers || !adminusers.split(',').includes(adminuserName)) {
return generateAdminResponse('Unauthorized');
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ async function handleUserPostRequest(request) {
}

// Get adminusers list
const adminusers = await KV.get('Admin');
const adminusers = await KV.get('Admin') || '';
if (!adminusers || !adminusers.split(',').includes(adminuserName)) {
return generateUserResponse('Unauthorized');
}
Expand Down Expand Up @@ -1515,7 +1515,7 @@ async function handleRegisterPostRequest(request) {
}

const autoDeleteCDK = await KV.get('AutoDeleteCDK')
const cdkeyStore = await KV.get('CDKEY')
const cdkeyStore = await KV.get('CDKEY') || '';
const cdkeyList = cdkeyStore ? cdkeyStore.split(',') : []

if (!cdkeyList.includes(cdkey)) {
Expand Down Expand Up @@ -2703,10 +2703,10 @@ if (userName.startsWith('fk-')) {
let foundSuffix = false;
let suffix = '';
const forcean = await KV.get("ForceAN");
const defaultusers = await KV.get("Users");
const vipusers = await KV.get("VIPUsers");
const freeusers = await KV.get("FreeUsers");
const admin = await KV.get("Admin");
const defaultusers = await KV.get("Users")|| '';
const vipusers = await KV.get("VIPUsers")|| '';
const freeusers = await KV.get("FreeUsers")|| '';
const admin = await KV.get("Admin")|| '';
// 合并所有用户
const users = `${defaultusers},${vipusers},${freeusers},${admin}`;

Expand Down

0 comments on commit 0b6031a

Please sign in to comment.