Use Go web server implementation for whole management iface.

pull/26/head
Christopher Young 2015-08-31 13:02:20 -04:00
rodzic 10a711f620
commit 3e72619ad2
3 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -16,7 +16,7 @@ import (
const (
stratuxVersion = "v0.2"
configLocation = "/etc/stratux.conf"
managementAddr = ":9110"
managementAddr = ":80"
maxDatagramSize = 8192
UPLINK_BLOCK_DATA_BITS = 576
UPLINK_BLOCK_BITS = (UPLINK_BLOCK_DATA_BITS + 160)
@ -430,6 +430,8 @@ func saveSettings() {
log.Printf("can't save settings %s: %s\n", configLocation, err.Error())
return
}
jsonSettings, _ := json.Marshal(&globalSettings)
fd.Write(jsonSettings)
log.Printf("wrote settings.\n")
}

Wyświetl plik

@ -62,7 +62,8 @@ func handleManagementConnection(conn *websocket.Conn) {
}
func managementInterface() {
http.HandleFunc("/",
http.Handle("/", http.FileServer(http.Dir("/var/www")))
http.HandleFunc("/control",
func(w http.ResponseWriter, req *http.Request) {
s := websocket.Server{
Handler: websocket.Handler(handleManagementConnection)}

Wyświetl plik

@ -24,7 +24,7 @@ function setConnectedClass (cssClass) {
}
function connect() {
socket = new WebSocket('ws://' + window.location.hostname + ':9110/');
socket = new WebSocket('ws://' + window.location.hostname + '/control');
socket.onopen = function(msg) {
setConnectedClass('label-success');