mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Specify file read encoding where possible
This commit is contained in:
12
server.js
12
server.js
@@ -4227,7 +4227,7 @@ app.post('/readsecretstate', jsonParser, (_, response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fileContents = fs.readFileSync(SECRETS_FILE);
|
const fileContents = fs.readFileSync(SECRETS_FILE, 'utf8');
|
||||||
const secrets = JSON.parse(fileContents);
|
const secrets = JSON.parse(fileContents);
|
||||||
const state = {};
|
const state = {};
|
||||||
|
|
||||||
@@ -4286,7 +4286,7 @@ app.post('/viewsecrets', jsonParser, async (_, response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const fileContents = fs.readFileSync(SECRETS_FILE, 'utf8');
|
const fileContents = fs.readFileSync(SECRETS_FILE, 'utf-8');
|
||||||
const secrets = JSON.parse(fileContents);
|
const secrets = JSON.parse(fileContents);
|
||||||
return response.send(secrets);
|
return response.send(secrets);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -4872,8 +4872,8 @@ function writeSecret(key, value) {
|
|||||||
writeFileAtomicSync(SECRETS_FILE, emptyFile, "utf-8");
|
writeFileAtomicSync(SECRETS_FILE, emptyFile, "utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileContents = fs.readFileSync(SECRETS_FILE);
|
const fileContents = fs.readFileSync(SECRETS_FILE, 'utf-8');
|
||||||
const secrets = JSON.parse(fileContents.toString());
|
const secrets = JSON.parse(fileContents);
|
||||||
secrets[key] = value;
|
secrets[key] = value;
|
||||||
writeFileAtomicSync(SECRETS_FILE, JSON.stringify(secrets), "utf-8");
|
writeFileAtomicSync(SECRETS_FILE, JSON.stringify(secrets), "utf-8");
|
||||||
}
|
}
|
||||||
@@ -4883,8 +4883,8 @@ function readSecret(key) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileContents = fs.readFileSync(SECRETS_FILE);
|
const fileContents = fs.readFileSync(SECRETS_FILE, 'utf-8');
|
||||||
const secrets = JSON.parse(fileContents.toString());
|
const secrets = JSON.parse(fileContents);
|
||||||
return secrets[key];
|
return secrets[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user