mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-12 06:26:47 +03:00
Fixed Private Repo Issues
This commit is contained in:
@@ -91,29 +91,27 @@ export const GET: APIRoute = async ({ request }) => {
|
||||
.from(repositories)
|
||||
.where(and(...publicConditions));
|
||||
|
||||
// Get private count (only if private repos are enabled in config)
|
||||
const [privateCount] = githubConfig.privateRepositories ? await db
|
||||
// Get private count (always show actual count regardless of config)
|
||||
const [privateCount] = await db
|
||||
.select({ count: count() })
|
||||
.from(repositories)
|
||||
.where(
|
||||
and(
|
||||
...baseConditions,
|
||||
eq(repositories.isPrivate, true),
|
||||
...(githubConfig.skipForks ? [eq(repositories.isForked, false)] : [])
|
||||
eq(repositories.isPrivate, true)
|
||||
)
|
||||
) : [{ count: 0 }];
|
||||
);
|
||||
|
||||
// Get fork count (only if forks are enabled in config)
|
||||
const [forkCount] = !githubConfig.skipForks ? await db
|
||||
// Get fork count (always show actual count regardless of config)
|
||||
const [forkCount] = await db
|
||||
.select({ count: count() })
|
||||
.from(repositories)
|
||||
.where(
|
||||
and(
|
||||
...baseConditions,
|
||||
eq(repositories.isForked, true),
|
||||
...(!githubConfig.privateRepositories ? [eq(repositories.isPrivate, false)] : [])
|
||||
eq(repositories.isForked, true)
|
||||
)
|
||||
) : [{ count: 0 }];
|
||||
);
|
||||
|
||||
return {
|
||||
...org,
|
||||
|
||||
@@ -78,7 +78,7 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
// Fetch repos based on config settings
|
||||
const allRepos = [];
|
||||
|
||||
// Always fetch public repos
|
||||
// Fetch all repos (public, private, and member) to show in UI
|
||||
const publicRepos = await octokit.paginate(octokit.repos.listForOrg, {
|
||||
org,
|
||||
type: "public",
|
||||
@@ -86,28 +86,24 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
});
|
||||
allRepos.push(...publicRepos);
|
||||
|
||||
// Fetch private repos if enabled in config
|
||||
if (decryptedConfig.githubConfig?.includePrivate) {
|
||||
const privateRepos = await octokit.paginate(octokit.repos.listForOrg, {
|
||||
org,
|
||||
type: "private",
|
||||
per_page: 100,
|
||||
});
|
||||
allRepos.push(...privateRepos);
|
||||
}
|
||||
// Always fetch private repos to show them in the UI
|
||||
const privateRepos = await octokit.paginate(octokit.repos.listForOrg, {
|
||||
org,
|
||||
type: "private",
|
||||
per_page: 100,
|
||||
});
|
||||
allRepos.push(...privateRepos);
|
||||
|
||||
// Also fetch member repos (includes private repos the user has access to)
|
||||
if (decryptedConfig.githubConfig?.includePrivate) {
|
||||
const memberRepos = await octokit.paginate(octokit.repos.listForOrg, {
|
||||
org,
|
||||
type: "member",
|
||||
per_page: 100,
|
||||
});
|
||||
// Filter out duplicates
|
||||
const existingIds = new Set(allRepos.map(r => r.id));
|
||||
const uniqueMemberRepos = memberRepos.filter(r => !existingIds.has(r.id));
|
||||
allRepos.push(...uniqueMemberRepos);
|
||||
}
|
||||
const memberRepos = await octokit.paginate(octokit.repos.listForOrg, {
|
||||
org,
|
||||
type: "member",
|
||||
per_page: 100,
|
||||
});
|
||||
// Filter out duplicates
|
||||
const existingIds = new Set(allRepos.map(r => r.id));
|
||||
const uniqueMemberRepos = memberRepos.filter(r => !existingIds.has(r.id));
|
||||
allRepos.push(...uniqueMemberRepos);
|
||||
|
||||
// Insert repositories
|
||||
const repoRecords = allRepos.map((repo) => ({
|
||||
|
||||
Reference in New Issue
Block a user