|
|
@ -8,7 +8,7 @@ import { Request, Response } from 'express';
|
|
|
|
import { deleteS3 } from '../storage';
|
|
|
|
import { deleteS3 } from '../storage';
|
|
|
|
import { SkynetDelete, SkynetDownload } from '../skynet';
|
|
|
|
import { SkynetDelete, SkynetDownload } from '../skynet';
|
|
|
|
import { path, log, getTrueHttp, getTrueDomain, formatBytes, formatTimestamp, getS3url, getDirectUrl, getResourceColor, replaceholder } from '../utils';
|
|
|
|
import { path, log, getTrueHttp, getTrueDomain, formatBytes, formatTimestamp, getS3url, getDirectUrl, getResourceColor, replaceholder } from '../utils';
|
|
|
|
const { diskFilePath, s3enabled, viewDirect, useSia }: Config = fs.readJsonSync(path('config.json'));
|
|
|
|
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'));
|
|
|
|
const { CODE_UNAUTHORIZED, CODE_NOT_FOUND, }: MagicNumbers = fs.readJsonSync(path('MagicNumbers.json'));
|
|
|
|
import { data } from '../data';
|
|
|
|
import { data } from '../data';
|
|
|
|
import { users } from '../auth';
|
|
|
|
import { users } from '../auth';
|
|
|
@ -47,7 +47,7 @@ router.get('/', (req: Request, res: Response, next) => data().get(req.ass.resour
|
|
|
|
// Send the view to the client
|
|
|
|
// Send the view to the client
|
|
|
|
res.render('view', {
|
|
|
|
res.render('view', {
|
|
|
|
fileIs: fileData.is,
|
|
|
|
fileIs: fileData.is,
|
|
|
|
title: escape(fileData.originalname),
|
|
|
|
title: useIdInViewer ? `${resourceId}${idInViewerExtension ? `${fileData.ext}` : ''}` : escape(fileData.originalname),
|
|
|
|
mimetype: fileData.mimetype,
|
|
|
|
mimetype: fileData.mimetype,
|
|
|
|
uploader: users.find(user => user.unid === fileData.uploader)?.username || 'Unknown',
|
|
|
|
uploader: users.find(user => user.unid === fileData.uploader)?.username || 'Unknown',
|
|
|
|
timestamp: formatTimestamp(fileData.timestamp, fileData.timeoffset),
|
|
|
|
timestamp: formatTimestamp(fileData.timestamp, fileData.timeoffset),
|
|
|
|