This commit is contained in:
6543 2022-11-12 19:13:54 +01:00
parent 5e499fc12c
commit 6afc95b875
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE

View file

@ -105,7 +105,6 @@ func Handler(mainDomainSuffix, rawDomain string,
if len(pathElements) > 2 && strings.HasPrefix(pathElements[2], "@") {
log.Debug().Msg("raw domain preparations, now trying with specified branch")
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: false,
ServeRaw: true,
TargetOwner: pathElements[0],
TargetRepo: pathElements[1],
@ -162,6 +161,7 @@ func Handler(mainDomainSuffix, rawDomain string,
log.Debug().Msg("main domain preparations, now trying with specified repo & branch")
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: true,
TargetOwner: targetOwner,
TargetRepo: pathElements[0],
TargetBranch: pathElements[1][1:],
@ -182,6 +182,7 @@ func Handler(mainDomainSuffix, rawDomain string,
if strings.HasPrefix(pathElements[0], "@") {
log.Debug().Msg("main domain preparations, now trying with specified branch")
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: true,
TargetOwner: targetOwner,
TargetRepo: "pages",
TargetBranch: pathElements[0][1:],
@ -203,6 +204,7 @@ func Handler(mainDomainSuffix, rawDomain string,
log.Debug().Msg("main domain preparations, now trying with specified repo")
if pathElements[0] != "pages" {
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: true,
TargetOwner: targetOwner,
TargetRepo: pathElements[0],
TargetBranch: "pages",
@ -218,6 +220,7 @@ func Handler(mainDomainSuffix, rawDomain string,
// example.codeberg.page/index.html
log.Debug().Msg("main domain preparations, now trying with default repo/branch")
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: true,
TargetOwner: targetOwner,
TargetRepo: "pages",
TargetPath: path.Join(pathElements...),
@ -255,6 +258,7 @@ func Handler(mainDomainSuffix, rawDomain string,
// Try to use the given repo on the given branch or the default branch
log.Debug().Msg("custom domain preparations, now trying with details from DNS")
if targetOpt, works := tryBranch(log, ctx, giteaClient, &upstream.Options{
TryIndexPages: true,
TargetOwner: targetOwner,
TargetRepo: targetRepo,
TargetBranch: targetBranch,