From 88943830db031e57e3ba661b62e064b6b058a02e Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Sat, 3 Aug 2024 23:20:52 -0700 Subject: [PATCH] Run prettier --- i18n/resources.js | 123 ++++++++++++++-------------- src/embed/status.ts | 8 +- src/realms/api/router.ts | 4 +- src/realms/twitter/router.ts | 7 +- src/realms/twitter/routes/status.ts | 4 +- 5 files changed, 71 insertions(+), 75 deletions(-) diff --git a/i18n/resources.js b/i18n/resources.js index 33d4154..9900e81 100644 --- a/i18n/resources.js +++ b/i18n/resources.js @@ -1,62 +1,61 @@ - -import af from './af/resources.json'; -import ar from './ar/resources.json'; -import ca from './ca/resources.json'; -import cs from './cs/resources.json'; -import da from './da/resources.json'; -import de from './de/resources.json'; -import el from './el/resources.json'; -import en from './en/resources.json'; -import es from './es-ES/resources.json'; -import fi from './fi/resources.json'; -import fr from './fr/resources.json'; -import he from './he/resources.json'; -import hu from './hu/resources.json'; -import it from './it/resources.json'; -import ja from './ja/resources.json'; -import ko from './ko/resources.json'; -import nl from './nl/resources.json'; -import no from './no/resources.json'; -import pl from './pl/resources.json'; -import pt from './pt-PT/resources.json'; -import ro from './ro/resources.json'; -import ru from './ru/resources.json'; -import sr from './sr/resources.json'; -import sv from './sv-SE/resources.json'; -import tr from './tr/resources.json'; -import uk from './uk/resources.json'; -import vi from './vi/resources.json'; -import zhCN from './zh-CN/resources.json'; -import zhTW from './zh-TW/resources.json'; - -export default { - af: {translation: af}, - ar: {translation: ar}, - ca: {translation: ca}, - cs: {translation: cs}, - da: {translation: da}, - de: {translation: de}, - el: {translation: el}, - en: {translation: en}, - es: {translation: es}, - fi: {translation: fi}, - fr: {translation: fr}, - he: {translation: he}, - hu: {translation: hu}, - it: {translation: it}, - ja: {translation: ja}, - ko: {translation: ko}, - nl: {translation: nl}, - no: {translation: no}, - pl: {translation: pl}, - pt: {translation: pt}, - ro: {translation: ro}, - ru: {translation: ru}, - sr: {translation: sr}, - sv: {translation: sv}, - tr: {translation: tr}, - uk: {translation: uk}, - vi: {translation: vi}, - 'zh-CN': {translation: zhCN}, - 'zh-TW': {translation: zhTW} -}; \ No newline at end of file +import af from './af/resources.json'; +import ar from './ar/resources.json'; +import ca from './ca/resources.json'; +import cs from './cs/resources.json'; +import da from './da/resources.json'; +import de from './de/resources.json'; +import el from './el/resources.json'; +import en from './en/resources.json'; +import es from './es-ES/resources.json'; +import fi from './fi/resources.json'; +import fr from './fr/resources.json'; +import he from './he/resources.json'; +import hu from './hu/resources.json'; +import it from './it/resources.json'; +import ja from './ja/resources.json'; +import ko from './ko/resources.json'; +import nl from './nl/resources.json'; +import no from './no/resources.json'; +import pl from './pl/resources.json'; +import pt from './pt-PT/resources.json'; +import ro from './ro/resources.json'; +import ru from './ru/resources.json'; +import sr from './sr/resources.json'; +import sv from './sv-SE/resources.json'; +import tr from './tr/resources.json'; +import uk from './uk/resources.json'; +import vi from './vi/resources.json'; +import zhCN from './zh-CN/resources.json'; +import zhTW from './zh-TW/resources.json'; + +export default { + 'af': { translation: af }, + 'ar': { translation: ar }, + 'ca': { translation: ca }, + 'cs': { translation: cs }, + 'da': { translation: da }, + 'de': { translation: de }, + 'el': { translation: el }, + 'en': { translation: en }, + 'es': { translation: es }, + 'fi': { translation: fi }, + 'fr': { translation: fr }, + 'he': { translation: he }, + 'hu': { translation: hu }, + 'it': { translation: it }, + 'ja': { translation: ja }, + 'ko': { translation: ko }, + 'nl': { translation: nl }, + 'no': { translation: no }, + 'pl': { translation: pl }, + 'pt': { translation: pt }, + 'ro': { translation: ro }, + 'ru': { translation: ru }, + 'sr': { translation: sr }, + 'sv': { translation: sv }, + 'tr': { translation: tr }, + 'uk': { translation: uk }, + 'vi': { translation: vi }, + 'zh-CN': { translation: zhCN }, + 'zh-TW': { translation: zhTW } +}; diff --git a/src/embed/status.ts b/src/embed/status.ts index e56df27..799d29c 100644 --- a/src/embed/status.ts +++ b/src/embed/status.ts @@ -1,7 +1,7 @@ import { Context } from 'hono'; import { StatusCode } from 'hono/utils/http-status'; import i18next from 'i18next'; -import icu from "i18next-icu"; +import icu from 'i18next-icu'; import { Constants } from '../constants'; import { handleQuote } from '../helpers/quote'; import { formatNumber, sanitizeText, truncateWithEllipsis } from '../helpers/utils'; @@ -390,8 +390,10 @@ export const handleStatus = async ( /* Finally, add the footer of the poll with # of votes and time left */ str += '\n'; /* TODO: Localize time left */ - str += i18next - .t('pollVotes', { voteCount: formatNumber(poll.total_votes), timeLeft: poll.time_left_en }) + str += i18next.t('pollVotes', { + voteCount: formatNumber(poll.total_votes), + timeLeft: poll.time_left_en + }); /* Check if the poll is ongoing and apply low TTL cache control. Yes, checking if this is a string is a hacky way to do this, but diff --git a/src/realms/api/router.ts b/src/realms/api/router.ts index 554ab14..f279dd1 100644 --- a/src/realms/api/router.ts +++ b/src/realms/api/router.ts @@ -4,7 +4,7 @@ import { profileRequest } from '../twitter/routes/profile'; import { Strings } from '../../strings'; import { Constants } from '../../constants'; import { linkHitRequest } from './hit'; -import { trimTrailingSlash } from 'hono/trailing-slash' +import { trimTrailingSlash } from 'hono/trailing-slash'; export const api = new Hono(); @@ -21,7 +21,7 @@ api.use('*', async (c, next) => { await next(); }); -api.use(trimTrailingSlash()) +api.use(trimTrailingSlash()); api.get('/2/hit', linkHitRequest); diff --git a/src/realms/twitter/router.ts b/src/realms/twitter/router.ts index 8e01cf0..5df0bd7 100644 --- a/src/realms/twitter/router.ts +++ b/src/realms/twitter/router.ts @@ -31,7 +31,7 @@ export const getBaseRedirectUrl = (c: Context) => { const twitterStatusRequest = async (c: Context) => await statusRequest(c); const _profileRequest = async (c: Context) => await profileRequest(c); -twitter.use(trimTrailingSlash()) +twitter.use(trimTrailingSlash()); twitter.get('/:endpoint{status(es)?}/:id', twitterStatusRequest); twitter.get('/:endpoint{status(es)?}/:id/:language', twitterStatusRequest); twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:language', twitterStatusRequest); @@ -60,10 +60,7 @@ twitter.get( '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language', twitterStatusRequest ); -twitter.get( - '/:handle/:endpoint{status(es)?}/:id/*', - twitterStatusRequest -); +twitter.get('/:handle/:endpoint{status(es)?}/:id/*', twitterStatusRequest); twitter.get('/version', versionRoute); twitter.get('/set_base_redirect', setRedirectRequest); diff --git a/src/realms/twitter/routes/status.ts b/src/realms/twitter/routes/status.ts index 05300c5..d08cf3f 100644 --- a/src/realms/twitter/routes/status.ts +++ b/src/realms/twitter/routes/status.ts @@ -56,9 +56,7 @@ export const statusRequest = async (c: Context) => { } else if (Constants.INSTANT_VIEW_DOMAINS.includes(url.hostname)) { console.log('Forced instant view request'); flags.forceInstantView = true; - } else if ( - experimentCheck(Experiment.IV_FORCE_THREAD_UNROLL, userAgent.includes('Telegram')) - ) { + } else if (experimentCheck(Experiment.IV_FORCE_THREAD_UNROLL, userAgent.includes('Telegram'))) { console.log('Forced unroll instant view'); flags.instantViewUnrollThreads = true; } else if (Constants.GALLERY_DOMAINS.includes(url.hostname)) {