File tree Expand file tree Collapse file tree
packages/app/server/api/repo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,20 @@ 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+
3145async function getCommitMetadata (
3246 installation : Awaited < ReturnType < typeof useOctokitInstallation > > ,
3347 owner : string ,
@@ -237,7 +251,7 @@ export default defineEventHandler(async (event) => {
237251 const nextCursor = hasNextPage ? String ( page + 1 ) : null ;
238252 const totalCount = releases . length ;
239253 const totalPages = Math . max ( 1 , Math . ceil ( totalCount / perPage ) ) ;
240- const origin = getRequestURL ( event ) . origin ;
254+ const origin = getCommitPanelOrigin ( event ) ;
241255 const commitMetadata = await getCommitMetadata (
242256 installation ,
243257 query . owner ,
You can’t perform that action at this time.
0 commit comments