Run prettier

This commit is contained in:
dangered wolf 2024-01-22 19:35:58 -05:00
parent 4bd2c7b9c8
commit ae8417cd71
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
5 changed files with 23 additions and 24 deletions

View file

@ -138,13 +138,12 @@ export const twitterFetch = async (
if (useElongator && typeof c.env?.TwitterProxy !== 'undefined') {
console.log('Fetching using elongator');
const performanceStart = performance.now();
apiRequest = await withTimeout(
(signal: AbortSignal) =>
c.env?.TwitterProxy.fetch(url, {
method: 'GET',
headers: headers,
signal: signal
})
apiRequest = await withTimeout((signal: AbortSignal) =>
c.env?.TwitterProxy.fetch(url, {
method: 'GET',
headers: headers,
signal: signal
})
);
const performanceEnd = performance.now();
console.log(`Elongator request successful after ${performanceEnd - performanceStart}ms`);

View file

@ -64,13 +64,12 @@ export const translateStatus = async (
tweet.rest_id ?? tweet.legacy?.id_str
},destinationLanguage=None,translationSource=Some(Google),feature=None,timeout=None,onlyCached=None/translation/service/translateTweet`;
console.log(url, headers);
translationApiResponse = (await withTimeout(
(signal: AbortSignal) =>
c.env?.TwitterProxy.fetch(url, {
method: 'GET',
headers: headers,
signal: signal
})
translationApiResponse = (await withTimeout((signal: AbortSignal) =>
c.env?.TwitterProxy.fetch(url, {
method: 'GET',
headers: headers,
signal: signal
})
)) as Response;
translationResults = (await translationApiResponse.json()) as TranslationPartial;

View file

@ -58,11 +58,11 @@ export async function withTimeout<T>(
}
export const formatNumber = (num: number) => {
if (num >= 1e6) {
return (num / 1e6).toFixed(2) + 'M';
} else if (num >= 1e3) {
return (num / 1e3).toFixed(1) + 'K';
} else {
return num.toString();
}
if (num >= 1e6) {
return (num / 1e6).toFixed(2) + 'M';
} else if (num >= 1e3) {
return (num / 1e3).toFixed(1) + 'K';
} else {
return num.toString();
}
};

View file

@ -58,7 +58,7 @@ export const statusRequest = async (c: Context) => {
} else if (Constants.GALLERY_DOMAINS.includes(url.hostname)) {
console.log('Gallery embed request');
flags.gallery = true;
} else if (Constants.FORCE_MOSAIC_DOMAINS.includes(url.hostname)) {
} else if (Constants.FORCE_MOSAIC_DOMAINS.includes(url.hostname)) {
console.log('Force mosaic request');
flags.forceMosaic = true;
} else if (prefix === 'dl' || prefix === 'dir') {

View file

@ -10,7 +10,8 @@ import { twitter } from './realms/twitter/router';
import { cacheMiddleware } from './caches';
const noCache = 'max-age=0, no-cache, no-store, must-revalidate';
const embeddingClientRegex = /(discordbot|telegrambot|facebook|whatsapp|firefox\/92|vkshare|revoltchat|preview)/gi;
const embeddingClientRegex =
/(discordbot|telegrambot|facebook|whatsapp|firefox\/92|vkshare|revoltchat|preview)/gi;
/* This is the root app which contains route trees for multiple "realms".