Support Forgejo servers

This commit is contained in:
Georg Bauer
2026-08-03 18:14:21 +02:00
parent 46cca8fdd2
commit d47b21d6a6
15 changed files with 405 additions and 78 deletions

View File

@@ -1,8 +1,8 @@
# Gotcha
Gotcha is a lightweight Gitea client with a reusable Rust core, a CLI, and a
native iOS application. The iOS interface is UIKit/Swift; UniFFI exposes the
Rust application logic to Swift.
Gotcha is a lightweight Gitea and Forgejo client with a reusable Rust core, a
CLI, and a native iOS application. The iOS interface is UIKit/Swift; UniFFI
exposes the Rust application logic to Swift.
On the icon: git in a tea cup. it is obvious, isn't it?
@@ -17,8 +17,8 @@ not necessarily the app to use when you manage or frequent a large instance.
## Workspace
- `gotcha_gitea`: reusable asynchronous Gitea API client with the complete
typed Gitea 1.25 API and model surface
- `gotcha_gitea`: reusable asynchronous Gitea/Forgejo API client with the
complete typed Gitea 1.25-compatible API and model surface
- `gotcha`: CLI for typed common operations and arbitrary API requests
- `gotcha-app`: Rust application core and UniFFI API used by iOS
- `ios`: native UIKit application for activity, repositories, favorites,
@@ -41,6 +41,7 @@ Store each server profile in `~/.config/gotcha/config`:
```sh
cargo run -p gotcha-cli -- auth login gitea.example.com
cargo run -p gotcha-cli -- auth login forgejo.example.com --provider forgejo
cargo run -p gotcha-cli -- server version
cargo run -p gotcha-cli -- user show
@@ -56,15 +57,18 @@ cargo run -p gotcha-cli -- api request GET repos/owner/project/issues
cargo run -p gotcha-cli -- api request POST user/repos '{"name":"demo"}'
```
`auth login` derives `https://gitea.example.com` from the server name and reads
the token from standard input with echo disabled. The resulting plain YAML file
at `~/.config/gotcha/config` has mode `0600` and one entry per server:
`auth login` derives `https://gitea.example.com` from the server name, discovers
Gitea or Forgejo, and reads the token from standard input with echo disabled.
The optional provider requires the selected API when automatic discovery is
not sufficient. The resulting plain YAML file at `~/.config/gotcha/config` has
mode `0600` and one entry per server:
```yaml
servers:
gitea.example.com:
url: https://gitea.example.com
token: your-token
provider: gitea
```
Inside a Git repository, Gotcha matches its remotes to these server URLs and
@@ -74,14 +78,14 @@ accepted as command-line arguments or environment variables.
## Architecture
`gotcha_gitea` owns Gitea access, authentication, validation, mutations, and
relationships between Gitea objects. The CLI is a terminal presentation layer:
`gotcha_gitea` owns Gitea/Forgejo access, authentication, validation,
mutations, and relationships between server objects. The CLI is a terminal presentation layer:
it parses arguments and YAML, invokes shared client operations, and formats the
results. `gotcha-app` owns application state, preferences, favorites,
Keychain-backed credentials, and view-ready UniFFI records. UIKit owns native
navigation, controls, layout, and other platform presentation behavior.
New Gitea workflows belong in `gotcha_gitea::Client` first, then receive CLI or
New server workflows belong in `gotcha_gitea::Client` first, then receive CLI or
app presentation as needed. Future work includes iOS integrations such as
sharing, notifications, and background refresh.