# wchill/patcheddit architecture

> Architecture diagram of the GitHub repository wchill/patcheddit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wchill/patcheddit
- Repository: https://github.com/wchill/patcheddit

## Overview

Patcheddit is a Morphe-compatible patch bundle that modifies third-party Reddit clients, chiefly to restore OAuth/API behavior and add client-specific features. The main workflow is selecting a supported app and patches in Morphe Manager, applying bytecode/resource changes, then using the resulting app and its Morphe settings. The README documents capabilities beyond the sampled code; edges for those features cite the README, while source-level edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt`](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt) (Boost extension), [`patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt) (Extension registry), [`extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java`](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java) (Token editor), [`patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt`](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt) (OAuth spoof patches)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patching["Patch selection and application"]
  node_compat["App compatibility"]
  node_registry["Extension registry"]
  node_spoof["OAuth spoof patches"]
  node_httpinject["HTTP hook injection"]
end

subgraph group_shared["Shared runtime support"]
  node_settings["Morphe settings"]
  node_crashlogs[("Crash diagnostics")]
  node_requestshim["Reddit response shims"]
  node_redgifs["Redgifs token support"]
end

subgraph group_boost["Boost features"]
  node_boosthttp["Boost HTTP utilities<br/>[HttpUtils.java]"]
  node_oauthui["Token editor"]
  node_oauthaccounts["OAuth account handling"]
  node_oauthpayload["Token payload validation"]
  node_boostmedia["Media playback bindings"]
  node_boostgallery["Gallery preview"]
  node_boostupload["Image upload features"]
  node_boostarchive["Deleted content recovery<br/>[ArcticShift.java]"]
  node_boostwayback["Wayback recovery"]
end

subgraph group_clients["Client-specific adapters"]
  node_boostextension["Boost extension"]
  node_otherclients["Other supported clients"]
end

node_user(("App patcher"))
node_manager["Morphe Manager"]
node_patchedapps["Patched Reddit apps"]
node_reddit["Reddit services"]
node_archive["Archive services"]

node_user -->|"selects app"| node_manager
node_manager -->|"checks compatibility"| node_compat
node_manager -->|"selects extensions"| node_registry
node_registry -->|"registers client patches"| node_spoof
node_registry -->|"uses HTTP hooks"| node_httpinject
node_spoof -->|"patches OAuth values"| node_patchedapps
node_httpinject -->|"injects hooks"| node_patchedapps
node_patchedapps -->|"exposes settings"| node_settings
node_patchedapps -->|"records crashes"| node_crashlogs
node_patchedapps -.->|"shims API responses"| node_requestshim
node_patchedapps -.->|"refreshes tokens"| node_redgifs
node_registry -->|"registers Boost"| node_boostextension
node_boostextension -->|"configures HTTP"| node_boosthttp
node_boosthttp -->|"requests Reddit"| node_reddit
node_settings -->|"opens token settings"| node_oauthui
node_oauthui -->|"loads and saves"| node_oauthaccounts
node_oauthui -->|"parses tokens"| node_oauthpayload
node_oauthaccounts -->|"verifies credentials"| node_reddit
node_boostextension -.->|"installs media support"| node_boostmedia
node_boostmedia -->|"supports playback"| node_boostgallery
node_boostextension -->|"adds upload options"| node_boostupload
node_boostextension -->|"restores deleted content"| node_boostarchive
node_boostextension -->|"loads archived media"| node_boostwayback
node_boostarchive -->|"queries Arctic Shift"| node_archive
node_boostwayback -->|"queries Wayback"| node_archive
node_registry -->|"registers client adapters"| node_otherclients
node_otherclients -->|"patches supported apps"| node_patchedapps

click node_compat "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/AppCompatibility.kt"
click node_registry "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt"
click node_spoof "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt"
click node_httpinject "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/http/HttpClientExtensionPatch.kt"
click node_settings "https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/settings/MorpheSettingsActivity.java"
click node_crashlogs "https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/debug/FatalCrashLogs.java"
click node_requestshim "https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/requests/RedditRouteResponseShim.java"
click node_redgifs "https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/fixes/redgifs/RedgifsTokenManager.java"
click node_boostextension "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt"
click node_boosthttp "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/HttpUtils.java"
click node_oauthui "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java"
click node_oauthaccounts "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenAccounts.java"
click node_oauthpayload "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenPayload.java"
click node_boostmedia "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/kotlin/app/morphe/extension/boost/media/MediaNativeBindings.kt"
click node_boostgallery "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/gallery/GalleryAnimatedPreview.java"
click node_boostupload "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/kotlin/app/morphe/extension/boost/upload/ExternalImageUploadFactory.kt"
click node_boostarchive "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/arcticshift/ArcticShift.java"
click node_boostwayback "https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/wayback/WaybackMachine.java"
click node_otherclients "https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_compat,node_registry,node_spoof,node_httpinject toneBlue
class node_settings,node_crashlogs,node_requestshim,node_redgifs toneAmber
class node_boosthttp,node_oauthui,node_oauthaccounts,node_oauthpayload,node_boostmedia,node_boostgallery,node_boostupload,node_boostarchive,node_boostwayback toneMint
class node_boostextension,node_otherclients toneRose
class node_user,node_manager,node_patchedapps,node_reddit,node_archive toneIndigo
```

## Components

### Patch selection and application

- [App compatibility](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/AppCompatibility.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/AppCompatibility.kt`
- [Extension registry](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`
- [OAuth spoof patches](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt`
- [HTTP hook injection](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/http/HttpClientExtensionPatch.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/http/HttpClientExtensionPatch.kt`

### Shared runtime support

- [Morphe settings](https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/settings/MorpheSettingsActivity.java): `extensions/shared/library/src/main/java/app/morphe/extension/shared/settings/MorpheSettingsActivity.java`
- [Crash diagnostics](https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/debug/FatalCrashLogs.java): `extensions/shared/library/src/main/java/app/morphe/extension/shared/debug/FatalCrashLogs.java`
- [Reddit response shims](https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/requests/RedditRouteResponseShim.java): `extensions/shared/library/src/main/java/app/morphe/extension/shared/requests/RedditRouteResponseShim.java`
- [Redgifs token support](https://github.com/wchill/patcheddit/blob/main/extensions/shared/library/src/main/java/app/morphe/extension/shared/fixes/redgifs/RedgifsTokenManager.java): `extensions/shared/library/src/main/java/app/morphe/extension/shared/fixes/redgifs/RedgifsTokenManager.java`

### Boost features

- [Boost HTTP utilities](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/HttpUtils.java): `extensions/boost/src/main/java/app/morphe/extension/boost/http/HttpUtils.java`
- [Token editor](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java): `extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java`
- [OAuth account handling](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenAccounts.java): `extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenAccounts.java`
- [Token payload validation](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenPayload.java): `extensions/boost/src/main/java/app/morphe/extension/boost/oauth/OAuthTokenPayload.java`
- [Media playback bindings](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/kotlin/app/morphe/extension/boost/media/MediaNativeBindings.kt): `extensions/boost/src/main/kotlin/app/morphe/extension/boost/media/MediaNativeBindings.kt`
- [Gallery preview](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/gallery/GalleryAnimatedPreview.java): `extensions/boost/src/main/java/app/morphe/extension/boost/gallery/GalleryAnimatedPreview.java`
- [Image upload features](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/kotlin/app/morphe/extension/boost/upload/ExternalImageUploadFactory.kt): `extensions/boost/src/main/kotlin/app/morphe/extension/boost/upload/ExternalImageUploadFactory.kt`
- [Deleted content recovery](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/arcticshift/ArcticShift.java): `extensions/boost/src/main/java/app/morphe/extension/boost/http/arcticshift/ArcticShift.java`
- [Wayback recovery](https://github.com/wchill/patcheddit/blob/main/extensions/boost/src/main/java/app/morphe/extension/boost/http/wayback/WaybackMachine.java): `extensions/boost/src/main/java/app/morphe/extension/boost/http/wayback/WaybackMachine.java`

### Client-specific adapters

- [Boost extension](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt`
- [Other supported clients](https://github.com/wchill/patcheddit/blob/main/patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt): `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`

### Other components

- **App patcher**
- **Morphe Manager**
- **Patched Reddit apps**
- **Reddit services**
- **Archive services**

## Connections

- App patcher → Morphe Manager: selects app
- Morphe Manager → App compatibility: checks compatibility (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/AppCompatibility.kt`)
- Morphe Manager → Extension registry: selects extensions (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`)
- Extension registry → OAuth spoof patches: registers client patches (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`)
- Extension registry → HTTP hook injection: uses HTTP hooks (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`)
- OAuth spoof patches → Patched Reddit apps: patches OAuth values (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/SpoofClientPatch.kt`)
- HTTP hook injection → Patched Reddit apps: injects hooks (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/http/HttpClientExtensionPatch.kt`)
- Patched Reddit apps → Morphe settings: exposes settings
- Patched Reddit apps → Crash diagnostics: records crashes
- Patched Reddit apps → Reddit response shims: shims API responses
- Patched Reddit apps → Redgifs token support: refreshes tokens
- Extension registry → Boost extension: registers Boost (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`)
- Boost extension → Boost HTTP utilities: configures HTTP (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt`)
- Boost HTTP utilities → Reddit services: requests Reddit
- Morphe settings → Token editor: opens token settings
- Token editor → OAuth account handling: loads and saves (evidence: `extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java`)
- Token editor → Token payload validation: parses tokens (evidence: `extensions/boost/src/main/java/app/morphe/extension/boost/settings/OAuthTokensFragment.java`)
- OAuth account handling → Reddit services: verifies credentials
- Boost extension → Media playback bindings: installs media support
- Media playback bindings → Gallery preview: supports playback (evidence: `extensions/boost/src/main/java/app/morphe/extension/boost/gallery/GalleryAnimatedPreview.java`)
- Boost extension → Image upload features: adds upload options
- Boost extension → Deleted content recovery: restores deleted content
- Boost extension → Wayback recovery: loads archived media
- Deleted content recovery → Archive services: queries Arctic Shift
- Wayback recovery → Archive services: queries Wayback
- Extension registry → Other supported clients: registers client adapters (evidence: `patches/src/main/kotlin/app/morphe/patches/reddit/customclients/ExtensionPatches.kt`)
- Other supported clients → Patched Reddit apps: patches supported apps
