mirror of https://github.com/nealey/spongy
multi-server fixes
This commit is contained in:
parent
de2bff69da
commit
027929559d
|
@ -10,6 +10,7 @@
|
|||
<div id="foraButtons"></div>
|
||||
<div id="foraText"></div>
|
||||
<form id="command">
|
||||
<input type="hidden" name="server" value="slashnet" id="server">
|
||||
<input type="hidden" name="auth" value="" id="authtok">
|
||||
<input type="hidden" name="type" value="command">
|
||||
<input type="hidden" name="target" id="target">
|
||||
|
|
|
@ -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"))
|
||||
|
|
3
wirc.js
3
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;
|
||||
|
|
Loading…
Reference in New Issue