Compare commits
	
		
			47 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| f4684673e7 | |||
| 0dc5c2878f | |||
| efdb188aba | |||
| 54e21f2b2d | |||
| dd166cf0e9 | |||
| 92b1c4daa5 | |||
| ea4135888d | |||
| 8e999f5ddb | |||
| 62c03cf9f1 | |||
| 6abdc8d2a9 | |||
| 1a281095f0 | |||
| 69613d07a5 | |||
| 19b2221ea1 | |||
| 9840c1024e | |||
| 00cdce5f5a | |||
| 312cbb7bc1 | |||
| bea598f7a3 | |||
| ef9a61e9cf | |||
| 0ec079cfd4 | |||
| 54ecffd0d4 | |||
| 41e244c255 | |||
| a109e2dc29 | |||
| 0bafa59358 | |||
| 78ced31e9d | |||
| 16a4a2556b | |||
| fafca96711 | |||
| 2eacb06c9e | |||
| 1f2871b917 | |||
| 855206feed | |||
| efa195df5b | |||
| 89c8cb0dc8 | |||
| c2de4c8d45 | |||
| 738e9aed41 | |||
| bdb7b4835d | |||
| 447e8c2591 | |||
| 37014f7f52 | |||
| b8791f6aa2 | |||
| 377131e43d | |||
| 20fa044906 | |||
| 0cb14fb964 | |||
| a60d821e39 | |||
| 15d9ee0023 | |||
| ed0195c4b8 | |||
| a71eb45dd5 | |||
| 086ecfb0a9 | |||
| dff36f6bff | |||
| 7a9b271b90 | 
@@ -5,4 +5,8 @@ mode:regex
 | 
				
			|||||||
^clientpack/
 | 
					^clientpack/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
^_dist/
 | 
					^_dist/
 | 
				
			||||||
^bindata\.go$
 | 
					^node_modules/
 | 
				
			||||||
 | 
					^vendor/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					^nmdc-webfrontend$
 | 
				
			||||||
 | 
					^nmdc-webfrontend\.exe$
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								.hgtags
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								.hgtags
									
									
									
									
									
								
							@@ -1,6 +1,11 @@
 | 
				
			|||||||
769fad81e3f8db8f7e5f5c164656a382a169d735 release-1.0.0
 | 
					769fad81e3f8db8f7e5f5c164656a382a169d735 v1.0.0
 | 
				
			||||||
9ed95938d809a8226aca529e34b655e6d8c8c379 release-1.0.1
 | 
					9ed95938d809a8226aca529e34b655e6d8c8c379 v1.0.1
 | 
				
			||||||
46fe533682419c8a519836ac95b5575053aa0fa8 release-1.0.2
 | 
					46fe533682419c8a519836ac95b5575053aa0fa8 v1.0.2
 | 
				
			||||||
a2c92b262f339f82eb01c8d92dda252a27432255 release-1.1.0
 | 
					a2c92b262f339f82eb01c8d92dda252a27432255 v1.1.0
 | 
				
			||||||
d14041daa7bbbd37ea2ff47aa978b9595af67ca3 release-1.1.1
 | 
					d14041daa7bbbd37ea2ff47aa978b9595af67ca3 v1.1.1
 | 
				
			||||||
7278eb0d067d8ed2a653de6a1feeeb7f76fb9891 release-1.1.2
 | 
					7278eb0d067d8ed2a653de6a1feeeb7f76fb9891 v1.1.2
 | 
				
			||||||
 | 
					6cbd9d59630372c0dff430e3dc6c1fbd7dcee734 v1.1.3
 | 
				
			||||||
 | 
					76c178b8f27ec894e79b8f73649fcb3e45a73729 v1.1.4
 | 
				
			||||||
 | 
					0eeab5594ba4d683e6a268ef971675c73b226bd0 v1.2.0
 | 
				
			||||||
 | 
					c8cd84947e4516215e50639914adfaecf350fe91 v1.2.1
 | 
				
			||||||
 | 
					0c6b957de43252f89688ba73c4857f6d912b2912 v1.2.2
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package main
 | 
				
			|||||||
type Config struct {
 | 
					type Config struct {
 | 
				
			||||||
	App struct {
 | 
						App struct {
 | 
				
			||||||
		MotdHTML        string `json:"motd"`
 | 
							MotdHTML        string `json:"motd"`
 | 
				
			||||||
 | 
							ContentedServer string `json:"contented_server"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Web struct {
 | 
						Web struct {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										33
									
								
								Gopkg.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								Gopkg.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[projects]]
 | 
				
			||||||
 | 
					  name = "code.ivysaur.me/libnmdc"
 | 
				
			||||||
 | 
					  packages = ["."]
 | 
				
			||||||
 | 
					  revision = "4ea6cbb6f1a2d91a1e64c4b028b1c0ffe1bdd88d"
 | 
				
			||||||
 | 
					  version = "v0.15.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[projects]]
 | 
				
			||||||
 | 
					  branch = "master"
 | 
				
			||||||
 | 
					  name = "github.com/googollee/go-engine.io"
 | 
				
			||||||
 | 
					  packages = [".","message","parser","polling","transport","websocket"]
 | 
				
			||||||
 | 
					  revision = "80ae0e43aca17b4c5a6834999d0f2eaa16b9afda"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[projects]]
 | 
				
			||||||
 | 
					  branch = "master"
 | 
				
			||||||
 | 
					  name = "github.com/googollee/go-socket.io"
 | 
				
			||||||
 | 
					  packages = ["."]
 | 
				
			||||||
 | 
					  revision = "5447e71f36d394766bf855d5714a487596809f0d"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[projects]]
 | 
				
			||||||
 | 
					  name = "github.com/gorilla/websocket"
 | 
				
			||||||
 | 
					  packages = ["."]
 | 
				
			||||||
 | 
					  revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
 | 
				
			||||||
 | 
					  version = "v1.2.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[solve-meta]
 | 
				
			||||||
 | 
					  analyzer-name = "dep"
 | 
				
			||||||
 | 
					  analyzer-version = 1
 | 
				
			||||||
 | 
					  inputs-digest = "383f1855bfd5d5845dcfa88d2dab2599d9fdee6ddd849d9cb1e1a5ae35fd41ac"
 | 
				
			||||||
 | 
					  solver-name = "gps-cdcl"
 | 
				
			||||||
 | 
					  solver-version = 1
 | 
				
			||||||
							
								
								
									
										30
									
								
								Gopkg.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Gopkg.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					# Gopkg.toml example
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
 | 
				
			||||||
 | 
					# for detailed Gopkg.toml documentation.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# required = ["github.com/user/thing/cmd/thing"]
 | 
				
			||||||
 | 
					# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# [[constraint]]
 | 
				
			||||||
 | 
					#   name = "github.com/user/project"
 | 
				
			||||||
 | 
					#   version = "1.0.0"
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# [[constraint]]
 | 
				
			||||||
 | 
					#   name = "github.com/user/project2"
 | 
				
			||||||
 | 
					#   branch = "dev"
 | 
				
			||||||
 | 
					#   source = "github.com/myfork/project2"
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# [[override]]
 | 
				
			||||||
 | 
					#  name = "github.com/x/y"
 | 
				
			||||||
 | 
					#  version = "2.4.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[constraint]]
 | 
				
			||||||
 | 
					  name = "code.ivysaur.me/libnmdc"
 | 
				
			||||||
 | 
					  version = "0.15.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[constraint]]
 | 
				
			||||||
 | 
					  branch = "master"
 | 
				
			||||||
 | 
					  name = "github.com/googollee/go-socket.io"
 | 
				
			||||||
							
								
								
									
										60
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
				
			|||||||
 | 
					# Makefile for nmdc-webfrontend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BINNAME=nmdc-webfrontend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VERSION=1.2.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GOFLAGS=-a \
 | 
				
			||||||
 | 
						-ldflags "-s -w -X main.VERSION=$(BINNAME)/$(VERSION)" \
 | 
				
			||||||
 | 
						-gcflags "-trimpath ${GOPATH}" \
 | 
				
			||||||
 | 
						-asmflags "-trimpath ${GOPATH}"
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					SOURCES=client/ Gopkg.lock Gopkg.toml Makefile Config.go main.go nmdc-webfrontend.conf.SAMPLE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: all deps clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					all: $(BINNAME)-$(VERSION)-win32.7z $(BINNAME)-$(VERSION)-linux64.tar.xz $(BINNAME)-$(VERSION)-src.tar.xz
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					deps:
 | 
				
			||||||
 | 
						npm install -g less uglify-js less-plugin-clean-css html-minifier
 | 
				
			||||||
 | 
						go get -u github.com/jteeuwen/go-bindata/...
 | 
				
			||||||
 | 
						go get -u github.com/golang/dep/cmd/dep
 | 
				
			||||||
 | 
						dep ensure
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					clean:
 | 
				
			||||||
 | 
						rm -f ./$(BINNAME)
 | 
				
			||||||
 | 
						rm -f ./$(BINNAME).exe
 | 
				
			||||||
 | 
						rm -fr ./clientpack
 | 
				
			||||||
 | 
						rm -f ./bindata.go
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bindata.go: client client/*
 | 
				
			||||||
 | 
						rm -fr ./clientpack
 | 
				
			||||||
 | 
						cp -r ./client ./clientpack
 | 
				
			||||||
 | 
						( echo ';(function() {' ; cat clientpack/dcwebui.js ; echo '})();' ) | uglifyjs -o clientpack/dcwebui.min.js -c -m --ie8
 | 
				
			||||||
 | 
						lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css
 | 
				
			||||||
 | 
						cat clientpack/index.htm \
 | 
				
			||||||
 | 
							| sed -e '/dcwebui.css/{i <style>' -e 'r clientpack/dcwebui.min.css' -e 'a </style>' -e 'd}' \
 | 
				
			||||||
 | 
							| sed -e '/dcwebui.js/{i <script>' -e 'r clientpack/dcwebui.min.js' -e 'a </script>' -e 'd}' \
 | 
				
			||||||
 | 
							| sed -e '/socket.io-1.7.2.js/{i <script>' -e 'r clientpack/socket.io-1.7.2.js' -e 'a </script>' -e 'd}' \
 | 
				
			||||||
 | 
							> clientpack/index.packed.htm
 | 
				
			||||||
 | 
						mv clientpack/index.packed.htm clientpack/index.htm
 | 
				
			||||||
 | 
						html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm
 | 
				
			||||||
 | 
						mv clientpack/index.min.htm clientpack/index.htm
 | 
				
			||||||
 | 
						rm ./clientpack/*.js
 | 
				
			||||||
 | 
						rm ./clientpack/*.css
 | 
				
			||||||
 | 
						go-bindata -nomemcopy -nometadata -prefix clientpack clientpack
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					$(BINNAME).exe: bindata.go *.go
 | 
				
			||||||
 | 
						GOARCH=386 GOOS=windows go build $(GOFLAGS) -o $(BINNAME).exe
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$(BINNAME): bindata.go *.go
 | 
				
			||||||
 | 
						GOARCH=amd64 GOOS=linux go build $(GOFLAGS) -o $(BINNAME)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					$(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 --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
 | 
				
			||||||
@@ -6,13 +6,48 @@ Written in Golang
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Tags: nmdc
 | 
					Tags: nmdc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This project supercedes [entry=dcwebui]dcwebui[/entry], [entry=flexdc]flexdc[/entry], and [entry=dcwebui2]dcwebui2[/entry].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=UPGRADING FROM DCWEBUI2=
 | 
					=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.
 | 
					- 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.
 | 
				
			||||||
- Future changes to the configuration file since nmdc-webfrontend 1.0.0 are backward compatible (see the changelog for more details).
 | 
					- Future changes to the configuration file since nmdc-webfrontend 1.0.0 are backward compatible (see the changelog for more details).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=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
 | 
				
			||||||
 | 
					    - `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=
 | 
					=CHANGELOG=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2017-10-16 1.2.1
 | 
				
			||||||
 | 
					- Enhancement: Increase scrollback buffer size
 | 
				
			||||||
 | 
					- Fix an issue with missing `contented` upload link once logged in
 | 
				
			||||||
 | 
					- Fix a cosmetic issue with `(0)` appearing in page title
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2017-10-15 1.2.0
 | 
				
			||||||
 | 
					- Feature: Add `contented` integration (set `app.contented_server` in config file)
 | 
				
			||||||
 | 
					- Fix a cosmetic issue with the menu icon on devices without unicode font coverage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2017-02-11 1.1.4
 | 
				
			||||||
 | 
					- Update libnmdc to 0.14
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2017-02-11 1.1.3
 | 
					2017-02-11 1.1.3
 | 
				
			||||||
- Feature: Display user IP address on hover, if available
 | 
					- Feature: Display user IP address on hover, if available
 | 
				
			||||||
- Enhancement: Allow clicking on popup notifications
 | 
					- Enhancement: Allow clicking on popup notifications
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										281
									
								
								bindata.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										281
									
								
								bindata.go
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										184
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										184
									
								
								build.sh
									
									
									
									
									
								
							@@ -1,184 +0,0 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					 | 
				
			||||||
# godist.sh is a template build script for golang applications.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Copyright (c) 2016, The godist.sh Author(s)
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Permission to use, copy, modify, and/or distribute this software for any
 | 
					 | 
				
			||||||
#  purpose with or without fee is hereby granted, provided that the above
 | 
					 | 
				
			||||||
#  copyright notice and this permission notice appear in all copies.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 | 
					 | 
				
			||||||
#  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 | 
					 | 
				
			||||||
#  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 | 
					 | 
				
			||||||
#  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 | 
					 | 
				
			||||||
#  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 | 
					 | 
				
			||||||
#  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 | 
					 | 
				
			||||||
#  PERFORMANCE OF THIS SOFTWARE.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
set -eu
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
DIST_DIR=./_dist
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EXTRA_FILES=(
 | 
					 | 
				
			||||||
	nmdc-webfrontend.conf.SAMPLE
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_package_name() {
 | 
					 | 
				
			||||||
	# Binaries are named after the containing folder.
 | 
					 | 
				
			||||||
	pwd | tr / $'\n' | tail -n1
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
check_dependencies() {
 | 
					 | 
				
			||||||
	# `set -e` will take care of killing the application if the dependency
 | 
					 | 
				
			||||||
	# goes unresolved.
 | 
					 | 
				
			||||||
	which 7z > /dev/null
 | 
					 | 
				
			||||||
	which php > /dev/null
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
get_platform_description() {
 | 
					 | 
				
			||||||
	if [[ $GOOS == windows ]] ; then
 | 
					 | 
				
			||||||
		echo -n "win"
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		echo -n "${GOOS}"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if [[ $GOARCH == 386 ]] ; then
 | 
					 | 
				
			||||||
		echo -n 32
 | 
					 | 
				
			||||||
	elif [[ $GOARCH == amd64 ]] ; then
 | 
					 | 
				
			||||||
		echo -n 64
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		echo -n "-${GOARCH}"
 | 
					 | 
				
			||||||
		if [[ -v $GOARM ]] ; then
 | 
					 | 
				
			||||||
			echo -n "v${GOARM}"
 | 
					 | 
				
			||||||
		fi
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pathfix() {
 | 
					 | 
				
			||||||
	if [[ $(uname -o) == Cygwin ]] ; then
 | 
					 | 
				
			||||||
		cygpath -w "$1"
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		echo "$1"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
single_build() {
 | 
					 | 
				
			||||||
	local version="$1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	# Determine build output name
 | 
					 | 
				
			||||||
	local bin_name=''
 | 
					 | 
				
			||||||
	if [[ $GOOS == windows ]] ; then
 | 
					 | 
				
			||||||
		local_bin_name="$(get_package_name).exe"
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		local_bin_name="$(get_package_name)"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if [[ -f ./$local_bin_name ]] ; then
 | 
					 | 
				
			||||||
		rm -f "./$local_bin_name"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	local tmpdir=$(mktemp -d)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Platform identifier
 | 
					 | 
				
			||||||
	local platform="$(get_platform_description)"
 | 
					 | 
				
			||||||
	echo "[INFO] Building ${version} for ${platform}..."
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Build.
 | 
					 | 
				
			||||||
	# GOARCH/GOOS supplied in function env
 | 
					 | 
				
			||||||
	go build \
 | 
					 | 
				
			||||||
		-a \
 | 
					 | 
				
			||||||
		-ldflags "-s -w -X main.VERSION=nmdc-webfrontend/${version}" \
 | 
					 | 
				
			||||||
		-gcflags "-trimpath=${GOPATH}" \
 | 
					 | 
				
			||||||
		-asmflags "-trimpath=${GOPATH}" \
 | 
					 | 
				
			||||||
		-o "$(pathfix "${tmpdir}/${local_bin_name}")"
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Archive.
 | 
					 | 
				
			||||||
	if [[ ! -d $DIST_DIR ]] ; then
 | 
					 | 
				
			||||||
		mkdir "$DIST_DIR"
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	local archive_name="${DIST_DIR}/$(get_package_name)-${version}-${platform}"
 | 
					 | 
				
			||||||
	if [[ $GOOS == windows ]] ; then
 | 
					 | 
				
			||||||
		archive_name="${archive_name}.7z"
 | 
					 | 
				
			||||||
		7z a -mx9 "$archive_name" "${tmpdir}/${local_bin_name}" "${EXTRA_FILES[@]}" >/dev/null
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		archive_name="${archive_name}.tar.xz"
 | 
					 | 
				
			||||||
		XZ_OPT='-9' tar caf "$archive_name" -C "${tmpdir}" "${local_bin_name}" -C "$(pwd)" "${EXTRA_FILES[@]}" --owner=0 --group=0 >/dev/null
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Cleanup
 | 
					 | 
				
			||||||
	rm -f "${tmpdir}/${local_bin_name}"
 | 
					 | 
				
			||||||
	rmdir "$tmpdir"
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
datestamp() {
 | 
					 | 
				
			||||||
	( TZ=UTC date +%Y%m%d%H%M%SZ )
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
usage() {
 | 
					 | 
				
			||||||
	cat <<EOD
 | 
					 | 
				
			||||||
Usage: ./godist.sh [-v VERSION]
 | 
					 | 
				
			||||||
EOD
 | 
					 | 
				
			||||||
	exit 0
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
main() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	check_dependencies
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if [[ ! -v GOPATH ]] ; then
 | 
					 | 
				
			||||||
		echo "Please set GOPATH." >&2
 | 
					 | 
				
			||||||
		exit 1
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	if [[ ! -d $GOPATH ]] ; then
 | 
					 | 
				
			||||||
		echo "Invalid GOPATH set." >&2
 | 
					 | 
				
			||||||
		exit 1
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	local version=""
 | 
					 | 
				
			||||||
	while getopts ':v:' flag ; do
 | 
					 | 
				
			||||||
		case "$flag" in
 | 
					 | 
				
			||||||
			v)
 | 
					 | 
				
			||||||
				version="$OPTARG"
 | 
					 | 
				
			||||||
			;;
 | 
					 | 
				
			||||||
			*)
 | 
					 | 
				
			||||||
				usage
 | 
					 | 
				
			||||||
			;;
 | 
					 | 
				
			||||||
		esac
 | 
					 | 
				
			||||||
	done
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if [[ $version == "" ]] ; then
 | 
					 | 
				
			||||||
		read -p "Enter version string (blank for timestamp)> " version
 | 
					 | 
				
			||||||
		if [[ $version == "" ]] ; then
 | 
					 | 
				
			||||||
			version=$(datestamp)
 | 
					 | 
				
			||||||
		fi
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if [[ -f ./bindata.go ]] ; then
 | 
					 | 
				
			||||||
		rm ./bindata.go
 | 
					 | 
				
			||||||
	fi
 | 
					 | 
				
			||||||
	php clientpack.php
 | 
					 | 
				
			||||||
	go-bindata -nomemcopy -prefix clientpack clientpack
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	GOARCH=amd64 GOOS=windows single_build "$version"
 | 
					 | 
				
			||||||
	GOARCH=386   GOOS=windows single_build "$version"
 | 
					 | 
				
			||||||
	GOARCH=amd64 GOOS=linux   single_build "$version"
 | 
					 | 
				
			||||||
	GOARCH=386   GOOS=linux   single_build "$version"
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	# Also make source tarball
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	local SOURCE_FILES=(
 | 
					 | 
				
			||||||
		client/
 | 
					 | 
				
			||||||
		build.sh
 | 
					 | 
				
			||||||
		clientpack.php
 | 
					 | 
				
			||||||
		Config.go
 | 
					 | 
				
			||||||
		main.go
 | 
					 | 
				
			||||||
		nmdc-webfrontend.conf.SAMPLE
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
	XZ_OPT='-9' tar caf "_dist/$(get_package_name)-${version}-src.tar.xz" "${SOURCE_FILES[@]}" --owner=0 --group=0 >/dev/null
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	echo "[INFO] Build complete."
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
main "$@"
 | 
					 | 
				
			||||||
@@ -71,10 +71,15 @@ html,body {
 | 
				
			|||||||
	color:black;
 | 
						color:black;
 | 
				
			||||||
	font-weight:bold;
 | 
						font-weight:bold;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	line-height:18px;
 | 
						line-height:0;
 | 
				
			||||||
 | 
						height:18px;
 | 
				
			||||||
	width:18px;
 | 
						width:18px;
 | 
				
			||||||
	text-align:center;
 | 
						text-align:center;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					.menubutton svg {
 | 
				
			||||||
 | 
						width: 18px;
 | 
				
			||||||
 | 
						height: 18px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
.menubutton:hover {
 | 
					.menubutton:hover {
 | 
				
			||||||
	background:white;
 | 
						background:white;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +1,12 @@
 | 
				
			|||||||
/* dcwebui.js */
 | 
					/* dcwebui.js */
 | 
				
			||||||
//IIFEMODE:;(function() {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var SENTINEL_PASSWORD = "************";
 | 
					var SENTINEL_PASSWORD = "************";
 | 
				
			||||||
var CHAT_SCROLLBACK_LIMIT = 50; // Once over 2x $limit, the first $limit will be trimmed off the list
 | 
					var CHAT_SCROLLBACK_LIMIT = 200; // Once over 2x $limit, the first $limit will be trimmed off the list
 | 
				
			||||||
var EXTERN_ROOT = window.location.protocol + "//" + window.location.host + "/";
 | 
					var EXTERN_ROOT = window.location.protocol + "//" + window.location.host + "/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var $ = function(s) {
 | 
					var el = function(s) {
 | 
				
			||||||
	// There used to be a querySelectorAll implementation, but, better that we don't have
 | 
						// There used to be a querySelectorAll implementation, but, better that we don't have
 | 
				
			||||||
	//  potentially-incompatible implementations if this one does actually work.
 | 
						//  potentially-incompatible implementations if this one does actually work.
 | 
				
			||||||
	// i'm not writing a selector engine...
 | 
						// i'm not writing a selector engine...
 | 
				
			||||||
@@ -179,7 +178,7 @@ var notify = function(title, body, tab) {
 | 
				
			|||||||
/* Tab writers */ 
 | 
					/* Tab writers */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var write = function(tab) {
 | 
					var write = function(tab) {
 | 
				
			||||||
	var $tab = $('#inner-'+tab);
 | 
						var $tab = el('#inner-'+tab);
 | 
				
			||||||
	return {
 | 
						return {
 | 
				
			||||||
		'cls': function() {
 | 
							'cls': function() {
 | 
				
			||||||
			$tab.innerHTML = '';
 | 
								$tab.innerHTML = '';
 | 
				
			||||||
@@ -255,7 +254,7 @@ var userlist = {
 | 
				
			|||||||
	'add': function(u) {
 | 
						'add': function(u) {
 | 
				
			||||||
		if (this.has(u)) return;
 | 
							if (this.has(u)) return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		var userlists = $(".userlist");
 | 
							var userlists = el(".userlist");
 | 
				
			||||||
		for (var l = 0, e = userlists.length; l !== e; ++l) {
 | 
							for (var l = 0, e = userlists.length; l !== e; ++l) {
 | 
				
			||||||
			var userlist = userlists[l];
 | 
								var userlist = userlists[l];
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
@@ -284,7 +283,7 @@ var userlist = {
 | 
				
			|||||||
		return this;
 | 
							return this;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'del': function(u) {
 | 
						'del': function(u) {
 | 
				
			||||||
		var userlists = $(".userlist");
 | 
							var userlists = el(".userlist");
 | 
				
			||||||
		for (var l = 0, e = userlists.length; l !== e; ++l) {
 | 
							for (var l = 0, e = userlists.length; l !== e; ++l) {
 | 
				
			||||||
			if (! userlists[l].children) continue;
 | 
								if (! userlists[l].children) continue;
 | 
				
			||||||
			var userlist = userlists[l];
 | 
								var userlist = userlists[l];
 | 
				
			||||||
@@ -301,7 +300,7 @@ var userlist = {
 | 
				
			|||||||
		return this;
 | 
							return this;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'clear': function() {
 | 
						'clear': function() {
 | 
				
			||||||
		var userlists = $(".userlist");
 | 
							var userlists = el(".userlist");
 | 
				
			||||||
		for (var i in userlists) {
 | 
							for (var i in userlists) {
 | 
				
			||||||
			if (! userlists[i].children) continue;
 | 
								if (! userlists[i].children) continue;
 | 
				
			||||||
			var userlist = userlists[i];
 | 
								var userlist = userlists[i];
 | 
				
			||||||
@@ -314,7 +313,7 @@ var userlist = {
 | 
				
			|||||||
		return this;
 | 
							return this;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'names': function() {
 | 
						'names': function() {
 | 
				
			||||||
		var userlist = $(".userlist")[0].children;
 | 
							var userlist = el(".userlist")[0].children;
 | 
				
			||||||
		var ret = [];
 | 
							var ret = [];
 | 
				
			||||||
		for (var i = 0, e = userlist.length; i < e; ++i) {
 | 
							for (var i = 0, e = userlist.length; i < e; ++i) {
 | 
				
			||||||
			ret.push( textContent(userlist[i]) );
 | 
								ret.push( textContent(userlist[i]) );
 | 
				
			||||||
@@ -322,14 +321,14 @@ var userlist = {
 | 
				
			|||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'has': function(u) {
 | 
						'has': function(u) {
 | 
				
			||||||
		return $(".user-" + b64(u)).length !== 0; /* there are two - large and non-large */
 | 
							return el(".user-" + b64(u)).length !== 0; /* there are two - large and non-large */
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'count': function() {
 | 
						'count': function() {
 | 
				
			||||||
		return $(".userlist")[0].children.length;
 | 
							return el(".userlist")[0].children.length;
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	'setInfo': function(nick, props) {
 | 
						'setInfo': function(nick, props) {
 | 
				
			||||||
		var baseClass = "user-" + b64(nick);
 | 
							var baseClass = "user-" + b64(nick);
 | 
				
			||||||
		var $el = $("." + baseClass);
 | 
							var $el = el("." + baseClass);
 | 
				
			||||||
		var prop_str = [];
 | 
							var prop_str = [];
 | 
				
			||||||
		if (props.Description.length > 0) {
 | 
							if (props.Description.length > 0) {
 | 
				
			||||||
			prop_str.push(props.Description);
 | 
								prop_str.push(props.Description);
 | 
				
			||||||
@@ -358,7 +357,7 @@ var userlist = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var submit = function() {
 | 
					var submit = function() {
 | 
				
			||||||
	var str = $("#chatbox").value;
 | 
						var str = el("#chatbox").value;
 | 
				
			||||||
	if (! str.length) return;
 | 
						if (! str.length) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (hub_state === STATE_READY_FOR_LOGIN) {
 | 
						if (hub_state === STATE_READY_FOR_LOGIN) {
 | 
				
			||||||
@@ -401,7 +400,7 @@ var submit = function() {
 | 
				
			|||||||
		write("tab-main").system("Invalid internal state.");
 | 
							write("tab-main").system("Invalid internal state.");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#chatbox").value = '';
 | 
						el("#chatbox").value = '';
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* page visibility */
 | 
					/* page visibility */
 | 
				
			||||||
@@ -448,13 +447,13 @@ var pagevis_setup = function(fnActive, fnInactive) {
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
var tab_set = function(tab) {
 | 
					var tab_set = function(tab) {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var tabs = $(".tabpane");
 | 
						var tabs = el(".tabpane");
 | 
				
			||||||
	for (var i in tabs) {
 | 
						for (var i in tabs) {
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			tabs[i].style.display = (tabs[i].id === tab ? 'block' : 'none');
 | 
								tabs[i].style.display = (tabs[i].id === tab ? 'block' : 'none');
 | 
				
			||||||
		} catch (e) {};
 | 
							} catch (e) {};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	var tabitems = $(".tabitem");
 | 
						var tabitems = el(".tabitem");
 | 
				
			||||||
	for (var i in tabitems) {
 | 
						for (var i in tabitems) {
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			// Update UNREAD/SELECTED flags for the target
 | 
								// Update UNREAD/SELECTED flags for the target
 | 
				
			||||||
@@ -482,13 +481,13 @@ var tab_set = function(tab) {
 | 
				
			|||||||
	updateTitle();
 | 
						updateTitle();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	write(tab).scroll();
 | 
						write(tab).scroll();
 | 
				
			||||||
	$("#chatbox").focus();
 | 
						el("#chatbox").focus();
 | 
				
			||||||
	last_tab = tab;
 | 
						last_tab = tab;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var tab_new = function(id, name) {
 | 
					var tab_new = function(id, name) {
 | 
				
			||||||
	appendInnerHTML($("#bar"),
 | 
						appendInnerHTML(el("#bar"),
 | 
				
			||||||
		' <div class="tabitem" data-tab="tab-ext-'+id+'" id="tabitem-tab-ext-'+id+'">'+
 | 
							' <div class="tabitem" data-tab="tab-ext-'+id+'" id="tabitem-tab-ext-'+id+'">'+
 | 
				
			||||||
			'<span class="tab-label">'+
 | 
								'<span class="tab-label">'+
 | 
				
			||||||
				hesc(name)+
 | 
									hesc(name)+
 | 
				
			||||||
@@ -496,7 +495,7 @@ var tab_new = function(id, name) {
 | 
				
			|||||||
			'<a class="tab-closer" data-tab="tab-ext-'+id+'">×</a>'+
 | 
								'<a class="tab-closer" data-tab="tab-ext-'+id+'">×</a>'+
 | 
				
			||||||
		'</div> '
 | 
							'</div> '
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
	appendInnerHTML($("#extratabs"),
 | 
						appendInnerHTML(el("#extratabs"),
 | 
				
			||||||
		' <div class="tabpane content placement-mid" id="tab-ext-'+id+'" style="display:none;">'+
 | 
							' <div class="tabpane content placement-mid" id="tab-ext-'+id+'" style="display:none;">'+
 | 
				
			||||||
			'<div class="content-inner" id="inner-tab-ext-'+id+'"></div>'+
 | 
								'<div class="content-inner" id="inner-tab-ext-'+id+'"></div>'+
 | 
				
			||||||
		'</div>'
 | 
							'</div>'
 | 
				
			||||||
@@ -509,11 +508,11 @@ var tab_free = function(id) {
 | 
				
			|||||||
	if (id === "tab-main") return;
 | 
						if (id === "tab-main") return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// remove tab item and body
 | 
						// remove tab item and body
 | 
				
			||||||
	var el = $("#tabitem-"+id);
 | 
						var $el = el("#tabitem-"+id);
 | 
				
			||||||
	el.parentNode.removeChild(el);
 | 
						$el.parentNode.removeChild($el);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var el = $("#"+id);
 | 
						$el = el("#"+id);
 | 
				
			||||||
	el.parentNode.removeChild(el);
 | 
						$el.parentNode.removeChild($el);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	// clear from PM tabs
 | 
						// clear from PM tabs
 | 
				
			||||||
	for (var i in pm_tabs) {
 | 
						for (var i in pm_tabs) {
 | 
				
			||||||
@@ -547,7 +546,7 @@ var noprop = function(ev) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var tab_addHandlers = function() {
 | 
					var tab_addHandlers = function() {
 | 
				
			||||||
	var tabitems = $(".tabitem");
 | 
						var tabitems = el(".tabitem");
 | 
				
			||||||
	for (var i = 0; i < tabitems.length; i++) {
 | 
						for (var i = 0; i < tabitems.length; i++) {
 | 
				
			||||||
		if (! tabitems[i]) continue;
 | 
							if (! tabitems[i]) continue;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -558,7 +557,7 @@ var tab_addHandlers = function() {
 | 
				
			|||||||
		};
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var tabclosers = $(".tab-closer");
 | 
						var tabclosers = el(".tab-closer");
 | 
				
			||||||
	for (var i = 0; i < tabclosers.length; i++) {
 | 
						for (var i = 0; i < tabclosers.length; i++) {
 | 
				
			||||||
		if (! tabclosers[i]) continue;
 | 
							if (! tabclosers[i]) continue;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -598,7 +597,7 @@ var tabcomplete_state = '';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var tabcompletion_start = function(direction) {
 | 
					var tabcompletion_start = function(direction) {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var cursor = $("#chatbox").value.replace(/^.*\s([^\s]+)$/, '$1');
 | 
						var cursor = el("#chatbox").value.replace(/^.*\s([^\s]+)$/, '$1');
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (tabcomplete_state === '') {
 | 
						if (tabcomplete_state === '') {
 | 
				
			||||||
		// new tab completion
 | 
							// new tab completion
 | 
				
			||||||
@@ -634,10 +633,10 @@ var tabcompletion_start = function(direction) {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	// Replace in textbox
 | 
						// Replace in textbox
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	var chatprefix = $("#chatbox").value.substr(0, $("#chatbox").value.length - cursor.length);
 | 
						var chatprefix = el("#chatbox").value.substr(0, el("#chatbox").value.length - cursor.length);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#chatbox").value = chatprefix + targetName;
 | 
						el("#chatbox").value = chatprefix + targetName;
 | 
				
			||||||
	$("#chatbox").focus();
 | 
						el("#chatbox").focus();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var tabcompletion_inactive = function() {
 | 
					var tabcompletion_inactive = function() {
 | 
				
			||||||
@@ -686,10 +685,17 @@ MenuList.prototype.toggle = function() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* */ 
 | 
					/* */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var menu = new MenuList($("#menubutton"));
 | 
					var menu = new MenuList(el("#menubutton"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
menu.reset = function() {
 | 
					menu.reset = function() {
 | 
				
			||||||
	this.clear();
 | 
						this.clear();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (contented_url.length > 0) {
 | 
				
			||||||
 | 
							menu.add("Upload", function() {
 | 
				
			||||||
 | 
								contented_load();
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	this.add(joinparts_getstr(),  toggle_joinparts);
 | 
						this.add(joinparts_getstr(),  toggle_joinparts);
 | 
				
			||||||
	this.add(desktop_notifications_fmtstr(), desktop_notifications_toggle);
 | 
						this.add(desktop_notifications_fmtstr(), desktop_notifications_toggle);
 | 
				
			||||||
	this.add(warnonclose_fmtstr(), warnonclose_toggle);
 | 
						this.add(warnonclose_fmtstr(), warnonclose_toggle);
 | 
				
			||||||
@@ -782,14 +788,18 @@ var toggle_joinparts = function(ev) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var updateTitle = function() {
 | 
					var updateTitle = function() {
 | 
				
			||||||
	var prefix = "";
 | 
						var prefix = "";
 | 
				
			||||||
	var unrTabs = $(".unread");
 | 
						var unrTabs = el(".unread");
 | 
				
			||||||
	if (unrTabs.length === 1 && unrTabs[0].getAttribute('data-tab') == "tab-main") {
 | 
						if (unrTabs.length === 1 && unrTabs[0].getAttribute('data-tab') == "tab-main") {
 | 
				
			||||||
		prefix = "[" + mainchat_unread_count + " NEW] "
 | 
							prefix = "[" + mainchat_unread_count + " NEW] "
 | 
				
			||||||
	} else if (unrTabs.length > 0) {
 | 
						} else if (unrTabs.length > 0) {
 | 
				
			||||||
		prefix = "[NEW PM] "
 | 
							prefix = "[NEW PM] "
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	document.title = prefix + hub_hubname + " ("+userlist.count()+")"
 | 
						var suffix = "";
 | 
				
			||||||
 | 
						if (userlist.count() > 0) {
 | 
				
			||||||
 | 
							suffix = " ("+userlist.count()+")";
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						document.title = prefix + hub_hubname + suffix;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var sock = {};
 | 
					var sock = {};
 | 
				
			||||||
@@ -883,7 +893,7 @@ var scrollback_move = function(delta) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#chatbox").value = chat_scrollback[chat_scrollback_index];
 | 
						el("#chatbox").value = chat_scrollback[chat_scrollback_index];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* */
 | 
					/* */
 | 
				
			||||||
@@ -908,25 +918,25 @@ var transition = function(new_state) {
 | 
				
			|||||||
	switch(new_state) {
 | 
						switch(new_state) {
 | 
				
			||||||
		case STATE_DISCONNECTED: {
 | 
							case STATE_DISCONNECTED: {
 | 
				
			||||||
			userlist.clear();		
 | 
								userlist.clear();		
 | 
				
			||||||
			$("#chatbox").disabled = true;
 | 
								el("#chatbox").disabled = true;
 | 
				
			||||||
			$("#chatbox").value = ''; // clear
 | 
								el("#chatbox").value = ''; // clear
 | 
				
			||||||
		} break;
 | 
							} break;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		case STATE_READY_FOR_LOGIN: {
 | 
							case STATE_READY_FOR_LOGIN: {
 | 
				
			||||||
			userlist.clear();
 | 
								userlist.clear();
 | 
				
			||||||
			$("#chatbox").spellcheck = false;
 | 
								el("#chatbox").spellcheck = false;
 | 
				
			||||||
			$("#chatbox").disabled = false;
 | 
								el("#chatbox").disabled = false;
 | 
				
			||||||
			$("#chatbox").value = ''; // clear
 | 
								el("#chatbox").value = ''; // clear
 | 
				
			||||||
		} break;
 | 
							} break;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		case STATE_CONNECTING: {
 | 
							case STATE_CONNECTING: {
 | 
				
			||||||
			$("#chatbox").disabled = true;
 | 
								el("#chatbox").disabled = true;
 | 
				
			||||||
		} break;
 | 
							} break;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		case STATE_ACTIVE: {			
 | 
							case STATE_ACTIVE: {			
 | 
				
			||||||
			write("tab-main").system("Now talking on "+hub_hubname);
 | 
								write("tab-main").system("Now talking on "+hub_hubname);
 | 
				
			||||||
			$("#chatbox").disabled = false;
 | 
								el("#chatbox").disabled = false;
 | 
				
			||||||
			$("#chatbox").spellcheck = true;
 | 
								el("#chatbox").spellcheck = true;
 | 
				
			||||||
		} break;
 | 
							} break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@@ -936,12 +946,49 @@ var tab_is_visible = function(tabref) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var tab_mark_unread = function(tabref) {
 | 
					var tab_mark_unread = function(tabref) {
 | 
				
			||||||
	if ($("#tabitem-"+tabref).className.indexOf('unread') === -1) {
 | 
						if (el("#tabitem-"+tabref).className.indexOf('unread') === -1) {
 | 
				
			||||||
		$("#tabitem-"+tabref).className += " unread";
 | 
							el("#tabitem-"+tabref).className += " unread";
 | 
				
			||||||
		updateTitle();
 | 
							updateTitle();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var contented_url = "";
 | 
				
			||||||
 | 
					var contented_loaded_sdk = false;
 | 
				
			||||||
 | 
					var contented_load = function() {
 | 
				
			||||||
 | 
						if (contented_url.length === 0) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						var onceSDKLoaded = function() {
 | 
				
			||||||
 | 
							contented.init("#inner-tab-main", function(items) {
 | 
				
			||||||
 | 
								var val = el("#chatbox").value;
 | 
				
			||||||
 | 
								for (var i = 0; i < items.length; ++i) {
 | 
				
			||||||
 | 
									if (val.length > 0) {
 | 
				
			||||||
 | 
										val += " ";
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									val += contented.getPreviewURL(items[i]);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								el("#chatbox").value = val;
 | 
				
			||||||
 | 
							});
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if (contented_loaded_sdk) {
 | 
				
			||||||
 | 
							onceSDKLoaded();
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							var scriptElement = document.createElement('script');
 | 
				
			||||||
 | 
							scriptElement.onload = function() {
 | 
				
			||||||
 | 
								contented_loaded_sdk = true;
 | 
				
			||||||
 | 
								onceSDKLoaded();
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
							scriptElement.src = contented_url + "sdk.js";
 | 
				
			||||||
 | 
							document.body.appendChild(scriptElement);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
window.onload = function() {
 | 
					window.onload = function() {
 | 
				
			||||||
	write("tab-main").system("Communicating with server...");
 | 
						write("tab-main").system("Communicating with server...");
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -951,13 +998,13 @@ window.onload = function() {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	// HTML event handlers
 | 
						// HTML event handlers
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#form-none").onsubmit = function(ev) {
 | 
						el("#form-none").onsubmit = function(ev) {
 | 
				
			||||||
		submit();
 | 
							submit();
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return noprop(ev); // don't submit form
 | 
							return noprop(ev); // don't submit form
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#chatbox").onkeydown = function(ev) {
 | 
						el("#chatbox").onkeydown = function(ev) {
 | 
				
			||||||
		if (ev.keyCode === 9 /* Tab */) {
 | 
							if (ev.keyCode === 9 /* Tab */) {
 | 
				
			||||||
			tabcompletion_start( ev.shiftKey ? -1 : 1 );
 | 
								tabcompletion_start( ev.shiftKey ? -1 : 1 );
 | 
				
			||||||
			return noprop(ev);
 | 
								return noprop(ev);
 | 
				
			||||||
@@ -985,7 +1032,7 @@ window.onload = function() {
 | 
				
			|||||||
		usermenu.hide();
 | 
							usermenu.hide();
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	$("#menubutton").onclick = function(ev) {
 | 
						el("#menubutton").onclick = function(ev) {
 | 
				
			||||||
		menu.toggle();
 | 
							menu.toggle();
 | 
				
			||||||
		return noprop(ev);
 | 
							return noprop(ev);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
@@ -1043,7 +1090,7 @@ window.onload = function() {
 | 
				
			|||||||
		if (pre_login.indexOf(":") !== -1) {
 | 
							if (pre_login.indexOf(":") !== -1) {
 | 
				
			||||||
			pre_login = pre_login.substr(0, pre_login.indexOf(":")) + ":" + SENTINEL_PASSWORD;
 | 
								pre_login = pre_login.substr(0, pre_login.indexOf(":")) + ":" + SENTINEL_PASSWORD;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		$("#chatbox").value = pre_login;
 | 
							el("#chatbox").value = pre_login;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (have_cleared_once) {
 | 
							if (have_cleared_once) {
 | 
				
			||||||
			// re-log-in automatically			
 | 
								// re-log-in automatically			
 | 
				
			||||||
@@ -1137,6 +1184,8 @@ window.onload = function() {
 | 
				
			|||||||
	sock.on('usercommand', function(data) {
 | 
						sock.on('usercommand', function(data) {
 | 
				
			||||||
		process_usercommand(data);
 | 
							process_usercommand(data);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
						sock.on('contented', function(url) {
 | 
				
			||||||
 | 
							contented_url = url;
 | 
				
			||||||
 | 
							menu.reset(); // sent before login
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					 | 
				
			||||||
//IIFEMODE:})();
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,11 @@
 | 
				
			|||||||
	</head>
 | 
						</head>
 | 
				
			||||||
	<body>
 | 
						<body>
 | 
				
			||||||
		<div class="tabbar placement-top" id="bar">
 | 
							<div class="tabbar placement-top" id="bar">
 | 
				
			||||||
			<div class="menubutton" id="menubutton">☰</div>
 | 
								<div class="menubutton" id="menubutton">
 | 
				
			||||||
 | 
									<svg viewBox="0 0 24 24">
 | 
				
			||||||
 | 
										<path fill="#000000" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" />
 | 
				
			||||||
 | 
									</svg>
 | 
				
			||||||
 | 
								</div>
 | 
				
			||||||
			<div class="tabitem selected" data-tab="tab-main" id="tabitem-tab-main">
 | 
								<div class="tabitem selected" data-tab="tab-main" id="tabitem-tab-main">
 | 
				
			||||||
				<span class="tab-label">
 | 
									<span class="tab-label">
 | 
				
			||||||
					Main
 | 
										Main
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,56 +0,0 @@
 | 
				
			|||||||
#!/usr/bin/php
 | 
					 | 
				
			||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Dependencies:
 | 
					 | 
				
			||||||
#   - PHP
 | 
					 | 
				
			||||||
#   - Uglifyjs (`npm install -g uglifyjs`)
 | 
					 | 
				
			||||||
#   - Lessc (`npm install -g less`)
 | 
					 | 
				
			||||||
#   - Lessc minifier (`npm install -g less-plugin-clean-css`)
 | 
					 | 
				
			||||||
#   - HTML minifier (`npm install -g html-minifier`)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "Compressing/minifying web resources...\n";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (is_dir('clientpack')) {
 | 
					 | 
				
			||||||
	`rm -r clientpack`;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`cp -r client clientpack`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Toggle IIFE on
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`sed -i -re 's~//IIFEMODE:~~g' clientpack/dcwebui.js`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Minify JS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`uglifyjs clientpack/dcwebui.js -o clientpack/dcwebui.min.js -c -m`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Minify CSS
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`lessc --clean-css clientpack/dcwebui.css clientpack/dcwebui.min.css`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Embed css into HTML file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$html_content = file_get_contents('clientpack/index.htm');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$html_content = preg_replace_callback('~<link[^>]+dcwebui.css[^>]*>~', function() { return '<style type="text/css">'.file_get_contents('clientpack/dcwebui.min.css').'</style>'; }, $html_content);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Embed JS into HTML file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$html_content = preg_replace_callback('~<script[^>]+dcwebui.js[^>]*>~', function() { return '<script type="text/javascript">'.file_get_contents('clientpack/dcwebui.min.js').'</script>'; }, $html_content);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Embed socketio into HTML file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
define('SIO_NAME', 'socket.io-1.7.2.js');
 | 
					 | 
				
			||||||
$html_content = preg_replace_callback('~<script[^>]+'.SIO_NAME.'[^>]*>~', function() { return '<script type="text/javascript">'.file_get_contents('clientpack/'.SIO_NAME).'</script>'; }, $html_content);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Minify the combined file
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
file_put_contents('clientpack/index.htm', $html_content);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`html-minifier --collapse-whitespace -o clientpack/index.min.htm clientpack/index.htm`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Clean up files
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
`rm clientpack/{index.htm,dcwebui{.min,}.js,dcwebui{.min,}.css}`;
 | 
					 | 
				
			||||||
unlink('clientpack/'.SIO_NAME);
 | 
					 | 
				
			||||||
rename('clientpack/index.min.htm', 'clientpack/index.htm');
 | 
					 | 
				
			||||||
							
								
								
									
										30
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								main.go
									
									
									
									
									
								
							@@ -5,8 +5,9 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"log"
 | 
						"log"
 | 
				
			||||||
 | 
						"mime"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strings"
 | 
						"path/filepath"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"code.ivysaur.me/libnmdc"
 | 
						"code.ivysaur.me/libnmdc"
 | 
				
			||||||
	"github.com/googollee/go-socket.io"
 | 
						"github.com/googollee/go-socket.io"
 | 
				
			||||||
@@ -170,6 +171,10 @@ func (this *App) SocketIOServer(so socketio.Socket) {
 | 
				
			|||||||
	so.Emit("raw", this.cfg.App.MotdHTML+"<br>")
 | 
						so.Emit("raw", this.cfg.App.MotdHTML+"<br>")
 | 
				
			||||||
	so.Emit("sys", "Enter a name to connect as (or name:pass for a registered nick)")
 | 
						so.Emit("sys", "Enter a name to connect as (or name:pass for a registered nick)")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if len(this.cfg.App.ContentedServer) > 0 {
 | 
				
			||||||
 | 
							so.Emit("contented", this.cfg.App.ContentedServer)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	doneChan := make(chan struct{}, 0)
 | 
						doneChan := make(chan struct{}, 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	so.On("hello", func(data map[string]string) {
 | 
						so.On("hello", func(data map[string]string) {
 | 
				
			||||||
@@ -200,27 +205,8 @@ func (this *App) StaticRequestHandler(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	knownContentTypes := map[string]string{
 | 
						w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(fileName)))
 | 
				
			||||||
		".htm": "text/html",
 | 
						w.Header().Set("Content-Length", fmt.Sprintf("%d", len(data)))
 | 
				
			||||||
		".png": "image/png",
 | 
					 | 
				
			||||||
		".ico": "image/x-icon",
 | 
					 | 
				
			||||||
		// No CSS/JS since they're embedded in the HTML
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	foundMime := false
 | 
					 | 
				
			||||||
	for ext, mimeType := range knownContentTypes {
 | 
					 | 
				
			||||||
		if strings.HasSuffix(fileName, ext) {
 | 
					 | 
				
			||||||
			w.Header().Set("Content-Type", mimeType)
 | 
					 | 
				
			||||||
			foundMime = true
 | 
					 | 
				
			||||||
			break
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if !foundMime {
 | 
					 | 
				
			||||||
		w.Header().Set("Content-Type", "application/x-octet-stream")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	dataInfo, _ := AssetInfo(fileName)
 | 
					 | 
				
			||||||
	w.Header().Set("Content-Length", fmt.Sprintf("%d", dataInfo.Size()))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	w.Write(data)
 | 
						w.Write(data)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user