17 Commits

9 changed files with 46 additions and 22 deletions

View File

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

View File

@@ -8,3 +8,6 @@ d14041daa7bbbd37ea2ff47aa978b9595af67ca3 v1.1.1
76c178b8f27ec894e79b8f73649fcb3e45a73729 v1.1.4
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.2
VERSION=1.3.0
GOFLAGS=-a \
-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \
@@ -54,7 +54,7 @@ $(BINNAME)-$(VERSION)-win32.7z: $(BINNAME).exe nmdc-webfrontend.conf.SAMPLE
7z a -mx9 "$(BINNAME)-$(VERSION)-win32.7z" $(BINNAME).exe nmdc-webfrontend.conf.SAMPLE
$(BINNAME)-$(VERSION)-linux64.tar.xz: $(BINNAME) nmdc-webfrontend.conf.SAMPLE
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-linux64.tar.xz" $(BINNAME) nmdc-webfrontend.conf.SAMPLE
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-linux64.tar.xz" $(BINNAME) nmdc-webfrontend.conf.SAMPLE --owner=0 --group=0
$(BINNAME)-$(VERSION)-src.tar.xz: $(SOURCES)
XZ_OPT='-9' tar caf "$(BINNAME)-$(VERSION)-src.tar.xz" $(SOURCES) --owner=0 --group=0

View File

@@ -1,11 +1,13 @@
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
Tags: nmdc
This project supercedes [entry=dcwebui]dcwebui[/entry], [entry=flexdc]flexdc[/entry], and [entry=dcwebui2]dcwebui2[/entry].
=UPGRADING FROM DCWEBUI2=
- The configuration file content is identical between nmdc-webfrontend 1.0.0 and dcwebui2 1.3.0, but please now ensure it's valid JSON instead of arbitrary javascript. This means no assignment, use double-quoted strings, and no comments.
@@ -14,18 +16,26 @@ Tags: nmdc
=DEVELOPING=
[go-get]code.ivysaur.me/nmdc-webfrontend git https://git.ivysaur.me/code.ivysaur.me/nmdc-webfrontend.git[/go-get]
1. Install Go, Node.js, NPM, and 7-Zip (`p7zip-full` on Debian)
2. Set up your `$GOPATH`
3. Download the source code
- `https://git.ivysaur.me/code.ivysaur.me/nmdc-webfrontend.git` ; or
- `go get code.ivysaur.me/nmdc-webfrontend` ; or
- download and extract a source archive
    - `git clone https://git.ivysaur.me/code.ivysaur.me/nmdc-webfrontend.git `; or
    - `go get code.ivysaur.me/nmdc-webfrontend` ; or
    - download and extract a source archive
4. Install dependencies: `sudo make deps`
5. Build: `make`
6. Optional: Set `web.external_webroot: true` in the config file for unminified development
=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"
}
}
}