Run prettier

This commit is contained in:
dangered wolf 2024-08-03 23:20:52 -07:00
parent bdba409f92
commit 88943830db
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
5 changed files with 71 additions and 75 deletions

View file

@ -1,62 +1,61 @@
import af from './af/resources.json';
import af from './af/resources.json'; import ar from './ar/resources.json';
import ar from './ar/resources.json'; import ca from './ca/resources.json';
import ca from './ca/resources.json'; import cs from './cs/resources.json';
import cs from './cs/resources.json'; import da from './da/resources.json';
import da from './da/resources.json'; import de from './de/resources.json';
import de from './de/resources.json'; import el from './el/resources.json';
import el from './el/resources.json'; import en from './en/resources.json';
import en from './en/resources.json'; import es from './es-ES/resources.json';
import es from './es-ES/resources.json'; import fi from './fi/resources.json';
import fi from './fi/resources.json'; import fr from './fr/resources.json';
import fr from './fr/resources.json'; import he from './he/resources.json';
import he from './he/resources.json'; import hu from './hu/resources.json';
import hu from './hu/resources.json'; import it from './it/resources.json';
import it from './it/resources.json'; import ja from './ja/resources.json';
import ja from './ja/resources.json'; import ko from './ko/resources.json';
import ko from './ko/resources.json'; import nl from './nl/resources.json';
import nl from './nl/resources.json'; import no from './no/resources.json';
import no from './no/resources.json'; import pl from './pl/resources.json';
import pl from './pl/resources.json'; import pt from './pt-PT/resources.json';
import pt from './pt-PT/resources.json'; import ro from './ro/resources.json';
import ro from './ro/resources.json'; import ru from './ru/resources.json';
import ru from './ru/resources.json'; import sr from './sr/resources.json';
import sr from './sr/resources.json'; import sv from './sv-SE/resources.json';
import sv from './sv-SE/resources.json'; import tr from './tr/resources.json';
import tr from './tr/resources.json'; import uk from './uk/resources.json';
import uk from './uk/resources.json'; import vi from './vi/resources.json';
import vi from './vi/resources.json'; import zhCN from './zh-CN/resources.json';
import zhCN from './zh-CN/resources.json'; import zhTW from './zh-TW/resources.json';
import zhTW from './zh-TW/resources.json';
export default {
export default { 'af': { translation: af },
af: {translation: af}, 'ar': { translation: ar },
ar: {translation: ar}, 'ca': { translation: ca },
ca: {translation: ca}, 'cs': { translation: cs },
cs: {translation: cs}, 'da': { translation: da },
da: {translation: da}, 'de': { translation: de },
de: {translation: de}, 'el': { translation: el },
el: {translation: el}, 'en': { translation: en },
en: {translation: en}, 'es': { translation: es },
es: {translation: es}, 'fi': { translation: fi },
fi: {translation: fi}, 'fr': { translation: fr },
fr: {translation: fr}, 'he': { translation: he },
he: {translation: he}, 'hu': { translation: hu },
hu: {translation: hu}, 'it': { translation: it },
it: {translation: it}, 'ja': { translation: ja },
ja: {translation: ja}, 'ko': { translation: ko },
ko: {translation: ko}, 'nl': { translation: nl },
nl: {translation: nl}, 'no': { translation: no },
no: {translation: no}, 'pl': { translation: pl },
pl: {translation: pl}, 'pt': { translation: pt },
pt: {translation: pt}, 'ro': { translation: ro },
ro: {translation: ro}, 'ru': { translation: ru },
ru: {translation: ru}, 'sr': { translation: sr },
sr: {translation: sr}, 'sv': { translation: sv },
sv: {translation: sv}, 'tr': { translation: tr },
tr: {translation: tr}, 'uk': { translation: uk },
uk: {translation: uk}, 'vi': { translation: vi },
vi: {translation: vi}, 'zh-CN': { translation: zhCN },
'zh-CN': {translation: zhCN}, 'zh-TW': { translation: zhTW }
'zh-TW': {translation: zhTW} };
};

View file

@ -1,7 +1,7 @@
import { Context } from 'hono'; import { Context } from 'hono';
import { StatusCode } from 'hono/utils/http-status'; import { StatusCode } from 'hono/utils/http-status';
import i18next from 'i18next'; import i18next from 'i18next';
import icu from "i18next-icu"; import icu from 'i18next-icu';
import { Constants } from '../constants'; import { Constants } from '../constants';
import { handleQuote } from '../helpers/quote'; import { handleQuote } from '../helpers/quote';
import { formatNumber, sanitizeText, truncateWithEllipsis } from '../helpers/utils'; 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 */ /* Finally, add the footer of the poll with # of votes and time left */
str += '\n'; /* TODO: Localize time left */ str += '\n'; /* TODO: Localize time left */
str += i18next str += i18next.t('pollVotes', {
.t('pollVotes', { voteCount: formatNumber(poll.total_votes), timeLeft: poll.time_left_en }) voteCount: formatNumber(poll.total_votes),
timeLeft: poll.time_left_en
});
/* Check if the poll is ongoing and apply low TTL cache control. /* 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 Yes, checking if this is a string is a hacky way to do this, but

View file

@ -4,7 +4,7 @@ import { profileRequest } from '../twitter/routes/profile';
import { Strings } from '../../strings'; import { Strings } from '../../strings';
import { Constants } from '../../constants'; import { Constants } from '../../constants';
import { linkHitRequest } from './hit'; import { linkHitRequest } from './hit';
import { trimTrailingSlash } from 'hono/trailing-slash' import { trimTrailingSlash } from 'hono/trailing-slash';
export const api = new Hono(); export const api = new Hono();
@ -21,7 +21,7 @@ api.use('*', async (c, next) => {
await next(); await next();
}); });
api.use(trimTrailingSlash()) api.use(trimTrailingSlash());
api.get('/2/hit', linkHitRequest); api.get('/2/hit', linkHitRequest);

View file

@ -31,7 +31,7 @@ export const getBaseRedirectUrl = (c: Context) => {
const twitterStatusRequest = async (c: Context) => await statusRequest(c); const twitterStatusRequest = async (c: Context) => await statusRequest(c);
const _profileRequest = async (c: Context) => await profileRequest(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', twitterStatusRequest);
twitter.get('/:endpoint{status(es)?}/:id/:language', twitterStatusRequest); twitter.get('/:endpoint{status(es)?}/:id/:language', twitterStatusRequest);
twitter.get('/:handle{[0-9a-zA-Z_]+}/: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', '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language',
twitterStatusRequest twitterStatusRequest
); );
twitter.get( twitter.get('/:handle/:endpoint{status(es)?}/:id/*', twitterStatusRequest);
'/:handle/:endpoint{status(es)?}/:id/*',
twitterStatusRequest
);
twitter.get('/version', versionRoute); twitter.get('/version', versionRoute);
twitter.get('/set_base_redirect', setRedirectRequest); twitter.get('/set_base_redirect', setRedirectRequest);

View file

@ -56,9 +56,7 @@ export const statusRequest = async (c: Context) => {
} else if (Constants.INSTANT_VIEW_DOMAINS.includes(url.hostname)) { } else if (Constants.INSTANT_VIEW_DOMAINS.includes(url.hostname)) {
console.log('Forced instant view request'); console.log('Forced instant view request');
flags.forceInstantView = true; flags.forceInstantView = true;
} else if ( } else if (experimentCheck(Experiment.IV_FORCE_THREAD_UNROLL, userAgent.includes('Telegram'))) {
experimentCheck(Experiment.IV_FORCE_THREAD_UNROLL, userAgent.includes('Telegram'))
) {
console.log('Forced unroll instant view'); console.log('Forced unroll instant view');
flags.instantViewUnrollThreads = true; flags.instantViewUnrollThreads = true;
} else if (Constants.GALLERY_DOMAINS.includes(url.hostname)) { } else if (Constants.GALLERY_DOMAINS.includes(url.hostname)) {