mirror of
https://github.com/okyyds/yyds.git
synced 2026-07-14 07:41:16 +08:00
update
This commit is contained in:
@@ -6,10 +6,17 @@ const { readFile } = require('fs/promises');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const qlDir = '/ql';
|
const qlDir = '/ql';
|
||||||
const authFile = path.join(qlDir, 'config/auth.json');
|
const fs = require('fs');
|
||||||
|
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
|
||||||
|
let authFile="";
|
||||||
|
if (Fileexists)
|
||||||
|
authFile="/ql/data/config/auth.json"
|
||||||
|
else
|
||||||
|
authFile="/ql/config/auth.json"
|
||||||
|
//const authFile = path.join(qlDir, 'config/auth.json');
|
||||||
|
|
||||||
const api = got.extend({
|
const api = got.extend({
|
||||||
prefixUrl: 'http://localhost:5600',
|
prefixUrl: 'http://127.0.0.1:5600',
|
||||||
retry: { limit: 0 },
|
retry: { limit: 0 },
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -80,6 +87,27 @@ module.exports.updateEnv = async (cookie, eid, remarks) => {
|
|||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.updateEnv11 = async (cookie, eid, remarks) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'put',
|
||||||
|
url: 'api/envs',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
json: {
|
||||||
|
name: 'JD_COOKIE',
|
||||||
|
value: cookie,
|
||||||
|
id: eid,
|
||||||
|
remarks,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.DisableCk = async (eid) => {
|
module.exports.DisableCk = async (eid) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
@@ -112,21 +140,48 @@ module.exports.EnableCk = async (eid) => {
|
|||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getstatus = async (eid) => {
|
module.exports.getstatus = async(eid) => {
|
||||||
const envs = await this.getEnvs();
|
const envs = await this.getEnvs();
|
||||||
|
var tempid = 0;
|
||||||
for (let i = 0; i < envs.length; i++) {
|
for (let i = 0; i < envs.length; i++) {
|
||||||
if(envs[i]._id==eid){
|
tempid = 0;
|
||||||
|
if (envs[i]._id) {
|
||||||
|
tempid = envs[i]._id;
|
||||||
|
}
|
||||||
|
if (envs[i].id) {
|
||||||
|
tempid = envs[i].id;
|
||||||
|
}
|
||||||
|
if (tempid == eid) {
|
||||||
return envs[i].status;
|
return envs[i].status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 99;
|
return 99;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getEnvById = async (eid) => {
|
module.exports.getEnvById = async(eid) => {
|
||||||
|
const envs = await this.getEnvs();
|
||||||
|
var tempid = 0;
|
||||||
|
for (let i = 0; i < envs.length; i++) {
|
||||||
|
tempid = 0;
|
||||||
|
if (envs[i]._id) {
|
||||||
|
tempid = envs[i]._id;
|
||||||
|
}
|
||||||
|
if (envs[i].id) {
|
||||||
|
tempid = envs[i].id;
|
||||||
|
}
|
||||||
|
if (tempid == eid) {
|
||||||
|
return envs[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.getEnvByPtPin = async (Ptpin) => {
|
||||||
const envs = await this.getEnvs();
|
const envs = await this.getEnvs();
|
||||||
for (let i = 0; i < envs.length; i++) {
|
for (let i = 0; i < envs.length; i++) {
|
||||||
if(envs[i]._id==eid){
|
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||||
return envs[i].value;
|
if(tempptpin==Ptpin){
|
||||||
|
return envs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
9
ql.js
9
ql.js
@@ -6,7 +6,14 @@ const { readFile } = require('fs/promises');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const qlDir = '/ql';
|
const qlDir = '/ql';
|
||||||
const authFile = path.join(qlDir, 'config/auth.json');
|
const fs = require('fs');
|
||||||
|
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
|
||||||
|
let authFile="";
|
||||||
|
if (Fileexists)
|
||||||
|
authFile="/ql/data/config/auth.json"
|
||||||
|
else
|
||||||
|
authFile="/ql/config/auth.json"
|
||||||
|
//const authFile = path.join(qlDir, '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',
|
||||||
|
|||||||
Reference in New Issue
Block a user