mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-12 06:26:47 +03:00
More fixes
This commit is contained in:
@@ -66,30 +66,17 @@ export const GET: APIRoute = async ({ request }) => {
|
||||
baseConditions.push(eq(repositories.isStarred, false));
|
||||
}
|
||||
|
||||
// Get total count with all user config filters applied
|
||||
const totalConditions = [...baseConditions];
|
||||
if (githubConfig.skipForks) {
|
||||
totalConditions.push(eq(repositories.isForked, false));
|
||||
}
|
||||
if (!githubConfig.privateRepositories) {
|
||||
totalConditions.push(eq(repositories.isPrivate, false));
|
||||
}
|
||||
|
||||
// Get actual total count (without user config filters)
|
||||
const [totalCount] = await db
|
||||
.select({ count: count() })
|
||||
.from(repositories)
|
||||
.where(and(...totalConditions));
|
||||
|
||||
// Get public count
|
||||
const publicConditions = [...baseConditions, eq(repositories.isPrivate, false)];
|
||||
if (githubConfig.skipForks) {
|
||||
publicConditions.push(eq(repositories.isForked, false));
|
||||
}
|
||||
.where(and(...baseConditions));
|
||||
|
||||
// Get public count (actual count, not filtered)
|
||||
const [publicCount] = await db
|
||||
.select({ count: count() })
|
||||
.from(repositories)
|
||||
.where(and(...publicConditions));
|
||||
.where(and(...baseConditions, eq(repositories.isPrivate, false)));
|
||||
|
||||
// Get private count (always show actual count regardless of config)
|
||||
const [privateCount] = await db
|
||||
|
||||
@@ -113,7 +113,7 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
(config.githubConfig?.preserveOrgStructure ? "preserve" : "flat-user");
|
||||
|
||||
const shouldUseOrgMirror =
|
||||
owner !== config.giteaConfig?.username || // Different owner means org
|
||||
owner !== config.giteaConfig?.defaultOwner || // Different owner means org
|
||||
mirrorStrategy === "single-org" || // Single-org strategy always uses org
|
||||
repoData.isStarred; // Starred repos always go to org
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
(config.githubConfig?.preserveOrgStructure ? "preserve" : "flat-user");
|
||||
|
||||
const shouldUseOrgMirror =
|
||||
owner !== config.giteaConfig?.username || // Different owner means org
|
||||
owner !== config.giteaConfig?.defaultOwner || // Different owner means org
|
||||
mirrorStrategy === "single-org" || // Single-org strategy always uses org
|
||||
repoData.isStarred; // Starred repos always go to org
|
||||
|
||||
|
||||
Reference in New Issue
Block a user