fix non-color pages from the handler

This commit is contained in:
idk
2019-06-25 11:41:22 -04:00
parent c3192414f7
commit 593a62f27c
3 changed files with 30 additions and 30 deletions

View File

@ -269,8 +269,8 @@ func (c *Conf) I2PINILoad(iniFile string, label ...string) error {
c.SetKeyFile(label...)
c.SetUserName(label...)
c.SetPassword(label...)
c.SetControlHost(label...)
c.SetControlPort(label...)
c.SetControlHost(label...)
c.SetControlPort(label...)
if v, ok := c.Get("i2cp.accessList", label...); ok {
csv := strings.Split(v, ",")
for _, z := range csv {

View File

@ -65,10 +65,10 @@ inbound.length = 3
outbound.length = 3
keys = httpserver
[sam-forwarder-tcp-http-client]
type = httpclient
host = 127.0.0.1
port = 8086
inbound.length = 3
outbound.length = 3
keys = proxy
#[sam-forwarder-tcp-http-client]
#type = httpclient
#host = 127.0.0.1
#port = 8086
#inbound.length = 3
#outbound.length = 3
#keys = proxy

View File

@ -83,10 +83,13 @@ func (t *TunnelHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
}
t.Printdivf(t.SAMTunnel.ID(), "TunName", t.SAMTunnel.ID(), rw, req)
fmt.Fprintf(rw, " <span id=\"toggle%s\" class=\"control\">\n", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <a href=\"#\" onclick=\"toggle_visibility_class('%s');\"> Show/Hide %s</a><br>\n", t.SAMTunnel.ID(), t.SAMTunnel.ID())
fmt.Fprintf(rw, " <a href=\"/%s/color\">Tunnel page</a>\n", t.SAMTunnel.ID())
fmt.Fprintf(rw, " </span>\n")
if strings.HasSuffix(req.URL.Path, "color") {
fmt.Fprintf(rw, " <span id=\"toggle%s\" class=\"control\">\n", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <a href=\"#\" onclick=\"toggle_visibility_class('%s');\"> Show/Hide %s</a><br>\n", t.SAMTunnel.ID(), t.SAMTunnel.ID())
fmt.Fprintf(rw, " <a href=\"/%s/color\">Tunnel page</a>\n", t.SAMTunnel.ID())
fmt.Fprintf(rw, " </span>\n")
}
for key, value := range t.SAMTunnel.Props() {
if key != "TunName" {
t.Printdivf(key, key, value, rw, req)
@ -94,27 +97,24 @@ func (t *TunnelHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
}
if strings.HasSuffix(req.URL.Path, "color") {
fmt.Fprintf(rw, " </div>\n\n")
}
if strings.HasSuffix(req.URL.Path, "color") {
fmt.Fprintf(rw, " <div id=\"%s\" class=\"%s control panel\" >", t.SAMTunnel.ID()+".control", t.SAMTunnel.GetType())
}
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"start\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"start\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[START]\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"stop\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"stop\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[STOP].\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"start\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"start\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[START]\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"restart\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"restart\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\"[RESTART].\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"stop\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"stop\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[STOP].\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <div id=\"%s.status\" class=\"%s status\">.[STATUS].</div>", t.SAMTunnel.ID(), t.SAMTunnel.ID())
if strings.HasSuffix(req.URL.Path, "color") {
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"restart\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"restart\" name=\"action\" />")
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\"[RESTART].\">")
fmt.Fprintf(rw, " </form>")
fmt.Fprintf(rw, " <div id=\"%s.status\" class=\"%s status\">.[STATUS].</div>", t.SAMTunnel.ID(), t.SAMTunnel.ID())
fmt.Fprintf(rw, " </div>\n\n")
}
}