mirror of https://github.com/tycrek/ass.git
fix: show original if user overrode with zws
This commit is contained in:
parent
fe79d84662
commit
6dc539c7d5
|
@ -1,3 +1,4 @@
|
|||
import lengthGen from './lengthGen';
|
||||
const zeroWidthChars = ['\u200B', '\u200C', '\u200D', '\u2060'];
|
||||
export default ({ length }: { length: number }) => lengthGen(length, zeroWidthChars);
|
||||
export const checkIfZws = (str: string) => str.split('').every(char => zeroWidthChars.includes(char));
|
||||
|
|
|
@ -7,6 +7,7 @@ import fetch, { Response as FetchResponse } from 'node-fetch';
|
|||
import { Request, Response } from 'express';
|
||||
import { deleteS3 } from '../storage';
|
||||
import { SkynetDelete, SkynetDownload } from '../skynet';
|
||||
import { checkIfZws } from '../generators/zws';
|
||||
import { path, log, getTrueHttp, getTrueDomain, formatBytes, formatTimestamp, getS3url, getDirectUrl, getResourceColor, replaceholder } from '../utils';
|
||||
const { diskFilePath, s3enabled, viewDirect, useIdInViewer, idInViewerExtension, useSia }: Config = fs.readJsonSync(path('config.json'));
|
||||
const { CODE_UNAUTHORIZED, CODE_NOT_FOUND, }: MagicNumbers = fs.readJsonSync(path('MagicNumbers.json'));
|
||||
|
@ -47,7 +48,7 @@ router.get('/', (req: Request, res: Response, next) => data().get(req.ass.resour
|
|||
// Send the view to the client
|
||||
res.render('view', {
|
||||
fileIs: fileData.is,
|
||||
title: useIdInViewer ? `${resourceId}${idInViewerExtension ? `${fileData.ext}` : ''}` : escape(fileData.originalname),
|
||||
title: useIdInViewer && !checkIfZws(resourceId) ? `${resourceId}${idInViewerExtension ? `${fileData.ext}` : ''}` : escape(fileData.originalname),
|
||||
mimetype: fileData.mimetype,
|
||||
uploader: users.find(user => user.unid === fileData.uploader)?.username || 'Unknown',
|
||||
timestamp: formatTimestamp(fileData.timestamp, fileData.timeoffset),
|
||||
|
|
Loading…
Reference in New Issue