mirror of
https://github.com/6dylan6/jdpro.git
synced 2026-02-04 22:54:49 +00:00
Compare commits
2 Commits
d7403519a1
...
826b66f81e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
826b66f81e | ||
|
|
a3c45e6b2a |
File diff suppressed because one or more lines are too long
@ -7,10 +7,15 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const tokenFileList = ['/ql/data/db/keyv.sqlite', '/ql/data/config/auth.json', '/ql/config/auth.json'];
|
||||
let authFile = getLatestFile(tokenFileList);
|
||||
const api = got.extend({
|
||||
prefixUrl: 'http://127.0.0.1:5600',
|
||||
retry: { limit: 0 },
|
||||
});
|
||||
const HOSTS = ['http://127.0.0.1:5600','http://127.0.0.1:5700'];
|
||||
function api(options){
|
||||
const req = got.extend({prefixUrl: HOSTS[0],retry:{limit:0},timeout:{request:5000}})(options);
|
||||
['json','text','buffer'].forEach(m=>{
|
||||
const orig=req[m].bind(req);
|
||||
req[m]=()=>orig().catch(e=>['ECONNREFUSED','ETIMEDOUT'].includes(e.code)?got.extend({prefixUrl:HOSTS[1],retry:{limit:0},timeout:{request:5000}})(options)[m]():Promise.reject(e));
|
||||
});
|
||||
return req;
|
||||
}
|
||||
function getLatestFile(files) {
|
||||
let latestFile = null;
|
||||
let latestMtime = 0;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user