12 Commits

Author SHA1 Message Date
f0e64cbc34 modernise the sample configuration file 2017-11-26 19:56:43 +13:00
e7587dae2d Added tag v1.3.0 for changeset 4dc4a77c8db3 2017-11-26 19:55:50 +13:00
2e264ecaf1 doc: readme 2017-11-26 19:55:45 +13:00
046c6627ec makefile: bump version to 1.3.0 2017-11-26 19:55:39 +13:00
36f49749ad config: hub.port is optional, allow putting full URL in hub.address field 2017-11-26 19:54:03 +13:00
aacebe5c5f compatibility updates for libnmdc 2017-11-26 19:51:10 +13:00
80d230be98 vendor: bump libnmdc 0.15.0 -> 0.16.0 2017-11-26 19:48:53 +13:00
27c9621833 makefile: bump version to 1.2.4 2017-11-14 19:58:00 +13:00
082502c7e6 Added tag v1.2.3 for changeset e7de5d5504b9 2017-11-14 19:57:50 +13:00
f4684673e7 doc: readme 2017-11-14 19:57:44 +13:00
0dc5c2878f hgignore 2017-11-14 19:47:21 +13:00
efdb188aba vendor: bump libnmdc 0.14.0 -> 0.15.0 2017-11-14 19:45:08 +13:00
9 changed files with 38 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ mode:regex
^clientpack/
^_dist/
^node_modules/
^vendor/
^nmdc-webfrontend$

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 = "21847db9fdc1b983285de44e789cd9e921bdf1bb"
version = "v0.14.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 = "928468c40a3a664870459e1d5a1fa97fcbc45802fdd498ebf89bcffe0b44ec6e"
inputs-digest = "7ac2438222289730d49b803fd1c631629921f95fd406c3154a54d34e11fb6947"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -23,7 +23,7 @@
[[constraint]]
name = "code.ivysaur.me/libnmdc"
version = "0.14.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,13 @@ 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
2017-10-28 1.2.2
- Enhancement: Simplify build process
- Fix an issue with closing PM tabs

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"
}
}
}