A bunch of Changes
Docker is broken as of now, will fix later
This commit is contained in:
parent
1a6953900c
commit
6375fe5af1
27 changed files with 258 additions and 81 deletions
|
@ -2,16 +2,21 @@ package webserver
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"watn3y/bloaterbot/config"
|
||||
"watn3y.de/bloaterbot/config"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func RunServer() {
|
||||
fs := http.FileServer(http.Dir("./videos"))
|
||||
http.Handle("/", fs)
|
||||
//http.HandleFunc("/", handle204)
|
||||
|
||||
log.Info().Str("port", config.BotConfig.Webserver.Port).Str("path", "./videos").Msg("Starting webserver")
|
||||
videos := http.FileServer(http.Dir("data/videos"))
|
||||
nenefoot := http.FileServer(http.Dir("data/nenefoot"))
|
||||
|
||||
http.Handle("/", videos)
|
||||
http.Handle("/nenefoot/", nenefoot)
|
||||
|
||||
log.Info().Str("port", config.BotConfig.Webserver.Port).Msg("Starting webserver")
|
||||
|
||||
err := http.ListenAndServe(":"+config.BotConfig.Webserver.Port, nil)
|
||||
|
||||
|
@ -20,3 +25,16 @@ func RunServer() {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/*func handle204(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
buf, err := os.ReadFile("data/204.jpg")
|
||||
if err != nil {
|
||||
log.Err(err).Msg("failed to open data/204.jpg")
|
||||
}
|
||||
w.Header().Set("Content-Type", "image/jpeg")
|
||||
w.Write(buf)
|
||||
return
|
||||
|
||||
}
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue