{"id":13644041,"url":"https://github.com/zacharee/MastodonRedirect","last_synced_at":"2025-04-21T06:32:49.631Z","repository":{"id":180196222,"uuid":"664480223","full_name":"zacharee/MastodonRedirect","owner":"zacharee","description":"Deep linking proxy for Mastodon and Lemmy on Android, allowing you to launch your selected client automatically.","archived":false,"fork":false,"pushed_at":"2024-12-22T04:40:24.000Z","size":2478,"stargazers_count":160,"open_issues_count":7,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-18T14:17:37.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zacharee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-10T04:33:23.000Z","updated_at":"2025-04-16T18:19:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"f13150d7-da17-4c68-8803-33b8b23cd301","html_url":"https://github.com/zacharee/MastodonRedirect","commit_stats":null,"previous_names":["zacharee/mastodonredirect"],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharee%2FMastodonRedirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharee%2FMastodonRedirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharee%2FMastodonRedirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacharee%2FMastodonRedirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacharee","download_url":"https://codeload.github.com/zacharee/MastodonRedirect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250008274,"owners_count":21359956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:01:56.776Z","updated_at":"2025-04-21T06:32:44.621Z","avatar_url":"https://github.com/zacharee.png","language":"Kotlin","funding_links":[],"categories":["🔐 Security \u0026 Privacy","Kotlin"],"sub_categories":["🔧 Uncategorized Tools"],"readme":"# Fediverse Redirect\nA simple suite of apps for automatically launching fediverse links in your preferred Mastodon or Lemmy client.\n\n## Use-Cases\nMastodon and Lemmy are both examples of federated social media. This is mostly a good thing, for a whole host of reasons, but it does have one notable disadvantage: deep linking support.\n\nWhen you tap a Twitter link in your browser and your phone opens the Twitter app instead of the Twitter website to view the post, that's an example of deep linking. The trouble with federated social media is three-fold:\n1. There are a lot of different instances at different addresses running the same or interoperable software.\n2. Android only lets app developers declare supported deep link domains at compile time: users can't add custom domains, and domains can only be added through app updates. Many developers understandably don't want to maintain a list of thousands of domains.\n3. Android really isn't set up for a single app to support more than a few different domains for deep links.\n\nFediverse Redirect aims to solve the first two issues and somewhat solve the third.\n\nBy using [Fediverse Observer](https://fediverse.observer) as a data source, Fediverse Redirect can maintain an up-to-date list of active domains.\n\nOnce you download the app, you can choose your client app and then enable all supported domains, so that when you tap a recognized link, it gets passed to the proper Fediverse Redirect variant.\n\nThe Fediverse Redirect variant then sends the link directly to the chosen client app for it to handle.\n\nSince the point of Fediverse Redirect is only to change where supported links open, the maintenance of supported domains isn't extra busywork that has to be done in addition to other features and fixes; it's literally all the app does.\n\nClient developers do need to do some work for Fediverse Redirect to support them, but it's a one-time thing, and instructions are available below.\n\n## Screenshots\n\n\u003cimg alt=\"Mastodon Redirect clients list\" src=\"https://github.com/zacharee/MastodonRedirect/assets/9020352/839496b6-827f-4b90-a322-f6c33772354e\" width=\"400\"\u003e \u003cimg alt=\"Lemmy Redirect clients list\" src=\"https://github.com/zacharee/MastodonRedirect/assets/9020352/353cc22a-0bfc-4497-bcb0-6214be7a63c4\" width=\"400\"\u003e \u003cimg alt=\"Mastodon Redirect options dialog\" src=\"https://github.com/zacharee/MastodonRedirect/assets/9020352/e3853f1c-082e-4e87-859b-7df95b5ebc8f\" width=\"400\"\u003e \u003cimg alt=\"Supported domains list with options to ignore specified domains\" src=\"https://github.com/zacharee/MastodonRedirect/assets/9020352/a5acb398-7f54-42e2-bb5a-561feed4ae08\" width=\"400\"\u003e\n\n## Downloads\nFediverse Redirect has different variants depending on which social media network you want to use. Download the appropriate APK for your desired social network below.\n\n### GitHub\n[![GitHub Release](https://img.shields.io/github/v/release/zacharee/MastodonRedirect?style=for-the-badge\u0026logo=github\u0026label=Mastodon%20%2B%20Lemmy%20Redirect\u0026color=orange)](https://github.com/zacharee/MastodonRedirect/releases)\n\n### IzzyOnDroid\n[![Mastodon Redirect](https://img.shields.io/endpoint?url=https%3A%2F%2Fapt.izzysoft.de%2Ffdroid%2Fapi%2Fv1%2Fshield%2Fdev.zwander.mastodonredirect\u0026style=for-the-badge\u0026logo=f-droid\u0026label=Mastodon%20Redirect)](https://apt.izzysoft.de/fdroid/index/apk/dev.zwander.mastodonredirect/)\n[![Lemmy Redirect](https://img.shields.io/endpoint?url=https%3A%2F%2Fapt.izzysoft.de%2Ffdroid%2Fapi%2Fv1%2Fshield%2Fdev.zwander.lemmyredirect\u0026style=for-the-badge\u0026logo=f-droid\u0026label=Lemmy%20Redirect)](https://apt.izzysoft.de/fdroid/index/apk/dev.zwander.lemmyredirect/)\n[![PeerTube Redirect](https://img.shields.io/endpoint?url=https%3A%2F%2Fapt.izzysoft.de%2Ffdroid%2Fapi%2Fv1%2Fshield%2Fdev.zwander.peertuberedirect\u0026style=for-the-badge\u0026logo=f-droid\u0026label=PeerTube%20Redirect)](https://apt.izzysoft.de/fdroid/index/apk/dev.zwander.peertuberedirect/)\n\n## Supported Domains\nCurrently, most domains on [Fediverse Observer](https://fediverse.observer) are supported.\n\nFediverse Redirect supports most active and alive instances, but excludes dead instances and instances that haven't had any activity recently. This is to keep the list as short as possible and avoid crashes.\n\nFediverse Redirect also supports the `web+activity+http`, `web+activity+https`, and `web+ap` URL schemes. The expectation is that the full post or profile URL will follow.\n\nExamples:\n```\n// Post\nweb+ap://androiddev.social/@wander1236/110699242324667418\n\n// Profile\nweb+ap://androiddev.social/@wander1236\n```\n\n[Fedi Links Project](https://fedilinks.org/).\n\n## Setup\nIf any domains aren't enabled for handling by the Fediverse Redirect variant, the app will let you know and provide you buttons for enabling them.\n\nEnabling each supported domain one at a time is possible, but tedious. Instead, Fediverse Redirect can use [Shizuku](https://shizuku.rikka.app) to automatically enable all links at once. The setup for Shizuku is a little complex, but can be done completely on-device on Android 11 and later. It is also only needed once for the initial setup or for enabling domains added in app updates.\n\nAlternatively, you can use [LinkSheet](https://github.com/1fexd/LinkSheet) to have supported domains open in Fediverse Redirect. LinkSheet needs to be set as your default browser and then acts as a much more comprehensive and usable version of Android's built-in link handling options.\n\n## Usage\nOpen the chosen Fediverse Redirect variant and select your preferred client.\n\n## Client Support\nUnfortunately, many Fediverse clients don't have a way for Fediverse Redirect to interface with them.\n\nFediverse Redirect relies on clients having a link sharing target that can parse and open fediverse links. \n\nClients such as Tusky do have share targets, but they can only be used to create new posts, with the shared link as the content. Other clients have no share targets at all.\n\nMastodon Redirect currently supports the following clients:\n- [Elk (PWA: Stable or Canary)](https://github.com/elk-zone/elk).\n- [Fedilab (F-Droid or Play Store)](https://github.com/stom79/Fedilab).\n- [Mastodon](https://github.com/mastodon/mastodon-android).\n- [Megalodon](https://github.com/sk22/megalodon).\n- [Moshidon (Stable or Nightly)](https://github.com/LucasGGamerM/moshidon).\n- [Phanpy (PWA: Stable or Dev)](https://hachyderm.io/@phanpy).\n- [Subway Tooter](https://github.com/tateisu/SubwayTooter).\n- [Tooot](https://github.com/tooot-app/app).\n- [Trunks (Native or Web)](https://mastodon.social/@trunksapp).\n\n---------------------------\n\nLemmy Redirect currently supports the following clients:\n- [Eternity](https://codeberg.org/Bazsalanszky/Eternity).\n- [Jerboa](https://github.com/dessalines/jerboa).\n- [Liftoff](https://github.com/liftoff-app/liftoff).\n- [Summit](https://lemmy.world/c/summit).\n- [Sync](https://github.com/laurencedawson/sync-for-lemmy).\n- [Thunder](https://github.com/thunder-app/thunder).\n- [Voyager (1.46.0 and later)](https://github.com/aeharding/voyager).\n\nAnd the following auto-discovery clients:\n- [Raccoon](https://github.com/diegoberaldin/RaccoonForLemmy).\n\n---------------------------\n\nPeerTube Redirect currently supports the following clients:\n- ~~[Fedilab (F-Droid or Play Store)](https://github.com/stom79/Fedilab)~~ (Currently disabled as link handling is broken).\n- ~~[Grayjay (Stable, Unstable, or Play Store)](https://grayjay.app)~~ (Currently disabled as the PeerTube plugin only respects Grayjay's instance domain and also uses the wrong URL format to check for compatibility).\n- [NewPipe (Release or Debug-Main)](https://github.com/TeamNewPipe/NewPipe).\n\nIf your favorite client isn't on the list, consider creating an issue on their code repository or issue tracker linking to the section below, ***but please search through the existing issues first, including ones that have been closed***. Pestering developers won't help anyone.\n\n## Adding Client Support\nIf you're the developer of a Fediverse client and want to add support for Fediverse Redirect into your app, here's how.\n\n### Automatic\nYou can let Fediverse Redirect automatically discover your app by filtering for a custom Intent and parsing the data as a URL.\n\n#### Create a discoverable target.\nIn your `AndroidManifest.xml`, add the following intent filter inside the relevant Activity tag:\n\nMastodon Redirect:\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"dev.zwander.mastodonredirect.intent.action.OPEN_FEDI_LINK\" /\u003e\n    \n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n\u003c/intent-filter\u003e\n```\n\nLemmy Redirect:\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"dev.zwander.lemmyredirect.intent.action.OPEN_FEDI_LINK\" /\u003e\n    \n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n\u003c/intent-filter\u003e\n```\n\nPeerTube Redirect:\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"dev.zwander.peertuberedirect.intent.action.OPEN_FEDI_LINK\" /\u003e\n    \n    \u003ccategory android:name=\"android.intent.category.DEFAULT\" /\u003e\n\u003c/intent-filter\u003e\n```\n\nInside the Activity itself:\n\n```kotlin\noverride fun onCreate(savedInstanceState: Bundle?) {\n    // ...\n\n    val url = intent?.data?.toString()\n\n    // Validate `url`.\n    // Pass it to your internal link parser to find the post ID and such.\n    // Open in your thread/profile viewer component.\n}\n```\n\n### Manual\nThe high level process is pretty simple: expose some way for your app to be launched that accepts a URL and tries to parse it as a fediverse link to open as a post or profile. There are a few ways you can do this.\n\nOnce you've implemented support, feel free to open an issue or PR to have it added to Fediverse Redirect.\n\n#### Create a share target.\nNote: this will cause your app to appear in the share menu when a user chooses to share any text, not just links. If your app already has a share target for pasting the shared text into a new post draft, it might make sense to reuse that target with an option to open the shared link instead of only creating a new post.\n\nCheck out [Moshidon](https://github.com/LucasGGamerM/moshidon/blob/master/mastodon/src/main/java/org/joinmastodon/android/ExternalShareActivity.java) for an example.\n\nIn your `AndroidManifest.xml`, add the following intent filter inside the relevant Activity tag:\n\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"android.intent.action.SEND\"/\u003e\n    \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n    \u003cdata android:mimeType=\"text/*\"/\u003e\n\u003c/intent-filter\u003e\n```\n\nInside the Activity itself:\n\n```kotlin\noverride fun onCreate(savedInstanceState: Bundle?) {\n    // ...\n   \n    if (intent?.action == Intent.ACTION_SHARE) {\n       val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)\n      \n       // Validate that `sharedText` is a URL.\n       // Pass it to your internal link parser to find the post ID and such.\n       // Open in your thread/profile viewer component.\n    }\n}\n```\n\n#### Create a view target.\nThis is similar to the share target, but won't show up to users directly in the share menu.\n\nIn your `AndroidManifest.xml`, add the following intent filter inside the relevant Activity tag:\n\n```xml\n\u003cintent-filter\u003e\n    \u003caction android:name=\"android.intent.action.VIEW\"/\u003e\n   \u003ccategory android:name=\"android.intent.category.BROWSABLE\"/\u003e\n    \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n    \n    \u003cdata android:scheme=\"https\" /\u003e\n    \u003cdata android:scheme=\"http\" /\u003e\n    \u003cdata android:host=\"*\" /\u003e\n\u003c/intent-filter\u003e\n```\n\nInside the Activity itself:\n\n```kotlin\noverride fun onCreate(savedInstanceState: Bundle?) {\n   // ...\n    \n    val url = intent?.data?.toString()\n\n    // Validate `url`.\n    // Pass it to your internal link parser to find the post ID and such.\n    // Open in your thread/profile viewer component.\n}\n```\n\n## Building\nIn order to build Fediverse Redirect, you'll need two things:\n1. The latest [Android Studio Canary](https://developer.android.com/studio/preview) build.  \n2. ~~A [modified Android SDK](https://github.com/Reginer/aosp-android-jar) with hidden APIs exposed.~~\n\n~~Download the modified SDK corresponding to Fediverse Redirect's current `compile.sdk` value (found in [gradle.properties](https://github.com/zacharee/MastodonRedirect/tree/main/gradle.properties)) and follow the instructions provided in the link above to install it.~~\n\n## Contributing\nIf you want to add support for another app:\n\n1. Find the `LaunchStrategy.kt` file for the relevant variant. For example, if you want to add support for an app to Lemmy Redirect, open `lemmyredirect/src/main/java/dev/zwander/lemmyredirect/util/LaunchStrategy.kt`.\n2. Go to the `strings.xml` file for the variant and add the name of the app there.\n3. Create a new data object extending the relevant `LaunchStrategyRootGroup` class (for Lemmy, it would be `LemmyLaunchStrategyRootGroup`). The argument the base class takes is a reference to the string resource you added.\n4. Nested in that object, create another object extending the relevant `LaunchStrategy` class. This takes a key (unique to the app) and a variant label reference.\n5. Override the `createIntents()` function and return a list of Intents to attempt to launch. Usually, only one Intent is needed.\n6. Make sure to annotate both objects with `@Keep`.\n\nFediverse Redirect will automatically pick up the new class and show it as an option.\n\nCheck out the other objects in the file for examples.\n\n## Error Reporting\nFediverse Redirect uses Bugsnag for error reporting.\n\n\u003ca href=\"https://www.bugsnag.com\"\u003e\u003cimg src=\"https://assets-global.website-files.com/607f4f6df411bd01527dc7d5/63bc40cd9d502eda8ea74ce7_Bugsnag%20Full%20Color.svg\" width=\"200\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacharee%2FMastodonRedirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacharee%2FMastodonRedirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacharee%2FMastodonRedirect/lists"}