fix: scope tokens per host, harden Gitea support, port upstream fixes

Fork fixes:
- Global token is GitHub-only; never sent to Gitea/Forgejo hosts
- Gitea: download assets via browser_download_url (+token) so private repos work
- Gitea URL parsing keeps port and sub-path installs, strips browser sub-pages
- GitHub detected by hostname, not substring
- Gitea releases: follow pagination (X-Total-Count), skip drafts
- Gitea token validation against the repo; 404 is no longer "valid"
- Settings tab and migration log use this plugin's own id/folder
- Check-only mode no longer reinstalls/enables a missing plugin folder
- reloadPlugin reports load failures (enablePlugin resolves false)
- Repository / release-notes links work for both providers

Ported from upstream BRAT 2.2.0:
- Release sort: semver tags first, date fallback
- Null-safe version comparison, JSON shape guards
- Drop obsidian-daily-notes-interface (read daily note format directly)
- Notice.messageEl, CSS without !important, console.debug/error
This commit is contained in:
olivier committed 2026-10-25 20:39:33 -04:00
1 parent 91247d31e2
commit d3f3fe926a
21 files changed
+548 -495

No files matched your search

+6 -1
View File
@@ -15,7 +15,12 @@ Open the BRAT command palette and choose **"Add a beta plugin for testing"**, th
| **GitHub** | `user/repo` or `https://github.com/user/repo` | `TfTHacker/obsidian42-brat` |
| **Gitea** | `https://git.your-instance.com/user/repo` | `https://gitea.mithrilforge.dev/olivier/BindThem` |
The plugin auto-detects the provider from the URL. Each plugin entry stores its own Gitea instance URL and optional access token.
The plugin auto-detects the provider from the URL host: `github.com` is GitHub, any other host is Gitea/Forgejo. Gitea addresses may include a port (`https://git.lan:3000/user/repo`) or a sub-path install (`https://example.com/gitea/user/repo`); a pasted browser URL such as `…/user/repo/releases/tag/v1.0` is reduced to the repository.
### Access tokens
- **Global token** (settings): GitHub only. It is never sent to a Gitea/Forgejo host.
- **Per-plugin token**: set in the add-plugin dialog; sent only to that plugin's host. Use it for private Gitea repos.
## Installation