0000
This commit is contained in:
parent
7b1971da4e
commit
f243697788
20
source.js
20
source.js
@ -91,6 +91,26 @@ const server = http.createServer(async (req, res) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 清理缓存
|
||||
if (reqPath === 'clean') {
|
||||
// 删除缓存目录下的所有文件
|
||||
const files = fs.readdirSync(cacheDir);
|
||||
for (const file of files) {
|
||||
const filePath = pathModule.join(cacheDir, file);
|
||||
fs.unlinkSync(filePath);
|
||||
}
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain;charset=UTF-8' });
|
||||
res.end(JSON.stringify({
|
||||
code: 200,
|
||||
data: {
|
||||
cacheDir: cacheDir,
|
||||
pathIndexCount: Object.keys(pathIndex).length,
|
||||
files: files.length,
|
||||
}
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
// 当没有 token 或 undefined
|
||||
if (token === '' || typeof token === 'undefined') {
|
||||
token = reqPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user