This commit is contained in:
Ivan Davydov 2024-08-17 22:40:55 +03:00
parent 9c7e513623
commit 7fc84a085e
5 changed files with 1342994 additions and 0 deletions

File diff suppressed because it is too large Load diff

View 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 {

View file

@ -145,6 +145,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
PagesBranches: []string{"original"},
AllowedCorsDomains: []string{"original"},
BlacklistedPaths: []string{"original"},
HttpOnlyMode: false,
},
Forge: ForgeConfig{
Root: "original",
@ -185,6 +186,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
PagesBranches: []string{"changed"},
AllowedCorsDomains: []string{"changed"},
BlacklistedPaths: append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...),
HttpOnlyMode: true,
},
Forge: ForgeConfig{
Root: "changed",
@ -222,6 +224,7 @@ func TestMergeConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *testing.T
"--raw-domain", "changed",
"--allowed-cors-domains", "changed",
"--blacklisted-paths", "changed",
"--http-only-mode",
"--pages-branch", "changed",
"--host", "changed",
"--port", "8443",
@ -281,6 +284,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
RawDomain: "original",
AllowedCorsDomains: []string{"original"},
BlacklistedPaths: []string{"original"},
HttpOnlyMode: false,
}
mergeServerConfig(ctx, cfg)
@ -294,6 +298,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
RawDomain: "changed",
AllowedCorsDomains: fixArrayFromCtx(ctx, "allowed-cors-domains", []string{"changed"}),
BlacklistedPaths: fixArrayFromCtx(ctx, "blacklisted-paths", append([]string{"changed"}, ALWAYS_BLACKLISTED_PATHS...)),
HttpOnlyMode: true,
}
assert.Equal(t, expectedConfig, cfg)
@ -305,6 +310,7 @@ func TestMergeServerConfigShouldReplaceAllExistingValuesGivenAllArgsExist(t *tes
"--raw-domain", "changed",
"--allowed-cors-domains", "changed",
"--blacklisted-paths", "changed",
"--http-only-mode",
"--host", "changed",
"--port", "8443",
"--http-port", "443",
@ -329,6 +335,7 @@ func TestMergeServerConfigShouldReplaceOnlyOneValueExistingValueGivenOnlyOneArgE
{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{"--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 {
@ -345,6 +352,7 @@ func TestMergeServerConfigShouldReplaceOnlyOneValueExistingValueGivenOnlyOneArgE
PagesBranches: []string{"original"},
AllowedCorsDomains: []string{"original"},
BlacklistedPaths: []string{"original"},
HttpOnlyMode: false,
}
expectedConfig := cfg

BIN
go1.23.0.linux-arm64.tar.gz Normal file

Binary file not shown.

View file

@ -81,6 +81,7 @@ func Serve(ctx *cli.Context) error {
var listener net.Listener
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)
listener_, err := net.Listen("tcp", listeningHTTPAddress)
if err != nil {