mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-13 10:47:19 +03:00
Removed support for Jamstash in dev mode. Not needed anymore :)
This commit is contained in:
parent
a2e0acd6a2
commit
15a06fcd27
@ -1,6 +1,5 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
ui/node_modules
|
ui/node_modules
|
||||||
Jamstash-master
|
|
||||||
Dockerfile
|
Dockerfile
|
||||||
docker-compose*.yml
|
docker-compose*.yml
|
||||||
data
|
data
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,7 +12,6 @@ TODO.md
|
|||||||
var
|
var
|
||||||
navidrome.toml
|
navidrome.toml
|
||||||
master.zip
|
master.zip
|
||||||
Jamstash-master
|
|
||||||
testDB
|
testDB
|
||||||
navidrome.db
|
navidrome.db
|
||||||
*.swp
|
*.swp
|
||||||
|
7
Makefile
7
Makefile
@ -62,13 +62,6 @@ setup-git:
|
|||||||
(cd .git/hooks && ln -sf ../../git/* .)
|
(cd .git/hooks && ln -sf ../../git/* .)
|
||||||
.PHONY: setup-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
|
check_env: check_go_env check_node_env
|
||||||
.PHONY: check_env
|
.PHONY: check_env
|
||||||
|
|
||||||
|
@ -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 .
|
||||||
|
@ -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
|
|
||||||
}
|
|
@ -2,9 +2,7 @@ package server
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/deluan/navidrome/conf"
|
"github.com/deluan/navidrome/conf"
|
||||||
@ -67,10 +65,6 @@ func (a *Server) initRoutes() {
|
|||||||
http.Redirect(w, r, indexHtml, 302)
|
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
|
a.router = r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user