use cookie over path for namespace
parent
08dfb715d3
commit
44d548c603
|
|
@ -10,10 +10,11 @@ func main() {
|
||||||
as := args.NewArgSet()
|
as := args.NewArgSet()
|
||||||
as.Append(args.INT, "p", "port to listen on", 3004)
|
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.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 {
|
if err := as.Parse(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
s := NewServer(as.GetString("d"))
|
s := NewServer(as.GetString("d"), as.GetBool("ldap"))
|
||||||
if err := s.Routes(); err != nil {
|
if err := s.Routes(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
<script>
|
<script>
|
||||||
function setNamespace() {
|
function setNamespace() {
|
||||||
document.getElementById("namespace").disabled = true
|
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>
|
</script>
|
||||||
{{ if .This.Namespaces }}
|
{{ if .This.Namespaces }}
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,14 @@ import (
|
||||||
type Server struct {
|
type Server struct {
|
||||||
router *router.Router
|
router *router.Router
|
||||||
root string
|
root string
|
||||||
|
ldap bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer(root string) *Server {
|
func NewServer(root string, ldap bool) *Server {
|
||||||
return &Server{
|
return &Server{
|
||||||
router: router.New(),
|
router: router.New(),
|
||||||
root: root,
|
root: root,
|
||||||
|
ldap: ldap,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue