use cookie over path for namespace

master
Bel LaPointe 2022-02-18 07:10:08 -07:00
parent 08dfb715d3
commit 44d548c603
3 changed files with 7 additions and 3 deletions

View File

@ -10,10 +10,11 @@ func main() {
as := args.NewArgSet()
as.Append(args.INT, "p", "port to listen on", 3004)
as.Append(args.STRING, "d", "root dir with /index.html and /media and /files", "./public")
as.Append(args.BOOL, "ldap", "ldap features", false)
if err := as.Parse(); err != nil {
panic(err)
}
s := NewServer(as.GetString("d"))
s := NewServer(as.GetString("d"), as.GetBool("ldap"))
if err := s.Routes(); err != nil {
panic(err)
}

View File

@ -2,7 +2,8 @@
<script>
function setNamespace() {
document.getElementById("namespace").disabled = true
window.location.href = `${window.location.protocol}`+"//"+`${window.location.host}/ui/files/${document.getElementById("namespace").value}`
document.cookie = "namespace=" + document.getElementById("namespace").value
window.location.href = `${window.location.protocol}`+"//"+`${window.location.host}/ui/files`
}
</script>
{{ if .This.Namespaces }}

View File

@ -28,12 +28,14 @@ import (
type Server struct {
router *router.Router
root string
ldap bool
}
func NewServer(root string) *Server {
func NewServer(root string, ldap bool) *Server {
return &Server{
router: router.New(),
root: root,
ldap: ldap,
}
}