multi-server fixes
This commit is contained in:
parent
de2bff69da
commit
027929559d
|
@ -10,6 +10,7 @@
|
||||||
<div id="foraButtons"></div>
|
<div id="foraButtons"></div>
|
||||||
<div id="foraText"></div>
|
<div id="foraText"></div>
|
||||||
<form id="command">
|
<form id="command">
|
||||||
|
<input type="hidden" name="server" value="slashnet" id="server">
|
||||||
<input type="hidden" name="auth" value="" id="authtok">
|
<input type="hidden" name="auth" value="" id="authtok">
|
||||||
<input type="hidden" name="type" value="command">
|
<input type="hidden" name="type" value="command">
|
||||||
<input type="hidden" name="target" id="target">
|
<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) {
|
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
// XXX: I'm not happy with this irc.basedir file
|
BaseDir := "servers"
|
||||||
BaseDir := ReadString("irc.basedir")
|
DefaultDir := path.Join(BaseDir, "default")
|
||||||
ServerDir = path.Join(BaseDir, r.FormValue("server"))
|
ServerDir = path.Join(BaseDir, r.FormValue("server"))
|
||||||
|
|
||||||
if m, _ := path.Match(path.Join(BaseDir, "*"), ServerDir); ! m {
|
if path.Dir(DefaultDir) != path.Dir(ServerDir) {
|
||||||
ServerDir = path.Join(BaseDir, "default")
|
ServerDir = DefaultDir
|
||||||
}
|
}
|
||||||
|
|
||||||
authtok := ReadString(path.Join(ServerDir, "authtok"))
|
authtok := ReadString(path.Join(ServerDir, "authtok"))
|
||||||
|
|
3
wirc.js
3
wirc.js
|
@ -180,10 +180,11 @@ function handleCommand(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
var server = document.getElementById("server").value;
|
||||||
var authtok = prompt("Auth token", "");
|
var authtok = prompt("Auth token", "");
|
||||||
document.getElementById("authtok").value = authtok;
|
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;
|
source.onmessage = newmsg;
|
||||||
|
|
||||||
document.getElementById("command").onsubmit = handleCommand;
|
document.getElementById("command").onsubmit = handleCommand;
|
||||||
|
|
Loading…
Reference in New Issue