mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix
This commit is contained in:
parent
c724236930
commit
a56b7ff636
2
src/core
2
src/core
@ -1 +1 @@
|
|||||||
Subproject commit db7b494755d82213da7884451d5c26922debe3bd
|
Subproject commit 16ab139ae667c573c44f7889aefc22fb0c7c4d14
|
@ -1,52 +0,0 @@
|
|||||||
import http from 'http';
|
|
||||||
|
|
||||||
const privateRkey = '';
|
|
||||||
function logDebug(...args) {
|
|
||||||
console.log(...args);
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkUrl = new Promise((resolve, reject) => {
|
|
||||||
const uri = new URL('https://gchat.qpic.cn/download?appid=1407&fileid=CgkzNzk0NTAzMjYSFECDMhodswV7nH5Npuf2O8dstvL1GNaGEiD_CijQycnZsuaFA1CAvaMB&spec=0&rkey=CAESKE4_cASDm1t1mbnPfSzEvPzS-iYGLyXhjXjTRIhOHeSVDKkPp6Luaao');
|
|
||||||
const options = {
|
|
||||||
method: 'GET',
|
|
||||||
host: uri.host,
|
|
||||||
path: uri.pathname + uri.search,
|
|
||||||
headers: {
|
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
|
|
||||||
'Accept': '*/*',
|
|
||||||
'Range': 'bytes=0-0'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const req = http.request(options, (res) => {
|
|
||||||
logDebug(`Check rkey status: ${res.statusCode}`);
|
|
||||||
logDebug(`Check rkey headers: ${JSON.stringify(res.headers)}`);
|
|
||||||
if (res.statusCode == 200 || res.statusCode === 206) {
|
|
||||||
// console.log('The image URL is accessible.');
|
|
||||||
resolve('ok');
|
|
||||||
} else {
|
|
||||||
reject('The image URL is not accessible.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
req.setTimeout(3000, () => {
|
|
||||||
req.destroy();
|
|
||||||
reject('Check rkey request timed out');
|
|
||||||
});
|
|
||||||
|
|
||||||
req.on('error', (e) => {
|
|
||||||
console.error(`Problem with rkey request: ${e.message}`);
|
|
||||||
// reject(e.message);
|
|
||||||
});
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
const startTime = Date.now();
|
|
||||||
checkUrl.then((result) => {
|
|
||||||
const endTime = Date.now();
|
|
||||||
console.log(result);
|
|
||||||
console.log(`Time elapsed: ${endTime - startTime}ms`);
|
|
||||||
}).catch((error) => {
|
|
||||||
const endTime = Date.now();
|
|
||||||
console.error(error);
|
|
||||||
console.log(`Time elapsed: ${endTime - startTime}ms`);
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user