Files
andrew f0358dbdfe Add read-only repository viewer (UI + backend)
Implements a read-only repository viewer for remote Gitea repos and local clones. Adds UI/CSS for viewer panels, breadcrumb/branch controls, file table, code/Markdown preview, and readme rendering (frontend/css/components.css, frontend/js/app.js). Extends app state and wiring (state.js, app.js) with viewer actions, branch/content loading, local/remote navigation, and preview helpers (base64 decoding, markdown rendering, syntax highlighting, 256 KB preview limit). Adds Gitea API helpers to fetch repo branches and contents (frontend/js/gitea-api.js) and Tauri JS bindings for local repo operations (tauri-api.js). Implements Rust backend commands to list branches, tree entries, and file contents (with size/binary checks and helper utilities) and wires them into the Tauri command registry (src-tauri/src/lib.rs). Also updates README to mention the new read-only viewer.
2026-05-09 18:45:51 +12:00

75 lines
2.7 KiB
Markdown

# Gitpub Desktop
Gitpub Desktop is a lightweight, cross-platform Git client built with Tauri, Rust, and plain HTML/CSS/JavaScript.
It connects to any compatible self-hosted Gitea instance (including Gitpub) without hardcoding a single backend.
## Stack
- Tauri + Rust backend commands
- Vanilla HTML/CSS/JS frontend (no framework)
- System-installed Git for repository operations
- Gitea REST API for server-side repository listing and account context
## Project Structure
- `src-tauri/` Rust backend and Tauri application setup
- `frontend/` vanilla frontend shell
- `frontend/assets/` static assets
- `frontend/css/` UI styles
- `frontend/js/` application modules
- `frontend/components/` shared component/template area
## MVP Included
- First-launch setup flow for adding first Gitea server
- Multi-server backend management (add/edit/remove/switch/default)
- Dynamic API base URL generation (`<server>/api/v1`)
- Connection testing against Gitea API
- Repository dashboard with search and mock cards fallback
- Read-only repository viewer for remote Gitea repos and local clones
- Local repository open + recent repositories
- Rust Git commands: clone, pull, push, status, branch
- Settings for git path, clone directory, and theme placeholder
## Development
### Prerequisites
- [Node.js](https://nodejs.org/) (npm comes with it)
- [Rust](https://www.rust-lang.org/tools/install) via `rustup` (required for the Tauri backend)
- Platform-specific Tauri dependencies (WebView2 on Windows, Xcode tools on macOS, etc.) — see the [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/) for your OS
- **Git** installed and available on your `PATH` (the app shells out to `git` for clone, pull, push, and related commands)
### Start the app in dev mode
From the repository root:
```bash
npm install
npm run dev
```
This runs the Tauri dev process, which loads the static frontend from `frontend/` and hot-reloads the Rust side when you change `src-tauri/`. Edit HTML/CSS/JS under `frontend/` and refresh the window (or rely on your usual workflow) as needed.
### Production build
```bash
npm install
npm run tauri:build
```
Installers and bundles are emitted under `src-tauri/target/release/bundle/` (exact paths depend on the target platform).
### Useful commands
| Command | Purpose |
| --- | --- |
| `npm run dev` | Desktop app in development mode |
| `npm run tauri:build` | Release build and platform bundles |
| `npm run tauri -- <args>` | Forward arguments to the Tauri CLI (e.g. `npm run tauri -- info`) |
### Notes
- There is no separate Vite/webpack dev server; the UI is plain static files under `frontend/`.
- Point the app at a running Gitea-compatible instance during setup; API calls use `<your-server>/api/v1`.