9 Commits

8 changed files with 34 additions and 18 deletions

View File

@@ -9,3 +9,5 @@ d14041daa7bbbd37ea2ff47aa978b9595af67ca3 v1.1.1
0eeab5594ba4d683e6a268ef971675c73b226bd0 v1.2.0
c8cd84947e4516215e50639914adfaecf350fe91 v1.2.1
0c6b957de43252f89688ba73c4857f6d912b2912 v1.2.2
e7de5d5504b9a2bf368279d6a691458398a638bf v1.2.3
4dc4a77c8db3170b284e12e33171994ad18ffa29 v1.3.0

View File

@@ -17,7 +17,7 @@ type Config struct {
Hub struct {
Address string `json:"address"`
Port int `json:"port"`
Port int `json:"port,omitempty"`
Tag string `json:"tag"`
}
}

12
Gopkg.lock generated
View File

@@ -4,8 +4,14 @@
[[projects]]
name = "code.ivysaur.me/libnmdc"
packages = ["."]
revision = "4ea6cbb6f1a2d91a1e64c4b028b1c0ffe1bdd88d"
version = "v0.15.0"
revision = "a23cc9e61d24bb9b16b1126bdddd514e01d64792"
version = "v0.16.0"
[[projects]]
branch = "master"
name = "github.com/cxmcc/tiger"
packages = ["."]
revision = "bde35e2713d7f674987c2ecb21a6b0fc33749516"
[[projects]]
branch = "master"
@@ -28,6 +34,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "383f1855bfd5d5845dcfa88d2dab2599d9fdee6ddd849d9cb1e1a5ae35fd41ac"
inputs-digest = "7ac2438222289730d49b803fd1c631629921f95fd406c3154a54d34e11fb6947"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -23,7 +23,7 @@
[[constraint]]
name = "code.ivysaur.me/libnmdc"
version = "0.15.0"
version = "0.16.0"
[[constraint]]
branch = "master"

View File

@@ -2,7 +2,7 @@
BINNAME=nmdc-webfrontend
VERSION=1.2.3
VERSION=1.3.0
GOFLAGS=-a \
-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \

View File

@@ -1,6 +1,6 @@
A web interface to an NMDC hub.
A web interface to an NMDC/ADC hub.
Chat in real-time on your NMDC hub using a web browser. This project forks and deprecates my earlier `dcwebui2` project since Go seems to use less memory than node.
Chat in real-time on your NMDC/ADC hub using a web browser. This project forks and deprecates my earlier `dcwebui2` project since Go seems to use less memory than node.
Written in Golang
@@ -29,6 +29,10 @@ This project supercedes [entry=dcwebui]dcwebui[/entry], [entry=flexdc]flexdc[/en
=CHANGELOG=
2017-11-26 1.3.0
- Update libnmdc to 0.16 (adds ADC hub support)
- Configuration: The `hub.port` property is now optional. You can specify a full URI in the `hub.address` property instead.
2017-11-14 1.2.3
- Update libnmdc to 0.15

19
main.go
View File

@@ -48,14 +48,19 @@ func (this *App) HubWorker(Nick, Pass string, so socketio.Socket, done chan stru
selfUser.ClientTag = this.cfg.Hub.Tag
selfUser.ClientVersion = libnmdc.DEFAULT_CLIENT_VERSION
hco := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port)),
Self: *selfUser,
NickPassword: Pass,
NumEventsToBuffer: 0,
url := this.cfg.Hub.Address
if this.cfg.Hub.Port == 0 {
url = fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port)
}
hub := hco.Connect()
hco := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(url),
Self: selfUser,
NickPassword: Pass,
}
hubEvents := make(chan libnmdc.HubEvent, 10)
hub := libnmdc.ConnectAsync(&hco, hubEvents)
defer func() {
hub.Disconnect()
@@ -105,7 +110,7 @@ func (this *App) HubWorker(Nick, Pass string, so socketio.Socket, done chan stru
for {
select {
case hev, ok := <-hub.OnEvent:
case hev, ok := <-hubEvents:
if !ok {
log.Printf("[%s] hub chan closed\n", so.Id())
return // abandon

View File

@@ -12,9 +12,8 @@
},
"hub": {
"address": "127.0.0.1",
"port": 411,
"address": "nmdc://127.0.0.1:411",
"tag": "nmdc-webfrontend"
}
}
}