0000
This commit is contained in:
parent
6b33982a55
commit
e606aa2297
3
index.js
3
index.js
@ -4,6 +4,7 @@ const url = require('url');
|
||||
const querystring = require('querystring');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const requestTimeout = 10000; // 10 seconds
|
||||
const cacheDir = path.join(__dirname, '.cache');
|
||||
@ -40,7 +41,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const reqName = parsedUrl.pathname.split('/').pop();
|
||||
const cacheMetaFile = path.join(cacheDir, `${reqName.replace(/\//g, '_')}.meta`);
|
||||
const cacheContentFile = path.join(cacheDir, `${reqName.replace(/\//g, '_')}.content`);
|
||||
const tempCacheContentFile = path.join(cacheDir, `${reqName.replace(/\//g, '_')}.temp`);
|
||||
const tempCacheContentFile = path.join(cacheDir, `${reqName.replace(/\//g, '_')}_${crypto.randomUUID()}.temp`);
|
||||
|
||||
if (!sign || reqPath === '/') {
|
||||
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
||||
|
Loading…
x
Reference in New Issue
Block a user