mirror of
https://github.com/6dylan6/jdpro.git
synced 2025-12-17 23:34:43 +08:00
1
This commit is contained in:
9
jx_ttlhb.js
Normal file
9
jx_ttlhb.js
Normal file
File diff suppressed because one or more lines are too long
@@ -2125,22 +2125,28 @@ function GetnickName2() {
|
|||||||
}
|
}
|
||||||
const got = require('got');
|
const got = require('got');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
let exists = fs.existsSync('/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 = "";
|
let authFile = "";
|
||||||
if (exists)
|
if (Fileexists280)
|
||||||
|
authFile = "/ql/data/db/keyv.sqlite"
|
||||||
|
else if (Fileexists_)
|
||||||
authFile = "/ql/data/config/auth.json"
|
authFile = "/ql/data/config/auth.json"
|
||||||
else
|
else
|
||||||
authFile = "/ql/config/auth.json"
|
authFile = "/ql/config/auth.json"
|
||||||
|
|
||||||
|
|
||||||
const api = got.extend({
|
const api = got.extend({
|
||||||
prefixUrl: 'http://127.0.0.1:5600',
|
prefixUrl: 'http://127.0.0.1:5600',
|
||||||
retry: { limit: 0 },
|
retry: { limit: 0 },
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getToken() {
|
async function getToken() {
|
||||||
const authConfig = JSON.parse(fs.readFileSync(authFile));
|
const authConfig = await fs.readFileSync(authFile);
|
||||||
return authConfig.token;
|
// console.log(authConfig.toString().match(/"token":"(.*?)",/)[1])
|
||||||
|
return authConfig.toString().match(/"token":"(.*?)",/)[1];
|
||||||
}
|
}
|
||||||
|
// getToken()
|
||||||
|
|
||||||
async function getEnvs(){
|
async function getEnvs(){
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
|
|||||||
Reference in New Issue
Block a user