mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-05 18:40:56 +01:00
Run prettier
This commit is contained in:
parent
f774b4793a
commit
2ce765c36f
4 changed files with 37 additions and 25 deletions
|
@ -100,7 +100,7 @@ We use Twitter's color data for either the first image/video of the tweet, or th
|
||||||
|
|
||||||
FixTweet doesn't save logs of what tweets you're sending, nor do we have a public record of what tweets are being embedded by FixTweet.
|
FixTweet doesn't save logs of what tweets you're sending, nor do we have a public record of what tweets are being embedded by FixTweet.
|
||||||
|
|
||||||
In fact, because our core embedding and API service uses Cloudflare Workers, FixTweet can only run when you send it a request. Its memory doesn't stick around, and it doesn't have a file system or database to access at all. That is how we keep our privacy promise by building it into the architecture. My goal is always to provide a good public service, and FixTweet doesn't have any ads or tracking to make money off of, nor do we sell data (or even have data *to* sell).
|
In fact, because our core embedding and API service uses Cloudflare Workers, FixTweet can only run when you send it a request. Its memory doesn't stick around, and it doesn't have a file system or database to access at all. That is how we keep our privacy promise by building it into the architecture. My goal is always to provide a good public service, and FixTweet doesn't have any ads or tracking to make money off of, nor do we sell data (or even have data _to_ sell).
|
||||||
|
|
||||||
Note: We use Cloudflare to cache FixTweet responses to make repeat access faster, which have a maximum TTL of 1 hour. Temporary real-time logging in the terminal (specifically `wrangler tail`) may be used only by the developer while the Worker is being serviced or debugged (to make sure things work as they should), however these logs are only shown in the terminal and are never saved or used for any other purpose. URLs that cause runtime errors in the script (aka Exceptions, usually exceedingly rare unless there was a faulty update pushed out or Twitter API is down) may be logged for a developer to diagnose the issue that is preventing your embed from working.
|
Note: We use Cloudflare to cache FixTweet responses to make repeat access faster, which have a maximum TTL of 1 hour. Temporary real-time logging in the terminal (specifically `wrangler tail`) may be used only by the developer while the Worker is being serviced or debugged (to make sure things work as they should), however these logs are only shown in the terminal and are never saved or used for any other purpose. URLs that cause runtime errors in the script (aka Exceptions, usually exceedingly rare unless there was a faulty update pushed out or Twitter API is down) may be logged for a developer to diagnose the issue that is preventing your embed from working.
|
||||||
|
|
||||||
|
|
|
@ -148,25 +148,33 @@ const profileRequest = async (request: Request) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const versionRequest = async (request: Request) => {
|
const versionRequest = async (request: Request) => {
|
||||||
return new Response(Strings.VERSION_HTML.format({
|
return new Response(
|
||||||
|
Strings.VERSION_HTML.format({
|
||||||
rtt: request.cf?.clientTcpRtt ? `🏓 ${request.cf.clientTcpRtt} ms RTT` : '',
|
rtt: request.cf?.clientTcpRtt ? `🏓 ${request.cf.clientTcpRtt} ms RTT` : '',
|
||||||
colo: request.cf?.colo || '??',
|
colo: request.cf?.colo || '??',
|
||||||
httpversion: request.cf?.httpProtocol || 'Unknown HTTP Version',
|
httpversion: request.cf?.httpProtocol || 'Unknown HTTP Version',
|
||||||
tlsversion: request.cf?.tlsVersion || 'Unknown TLS Version',
|
tlsversion: request.cf?.tlsVersion || 'Unknown TLS Version',
|
||||||
ip: request.headers.get('x-real-ip') || request.headers.get('cf-connecting-ip') || 'Unknown IP',
|
ip:
|
||||||
|
request.headers.get('x-real-ip') ||
|
||||||
|
request.headers.get('cf-connecting-ip') ||
|
||||||
|
'Unknown IP',
|
||||||
city: request.cf?.city || 'Unknown City',
|
city: request.cf?.city || 'Unknown City',
|
||||||
region: request.cf?.region || request.cf?.country || 'Unknown Region',
|
region: request.cf?.region || request.cf?.country || 'Unknown Region',
|
||||||
country: request.cf?.country || 'Unknown Country',
|
country: request.cf?.country || 'Unknown Country',
|
||||||
asn: `AS${request.cf?.asn || '??'} (${request.cf?.asOrganization || 'Unknown ASN'})`,
|
asn: `AS${request.cf?.asn || '??'} (${
|
||||||
ua: sanitizeText(request.headers.get('user-agent') || 'Unknown User Agent'),
|
request.cf?.asOrganization || 'Unknown ASN'
|
||||||
}), {
|
})`,
|
||||||
|
ua: sanitizeText(request.headers.get('user-agent') || 'Unknown User Agent')
|
||||||
|
}),
|
||||||
|
{
|
||||||
headers: {
|
headers: {
|
||||||
...Constants.RESPONSE_HEADERS,
|
...Constants.RESPONSE_HEADERS,
|
||||||
'cache-control': 'max-age=1'
|
'cache-control': 'max-age=1'
|
||||||
},
|
},
|
||||||
status: 200
|
status: 200
|
||||||
});
|
}
|
||||||
}
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/* TODO: is there any way to consolidate these stupid routes for itty-router?
|
/* TODO: is there any way to consolidate these stupid routes for itty-router?
|
||||||
I couldn't find documentation allowing for regex matching */
|
I couldn't find documentation allowing for regex matching */
|
||||||
|
@ -256,7 +264,7 @@ export const cacheWrapper = async (
|
||||||
: request.url
|
: request.url
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(`Hello from ⛅ ${request.cf?.colo || 'UNK'}`)
|
console.log(`Hello from ⛅ ${request.cf?.colo || 'UNK'}`);
|
||||||
console.log('userAgent', userAgent);
|
console.log('userAgent', userAgent);
|
||||||
console.log('cacheUrl', cacheUrl);
|
console.log('cacheUrl', cacheUrl);
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,9 @@ This is caused by Twitter API downtime or a new bug. Try again in a little while
|
||||||
<h2>You hit a snag that broke ${BRANDING_NAME}. It's not your fault though—This is usually caused by a Twitter outage or a new bug.</h2>
|
<h2>You hit a snag that broke ${BRANDING_NAME}. It's not your fault though—This is usually caused by a Twitter outage or a new bug.</h2>
|
||||||
<p>${RELEASE_NAME}</p>
|
<p>${RELEASE_NAME}</p>
|
||||||
</body>
|
</body>
|
||||||
</html>`.replace(/( {2})/g, '').replace(/>[\s|\n]+</g, '><'),
|
</html>`
|
||||||
|
.replace(/( {2})/g, '')
|
||||||
|
.replace(/>[\s|\n]+</g, '><'),
|
||||||
VERSION_HTML: `<!DOCTYPE html>
|
VERSION_HTML: `<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -122,7 +124,9 @@ This is caused by Twitter API downtime or a new bug. Try again in a little while
|
||||||
<h2>User Agent:
|
<h2>User Agent:
|
||||||
{ua}</h2>
|
{ua}</h2>
|
||||||
</body>
|
</body>
|
||||||
</html>`.replace(/( {2})/g, '').replace(/>[\s|\n]+</g, '><'),
|
</html>`
|
||||||
|
.replace(/( {2})/g, '')
|
||||||
|
.replace(/>[\s|\n]+</g, '><'),
|
||||||
DEFAULT_AUTHOR_TEXT: 'Twitter',
|
DEFAULT_AUTHOR_TEXT: 'Twitter',
|
||||||
|
|
||||||
QUOTE_TEXT: `═ ↘️ Quoting {name} (@{screen_name}) ═════`,
|
QUOTE_TEXT: `═ ↘️ Quoting {name} (@{screen_name}) ═════`,
|
||||||
|
|
Loading…
Add table
Reference in a new issue