Skip to content

Commit

Permalink
refactor: trim tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue authored Nov 16, 2024
1 parent 93d0e2f commit 407cf96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ class AccountSession {
async function loadTokens() {
try {
const tokens = await fs.readFile('tokens.txt', 'utf-8')
return tokens.split('\n').filter(Boolean)
// 移除空行和空格,引号
return tokens.split('\n').filter(Boolean).map(token => token.trim().replace(/['"]+/g, ''))
} catch (error) {
console.log(`Failed to load tokens: ${error.message}`)
throw error
Expand Down

0 comments on commit 407cf96

Please sign in to comment.