Apply JnCrMx's patch for optional HTTP-only mode

This commit is contained in:
Ivan Davydov 2024-08-14 16:29:04 +03:00
parent 9524b1eb12
commit 5352937065
6 changed files with 62 additions and 40 deletions

View file

@ -9,6 +9,7 @@ mainDomain = 'codeberg.page'
rawDomain = 'raw.codeberg.page'
allowedCorsDomains = ['fonts.codeberg.org', 'design.codeberg.org']
blacklistedPaths = ['do/not/use']
httpOnlyMode = false
[forge]
root = 'https://codeberg.org'

View file

@ -18,6 +18,7 @@ type ServerConfig struct {
PagesBranches []string
AllowedCorsDomains []string
BlacklistedPaths []string
HttpOnlyMode bool `default:"false"`
}
type ForgeConfig struct {

View file

@ -84,6 +84,9 @@ func mergeServerConfig(ctx *cli.Context, config *ServerConfig) {
if ctx.IsSet("blacklisted-paths") {
config.BlacklistedPaths = ctx.StringSlice("blacklisted-paths")
}
if ctx.IsSet("http-only-mode") {
config.HttpOnlyMode = ctx.Bool("http-only-mode")
}
// add the paths that should always be blacklisted
config.BlacklistedPaths = append(config.BlacklistedPaths, ALWAYS_BLACKLISTED_PATHS...)