Skip to content

Commit

Permalink
Merge pull request #25 from Jipok/master
Browse files Browse the repository at this point in the history
Update front and fix UI on direct url
  • Loading branch information
117503445 authored Feb 24, 2024
2 parents 1c42894 + 31dbf5e commit 97cb6f4
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}

log.Debug().Str("URL", req.URL.Path).Str("Method", req.Method).Msg("Handler Request")
if req.Method == "GET" && (req.URL.Path == h.prefix || req.URL.Path == h.prefix+"/") {
if req.Method == "GET" && (req.URL.Path == h.prefix || strings.HasSuffix(req.URL.Path, "/")) {
if _, err := w.Write([]byte(WebdavjsHTML)); err != nil {
log.Error().Err(err).Msg("Failed to write index.html")
}
Expand Down
24 changes: 24 additions & 0 deletions internal/server/make_html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

rm webdavjs.html
cat > webdavjs.html <<EOL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GoWebDAV</title>
</head>
<body></body>
<script>
EOL

curl -s https://cdn.jsdelivr.net/gh/dom111/webdav-js/src/webdav-min.js >> webdavjs.html

echo -e "\n</script><style>\n" >> webdavjs.html

curl -s https://cdn.jsdelivr.net/gh/dom111/webdav-js/assets/css/style-min.css >> webdavjs.html

echo -e "\n</style></html>" >> webdavjs.html
57 changes: 55 additions & 2 deletions internal/server/webdavjs.html

Large diffs are not rendered by default.

0 comments on commit 97cb6f4

Please sign in to comment.