openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 452cc23208890a1731370b416c0df3b300960629
parent 67edb01b9c3f6a5f0cb149032bd09811f985974c
Author: vasyahacker <vasya@magicfreedom.com>
Date:   Fri, 31 Mar 2023 12:08:20 +0400

moved hardcoded /style path to -style option

Diffstat:
Mcmd/idecd/main.go | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/cmd/idecd/main.go b/cmd/idecd/main.go @@ -63,6 +63,7 @@ var host_opt *string = flag.String("host", "http://127.0.0.1:8080", "Node addres var verbose_opt *bool = flag.Bool("v", false, "Verbose") var echo_opt *string = flag.String("e", "list.txt", "Echoes list") var tpl_path_opt *string = flag.String("tpl", "./tpl", "Path to html templates") +var style_path_opt *string = flag.String("style", "./style", "Path to /style web-directory (css/images)") type WWW struct { Host string @@ -108,7 +109,13 @@ func main() { os.Exit(1) } + if _, err := os.Stat(*style_path_opt); errors.Is(err, os.ErrNotExist) { + ii.Info.Printf("Web share dir %s (for css/images) not found", + *style_path_opt) + } + unix.Unveil(*tpl_path_opt, "r") + unix.Unveil(*style_path_opt, "r") unix.Unveil(*echo_opt, "r") unix.Unveil(*users_opt, "rwc") unix.Unveil(filepath.Dir(*db_opt), "rwc") @@ -131,7 +138,7 @@ func main() { www.Host = *host_opt WebInit(&www) - fs := http.FileServer(http.Dir("style")) + fs := http.FileServer(http.Dir(*style_path_opt)) http.Handle("/style/", http.StripPrefix("/style/", fs)) http.HandleFunc("/list.txt", func(w http.ResponseWriter, r *http.Request) {