feat: add hash
This commit is contained in:
parent
3938a0f87e
commit
30589e3347
@ -16,6 +16,7 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
|
||||
const pathname = _u.pathname;
|
||||
const params = _u.searchParams;
|
||||
const password = params.get('p');
|
||||
const hash = params.get('hash');
|
||||
let objectName = '';
|
||||
let owner = '';
|
||||
const { user, app } = getUserFromRequest(req);
|
||||
@ -42,6 +43,11 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
|
||||
if (!checkPermission.success) {
|
||||
return createNotFoundPage('no permission');
|
||||
}
|
||||
if (hash && stat.etag === hash) {
|
||||
res.writeHead(304); // not modified
|
||||
res.end('not modified')
|
||||
return true;
|
||||
}
|
||||
const filterMetaData = filterKeys(stat.metaData, ['size', 'etag', 'last-modified']);
|
||||
const contentLength = stat.size;
|
||||
const etag = stat.etag;
|
||||
|
Loading…
x
Reference in New Issue
Block a user