Removed support for Jamstash in dev mode. Not needed anymore :)

This commit is contained in:
Deluan 2020-08-15 23:11:31 -04:00
parent a2e0acd6a2
commit 15a06fcd27
6 changed files with 1 additions and 63 deletions

View File

@ -1,6 +1,5 @@
.DS_Store
ui/node_modules
Jamstash-master
Dockerfile
docker-compose*.yml
data

1
.gitignore vendored
View File

@ -12,7 +12,6 @@ TODO.md
var
navidrome.toml
master.zip
Jamstash-master
testDB
navidrome.db
*.swp

View File

@ -62,13 +62,6 @@ setup-git:
(cd .git/hooks && ln -sf ../../git/* .)
.PHONY: setup-git
Jamstash-master:
wget -N https://github.com/tsquillario/Jamstash/archive/master.zip
unzip -o master.zip
rm master.zip
(cd Jamstash-master && npm ci && npx bower install && npx grunt build)
rm -rf Jamstash-master/node_modules Jamstash-master/bower_components
check_env: check_go_env check_node_env
.PHONY: check_env

View File

@ -1 +1 @@
-s -r "(\.go$$|navidrome.toml|resources)" -R "(Jamstash-master|^ui|^data|^db/migration)" -- go run .
-s -r "(\.go$$|navidrome.toml|resources)" -R "(^ui|^data|^db/migration)" -- go run .

View File

@ -1,47 +0,0 @@
package server
import (
"net/http"
"os"
"strings"
"github.com/go-chi/chi"
)
func FileServer(r chi.Router, fullPath, subPath string, root http.FileSystem) {
if strings.ContainsAny(fullPath, "{}*") {
panic("FileServer does not permit URL parameters.")
}
fs := http.StripPrefix(fullPath, http.FileServer(justFilesFilesystem{root}))
if subPath != "/" && subPath[len(subPath)-1] != '/' {
r.Get(subPath, http.RedirectHandler(fullPath+"/", 302).ServeHTTP)
subPath += "/"
}
subPath += "*"
r.Get(subPath, func(w http.ResponseWriter, r *http.Request) {
fs.ServeHTTP(w, r)
})
}
type justFilesFilesystem struct {
fs http.FileSystem
}
func (fs justFilesFilesystem) Open(name string) (http.File, error) {
f, err := fs.fs.Open(name)
if err != nil {
return nil, err
}
return neuteredReaddirFile{f}, nil
}
type neuteredReaddirFile struct {
http.File
}
func (f neuteredReaddirFile) Readdir(count int) ([]os.FileInfo, error) {
return nil, nil
}

View File

@ -2,9 +2,7 @@ package server
import (
"net/http"
"os"
"path"
"path/filepath"
"time"
"github.com/deluan/navidrome/conf"
@ -67,10 +65,6 @@ func (a *Server) initRoutes() {
http.Redirect(w, r, indexHtml, 302)
})
workDir, _ := os.Getwd()
filesDir := filepath.Join(workDir, "Jamstash-master/dist")
FileServer(r, "/Jamstash", "/Jamstash", http.Dir(filesDir))
a.router = r
}