Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/app/server/api/repo/commits.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@
branch: string | null;
}

function getCommitPanelOrigin(event: H3Event) {
const requestUrl = getRequestURL(event);
const headers = getHeaders(event);
const host =
headers["x-forwarded-host"]?.split(",")[0]?.trim() ||
headers.host?.split(",")[0]?.trim() ||
requestUrl.host;
const protocol =
headers["x-forwarded-proto"]?.split(",")[0]?.trim() ||
requestUrl.protocol.replace(":", "");

return `${protocol}://${host}`;
}

async function getCommitMetadata(
installation: Awaited<ReturnType<typeof useOctokitInstallation>>,
owner: string,
Expand Down Expand Up @@ -237,7 +251,7 @@
const nextCursor = hasNextPage ? String(page + 1) : null;
const totalCount = releases.length;
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
const origin = getRequestURL(event).origin;
const origin = getCommitPanelOrigin(event);
const commitMetadata = await getCommitMetadata(
installation,
query.owner,
Expand Down Expand Up @@ -311,7 +325,7 @@
},
};
} catch (error) {
console.error("Error fetching repository releases:", error);

Check warning on line 328 in packages/app/server/api/repo/commits.get.ts

View workflow job for this annotation

GitHub Actions / Run Linting

Unexpected console statement

return {
id: "error",
Expand Down
Loading