From 7627a5bc1c1b9b650f6340fb4fef08a4b51821e3 Mon Sep 17 00:00:00 2001 From: Adrian Victor Date: Sat, 16 May 2026 12:29:31 -0300 Subject: [PATCH] Add support for serving local files on 'listen' mode --- cmd/listen.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/listen.go b/cmd/listen.go index 4da2bca..58dcf90 100644 --- a/cmd/listen.go +++ b/cmd/listen.go @@ -41,6 +41,8 @@ is up to you, eg. Nginx, Apache, or even a simple Go server. token := viper.GetString("token") dir := viper.GetString("dir") branch := viper.GetString("branch") + notFound := viper.GetString("notfound") + files := viper.GetString("files") if bind == "" || server == "" || user == "" || token == "" || branch == "" || dir == "" { fmt.Println("bind, server, user, token, branch and dir are required") fmt.Println("dumping flags:") @@ -50,6 +52,8 @@ is up to you, eg. Nginx, Apache, or even a simple Go server. fmt.Println(" token: ", token) fmt.Println(" branch: ", branch) fmt.Println(" dir: ", dir) + fmt.Println(" notfound: ", notFound) + fmt.Println(" files: ", files) return } serverUrl, err := url.Parse(server) @@ -60,9 +64,11 @@ is up to you, eg. Nginx, Apache, or even a simple Go server. cfg := &lib.WebhookCFG{ Forgejo: lib.Forgejo{ - Server: *serverUrl, - Token: token, - Branch: branch, + Server: *serverUrl, + Token: token, + Branch: branch, + NotFound: notFound, + Files: files, }, GitDir: filepath.Join(dir, "git"), PageDir: filepath.Join(dir, "pages"), @@ -103,4 +109,6 @@ func init() { f.StringP("token", "k", "", "Forgejo api token or password") f.StringP("branch", "b", "static-pages", "branch to use") f.StringP("dir", "d", "", "directory to store data, must be writable") + f.StringP("notfound", "n", "", "path to custom 404.html file") + f.StringP("files", "f", "", "path for files to be served ") }