Fix Gitea repository integration and preview compose display

This commit is contained in:
Jason Parks
2025-03-23 15:35:22 -06:00
parent d5137d5d3a
commit f04c8a36af
3 changed files with 60 additions and 16 deletions

View File

@@ -216,4 +216,31 @@ export const giteaRouter = createTRPCRouter({
return { success: true };
}),
getGiteaUrl: protectedProcedure
.input(apiFindOneGitea)
.query(async ({ input, ctx }) => {
const { giteaId } = input;
if (!giteaId) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Gitea provider ID is required.",
});
}
const giteaProvider = await findGiteaById(giteaId);
if (
giteaProvider.gitProvider.organizationId !==
ctx.session.activeOrganizationId
) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not allowed to access this Gitea provider",
});
}
// Return the base URL of the Gitea instance
return giteaProvider.giteaUrl;
}),
});