kopia lustrzana https://github.com/cyoung/stratux
Use Go web server implementation for whole management iface.
rodzic
10a711f620
commit
3e72619ad2
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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');
|
||||
|
|
Ładowanie…
Reference in New Issue