diff --git a/index.html b/index.html index 5ddc3b0..51912bf 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,7 @@
+ diff --git a/src/wirc.cgi/wirc.cgi.go b/src/wirc.cgi/wirc.cgi.go index b86efed..89ea9cb 100644 --- a/src/wirc.cgi/wirc.cgi.go +++ b/src/wirc.cgi/wirc.cgi.go @@ -84,12 +84,12 @@ func handleCommand(w http.ResponseWriter, text string, target string) { func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - // XXX: I'm not happy with this irc.basedir file - BaseDir := ReadString("irc.basedir") + BaseDir := "servers" + DefaultDir := path.Join(BaseDir, "default") ServerDir = path.Join(BaseDir, r.FormValue("server")) - if m, _ := path.Match(path.Join(BaseDir, "*"), ServerDir); ! m { - ServerDir = path.Join(BaseDir, "default") + if path.Dir(DefaultDir) != path.Dir(ServerDir) { + ServerDir = DefaultDir } authtok := ReadString(path.Join(ServerDir, "authtok")) diff --git a/wirc.js b/wirc.js index 4a847c6..927e2fe 100644 --- a/wirc.js +++ b/wirc.js @@ -180,10 +180,11 @@ function handleCommand(event) { } function init() { + var server = document.getElementById("server").value; var authtok = prompt("Auth token", ""); document.getElementById("authtok").value = authtok; - var source = new EventSource("wirc.cgi?auth=" + authtok); + var source = new EventSource("wirc.cgi?server=" + server + "&auth=" + authtok); source.onmessage = newmsg; document.getElementById("command").onsubmit = handleCommand;