Skip to content

Commit 08a2753

Browse files
authored
fix: localhost in install links (#496)
1 parent 98b807b commit 08a2753

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

packages/app/server/api/repo/commits.get.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@ interface CommitMeta {
2828
branch: string | null;
2929
}
3030

31-
function getCommitPanelOrigin(event: H3Event) {
32-
const requestUrl = getRequestURL(event);
33-
const headers = getHeaders(event);
34-
const host =
35-
headers["x-forwarded-host"]?.split(",")[0]?.trim() ||
36-
headers.host?.split(",")[0]?.trim() ||
37-
requestUrl.host;
38-
const protocol =
39-
headers["x-forwarded-proto"]?.split(",")[0]?.trim() ||
40-
requestUrl.protocol.replace(":", "");
41-
42-
return `${protocol}://${host}`;
43-
}
44-
4531
async function getCommitMetadata(
4632
installation: Awaited<ReturnType<typeof useOctokitInstallation>>,
4733
owner: string,
@@ -251,7 +237,9 @@ export default defineEventHandler(async (event) => {
251237
const nextCursor = hasNextPage ? String(page + 1) : null;
252238
const totalCount = releases.length;
253239
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
254-
const origin = getCommitPanelOrigin(event);
240+
const origin = import.meta.dev
241+
? getRequestURL(event).origin
242+
: "https://pkg.pr.new";
255243
const commitMetadata = await getCommitMetadata(
256244
installation,
257245
query.owner,

0 commit comments

Comments
 (0)