mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-05-12 21:17:51 +00:00
...
This commit is contained in:
parent
9c7e513623
commit
7fc84a085e
5 changed files with 1342994 additions and 0 deletions
1342960
a1e4fe999f6a4038d862894e73f5590436574d0c.patch
Normal file
1342960
a1e4fe999f6a4038d862894e73f5590436574d0c.patch
Normal file
File diff suppressed because it is too large
Load diff
25
cd6eb82cf1f4ca4461bab6b031bc182362e28989.patch
Normal file
25
cd6eb82cf1f4ca4461bab6b031bc182362e28989.patch
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
From cd6eb82cf1f4ca4461bab6b031bc182362e28989 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ivan Davydov <lotigara@lotigara.ru>
|
||||||
|
Date: Fri, 16 Aug 2024 16:31:59 +0300
|
||||||
|
Subject: [PATCH] Fix warning in server/startup.go
|
||||||
|
|
||||||
|
---
|
||||||
|
server/startup.go | 5 +----
|
||||||
|
1 file changed, 1 insertion(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/server/startup.go b/server/startup.go
|
||||||
|
index e32e749..343e00c 100644
|
||||||
|
--- a/server/startup.go
|
||||||
|
+++ b/server/startup.go
|
||||||
|
@@ -81,10 +81,7 @@ func Serve(ctx *cli.Context) error {
|
||||||
|
|
||||||
|
var listener net.Listener
|
||||||
|
if cfg.Server.HttpOnlyMode {
|
||||||
|
- log.Info().Msgf(`Starting pages-server in HTTP-only mode. Some
|
||||||
|
- features like encrypted connections and custom
|
||||||
|
- domains are not available in this mode. It is advisable
|
||||||
|
- to run behind a reverse-proxy.`)
|
||||||
|
+ log.Warn().Msgf("Starting pages-server in HTTP-only mode. Some features like encrypted connections and custom domains are not available in this mode. It is advisable to run behind a reverse-proxy.")
|
||||||
|
log.Info().Msgf("Create TCP listener on %s", listeningHTTPAddress)
|
||||||
|
listener_, err := net.Listen("tcp", listeningHTTPAddress)
|
||||||
|
if err != nil {
|
|
@ -145,6 +145,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
|
||||||
PagesBranches: []string{"original"},
|
PagesBranches: []string{"original"},
|
||||||
AllowedCorsDomains: []string{"original"},
|
AllowedCorsDomains: []string{"original"},
|
||||||
BlacklistedPaths: []string{"original"},
|
BlacklistedPaths: []string{"original"},
|
||||||
|
HttpOnlyMode: false,
|
||||||
},
|
},
|
||||||
Forge: ForgeConfig{
|
Forge: ForgeConfig{
|
||||||
Root: "original",
|
Root: "original",
|
||||||
|
@ -185,6 +186,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
|
||||||
PagesBranches: []string{"changed"},
|
PagesBranches: []string{"changed"},
|
||||||
AllowedCorsDomains: []string{"changed"},
|
AllowedCorsDomains: []string{"changed"},
|
||||||
BlacklistedPaths: append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...),
|
BlacklistedPaths: append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...),
|
||||||
|
HttpOnlyMode: true,
|
||||||
},
|
},
|
||||||
Forge: ForgeConfig{
|
Forge: ForgeConfig{
|
||||||
Root: "changed",
|
Root: "changed",
|
||||||
|
@ -222,6 +224,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
|
||||||
"--raw-domain", "changed",
|
"--raw-domain", "changed",
|
||||||
"--allowed-cors-domains", "changed",
|
"--allowed-cors-domains", "changed",
|
||||||
"--blacklisted-paths", "changed",
|
"--blacklisted-paths", "changed",
|
||||||
|
"--http-only-mode",
|
||||||
"--pages-branch", "changed",
|
"--pages-branch", "changed",
|
||||||
"--host", "changed",
|
"--host", "changed",
|
||||||
"--port", "8443",
|
"--port", "8443",
|
||||||
|
@ -281,6 +284,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
|
||||||
RawDomain: "original",
|
RawDomain: "original",
|
||||||
AllowedCorsDomains: []string{"original"},
|
AllowedCorsDomains: []string{"original"},
|
||||||
BlacklistedPaths: []string{"original"},
|
BlacklistedPaths: []string{"original"},
|
||||||
|
HttpOnlyMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeServerConfig(ctx, cfg)
|
mergeServerConfig(ctx, cfg)
|
||||||
|
@ -294,6 +298,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
|
||||||
RawDomain: "changed",
|
RawDomain: "changed",
|
||||||
AllowedCorsDomains: fixArrayFromCtx(ctx, "allowed-cors-domains", []string{"changed"}),
|
AllowedCorsDomains: fixArrayFromCtx(ctx, "allowed-cors-domains", []string{"changed"}),
|
||||||
BlacklistedPaths: fixArrayFromCtx(ctx, "blacklisted-paths", append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...)),
|
BlacklistedPaths: fixArrayFromCtx(ctx, "blacklisted-paths", append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...)),
|
||||||
|
HttpOnlyMode: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, expectedConfig, cfg)
|
assert.Equal(t, expectedConfig, cfg)
|
||||||
|
@ -305,6 +310,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
|
||||||
"--raw-domain", "changed",
|
"--raw-domain", "changed",
|
||||||
"--allowed-cors-domains", "changed",
|
"--allowed-cors-domains", "changed",
|
||||||
"--blacklisted-paths", "changed",
|
"--blacklisted-paths", "changed",
|
||||||
|
"--http-only-mode",
|
||||||
"--host", "changed",
|
"--host", "changed",
|
||||||
"--port", "8443",
|
"--port", "8443",
|
||||||
"--http-port", "443",
|
"--http-port", "443",
|
||||||
|
@ -329,6 +335,7 @@ func TestMergeServerConfigShouldReplaceOnlyOneValueExistingValueGivenOnlyOneArgE
|
||||||
{args: []string{"--pages-branch", "changed"}, callback: func(sc *ServerConfig) { sc.PagesBranches = []string{"changed"} }},
|
{args: []string{"--pages-branch", "changed"}, callback: func(sc *ServerConfig) { sc.PagesBranches = []string{"changed"} }},
|
||||||
{args: []string{"--allowed-cors-domains", "changed"}, callback: func(sc *ServerConfig) { sc.AllowedCorsDomains = []string{"changed"} }},
|
{args: []string{"--allowed-cors-domains", "changed"}, callback: func(sc *ServerConfig) { sc.AllowedCorsDomains = []string{"changed"} }},
|
||||||
{args: []string{"--blacklisted-paths", "changed"}, callback: func(sc *ServerConfig) { sc.BlacklistedPaths = []string{"changed"} }},
|
{args: []string{"--blacklisted-paths", "changed"}, callback: func(sc *ServerConfig) { sc.BlacklistedPaths = []string{"changed"} }},
|
||||||
|
{args: []string{"--http-only-mode"}, callback: func(sc *ServerConfig) { sc.HttpOnlyMode = true }},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, pair := range testValuePairs {
|
for _, pair := range testValuePairs {
|
||||||
|
@ -345,6 +352,7 @@ func TestMergeServerConfigShouldReplaceOnlyOneValueExistingValueGivenOnlyOneArgE
|
||||||
PagesBranches: []string{"original"},
|
PagesBranches: []string{"original"},
|
||||||
AllowedCorsDomains: []string{"original"},
|
AllowedCorsDomains: []string{"original"},
|
||||||
BlacklistedPaths: []string{"original"},
|
BlacklistedPaths: []string{"original"},
|
||||||
|
HttpOnlyMode: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedConfig := cfg
|
expectedConfig := cfg
|
||||||
|
|
BIN
go1.23.0.linux-arm64.tar.gz
Normal file
BIN
go1.23.0.linux-arm64.tar.gz
Normal file
Binary file not shown.
|
@ -81,6 +81,7 @@ func Serve(ctx *cli.Context) error {
|
||||||
|
|
||||||
var listener net.Listener
|
var listener net.Listener
|
||||||
if cfg.Server.HttpOnlyMode {
|
if cfg.Server.HttpOnlyMode {
|
||||||
|
log.Warn().Msgf("Starting pages-server in HTTP-only mode. Some features like encrypted connections and custom domains are not available in this mode. It is advisable to run behind a reverse-proxy.")
|
||||||
log.Info().Msgf("Create TCP listener on %s", listeningHTTPAddress)
|
log.Info().Msgf("Create TCP listener on %s", listeningHTTPAddress)
|
||||||
listener_, err := net.Listen("tcp", listeningHTTPAddress)
|
listener_, err := net.Listen("tcp", listeningHTTPAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue