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:
1 parent
91247d31e2
commit
d3f3fe926a
21 files changed
+548
-495
No files matched your search
+2
-7
@@ -18,13 +18,12 @@ export interface ThemeInformation {
|
||||
}
|
||||
|
||||
export interface PluginVersion {
|
||||
repo: string; // path to the GitHub repository
|
||||
repo: string; // `user/repo` (GitHub) or repository URL (Gitea)
|
||||
version: "latest" | string; // version of the plugin (semver or latest)
|
||||
/** @deprecated Tokens are now stored in SecretStorage (Obsidian 1.11.4+) */
|
||||
token?: string; // optional private API key
|
||||
tokenName?: string; // name of secret in SecretStorage for per-repo token
|
||||
isIncompatible?: boolean; // if the plugin is incompatible
|
||||
giteaUrl?: string; // Gitea instance base URL (only for non-GitHub repos)
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
@@ -68,11 +67,10 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
* Adds a plugin for beta testing to the data.json file of this plugin
|
||||
*
|
||||
* @param plugin - the plugin object
|
||||
* @param repositoryPath - path to the GitHub repository
|
||||
* @param repositoryPath - `user/repo` (GitHub) or repository URL (Gitea)
|
||||
* @param specifyVersion - if the plugin needs to stay at the frozen version, we need to also record the version
|
||||
* @param isIncompatible - if the plugin is incompatible
|
||||
* @param secretName - optional: name of secret in SecretStorage for this repo
|
||||
* @param giteaUrl - optional: Gitea instance URL for non-GitHub repos
|
||||
*/
|
||||
export function addBetaPluginToList(
|
||||
plugin: BratPlugin,
|
||||
@@ -80,7 +78,6 @@ export function addBetaPluginToList(
|
||||
specifyVersion = "latest",
|
||||
isIncompatible = false,
|
||||
secretName = "",
|
||||
giteaUrl = "",
|
||||
): void {
|
||||
let save = false;
|
||||
if (!plugin.settings.pluginList.contains(repositoryPath)) {
|
||||
@@ -99,7 +96,6 @@ export function addBetaPluginToList(
|
||||
token: undefined, // Don't store token in settings
|
||||
tokenName: secretName || existingFrozenPlugin.tokenName,
|
||||
isIncompatible: isIncompatible || undefined,
|
||||
giteaUrl: giteaUrl || existingFrozenPlugin.giteaUrl,
|
||||
});
|
||||
save = true;
|
||||
} else {
|
||||
@@ -109,7 +105,6 @@ export function addBetaPluginToList(
|
||||
token: undefined, // Don't store token in settings
|
||||
tokenName: secretName || undefined,
|
||||
isIncompatible: isIncompatible || undefined,
|
||||
giteaUrl: giteaUrl || undefined,
|
||||
});
|
||||
save = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user