diff --git a/Cargo.lock b/Cargo.lock index 4e2f1538958..251263a8b53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ "but-forge", "but-forge-storage", "but-gerrit", + "but-gitea", "but-github", "but-gitlab", "but-graph", @@ -1207,6 +1208,22 @@ dependencies = [ "snapbox", ] +[[package]] +name = "but-gitea" +version = "0.0.0" +dependencies = [ + "anyhow", + "but-error", + "but-forge-storage", + "but-schemars", + "but-secret", + "reqwest 0.12.28", + "schemars 1.2.1", + "serde", + "tempfile", + "ts-rs", +] + [[package]] name = "but-github" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index e263193e138..9dfc185f795 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,8 @@ members = [ "crates/but-github", # 📄A thin wrapper of the GitHub API, for authentication and resource access. # 👉lacks top-level docs and docs. "crates/but-gitlab", # 📄A thin wrapper of the GitLab API, for authentication and resource access. + # 👉Has basic tests and top-level docs; purpose is intentionally narrow. + "crates/but-gitea", # 📄A thin wrapper of the Gitea API, for authentication and resource access. # 👉No tests, lacks top-level docs, purpose somewhat unclear. "crates/but-cursor", # 📄Integration with Cursor # 👉Kind of no docs, no tests, and unclear purpose. @@ -174,6 +176,7 @@ but-cherry-apply = { path = "crates/but-cherry-apply" } but-irc = { path = "crates/but-irc" } but-github = { path = "crates/but-github" } but-gitlab = { path = "crates/but-gitlab" } +but-gitea = { path = "crates/but-gitea" } but-error = { path = "crates/but-error" } but-serde = { path = "crates/but-serde" } but-schemars = { path = "crates/but-schemars" } diff --git a/apps/desktop/src/components/GiteaAccountBadge.svelte b/apps/desktop/src/components/GiteaAccountBadge.svelte new file mode 100644 index 00000000000..0585dce477c --- /dev/null +++ b/apps/desktop/src/components/GiteaAccountBadge.svelte @@ -0,0 +1,30 @@ + + + + {badgeText(account)} + diff --git a/apps/desktop/src/components/GiteaIntegration.svelte b/apps/desktop/src/components/GiteaIntegration.svelte new file mode 100644 index 00000000000..9ae136fabee --- /dev/null +++ b/apps/desktop/src/components/GiteaIntegration.svelte @@ -0,0 +1,175 @@ + + +
+ + + {#snippet error()} + + {#snippet title()} + Failed to load Gitea accounts + {/snippet} + + + {/snippet} + + {#snippet children(accounts)} + {@const noAccounts = accounts.length === 0} + {#each accounts as account} + + {/each} + + 0 ? "var(--clr-bg-2)" : undefined}> + {#snippet iconSide()} + + {/snippet} + + {#snippet title()} + Gitea + {/snippet} + + {#snippet caption()} + Store a personal access token for Codeberg or any Gitea-compatible instance. + {/snippet} + + {#snippet actions()} + + {/snippet} + + {/snippet} + + + + {#if showingFlow} +
+ + + {#snippet title()} + Add Gitea Account + {/snippet} + + {#snippet caption()} + Use the web base URL for your instance, such as `https://codeberg.org` or your + self-hosted Gitea host. + {/snippet} + + (hostInput = value)} + placeholder="https://codeberg.org" + error={hostError} + /> + (patInput = value)} + error={patError} + /> + + +
+ + +
+
+
+
+ {/if} +
+ +

+ 🔒 Credentials are persisted locally in your OS Keychain / Credential Manager. +

+ + diff --git a/apps/desktop/src/components/GiteaUserLoginState.svelte b/apps/desktop/src/components/GiteaUserLoginState.svelte new file mode 100644 index 00000000000..7306e74ae82 --- /dev/null +++ b/apps/desktop/src/components/GiteaUserLoginState.svelte @@ -0,0 +1,70 @@ + + + + {#snippet loading()} + forget(account)} + isForgetLoading={forgetting.current.isLoading} + > + {#snippet badge()} + + {/snippet} + + {/snippet} + {#snippet error()} + forget(account)} + isForgetLoading={forgetting.current.isLoading} + > + {#snippet badge()} + + {/snippet} + + {/snippet} + {#snippet children(user)} + forget(account)} + isForgetLoading={forgetting.current.isLoading} + > + {#snippet badge()} + + {/snippet} + + {/snippet} + diff --git a/apps/desktop/src/components/profileSettings/IntegrationsSettings.svelte b/apps/desktop/src/components/profileSettings/IntegrationsSettings.svelte index 5460515859e..9e5923a91e9 100644 --- a/apps/desktop/src/components/profileSettings/IntegrationsSettings.svelte +++ b/apps/desktop/src/components/profileSettings/IntegrationsSettings.svelte @@ -1,4 +1,5 @@