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 24, 2024
1 parent deede51 commit f83f4dd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1402,15 +1402,26 @@ async function deleteUsers(usersToDelete) {
// Update KV store
await KV.put(userType, updatedUsers);
}
//删除用户的历史sharetoken

/*
//注销该用的sharetoken,注销所有账号该用户的sharetoken【严格】,如需启用则取消注释这一段
const plusAliveAccounts = await KV.get('PlusAliveAccounts');
const accountNumbers = plusAliveAccounts.split(','); // 假设KV.PlusAliveAccounts返回的格式是"1,2,3,4,5"
for (const accountNumber of accountNumbers) {
await deleteShareToken(usersToDelete, accountNumber);
}
return '删除成功';
*/

//注销用户的历史sharetoken,仅注销最后一次登陆所用的
const accountNumber = await getToCheckAccountNumber(userName,'Plus');
return await deleteShareToken(usersToDelete,accountNumber);
}

async function deleteShareToken(userName,accountNumber) {
const url = 'https://chat.oaifree.com/token/register';
const passed = generatePassword(userName);
const accessToken = await KV.get(`at_${accountNumber}`) || '1';
const accessToken = await KV.get(`at_${accountNumber}`) || 'xxx';
/*
const tokenPrefix = await KV.get('TokenPrefix');
const baseUserName = tokenPrefix + userName.replace(/_\d+$/, ''); // 移除用户名后的编号 */
Expand Down

0 comments on commit f83f4dd

Please sign in to comment.