Fixed timeoffset breaking TS compilation

pull/62/head
tycrek 3 years ago
parent b2ffc44972
commit b38a403bc9
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -22,6 +22,7 @@ export interface FileData {
sha1: string
domain: string
timestamp: number
timeoffset: string
token: string
opengraph: OpenGraphData

@ -50,7 +50,7 @@ router.post('/', (req: AssRequest, res: AssResponse, next: Function) => {
req.file!.timestamp = DateTime.now().toMillis();
// Save the timezone offset
req.file.timeoffset = req.headers['x-ass-timeoffset'] || 'UTC+0';
req.file!.timeoffset = req.headers['x-ass-timeoffset']?.toString() || 'UTC+0';
// Keep track of the token that uploaded the resource
req.file!.token = req.token ?? '';

@ -47,7 +47,7 @@ export function getResourceColor(colorValue: string, vibrantValue: string) {
return colorValue === '&random' ? randomHexColour() : colorValue === '&vibrant' ? vibrantValue : colorValue;
}
export function formatTimestamp(timestamp: number, timeoffset) {
export function formatTimestamp(timestamp: number, timeoffset: string) {
return DateTime.fromMillis(timestamp).setZone(timeoffset).toLocaleString(DateTime.DATETIME_MED);
}
@ -58,7 +58,7 @@ export function formatBytes(bytes: number, decimals = 2) { // skipcq: JS-0074
return parseFloat((bytes / Math.pow(KILOBYTES, i)).toFixed(decimals < 0 ? 0 : decimals)).toString().concat(` ${sizes[i]}`);
}
export function replaceholder(data: string, size: number, timestamp: number, timeoffset, originalname: string) {
export function replaceholder(data: string, size: number, timestamp: number, timeoffset: string, originalname: string) {
return data
.replace(/&size/g, formatBytes(size))
.replace(/&filename/g, originalname)

Loading…
Cancel
Save