feat: Add Gitea integration
- New /api/gitea/* routes for Gitea API - List projects, branches, commits - File tree and content viewing - User token management
This commit is contained in:
@@ -43,6 +43,13 @@ interface Task {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
interface GiteaProjectRef {
|
||||
projectId: number;
|
||||
path: string;
|
||||
url: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface GitLabProjectRef {
|
||||
projectId: number;
|
||||
path: string;
|
||||
@@ -62,6 +69,8 @@ interface Project {
|
||||
gitlabProjectId?: number;
|
||||
gitlabUrl?: string;
|
||||
gitlabPath?: string;
|
||||
// Gitea Integration
|
||||
giteaProjects?: GiteaProjectRef[];
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
@@ -397,7 +406,7 @@ tasksRouter.post("/projects", authMiddleware, async (ctx) => {
|
||||
}
|
||||
|
||||
const body = await ctx.request.body.json();
|
||||
const { name, description, color, gitlabProjectId, gitlabUrl, gitlabPath } = body;
|
||||
const { name, description, color, gitlabProjectId, gitlabUrl, gitlabPath, gitlabProjects, giteaProjects, rules } = body;
|
||||
|
||||
if (!name) {
|
||||
ctx.response.status = 400;
|
||||
@@ -414,7 +423,10 @@ tasksRouter.post("/projects", authMiddleware, async (ctx) => {
|
||||
color: color || "#6366f1",
|
||||
gitlabProjectId: gitlabProjectId || undefined,
|
||||
gitlabUrl: gitlabUrl || undefined,
|
||||
gitlabPath: gitlabPath || undefined,
|
||||
gitlabPath: gitlabPath || undefined,
|
||||
gitlabProjects: gitlabProjects || [],
|
||||
giteaProjects: giteaProjects || [],
|
||||
rules: rules || "",
|
||||
createdAt: now,
|
||||
updatedAt: now
|
||||
} as Project);
|
||||
@@ -436,7 +448,7 @@ tasksRouter.put("/projects/:id", authMiddleware, async (ctx) => {
|
||||
|
||||
const id = ctx.params.id;
|
||||
const body = await ctx.request.body.json();
|
||||
const { name, description, color, rules, gitlabProjectId, gitlabUrl, gitlabPath, gitlabProjects } = body;
|
||||
const { name, description, color, rules, gitlabProjectId, gitlabUrl, gitlabPath, gitlabProjects, giteaProjects } = body;
|
||||
|
||||
const db = await getDB();
|
||||
|
||||
@@ -447,6 +459,7 @@ tasksRouter.put("/projects/:id", authMiddleware, async (ctx) => {
|
||||
if (rules !== undefined) (updateFields as any).rules = rules;
|
||||
// GitLab fields - Multiple projects (new)
|
||||
if (gitlabProjects !== undefined) updateFields.gitlabProjects = gitlabProjects || [];
|
||||
if (giteaProjects !== undefined) (updateFields as any).giteaProjects = giteaProjects || [];
|
||||
// Legacy single project fields (for backwards compatibility)
|
||||
if (gitlabProjectId !== undefined) updateFields.gitlabProjectId = gitlabProjectId || undefined;
|
||||
if (gitlabUrl !== undefined) updateFields.gitlabUrl = gitlabUrl || undefined;
|
||||
|
||||
Reference in New Issue
Block a user