Skip to content

Commit

Permalink
Merge branch 'main' into api2
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeredwolf committed Nov 15, 2024
2 parents 63bd598 + 0b75206 commit 59ee980
Show file tree
Hide file tree
Showing 85 changed files with 4,458 additions and 3,524 deletions.
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
BRANDING_NAME = "FxTwitter / FixupX"
BRANDING_NAME_BSKY = "FxBluesky"
STANDARD_DOMAIN_LIST = "fxtwitter.com,fixupx.com,twittpr.com"
STANDARD_BSKY_DOMAIN_LIST = "fxbsky.app,canary.fxbsky.app"
DIRECT_MEDIA_DOMAINS = "d.fxtwitter.com,dl.fxtwitter.com,d.twittpr.com,dl.twittpr.com,d.fixupx.com,d.xfixup.com,dl.fixupx.com,dl.xfixup.com"
TEXT_ONLY_DOMAINS = "t.fxtwitter.com,t.twittpr.com,t.fixupx.com"
INSTANT_VIEW_DOMAINS = "i.fxtwitter.com,i.twittpr.com,i.fixupx.com"
INSTANT_VIEW_THREADS_DOMAINS = "u.fxtwitter.com,u.twittpr.com,u.fixupx.com"
GALLERY_DOMAINS = "g.fxtwitter.com,g.twittpr.com,g.fixupx.com"
FORCE_MOSAIC_DOMAINS = "m.fxtwitter.com,m.twittpr.com,m.fixupx.com"
NATIVE_MULTI_IMAGE_DOMAINS = "m.fxtwitter.com,m.twittpr.com,m.fixupx.com"
MOSAIC_DOMAIN_LIST = "mosaic.fxtwitter.com"
MOSAIC_BSKY_DOMAIN_LIST = "mosaic.fxbsky.app"
GIF_TRANSCODE_DOMAIN_LIST = "gif.fxtwitter.com"
API_HOST_LIST = "api.fxtwitter.com,api-canary.fxtwitter.com"
HOST_URL = "https://fxtwitter.com"
REDIRECT_URL = "https://github.com/FixTweet/FxTwitter"
REDIRECT_URL_BSKY = "https://bsky.app/profile/fxbsky.app"
EMBED_URL = "https://github.com/FixTweet/FxTwitter"
SENTRY_DSN = ""
SENTRY_AUTH_TOKEN = ""
Expand Down
Binary file added .github/readme/directmedia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/fixtweet.webp
Binary file not shown.
Binary file added .github/readme/gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/poll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/quote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/tco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/textonly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/translate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/readme/videos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 41 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

![][icons]

[![Crowdin][crowdinbadge]][crowdin]
[![esbuild][buildbadge]][build]
[![Tests][testsbadge]][tests]
[![Status][statusbadge]][status]
Expand All @@ -20,6 +21,8 @@
[licensebadge]: https://img.shields.io/github/license/FixTweet/FxTwitter
[status]: https://status.fxtwitter.com
[statusbadge]: https://status.fxtwitter.com/api/badge/8/uptime/720?label=Uptime%2030d
[crowdinbadge]: https://badges.crowdin.net/fxtwitter/localized.svg
[crowdin]: https://crowdin.com/project/fxtwitter

## Written in TypeScript as a Cloudflare Worker to scale, packed with more features and [best-in-class user privacy 🔒](#built-with-privacy-in-mind).

Expand All @@ -29,47 +32,53 @@

### For `twitter.com` links on Discord, send a link and type `s/e/p` to make `twittpr.com`.

<img src="https://cdn.discordapp.com/attachments/165560751363325952/1006346785985417307/fixtweet.webp">
<img src="https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/fixtweet.webp">

## Embed Videos

We all have videos of memes and other things from Twitter we want to quickly share with friends. With normal Twitter links, embedding videos is often broken on Discord and impossible on Telegram. But using FxTwitter, we embed the raw mp4 file so it's compatible with just about anything supporting video embeds.

![](https://cdn.discordapp.com/attachments/165560751363325952/1184627562811494461/video.png)
![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/videos.png)

On Discord, we'll also automatically embed videos linked from other platforms, such as YouTube, so they can play without having to open a browser.

## Embed Polls

If you want to share the results of a Twitter poll, you can do so by just linking the post using FxTwitter.

![](https://cdn.discordapp.com/attachments/165560751363325952/1006331192372629544/FixTweet.png)
![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/poll.png)

## Embed Quotes & Media

Quotes and their media can provide important context to a post. So we'll automatically add said context, and even media if there isn't already media embedded in the quote.

![](https://cdn.discordapp.com/attachments/165560751363325952/1184630052797816863/quote.png)
![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/quote.png)

## Translate Posts

You can translate a post into any other supported language, with the original and translated text displayed as space allows.

Just append a post with its 2-letter ISO language code. So for English, add `/en` at the end.

![](https://cdn.discordapp.com/attachments/165560751363325952/1184625715522572298/translation.png)
![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/translate.png)

## Gallery view

Use `g.fxtwitter.com` or `g.fixupx.com` to generate minimal embeds with just the post's media and author information without other distractions. This can be particularly useful for read-only channels dedicated to sharing media.

![](https://cdn.discordapp.com/attachments/165560751363325952/1182788212482117662/gallery.png)
![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/gallery.png?a)

## Text-only view

Basically the opposite of gallery view, use `t.fxtwitter.com` / `t.fixupx.com` to exclude photos/videos and only display text.

![](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/textonly.png)

## Direct media links

Want to link directly to a post's media without the embed? You can easily do that using FxTwitter.

![Image demonstrating the feature](https://cdn.discordapp.com/attachments/165560751363325952/1006338772192989194/FixTweet.png)
![Image demonstrating the feature](https://raw.githubusercontent.com/FixTweet/FxTwitter/main/.github/readme/directmedia.png)

There are a few supported ways to do this:

Expand All @@ -87,20 +96,20 @@ In the future we plan to do even more with Instant View such as embedding entire

Examples from above:

- `https://d.fxtwitter.com/dangeredwolf/status/1548119328498728960`
- `https://fxtwitter.com/dangeredwolf/status/1548117889437208581.jpg`
- `https://d.fxtwitter.com/example/status/1548119328498728960`
- `https://fxtwitter.com/example/status/1548117889437208581.jpg`

Posts with multiple images are supported, so you can do something like this and it will pick the correct one:

`https://d.fxtwitter.com/dangeredwolf/status/1547514042146865153/photo/3`
`https://d.fxtwitter.com/example/status/1547514042146865153/photo/3`

Otherwise, it will default to the first image.

## Replace t.co shorteners with original link

The default Twitter embeds include t.co link shorteners, which make it difficult to know where the link is heading. We automatically replace t.co links with their original links to make things clearer.

![](https://cdn.discordapp.com/attachments/165560751363325952/1006348698659344464/FixTweet.png)
![](https://github.com/FixTweet/FxTwitter/blob/main/.github/readme/tco.png)

## Redirect to Nitter or other custom instances

Expand All @@ -124,26 +133,26 @@ On a different note, if the person who posted a FxTwitter link forgot to strip t

In many ways, FxTwitter has richer embeds and does more. Here's a table comparing some of FxTwitter's features compared to Twitter default embeds as well as other embedding services

| | FxTwitter | Twitter default | vxTwitter (BetterTwitFix) |
| -------------------------------------- | :------------------------------------------------: | :------------------------------: | :-------------------------------------------------: |
| Embed Posts / Images | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Embed profile pictures on text posts | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Embed Twitter Videos | :heavy_check_mark: | :heavy_minus_sign: Discord Only¹ | :heavy_check_mark: |
| Embed External Videos (YouTube, etc.) | :heavy_check_mark:| :x: | :x:³ |
| Embed Poll results | :heavy_check_mark: | :x: | [:heavy_check_mark:][polladd] |
| Embed Quotes | :heavy_check_mark: | :x: | :ballot_box_with_check: Without Media |
| Embed Multiple Images | :heavy_check_mark: | :heavy_minus_sign: Discord Only² | :heavy_check_mark: |
| Translate Posts | :heavy_check_mark: | :x: | :x: |
| Replace t.co with original links | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Redirect to media file (without embed) | :heavy_check_mark: | :x: | :ballot_box_with_check: Subdomain broken, no images |
| Gallery view | :heavy_check_mark: | :x: | :x: |
| Strip tracking info on redirect | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Show retweet, like, reply, view counts | :heavy_minus_sign: Discord / Telegram Instant View | :heavy_minus_sign: Discord Only² | :ballot_box_with_check: No replies / views |
| Discord sed replace (`s/`) friendly | :ballot_box_with_check: twittpr.com | N/A | :x: |
| Domain for X.com links | :ballot_box_with_check: fixupx.com | N/A | :ballot_box_with_check: fixvx.com |
| Telegram Instant View | :heavy_check_mark: | :x: | :x: |
| Status fetch API for Developers | :heavy_check_mark: | N/A | :heavy_check_mark: |
| Last commit | [![][flc]][fc] | N/A | [![][vlc]][vc] |
| | FxTwitter | Twitter default | vxTwitter (BetterTwitFix) |
| -------------------------------------- | :------------------------------------------------: | :----------------: | :-------------------------------------------------: |
| Embed Posts / Images | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Embed profile pictures on text posts | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Embed Twitter Videos | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Embed External Videos (YouTube, etc.) | :heavy_check_mark:| :x: | :x:³ |
| Embed Poll results | :heavy_check_mark: | :x: | [:heavy_check_mark:][polladd] |
| Embed Quotes | :heavy_check_mark: | :x: | :ballot_box_with_check: Without Media |
| Embed Multiple Images | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Translate Posts | :heavy_check_mark: | :x: | :x: |
| Replace t.co with original links | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Redirect to media file (without embed) | :heavy_check_mark: | :x: | :ballot_box_with_check: Subdomain broken, no images |
| Gallery view | :heavy_check_mark: | :x: | :x: |
| Strip tracking info on redirect | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Show retweet, like, reply, view counts | :heavy_minus_sign: Discord / Telegram Instant View | :x: | :ballot_box_with_check: No replies / views |
| Discord sed replace (`s/`) friendly | :ballot_box_with_check: twittpr.com | N/A | :x: |
| Domain for X.com links | :ballot_box_with_check: fixupx.com | N/A | :ballot_box_with_check: fixvx.com |
| Telegram Instant View | :heavy_check_mark: | :x: | :x: |
| Status fetch API for Developers | :heavy_check_mark: | N/A | :heavy_check_mark: |
| Last commit | [![][flc]][fc] | N/A | [![][vlc]][vc] |

[flc]: https://img.shields.io/github/last-commit/FixTweet/FxTwitter?label
[vlc]: https://img.shields.io/github/last-commit/dylanpdx/BetterTwitFix?label
Expand Down Expand Up @@ -231,4 +240,4 @@ Feel free to [open an issue](https://github.com/FixTweet/FxTwitter/issues)

## Disclaimer

Twitter, Tweet, and X are trademarks of X Corp. This project is not affiliated in any way with X Corp or Twitter.
Twitter, Tweet, and X are trademarks of X Corp. This project is not affiliated in any way with X Corp or Twitter.
33 changes: 22 additions & 11 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ const releaseName = `${workerName}-${gitBranch}-${gitCommit}-${new Date()

let envVariables = [
'BRANDING_NAME',
'BRANDING_NAME_BSKY',
'STANDARD_DOMAIN_LIST',
'STANDARD_BSKY_DOMAIN_LIST',
'DIRECT_MEDIA_DOMAINS',
'TEXT_ONLY_DOMAINS',
'INSTANT_VIEW_DOMAINS',
'INSTANT_VIEW_THREADS_DOMAINS',
'GALLERY_DOMAINS',
'FORCE_MOSAIC_DOMAINS',
'NATIVE_MULTI_IMAGE_DOMAINS',
'HOST_URL',
'REDIRECT_URL',
'REDIRECT_URL_BSKY',
'EMBED_URL',
'MOSAIC_DOMAIN_LIST',
'MOSAIC_BSKY_DOMAIN_LIST',
'API_HOST_LIST',
'SENTRY_DSN'
'SENTRY_DSN',
'GIF_TRANSCODE_DOMAIN_LIST'
];

// Create defines for all environment variables
Expand All @@ -55,14 +61,10 @@ for (let envVar of envVariables) {

defines['RELEASE_NAME'] = `"${releaseName}"`;

await esbuild.build({
entryPoints: ['src/worker.ts'],
sourcemap: 'external',
outdir: 'dist',
minify: true,
bundle: true,
format: 'esm',
plugins: [
const plugins = [];

if (process.env.SENTRY_DSN) {
plugins.push(
sentryEsbuildPlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
Expand All @@ -83,7 +85,16 @@ await esbuild.build({
// https://sentry.io/orgredirect/organizations/:orgslug/settings/auth-tokens/
authToken: process.env.SENTRY_AUTH_TOKEN
})
],
);
}

await esbuild.build({
entryPoints: ['src/worker.ts'],
sourcemap: 'external',
outdir: 'dist',
minify: true,
bundle: true,
format: 'esm',
plugins: plugins,
define: defines
});
1 change: 1 addition & 0 deletions i18n/af/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/ar/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/ca/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/cs/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions i18n/da/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
52 changes: 52 additions & 0 deletions i18n/de/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"translatedFrom": "Übersetzt aus {language}",
"quotedFrom": "Zitiert {name} (@{screen_name})",
"replyingTo": "Antwort auf @{screen_name}",
"threadPartHeader": "Teil von @{screen_name}'s Thread",
"ivAuthorActionReply": "<a href=\"{statusUrl}\">Antwort</a> von <b>{authorName}</b> (<a href=\"{authorUrl}\">@{authorScreenName}</a>):",
"ivAuthorActionOriginal": "<a href=\"{statusUrl}\">Original</a> von <b>{authorName}</b> (<a href=\"{authorUrl}\">@{authorScreenName}</a>):",
"ivAuthorActionFollowUp": "<a href=\"{statusUrl}\">Follow-up</a> von <b>{authorName}</b> (<a href=\"{authorUrl}\">@{authorScreenName}</a>):",
"ivQuoteHeader": "<a href=\"{url}\">Zitiert</a> {authorName} (<a href=\"{authorURL}\">@{authorHandle}</a>)",
"videoAltTextUnavailable": "{author}'s Video. Kein Alt Text verfügbar.",
"gifAltTextUnavailable": "{author}'s GIF. Kein Alt Text verfügbar.",
"ivOriginalText": "Ursprünglicher Text",
"ivViewOriginal": "Vollständiger Thread anzeigen",
"ivAboutAuthor": "Über den Autor",
"ivProfilePictureAlt": "{author}\"s Profilbild",
"ivFallbackText": "Wenn Sie dies sehen können, macht Ihr Browser etwas Seltsames mit Ihrem User-Agent.",
"ivInternetArchiveText": "{brandingName} Archiv",
"pollFinalResults": "Endergebnisse",
"ivCommunityNoteHeader": "Leser haben einen Kontext hinzugefügt, den Sie vielleicht wissen möchten",
"surveyHeader": "War dies hilfreich?",
"surveyYes": "Ja 😁",
"surveyNo": "Nein 💀",
"language_af": "Afrikaans",
"language_ar": "Arabisch",
"language_ca": "Katalanisch",
"language_cs": "Tschechisch",
"language_da": "Dänisch",
"language_de": "Deutsch",
"language_en": "Englisch",
"language_el": "Griechisch",
"language_es": "Spanisch",
"language_fi": "Finnisch",
"language_fr": "Französisch",
"language_he": "Hebräisch",
"language_hu": "Ungarisch",
"language_it": "Italienisch",
"language_ja": "Japanisch",
"language_ko": "Koreanisch",
"language_nl": "Niederländisch",
"language_no": "Norwegisch",
"language_pl": "Polnisch",
"language_pt": "Portugiesisch",
"language_ro": "Rumänisch",
"language_ru": "Russisch",
"language_sr": "Serbisch",
"language_sv": "Schwedisch",
"language_tr": "Türkisch",
"language_uk": "Ukrainisch",
"language_vi": "Vietnamesisch",
"language_zh-CN": "Chinesisch",
"language_zh-TW": "Chinesisch"
}
1 change: 1 addition & 0 deletions i18n/el/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit 59ee980

Please sign in to comment.