1
0
mirror of https://github.com/6dylan6/jdpro.git synced 2025-07-13 16:13:07 +08:00
This commit is contained in:
2024
2025-01-14 13:06:24 +08:00
parent a069399a69
commit ba4b018953
2 changed files with 24 additions and 9 deletions

9
jx_ttlhb.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -2125,22 +2125,28 @@ function GetnickName2() {
}
const got = require('got');
require('dotenv').config();
let exists = fs.existsSync('/ql/data/config/auth.json');
let authFile="";
if (exists)
authFile="/ql/data/config/auth.json"
let Fileexists280 = fs.existsSync('/ql/data/db/keyv.sqlite');
let Fileexists_ = fs.existsSync('/ql/data/config/auth.json');
let authFile = "";
if (Fileexists280)
authFile = "/ql/data/db/keyv.sqlite"
else if (Fileexists_)
authFile = "/ql/data/config/auth.json"
else
authFile="/ql/config/auth.json"
authFile = "/ql/config/auth.json"
const api = got.extend({
prefixUrl: 'http://127.0.0.1:5600',
retry: { limit: 0 },
prefixUrl: 'http://127.0.0.1:5600',
retry: { limit: 0 },
});
async function getToken() {
const authConfig = JSON.parse(fs.readFileSync(authFile));
return authConfig.token;
const authConfig = await fs.readFileSync(authFile);
// console.log(authConfig.toString().match(/"token":"(.*?)",/)[1])
return authConfig.toString().match(/"token":"(.*?)",/)[1];
}
// getToken()
async function getEnvs(){
const token = await getToken();