mirror of
https://github.com/6dylan6/jdpro.git
synced 2026-04-18 18:28:07 +08:00
Compare commits
15 Commits
ab5953567a
...
43909ff996
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43909ff996 | ||
|
|
b09f0de143 | ||
|
|
0da473a08c | ||
|
|
3e4cfce4bd | ||
|
|
f71a15a657 | ||
|
|
6ad4dce833 | ||
|
|
b048de83b8 | ||
|
|
01610e0ae1 | ||
|
|
20e6026473 | ||
|
|
b610cc2646 | ||
|
|
2009c0dbb1 | ||
|
|
87db7cb8db | ||
|
|
d89e8d7712 | ||
|
|
bc8b84a1b8 | ||
|
|
005fe03104 |
1
PROFILE.md
Normal file
1
PROFILE.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Welcome to my GitHub profile!
|
||||||
File diff suppressed because one or more lines are too long
264
function/ql.js
264
function/ql.js
@@ -4,147 +4,149 @@ const got = require('got');
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const { readFile } = require('fs/promises');
|
const { readFile } = require('fs/promises');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const qlDir = '/ql';
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
let Fileexists280 = fs.existsSync('/ql/data/db/keyv.sqlite');
|
||||||
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
|
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
|
||||||
let authFile="";
|
let authFile = "";
|
||||||
if (Fileexists)
|
if (Fileexists280)
|
||||||
authFile="/ql/data/config/auth.json"
|
authFile = "/ql/data/db/keyv.sqlite"
|
||||||
|
else if (Fileexists)
|
||||||
|
authFile = "/ql/data/config/auth.json"
|
||||||
else
|
else
|
||||||
authFile="/ql/config/auth.json"
|
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',
|
||||||
retry: { limit: 0 },
|
retry: { limit: 0 },
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getToken() {
|
async function getToken() {
|
||||||
const authConfig = JSON.parse(await readFile(authFile));
|
const authConfig = await readFile(authFile);
|
||||||
return authConfig.token;
|
// console.log(authConfig.toString().match(/"token":"(.*?)",/)[1])
|
||||||
|
return authConfig.toString().match(/"token":"(.*?)",/)[1];
|
||||||
}
|
}
|
||||||
|
// getToken()
|
||||||
module.exports.getEnvs = async () => {
|
module.exports.getEnvs = async () => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
url: 'api/envs',
|
url: 'api/envs',
|
||||||
searchParams: {
|
searchParams: {
|
||||||
searchValue: 'JD_COOKIE',
|
searchValue: 'JD_COOKIE',
|
||||||
t: Date.now(),
|
t: Date.now(),
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body.data;
|
return body.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getEnvsCount = async () => {
|
module.exports.getEnvsCount = async () => {
|
||||||
const data = await this.getEnvs();
|
const data = await this.getEnvs();
|
||||||
return data.length;
|
return data.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.addEnv = async (cookie, remarks) => {
|
module.exports.addEnv = async (cookie, remarks) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: 'api/envs',
|
url: 'api/envs',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
json: [{
|
json: [{
|
||||||
name: 'JD_COOKIE',
|
name: 'JD_COOKIE',
|
||||||
value: cookie,
|
value: cookie,
|
||||||
remarks,
|
remarks,
|
||||||
}],
|
}],
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.updateEnv = async (cookie, eid, remarks) => {
|
module.exports.updateEnv = async (cookie, eid, remarks) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
method: 'put',
|
method: 'put',
|
||||||
url: 'api/envs',
|
url: 'api/envs',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
json: {
|
json: {
|
||||||
name: 'JD_COOKIE',
|
name: 'JD_COOKIE',
|
||||||
value: cookie,
|
value: cookie,
|
||||||
_id: eid,
|
_id: eid,
|
||||||
remarks,
|
remarks,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.updateEnv11 = async (cookie, eid, remarks) => {
|
module.exports.updateEnv11 = async (cookie, eid, remarks) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
method: 'put',
|
method: 'put',
|
||||||
url: 'api/envs',
|
url: 'api/envs',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
json: {
|
json: {
|
||||||
name: 'JD_COOKIE',
|
name: 'JD_COOKIE',
|
||||||
value: cookie,
|
value: cookie,
|
||||||
id: eid,
|
id: eid,
|
||||||
remarks,
|
remarks,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body;
|
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({
|
||||||
method: 'put',
|
method: 'put',
|
||||||
url: 'api/envs/disable',
|
url: 'api/envs/disable',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
body: JSON.stringify([eid]),
|
body: JSON.stringify([eid]),
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.EnableCk = async (eid) => {
|
module.exports.EnableCk = async (eid) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
method: 'put',
|
method: 'put',
|
||||||
url: 'api/envs/enable',
|
url: 'api/envs/enable',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
body: JSON.stringify([eid]),
|
body: JSON.stringify([eid]),
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
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;
|
var tempid = 0;
|
||||||
for (let i = 0; i < envs.length; i++) {
|
for (let i = 0; i < envs.length; i++) {
|
||||||
tempid = 0;
|
tempid = 0;
|
||||||
if (envs[i]._id) {
|
if (envs[i]._id) {
|
||||||
tempid = envs[i]._id;
|
tempid = envs[i]._id;
|
||||||
}
|
}
|
||||||
@@ -158,7 +160,7 @@ module.exports.getstatus = async(eid) => {
|
|||||||
return 99;
|
return 99;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getEnvById = async(eid) => {
|
module.exports.getEnvById = async (eid) => {
|
||||||
const envs = await this.getEnvs();
|
const envs = await this.getEnvs();
|
||||||
var tempid = 0;
|
var tempid = 0;
|
||||||
for (let i = 0; i < envs.length; i++) {
|
for (let i = 0; i < envs.length; i++) {
|
||||||
@@ -177,28 +179,28 @@ module.exports.getEnvById = async(eid) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getEnvByPtPin = async (Ptpin) => {
|
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++) {
|
||||||
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||||
if(tempptpin==Ptpin){
|
if (tempptpin == Ptpin) {
|
||||||
return envs[i];
|
return envs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.delEnv = async (eid) => {
|
module.exports.delEnv = async (eid) => {
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
const body = await api({
|
const body = await api({
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
url: 'api/envs',
|
url: 'api/envs',
|
||||||
params: { t: Date.now() },
|
params: { t: Date.now() },
|
||||||
body: JSON.stringify([eid]),
|
body: JSON.stringify([eid]),
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
authorization: `Bearer ${token}`,
|
authorization: `Bearer ${token}`,
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
}).json();
|
}).json();
|
||||||
return body;
|
return body;
|
||||||
};
|
};
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -53,6 +53,7 @@ pnpm i -g request@2.88.2
|
|||||||
pnpm i -g jsdom@24.1.1
|
pnpm i -g jsdom@24.1.1
|
||||||
pnpm i -g moment@2.30.1
|
pnpm i -g moment@2.30.1
|
||||||
pnpm i -g cheerio@1.0.0
|
pnpm i -g cheerio@1.0.0
|
||||||
|
pnpm i -g tunnel
|
||||||
# pnpm install -g tough-cookie@4.1.4
|
# pnpm install -g tough-cookie@4.1.4
|
||||||
pnpm i -g https-proxy-agent@7.0.5
|
pnpm i -g https-proxy-agent@7.0.5
|
||||||
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jieba
|
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jieba
|
||||||
|
|||||||
7
jd_nhj_draw.js
Normal file
7
jd_nhj_draw.js
Normal file
File diff suppressed because one or more lines are too long
7
jd_sjxnw.js
Normal file
7
jd_sjxnw.js
Normal file
File diff suppressed because one or more lines are too long
7
jd_sxing_draw.js
Normal file
7
jd_sxing_draw.js
Normal file
File diff suppressed because one or more lines are too long
7
jd_wyw_check.js
Normal file
7
jd_wyw_check.js
Normal file
File diff suppressed because one or more lines are too long
7
jd_xnjfq_award.js
Normal file
7
jd_xnjfq_award.js
Normal file
File diff suppressed because one or more lines are too long
5
jd_xnjfq_task.js
Normal file
5
jd_xnjfq_task.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user