From 843669229637978669b7c6a0545000ff3ef80bb0 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 15 Jul 2026 17:44:26 +0530 Subject: [PATCH] Add a Connect to Gitea button alongside GitHub Gated behind _APP_VCS_PROVIDERS containing 'gitea' (server-side allow list), so it stays hidden unless Gitea is actually configured. Ships a stand-in monochrome icon since no Gitea icon exists in @appwrite.io/pink-icons-svelte yet. --- src/lib/components/git/IconGitea.svelte | 18 +++++++++++++ src/lib/components/git/connectGit.svelte | 32 ++++++++++++++++++------ src/lib/stores/git.ts | 12 +++++++-- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 src/lib/components/git/IconGitea.svelte diff --git a/src/lib/components/git/IconGitea.svelte b/src/lib/components/git/IconGitea.svelte new file mode 100644 index 0000000000..261f3efcd4 --- /dev/null +++ b/src/lib/components/git/IconGitea.svelte @@ -0,0 +1,18 @@ + + + + + diff --git a/src/lib/components/git/connectGit.svelte b/src/lib/components/git/connectGit.svelte index 3190a6b8c7..1de610712a 100644 --- a/src/lib/components/git/connectGit.svelte +++ b/src/lib/components/git/connectGit.svelte @@ -1,14 +1,19 @@ @@ -35,13 +40,24 @@ title="No installation was added to the project yet" description="Add an installation to connect repositories"> - + + + {#if isGiteaEnabled} + + {/if} + diff --git a/src/lib/stores/git.ts b/src/lib/stores/git.ts index 51f8df20f7..8181f20cce 100644 --- a/src/lib/stores/git.ts +++ b/src/lib/stores/git.ts @@ -1,14 +1,14 @@ import { page } from '$app/state'; import { getApiEndpoint } from './sdk'; -export function connectGitHub(callbackState: Record = null) { +function connectVcsProvider(provider: string, callbackState: Record = null) { const redirect = new URL(page.url); if (callbackState) { Object.keys(callbackState).forEach((key) => { redirect.searchParams.append(key, callbackState[key]); }); } - const target = new URL(`${getApiEndpoint(page.params.region)}/vcs/github/authorize`); + const target = new URL(`${getApiEndpoint(page.params.region)}/vcs/${provider}/authorize`); target.searchParams.set('project', page.params.project); target.searchParams.set('success', redirect.toString()); target.searchParams.set('failure', redirect.toString()); @@ -16,6 +16,14 @@ export function connectGitHub(callbackState: Record = null) { return target; } +export function connectGitHub(callbackState: Record = null) { + return connectVcsProvider('github', callbackState); +} + +export function connectGitea(callbackState: Record = null) { + return connectVcsProvider('gitea', callbackState); +} + export function deploymentStatusConverter(status: string) { // Status component possible values - status: 'waiting' | 'ready' | 'processing' | 'pending' | 'failed' | 'complete'; switch (status) {