Skip to content

Commit eb3fc61

Browse files
committed
feat(source-control): integrate Forgejo and Gitea servers
1 parent e816064 commit eb3fc61

37 files changed

Lines changed: 1857 additions & 24 deletions

‎apps/mobile/src/components/SourceControlIcon.tsx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { withUniwind } from "uniwind";
33

44
const ThemedSvg = withUniwind(Svg);
55

6-
export type SourceControlIconKind = "github" | "gitlab" | "bitbucket" | "azure-devops";
6+
export type SourceControlIconKind = "github" | "gitlab" | "forgejo" | "bitbucket" | "azure-devops";
77

88
export function SourceControlIcon(props: {
99
readonly kind: SourceControlIconKind;
@@ -14,6 +14,19 @@ export function SourceControlIcon(props: {
1414
const size = props.size ?? 18;
1515

1616
switch (props.kind) {
17+
case "forgejo":
18+
return (
19+
<ThemedSvg
20+
width={size}
21+
height={size}
22+
viewBox="0 0 24 24"
23+
color={props.color}
24+
colorClassName={props.colorClassName}
25+
fill="currentColor"
26+
>
27+
<Path d="M16.7773 0c1.6018 0 2.9004 1.2986 2.9004 2.9005s-1.2986 2.9004-2.9004 2.9004c-1.0854 0-2.0315-.596-2.5288-1.4787H12.91c-2.3322 0-4.2272 1.8718-4.2649 4.195l-.0007 2.1175a7.0759 7.0759 0 0 1 4.148-1.4205l.1176-.001 1.3385.0002c.4973-.8827 1.4434-1.4788 2.5288-1.4788 1.6018 0 2.9004 1.2986 2.9004 2.9005s-1.2986 2.9004-2.9004 2.9004c-1.0854 0-2.0315-.596-2.5288-1.4787H12.91c-2.3322 0-4.2272 1.8718-4.2649 4.195l-.0007 2.319c.8827.4973 1.4788 1.4434 1.4788 2.5287 0 1.602-1.2986 2.9005-2.9005 2.9005-1.6018 0-2.9004-1.2986-2.9004-2.9005 0-1.0853.596-2.0314 1.4788-2.5287l-.0002-9.9831c0-3.887 3.1195-7.0453 6.9915-7.108l.1176-.001h1.3385C14.7458.5962 15.692 0 16.7773 0ZM7.2227 19.9052c-.6596 0-1.1943.5347-1.1943 1.1943s.5347 1.1943 1.1943 1.1943 1.1944-.5347 1.1944-1.1943-.5348-1.1943-1.1944-1.1943Zm9.5546-10.4644c-.6596 0-1.1944.5347-1.1944 1.1943s.5348 1.1943 1.1944 1.1943c.6596 0 1.1943-.5347 1.1943-1.1943s-.5347-1.1943-1.1943-1.1943Zm0-7.7346c-.6596 0-1.1944.5347-1.1944 1.1943s.5348 1.1943 1.1944 1.1943c.6596 0 1.1943-.5347 1.1943-1.1943s-.5347-1.1943-1.1943-1.1943Z" />
28+
</ThemedSvg>
29+
);
1730
case "github":
1831
return (
1932
<ThemedSvg

‎apps/mobile/src/features/projects/AddProjectRepositoryRoute.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function AddProjectRepositoryRoute({
1717
const title =
1818
source === "github" ||
1919
source === "gitlab" ||
20+
source === "forgejo" ||
2021
source === "bitbucket" ||
2122
source === "azure-devops"
2223
? addProjectRemoteSourceLabel(source)

‎apps/mobile/src/features/projects/AddProjectScreen.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function sourceFromParam(value: string | string[] | undefined): AddProjectRemote
110110
source === "url" ||
111111
source === "github" ||
112112
source === "gitlab" ||
113+
source === "forgejo" ||
113114
source === "bitbucket" ||
114115
source === "azure-devops"
115116
) {

‎apps/server/src/git/GitManager.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,15 @@ export const make = Effect.gen(function* () {
12911291
(yield* readConfigValueNullable(cwd, `remote.${preferredRemoteName}.url`)) ??
12921292
(yield* readConfigValueNullable(cwd, "remote.origin.url"));
12931293

1294-
return remoteUrl ? detectSourceControlProviderFromGitRemoteUrl(remoteUrl) : null;
1294+
const provider = remoteUrl ? detectSourceControlProviderFromGitRemoteUrl(remoteUrl) : null;
1295+
if (!remoteUrl || provider?.kind !== "unknown") return provider;
1296+
const handle = yield* sourceControlProviders
1297+
.resolveHandle({
1298+
cwd,
1299+
context: { provider, remoteName: preferredRemoteName, remoteUrl },
1300+
})
1301+
.pipe(Effect.orElseSucceed(() => null));
1302+
return handle?.context?.provider ?? provider;
12951303
});
12961304

12971305
const resolveRemoteRepositoryContext = Effect.fn("resolveRemoteRepositoryContext")(function* (

0 commit comments

Comments
 (0)