diff --git a/src/embed/status.ts b/src/embed/status.ts
index 220c652..188d25b 100644
--- a/src/embed/status.ts
+++ b/src/embed/status.ts
@@ -105,10 +105,10 @@ export const handleStatus = async (
!flags?.gallery &&
!flags?.api &&
(status.media?.photos?.[0] || // Force instant view for photos for now https://bugs.telegram.org/c/33679
- status.media?.mosaic ||
- status.is_note_tweet ||
- status.quote ||
- status.translation ||
+ status.media?.mosaic ||
+ status.is_note_tweet ||
+ status.quote ||
+ status.translation ||
flags?.forceInstantView);
/* Force enable IV for archivers */
@@ -167,7 +167,7 @@ export const handleStatus = async (
``,
``,
``,
- ``,
+ ``
];
if (!flags.gallery) {
@@ -205,7 +205,7 @@ export const handleStatus = async (
}
}
- console.log('translation', status.translation)
+ console.log('translation', status.translation);
/* This status has a translation attached to it, so we'll render it. */
if (status.translation) {
@@ -400,27 +400,24 @@ export const handleStatus = async (
const useCard = status.embed_card === 'tweet' ? status.quote?.embed_card : status.embed_card;
-
/* Push basic headers relating to author, Tweet text, and site name */
- headers.push(
- ``
- );
+ headers.push(``);
if (!flags.gallery) {
headers.push(
``,
``,
- ``,
+ ``
);
} else {
if (isTelegram) {
headers.push(
``
- )
+ );
} else {
headers.push(
``
- )
+ );
}
}
@@ -442,7 +439,9 @@ export const handleStatus = async (
``.format(
{
base: Constants.HOST_URL,
- text: flags.gallery ? status.author.name : encodeURIComponent(truncateWithEllipsis(authorText, 255)),
+ text: flags.gallery
+ ? status.author.name
+ : encodeURIComponent(truncateWithEllipsis(authorText, 255)),
deprecatedFlag: flags?.deprecated ? '&deprecated=true' : '',
status: encodeURIComponent(statusId),
author: encodeURIComponent(status.author.screen_name || ''),
diff --git a/src/helpers/translate.ts b/src/helpers/translate.ts
index eca3845..f95fcfa 100644
--- a/src/helpers/translate.ts
+++ b/src/helpers/translate.ts
@@ -52,7 +52,9 @@ export const translateStatus = async (
}
try {
- const url = `${Constants.TWITTER_ROOT}/i/api/1.1/strato/column/None/tweetId=${tweet.rest_id ?? tweet.legacy?.id_str},destinationLanguage=None,translationSource=Some(Google),feature=None,timeout=None,onlyCached=None/translation/service/translateTweet`;
+ const url = `${Constants.TWITTER_ROOT}/i/api/1.1/strato/column/None/tweetId=${
+ 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) =>
diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts
index 98b2a8b..4602e85 100644
--- a/src/helpers/utils.ts
+++ b/src/helpers/utils.ts
@@ -57,7 +57,6 @@ export async function withTimeout(
}
}
-
const numberFormat = new Intl.NumberFormat('en-US');
export const formatNumber = (num: number) => numberFormat.format(num);
diff --git a/src/providers/twitter/conversation.ts b/src/providers/twitter/conversation.ts
index 4d174cf..8f69f9e 100644
--- a/src/providers/twitter/conversation.ts
+++ b/src/providers/twitter/conversation.ts
@@ -181,10 +181,14 @@ const processResponse = (instructions: ThreadInstruction[]): GraphQLProcessBucke
if (itemContentType === 'TimelineTweet') {
const entryType = content.itemContent.tweet_results.result.__typename;
if (entryType === 'Tweet') {
- bucket.statuses.push(content.itemContent.tweet_results.result as GraphQLTwitterStatus);
+ bucket.statuses.push(
+ content.itemContent.tweet_results.result as GraphQLTwitterStatus
+ );
}
if (entryType === 'TweetWithVisibilityResults') {
- bucket.statuses.push(content.itemContent.tweet_results.result.tweet as GraphQLTwitterStatus);
+ bucket.statuses.push(
+ content.itemContent.tweet_results.result.tweet as GraphQLTwitterStatus
+ );
}
} else if (itemContentType === 'TimelineTimelineCursor') {
bucket.cursors.push(content.itemContent as GraphQLTimelineCursor);
@@ -197,7 +201,9 @@ const processResponse = (instructions: ThreadInstruction[]): GraphQLProcessBucke
if (itemContentType === 'TimelineTweet') {
const entryType = item.item.itemContent.tweet_results?.result?.__typename;
if (entryType === 'Tweet') {
- bucket.statuses.push(item.item.itemContent.tweet_results.result as GraphQLTwitterStatus);
+ bucket.statuses.push(
+ item.item.itemContent.tweet_results.result as GraphQLTwitterStatus
+ );
}
if (entryType === 'TweetWithVisibilityResults') {
bucket.statuses.push(
@@ -216,7 +222,10 @@ const processResponse = (instructions: ThreadInstruction[]): GraphQLProcessBucke
return bucket;
};
-const findStatusInBucket = (id: string, bucket: GraphQLProcessBucket): GraphQLTwitterStatus | null => {
+const findStatusInBucket = (
+ id: string,
+ bucket: GraphQLProcessBucket
+): GraphQLTwitterStatus | null => {
return bucket.statuses.find(status => (status.rest_id ?? status.legacy?.id_str) === id) ?? null;
};
@@ -231,7 +240,8 @@ const findPreviousStatus = (id: string, bucket: GraphQLProcessBucket): number =>
return -1;
}
return bucket.statuses.findIndex(
- _status => (_status.rest_id ?? _status.legacy?.id_str) === status.legacy?.in_reply_to_status_id_str
+ _status =>
+ (_status.rest_id ?? _status.legacy?.id_str) === status.legacy?.in_reply_to_status_id_str
);
};
@@ -322,7 +332,13 @@ export const constructTwitterThread = async (
return { status: null, thread: null, author: null, code: 404 };
}
- status = (await buildAPITwitterStatus(c, originalStatus, undefined, false, legacyAPI)) as APITwitterStatus;
+ status = (await buildAPITwitterStatus(
+ c,
+ originalStatus,
+ undefined,
+ false,
+ legacyAPI
+ )) as APITwitterStatus;
if (status === null) {
return { status: null, thread: null, author: null, code: 404 };
@@ -480,7 +496,9 @@ export const constructTwitterThread = async (
};
threadStatuses.forEach(async status => {
- socialThread.thread?.push((await buildAPITwitterStatus(c, status, undefined, true, false)) as APITwitterStatus);
+ socialThread.thread?.push(
+ (await buildAPITwitterStatus(c, status, undefined, true, false)) as APITwitterStatus
+ );
});
return socialThread;
diff --git a/src/realms/api/router.ts b/src/realms/api/router.ts
index 42035c7..6816dc5 100644
--- a/src/realms/api/router.ts
+++ b/src/realms/api/router.ts
@@ -9,7 +9,10 @@ export const api = new Hono();
api.use('*', async (c, next) => {
if (!c.req.header('user-agent')) {
c.status(401);
- return c.json({"error":"You must identify yourself with a User-Agent header in order to use the FixTweet API. We recommend using a descriptive User-Agent header to identify your app, such as 'MyAwesomeBot/1.0 (+http://example.com/myawesomebot)'. We don\'t track or save what kinds of data you are pulling, but you may be blocked if you send too many requests from an unidentifiable user agent."});
+ return c.json({
+ error:
+ "You must identify yourself with a User-Agent header in order to use the FixTweet API. We recommend using a descriptive User-Agent header to identify your app, such as 'MyAwesomeBot/1.0 (+http://example.com/myawesomebot)'. We don't track or save what kinds of data you are pulling, but you may be blocked if you send too many requests from an unidentifiable user agent."
+ });
}
await next();
});
@@ -28,4 +31,4 @@ api.get('/:handle', profileRequest);
api.get('/:handle/', profileRequest);
/* TODO: Figure out why / won't resolve but * does */
-api.get('*', async c => c.redirect(Constants.API_DOCS_URL, 302));
\ No newline at end of file
+api.get('*', async c => c.redirect(Constants.API_DOCS_URL, 302));
diff --git a/src/realms/twitter/router.ts b/src/realms/twitter/router.ts
index 19512c7..3f79666 100644
--- a/src/realms/twitter/router.ts
+++ b/src/realms/twitter/router.ts
@@ -36,14 +36,8 @@ 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
-);
+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);
twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id', twitterStatusRequest);
twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/', twitterStatusRequest);
twitter.get(
diff --git a/src/render/instantview.ts b/src/render/instantview.ts
index 3dddc85..043b67d 100644
--- a/src/render/instantview.ts
+++ b/src/render/instantview.ts
@@ -132,7 +132,9 @@ const generateStatusFooter = (status: APIStatus, isQuote = false): string => {
{aboutSection}
`.format({
socialText: getSocialTextIV(status as APITwitterStatus) || '',
- viewOriginal: !isQuote ? `View original post` : notApplicableComment,
+ viewOriginal: !isQuote
+ ? `View original post`
+ : notApplicableComment,
aboutSection: isQuote
? ''
: `About author
diff --git a/src/types/types.d.ts b/src/types/types.d.ts
index bfd048a..6e2ad82 100644
--- a/src/types/types.d.ts
+++ b/src/types/types.d.ts
@@ -206,4 +206,4 @@ interface OEmbed {
title?: string | null;
type: 'link';
version: '1.0';
-}
\ No newline at end of file
+}
diff --git a/src/worker.ts b/src/worker.ts
index 1aaf6e0..b376088 100644
--- a/src/worker.ts
+++ b/src/worker.ts
@@ -107,14 +107,26 @@ app.use('*', async (c, next) => {
if (c.req.raw.cf) {
const cf = c.req.raw.cf;
console.log(`Hello from β
${cf.colo ?? 'UNK'}`);
- console.log(`πΆ ${cf.httpProtocol ?? 'Unknown HTTP Protocol'} π ${cf.clientTcpRtt ?? 'N/A'} ms RTT π ${cf.tlsVersion ?? 'Unencrypted Connection'} (${cf.tlsCipher ?? ''})`)
- console.log(`πΊοΈ ${cf.city ?? 'Unknown City'}, ${cf.regionCode ? (cf.regionCode + ', ') : ''}${cf.country ?? 'Unknown Country'} ${cf.isEUCountry ? '(EU)' : ''}`);
- console.log(`π ${c.req.header('x-real-ip') ?? ''} (${cf.asn ? ('AS' + cf.asn) : 'Unknown ASN'}, ${cf.asOrganization ?? 'Unknown Organization'})`);
+ console.log(
+ `πΆ ${cf.httpProtocol ?? 'Unknown HTTP Protocol'} π ${cf.clientTcpRtt ?? 'N/A'} ms RTT π ${
+ cf.tlsVersion ?? 'Unencrypted Connection'
+ } (${cf.tlsCipher ?? ''})`
+ );
+ console.log(
+ `πΊοΈ ${cf.city ?? 'Unknown City'}, ${cf.regionCode ? cf.regionCode + ', ' : ''}${
+ cf.country ?? 'Unknown Country'
+ } ${cf.isEUCountry ? '(EU)' : ''}`
+ );
+ console.log(
+ `π ${c.req.header('x-real-ip') ?? ''} (${cf.asn ? 'AS' + cf.asn : 'Unknown ASN'}, ${
+ cf.asOrganization ?? 'Unknown Organization'
+ })`
+ );
} else {
console.log(`π ${c.req.header('x-real-ip') ?? ''}`);
}
console.log('π΅οΈββοΈ', c.req.header('user-agent'));
- console.log('------------------')
+ console.log('------------------');
await next();
});