fix(tokenStore): recreate tokens.json on every read if deleted at runtime
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
132f6b606d
commit
ce6aad2466
@ -8,11 +8,10 @@ if (!fs.existsSync(dataDir)) {
|
|||||||
fs.mkdirSync(dataDir, { recursive: true });
|
fs.mkdirSync(dataDir, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(dataFile)) {
|
|
||||||
fs.writeFileSync(dataFile, "{}", "utf8");
|
|
||||||
}
|
|
||||||
|
|
||||||
function readStore() {
|
function readStore() {
|
||||||
|
if (!fs.existsSync(dataFile)) {
|
||||||
|
fs.writeFileSync(dataFile, "{}", "utf8");
|
||||||
|
}
|
||||||
return JSON.parse(fs.readFileSync(dataFile, "utf8"));
|
return JSON.parse(fs.readFileSync(dataFile, "utf8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user