From 81342e2579165ebfdb28c749dc5225141721a419 Mon Sep 17 00:00:00 2001 From: FifthWit Date: Thu, 30 Jan 2025 13:11:48 -0600 Subject: switched to double quotes --- frontend/src/utils/Jwt.ts | 20 ++++++++++---------- frontend/src/utils/Time.ts | 26 +++++++++++++------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'frontend/src/utils') diff --git a/frontend/src/utils/Jwt.ts b/frontend/src/utils/Jwt.ts index affcd36..dc6ec92 100644 --- a/frontend/src/utils/Jwt.ts +++ b/frontend/src/utils/Jwt.ts @@ -5,20 +5,20 @@ export function get_user_id_from_token( if (!token) { return undefined; } - const parts = token.split('.'); + const parts = token.split("."); if (parts.length !== 3) { return undefined; } const base64Url = parts[1]; - const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); + const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); const jsonPayload = decodeURIComponent( atob(base64) - .split('') + .split("") .map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); }) - .join('') + .join("") ); return JSON.parse(jsonPayload).sub; } @@ -29,20 +29,20 @@ export function get_user_mod_from_token( if (!token) { return undefined; } - const parts = token.split('.'); + const parts = token.split("."); if (parts.length !== 3) { return undefined; } const base64Url = parts[1]; - const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); + const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); const jsonPayload = decodeURIComponent( atob(base64) - .split('') + .split("") .map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); + return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); }) - .join('') + .join("") ); return JSON.parse(jsonPayload).mod; } diff --git a/frontend/src/utils/Time.ts b/frontend/src/utils/Time.ts index 34830b0..8f2c03c 100644 --- a/frontend/src/utils/Time.ts +++ b/frontend/src/utils/Time.ts @@ -6,47 +6,47 @@ export function time_ago(date: any) { let interval = Math.floor(seconds / 31536000); if (interval === 1) { - return interval + ' year ago'; + return interval + " year ago"; } if (interval > 1) { - return interval + ' years ago'; + return interval + " years ago"; } interval = Math.floor(seconds / 2592000); if (interval === 1) { - return interval + ' month ago'; + return interval + " month ago"; } if (interval > 1) { - return interval + ' months ago'; + return interval + " months ago"; } interval = Math.floor(seconds / 86400); if (interval === 1) { - return interval + ' day ago'; + return interval + " day ago"; } if (interval > 1) { - return interval + ' days ago'; + return interval + " days ago"; } interval = Math.floor(seconds / 3600); if (interval === 1) { - return interval + ' hour ago'; + return interval + " hour ago"; } if (interval > 1) { - return interval + ' hours ago'; + return interval + " hours ago"; } interval = Math.floor(seconds / 60); if (interval === 1) { - return interval + ' minute ago'; + return interval + " minute ago"; } if (interval > 1) { - return interval + ' minutes ago'; + return interval + " minutes ago"; } - if (seconds < 10) return 'just now'; + if (seconds < 10) return "just now"; - return Math.floor(seconds) + ' seconds ago'; + return Math.floor(seconds) + " seconds ago"; } export function ticks_to_time(ticks: number) { @@ -58,5 +58,5 @@ export function ticks_to_time(ticks: number) { seconds = seconds % 60; minutes = minutes % 60; - return `${hours === 0 ? '' : hours + ':'}${minutes === 0 ? '' : hours > 0 ? minutes.toString().padStart(2, '0') + ':' : minutes + ':'}${minutes > 0 ? seconds.toString().padStart(2, '0') : seconds}.${milliseconds.toString().padStart(3, '0')}`; + return `${hours === 0 ? "" : hours + ":"}${minutes === 0 ? "" : hours > 0 ? minutes.toString().padStart(2, "0") + ":" : minutes + ":"}${minutes > 0 ? seconds.toString().padStart(2, "0") : seconds}.${milliseconds.toString().padStart(3, "0")}`; } -- cgit v1.2.3