Run prettier

This commit is contained in:
dangered wolf 2024-04-30 15:46:32 -04:00
parent beea81de75
commit 8ee96a93d3
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
3 changed files with 17 additions and 10 deletions

View file

@ -9,10 +9,13 @@ export const api = new Hono();
api.use('*', async (c, next) => { api.use('*', async (c, next) => {
if (!c.req.header('user-agent')) { if (!c.req.header('user-agent')) {
return c.json({ 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." error:
}, 401); "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."
},
401
);
} }
await next(); await next();
}); });

View file

@ -28,7 +28,8 @@ export const setRedirectRequest = async (c: Context) => {
return c.html( return c.html(
Strings.MESSAGE_HTML.format({ Strings.MESSAGE_HTML.format({
message: `Failed to set base redirect: Your request seems to be originating from another domain, please open this up in a new tab if you are trying to set your base redirect.` message: `Failed to set base redirect: Your request seems to be originating from another domain, please open this up in a new tab if you are trying to set your base redirect.`
}), 403 }),
403
); );
} }
@ -47,7 +48,8 @@ export const setRedirectRequest = async (c: Context) => {
return c.html( return c.html(
Strings.MESSAGE_HTML.format({ Strings.MESSAGE_HTML.format({
message: `Your base redirect has been cleared. To set one, please pass along the <code>url</code> parameter.` message: `Your base redirect has been cleared. To set one, please pass along the <code>url</code> parameter.`
}), 200 }),
200
); );
} }
@ -71,7 +73,8 @@ export const setRedirectRequest = async (c: Context) => {
return c.html( return c.html(
Strings.MESSAGE_HTML.format({ Strings.MESSAGE_HTML.format({
message: `Your URL does not appear to be well-formed. Example: ?url=https://nitter.net` message: `Your URL does not appear to be well-formed. Example: ?url=https://nitter.net`
}), 200 }),
200
); );
} }

View file

@ -302,8 +302,8 @@ export const renderInstantView = (properties: RenderProperties): ResponseInstruc
let previousThreadPieceAuthor: string | null = null; let previousThreadPieceAuthor: string | null = null;
let originalAuthor: string | null = null; let originalAuthor: string | null = null;
const useThread = thread?.thread ?? [ thread?.status ] const useThread = thread?.thread ?? [thread?.status];
if (!status) { if (!status) {
throw new Error('Status is undefined'); throw new Error('Status is undefined');
@ -339,7 +339,8 @@ export const renderInstantView = (properties: RenderProperties): ResponseInstruc
<sub><a href="${status.url}">View full thread</a></sub> <sub><a href="${status.url}">View full thread</a></sub>
<h1>${status.author.name} (@${status.author.screen_name})</h1> <h1>${status.author.name} (@${status.author.screen_name})</h1>
${useThread.map(status => { ${useThread
.map(status => {
console.log('previousThreadPieceAuthor', previousThreadPieceAuthor); console.log('previousThreadPieceAuthor', previousThreadPieceAuthor);
if (!status) { if (!status) {
return ''; return '';