Compare commits
52 Commits
Author | SHA1 | Date |
---|---|---|
|
96ea435179 | |
|
c638819b00 | |
|
735bfd8122 | |
|
7458af2162 | |
|
b09306940e | |
|
40689e8761 | |
|
dc905f7a39 | |
|
782817521c | |
|
ad52b03d8f | |
|
aab8d232b5 | |
|
7fa4889dce | |
|
73ef74d479 | |
|
20ea487d06 | |
|
7a8f54a192 | |
|
37500b9496 | |
|
572a5f37a6 | |
|
3300be8371 | |
|
019d2961e5 | |
|
797edb1d5c | |
|
dead6fe01f | |
|
0775662416 | |
|
014c9d5e3a | |
|
47d10c231f | |
|
1579e18f69 | |
|
305f4d3e41 | |
|
e591cdd685 | |
|
316f169bc0 | |
|
9242d7a35f | |
|
507a8117e1 | |
|
28e0f09a27 | |
|
99c773b65b | |
|
6e4c5102c4 | |
|
6ed4a6924c | |
|
50d4acb9c1 | |
|
f85d3226e0 | |
|
d827c398f0 | |
|
c6be85e92f | |
|
1f00dfb03e | |
|
892b4cc2a8 | |
|
ded9d338cc | |
|
2b1eed1409 | |
|
b283823ffe | |
|
fface98131 | |
|
99f38da618 | |
|
fa6dce4c56 | |
|
8d12780c4e | |
|
0fec5f03a8 | |
|
0ef6c32701 | |
|
5cf2867741 | |
|
89610b4a7b | |
|
f0e4214d46 | |
|
6661761128 |
|
@ -3,3 +3,5 @@ go.mod
|
|||
go.sum
|
||||
|
||||
go.wit.com
|
||||
gowebd
|
||||
files/
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
go.wit.com {
|
||||
encode zstd gzip
|
||||
reverse_proxy localhost:3000
|
||||
}
|
78
Makefile
78
Makefile
|
@ -1,15 +1,75 @@
|
|||
all:
|
||||
git pull
|
||||
echo "build it!"
|
||||
GO111MODULE=off go build -v -x
|
||||
su -c ./go.wit.com
|
||||
# su -c "setcap 'cap_net_bind_service=+ep' go.wit.com"
|
||||
.PHONY: build
|
||||
|
||||
VERSION = $(shell git describe --tags)
|
||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||
|
||||
all: build
|
||||
@echo "make build # build"
|
||||
@echo "make clean # clean build files"
|
||||
@echo "make run # build and run on port 2233"
|
||||
@echo "make debian # will build a debian package"
|
||||
@echo ""
|
||||
@echo "make restart # restart the daemon"
|
||||
@echo "make enable # enable daemon on boot"
|
||||
@echo "make log # watch the daemon log"
|
||||
|
||||
build: goimports
|
||||
GO111MODULE=off go build \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
verbose:
|
||||
GO111MODULE=off go build -v -x \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
install:
|
||||
GO111MODULE=off go install \
|
||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||
|
||||
prod: build
|
||||
make stop
|
||||
cp gowebd /usr/bin/gowebd
|
||||
# allow the binary to open ports below 1024
|
||||
setcap 'cap_net_bind_service=+ep' /usr/bin/gowebd
|
||||
make start
|
||||
make log
|
||||
|
||||
log:
|
||||
@#systemctl status gowebd.service
|
||||
journalctl -f -xeu gowebd.service
|
||||
|
||||
enable:
|
||||
systemctl enable gowebd.service
|
||||
|
||||
restart:
|
||||
systemctl stop gowebd.service
|
||||
systemctl start gowebd.service
|
||||
|
||||
start:
|
||||
systemctl start gowebd.service
|
||||
|
||||
stop:
|
||||
systemctl stop gowebd.service
|
||||
|
||||
run: build
|
||||
./gowebd --port 2233 --repomap resources/repomap --hostname test.wit.com
|
||||
# setcap 'cap_net_bind_service=+ep' gowebd # allow the binary to open ports below 1024
|
||||
|
||||
goimports:
|
||||
reset
|
||||
goimports -w *.go
|
||||
|
||||
redomod:
|
||||
clean:
|
||||
rm -f go.*
|
||||
GO111MODULE= go mod init
|
||||
GO111MODULE= go mod tidy
|
||||
rm -f go.wit.com
|
||||
rm -f gowebd
|
||||
go-mod-clean purge
|
||||
|
||||
# makes a .deb package
|
||||
debian:
|
||||
rm ~/incoming/gowebd*.deb
|
||||
go-deb --no-gui --keep-files --repo go.wit.com/apps/gowebd
|
||||
|
||||
squash-the-last-3-commits-together:
|
||||
git rebase -i HEAD~3
|
||||
git fsck
|
||||
git prune
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
makes the website go.wit.com
|
||||
|
||||
TODO: make it generic so it can use different DNS names
|
19
args.go
19
args.go
|
@ -1,19 +0,0 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
this parses the command line arguements
|
||||
|
||||
this enables command line options from other packages like 'gui' and 'log'
|
||||
*/
|
||||
|
||||
import (
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
)
|
||||
|
||||
var args struct {
|
||||
ListRepos bool `arg:"--list-repos" help:"list all repositories"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
arg.MustParse(&args)
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
/*
|
||||
this parses the command line arguements
|
||||
this enables command line options from other packages like 'gui' and 'log'
|
||||
*/
|
||||
|
||||
import (
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
)
|
||||
|
||||
var argv args
|
||||
|
||||
type args struct {
|
||||
ListRepos bool `arg:"--list-repos" help:"list all repositories"`
|
||||
Port int `arg:"--port" default:"2520" help:"port to run on"`
|
||||
RepoMap string `arg:"--repomap" default:"/etc/gowebd/repomap" help:"repomap file"`
|
||||
Hostname string `arg:"--hostname" default:"go.wit.com" help:"hostname to use"`
|
||||
}
|
||||
|
||||
func (args) Version() string {
|
||||
return "gowebd " + VERSION + " Built on " + BUILDTIME
|
||||
}
|
||||
|
||||
func init() {
|
||||
arg.MustParse(&argv)
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
# this is the systemd control file
|
||||
mkdir -p files/lib/systemd/system/
|
||||
cp gowebd.service files/lib/systemd/system/
|
||||
|
||||
# caddy file. propose this as the dir structure caddy should use
|
||||
mkdir -p files/etc/gowebd/
|
||||
cp Caddyfile.go.wit.com files/etc/gowebd/
|
||||
cp resources/Makefile files/etc/gowebd/
|
||||
|
||||
# share dir
|
||||
mkdir -p files/usr/share/gowebd/
|
||||
cp Makefile files/usr/share/gowebd/
|
||||
cp -a resources/repomap files/usr/share/gowebd/repomap
|
||||
cp -a resources files/usr/share/gowebd/
|
|
@ -0,0 +1,11 @@
|
|||
Source: gowebd
|
||||
Build-Depends: golang
|
||||
Package: gowebd
|
||||
Maintainer: Jeff Carr <jcarr@wit.com>
|
||||
Architecture: amd64
|
||||
Depends: caddy
|
||||
URL: https://go.wit.com/apps/go.wit.com
|
||||
Description: the go.wit.com website integration with pkg.go.dev
|
||||
generates a simple website for integration with golang's
|
||||
packaging system at http://pkg.go.dev/
|
||||
TODO: generalize this so other people can use it
|
|
@ -10,7 +10,7 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func dumpClient(r *http.Request) {
|
||||
func dumpClient(accessf, clientf *os.File, r *http.Request) {
|
||||
var host, url, proto, addr, agent string
|
||||
|
||||
host = r.Host
|
||||
|
@ -105,8 +105,6 @@ func registerClient(f *os.File, r *http.Request) bool {
|
|||
if name == "Gopath" {
|
||||
gopath = value
|
||||
}
|
||||
// Giturl https://git.wit.org/gui/go-gui-toolkits.git
|
||||
// Headers: Gopath
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func okExit(thing string) {
|
||||
log.Info(thing, "ok")
|
||||
// log.Info("Finished go-clean on", check.GetGoPath(), "ok")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func badExit(err error) {
|
||||
log.Info("go-gui-toolkits failed: ", err)
|
||||
os.Exit(-1)
|
||||
}
|
200
files/index.html
200
files/index.html
|
@ -1,200 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="skeleton.v2.css" />
|
||||
<style>
|
||||
#footer {
|
||||
position: fixed;
|
||||
padding: 1% 0% 1% 0%; /* top left bottom right */
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
/* Height of the footer*/
|
||||
height: 40px;
|
||||
background: lightgrey;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</html>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<table class="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Package</th>
|
||||
<th>go get</th>
|
||||
<th>Authoritative sources (IPv6 only)</th>
|
||||
<th>github mirror</th>
|
||||
<th>Documentation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
<tr> <td><h5>log/ (needed for the gui)</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<tr>
|
||||
<td>log</td>
|
||||
<td> <a href="//go.wit.com/log">go.wit.com/log</a></td>
|
||||
<td> <a href="//git.wit.org/wit/log">git.wit.org/wit/log</a></td>
|
||||
<td> <a href="//github.com/wit-go/log">github.com/wit-go/log</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/log"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
|
||||
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
|
||||
<tr> <td><h5>gui/ packages</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<tr>
|
||||
<td>gui/gui</td>
|
||||
<td> <a href="//go.wit.com/gui/gui">go.wit.com/gui/gui</a></td>
|
||||
<td> <a href="//git.wit.org/gui/gui">git.wit.org/gui/gui</a></td>
|
||||
<td> <a href="//github.com/wit-go/gui">github.com/wit-go/gui</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/gui"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/widget</td>
|
||||
<td> <a href="//go.wit.com/gui/widget">go.wit.com/gui/widget</a></td>
|
||||
<td> <a href="//git.wit.org/gui/widget">git.wit.org/gui/widget</a></td>
|
||||
<td> <a href="//github.com/wit-go/widget">github.com/wit-go/widget</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/widget"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/gadgets</td>
|
||||
<td> <a href="//go.wit.com/gui/gadgets">go.wit.com/gui/gadgets</a></td>
|
||||
<td> <a href="//git.wit.org/gui/gadgets">git.wit.org/gui/gadgets</a></td>
|
||||
<td> <a href="//github.com/wit-go/gadgets">github.com/wit-go/gadgets</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/gadgets"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/toolkits</td>
|
||||
<td> <a href="//go.wit.com/gui/toolkits">go.wit.com/gui/toolkits</a></td>
|
||||
<td> <a href="//git.wit.org/gui/toolkits">git.wit.org/gui/toolkits</a></td>
|
||||
<td> <a href="//github.com/wit-go/toolkits">github.com/wit-go/toolkits</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/toolkits"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/debugger</td>
|
||||
<td> <a href="//go.wit.com/gui/debugger">go.wit.com/gui/debugger</a></td>
|
||||
<td> <a href="//git.wit.org/gui/debugger">git.wit.org/gui/debugger</a></td>
|
||||
<td> <a href="//github.com/wit-go/debugger">github.com/wit-go/debugger</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/debugger"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/examples</td>
|
||||
<td> <a href="//go.wit.com/gui/examples">go.wit.com/gui/examples</a></td>
|
||||
<td> <a href="//git.wit.org/gui/examples">git.wit.org/gui/examples</a></td>
|
||||
<td> <a href="//github.com/wit-go/examples">github.com/wit-go/examples</a></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/digitalocean</td>
|
||||
<td> <a href="//go.wit.com/gui/digitalocean">go.wit.com/gui/digitalocean</a></td>
|
||||
<td> <a href="//git.wit.org/gui/digitalocean">git.wit.org/gui/digitalocean</a></td>
|
||||
<td> </td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/digitalocean"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gui/cloudflare</td>
|
||||
<td> <a href="//go.wit.com/gui/cloudflare">go.wit.com/gui/cloudflare</a></td>
|
||||
<td> <a href="//git.wit.org/gui/cloudflare">git.wit.org/gui/cloudflare</a></td>
|
||||
<td> </td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/gui/cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
|
||||
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<tr> <td><h5>Applications</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<tr>
|
||||
<td>control-panel-dns</td>
|
||||
<td> <a href="//go.wit.com/apps/control-panel-dns">go.wit.com/apps/control-panel-dns</a></td>
|
||||
<td> <a href="//git.wit.org/jcarr/control-panel-dns">git.wit.org/jcarr/control-panel-dns</a></td>
|
||||
<td></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/apps/control-panels-dns"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>control-panel-digitalocean</td>
|
||||
<td> <a href="//go.wit.com/apps/control-panel-digitalocean">go.wit.com/apps/control-panel-digitalocean</a></td>
|
||||
<td> <a href="//git.wit.org/wit/control-panel-digitalocean">git.wit.org/wit/control-panel-digitalocean</a></td>
|
||||
<td></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/apps/control-panel-digitalocean"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>control-panel-cloudflare</td>
|
||||
<td> <a href="//go.wit.com/apps/control-panel-cloudflare">go.wit.com/apps/control-panel-cloudflare</a></td>
|
||||
<td> <a href="//git.wit.org/wit/control-panel-cloudflare">git.wit.org/wit/control-panel-cloudflare</a></td>
|
||||
<td></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/control-panels/cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
|
||||
<!--
|
||||
<tr>
|
||||
<td>control-panel-cloudflare</td>
|
||||
<td> <a href="//go.wit.com/control-panel-cloudflare">go.wit.com/control-panel-cloudflare</a></td>
|
||||
<td> <a href="//git.wit.org/wit/control-panel-cloudflare">git.wit.org/wit/control-panel-cloudflare</a></td>
|
||||
<td> <a href="//github.com/wit-go/control-panel-cloudflare">github.com/wit-go/control-panel-cloudflare</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/control-panel-cloudflare"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
<tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<tr> <td><h5>Support packages</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>
|
||||
<!--
|
||||
<tr>
|
||||
<td>go-arg</td>
|
||||
<td> <a href="//go.wit.com/arg">go.wit.com/arg</a></td>
|
||||
<td> <a href="//git.wit.org/gui/arg">git.wit.org/gui/arg</a></td>
|
||||
<td> <a href="//github.com/wit-go/shell">github.com/alexflint/go-arg</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/shell"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
-->
|
||||
<tr>
|
||||
<td>arg</td>
|
||||
<td> <a href="//go.wit.com/arg">go.wit.com/arg</a></td>
|
||||
<td> <a href="//git.wit.org/wit/arg">git.wit.org/wit/arg</a></td>
|
||||
<td> <a href="//github.com/wit-go/go-arg">github.com/wit-go/go-arg</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/arg"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>spew</td>
|
||||
<td> <a href="//go.wit.com/spew">go.wit.com/spew</a></td>
|
||||
<td> <a href="//git.wit.org/wit/spew">git.wit.org/wit/spew</a></td>
|
||||
<td> <a href="//github.com/wit-go/spew">github.com/wit-go/spew</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/spew"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>dnssec</td>
|
||||
<td> <a href="//go.wit.com/dnssec">go.wit.com/dnssec</a></td>
|
||||
<td> <a href="//git.wit.org/wit/dnssec">git.wit.org/wit/dnssec</a></td>
|
||||
<td> <a href="//github.com/wit-go/dnssec">github.com/wit-go/dnssec</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/dnssec"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>shell</td>
|
||||
<td> <a href="//go.wit.com/shell">go.wit.com/shell</a></td>
|
||||
<td> <a href="//git.wit.org/wit/shell">git.wit.org/wit/shell</a></td>
|
||||
<td> <a href="//github.com/wit-go/shell">github.com/wit-go/shell</a></td>
|
||||
<td> <a href="//pkg.go.dev/go.wit.com/shell"> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
|
||||
<!--
|
||||
<tr>
|
||||
<td></td>
|
||||
<td> <a href=""></a> </td>
|
||||
<td> <a href=""> <img src="goReference.svg" alt="Go Reference" /> </a> </td>
|
||||
</tr>
|
||||
-->
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!--
|
||||
<center>
|
||||
<div id="footer">
|
||||
simple go git repo list like <a href=http://go.uber.org/>go.uber.org</a><p>
|
||||
</div>
|
||||
</center>
|
||||
-->
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash -x
|
||||
#
|
||||
|
||||
echo "TODO: make this work"
|
|
@ -1,53 +0,0 @@
|
|||
# gui core packages
|
||||
|
||||
go.wit.com/gui git.wit.org/gui/gui The GUI API intended for Control Panels
|
||||
go.wit.com/widget git.wit.org/gui/widget Primitive Definitions for Buttons, Dropdowns, etc.
|
||||
|
||||
# Tutorials
|
||||
|
||||
go.wit.com/apps/helloworld git.wit.org/gui/helloworld A simple Demo
|
||||
go.wit.com/apps/basicwindow git.wit.org/jcarr/basicwindow A bit more of a Demo
|
||||
go.wit.com/apps/gadgetwindow git.wit.org/jcarr/gadgetwindow A more complicated Demo used for debugging the toolkits
|
||||
|
||||
# Applications
|
||||
|
||||
go.wit.com/apps/autotypist git.wit.org/jcarr/autotypist Wrapper around 'git' and 'go' for these repos
|
||||
go.wit.com/apps/guireleaser git.wit.org/jcarr/guireleaser
|
||||
go.wit.com/apps/go-deb git.wit.org/jcarr/go-deb Turn a GO package into a .deb package
|
||||
go.wit.com/apps/control-panel-digitalocean git.wit.org/wit/control-panel-digitalocean A simple Digital Ocean Control Panel
|
||||
go.wit.com/apps/control-panel-dns git.wit.org/jcarr/control-panel-dns A DNS Control Panel
|
||||
go.wit.com/apps/control-panel-cloudflare git.wit.org/wit/control-panel-cloudflare
|
||||
go.wit.com/apps/control-panel-vpn git.wit.org/jcarr/control-panel-vpn
|
||||
go.wit.com/apps/go.wit.com git.wit.org/jcarr/go.wit.com
|
||||
go.wit.com/apps/clone-gitea git.wit.org/jcarr/clone-gitea
|
||||
|
||||
# gui toolkit packages
|
||||
go.wit.com/toolkits/gocui git.wit.org/toolkits/gocui A console based GUI (like ncurses)
|
||||
go.wit.com/toolkits/andlabs git.wit.org/toolkits/andlabs Platform Native GUI (GTK on Linux and Cocoa on MacOS, Winows needs plugin support)
|
||||
go.wit.com/toolkits/nocui git.wit.org/toolkits/nocui A minimum toolkit plugin using STDIN/STDOUT
|
||||
go.wit.com/toolkits/tree git.wit.org/toolkits/tree Common plugin code to talk to the GUI
|
||||
go.wit.com/toolkits/debian git.wit.org/toolkits/debian make a .deb of the toolkit plugin binaries
|
||||
|
||||
# log/ (modified for the gui)
|
||||
|
||||
go.wit.com/log git.wit.org/wit/log a wrapper attempt around log for the GUI
|
||||
|
||||
# gui libraries
|
||||
go.wit.com/lib/gadgets git.wit.org/gui/gadgets Some common collections of widgets
|
||||
go.wit.com/lib/debugger git.wit.org/gui/debugger An attempt at a debugger
|
||||
go.wit.com/lib/gui/repostatus git.wit.org/jcarr/repostatus used by autotypist
|
||||
go.wit.com/lib/gui/hostname git.wit.org/jcarr/hostname
|
||||
go.wit.com/lib/gui/linuxstatus git.wit.org/jcarr/hostname for the DNS Control Panel
|
||||
go.wit.com/lib/gui/logsettings git.wit.org/jcarr/logsettings used for 'log' and debugger
|
||||
go.wit.com/lib/gui/digitalocean git.wit.org/gui/digitalocean used by the DO control panel
|
||||
go.wit.com/lib/gui/cloudflare git.wit.org/gui/cloudflare
|
||||
go.wit.com/lib/gui/shell git.wit.org/wit/shell
|
||||
go.wit.com/lib/protobuf/wit git.wit.org/wit/witProtobuf
|
||||
|
||||
# Support packages (forked for experiments)
|
||||
|
||||
go.wit.com/dev/alexflint/arg git.wit.org/jcarr/go-arg slight modifications to arg
|
||||
go.wit.com/dev/alexflint/scalar git.wit.org/jcarr/go-scalar
|
||||
go.wit.com/dev/andlabs/ui git.wit.org/interesting/andlabs-ui attempts to add RiscV support
|
||||
go.wit.com/dev/andlabs/libui git.wit.org/interesting/libui
|
||||
go.wit.com/dev/davecgh/spew git.wit.org/jcarr/go-spew
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="go-import" content="go.wit.com/gui/gui git https://git.wit.org/gui/gui">
|
||||
<meta name="go-source" content="go.wit.com/gui/gui https://git.wit.org/gui/gui https://git.wit.org/gui/tree/master{/dir} https://git.wit.org/gui/gui/tree/master{/dir}/{file}#L{line}">
|
||||
<meta http-equiv="refresh" content="0; url=https://git.wit.org/gui/gui">
|
||||
</head>
|
||||
<body>
|
||||
Nothing to see here. Please <a href="https://git.wit.org/gui/gui">move along</a>.
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=gowebd
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/gowebd
|
||||
ExecStop=killall gowebd
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,148 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// remove '?' part and trailing '/'
|
||||
func cleanURL(url string) string {
|
||||
url = "/" + strings.Trim(url, "/")
|
||||
return url
|
||||
}
|
||||
|
||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||
msg, err := ioutil.ReadAll(r.Body) // Read the body as []byte
|
||||
if err != nil {
|
||||
log.Info("ioutil.ReadAll() error =", err)
|
||||
return
|
||||
}
|
||||
// fmt.Fprintln(w, "ioutil.ReadAll() msg =", len(msg))
|
||||
// dumpClient(accessf, clientf, r)
|
||||
var route string
|
||||
// tmp = r.URL.String()
|
||||
route = cleanURL(r.URL.Path)
|
||||
parts := strings.Split(route, "?")
|
||||
log.Info("client sent url =", route, parts)
|
||||
requrl := parts[0]
|
||||
|
||||
url, repourl := findkey(requrl)
|
||||
log.Warn("gowebd URL =", url, "REPO URL =", repourl, "REQUEST URL =", requrl, "msg =", len(msg))
|
||||
if repourl != "" {
|
||||
repoHTML(w, url, repourl)
|
||||
return
|
||||
}
|
||||
if route == "/" {
|
||||
indexHeader(w)
|
||||
indexBodyStart(w)
|
||||
indexBodyScanConfig(w)
|
||||
indexDivEnd(w)
|
||||
pfile, err := os.ReadFile(FOOTER)
|
||||
if err == nil {
|
||||
fmt.Fprint(w, string(pfile))
|
||||
} else {
|
||||
log.Warn(err, "no footer file found in", FOOTER)
|
||||
log.Warn("falling back to the resources/footer.html")
|
||||
writeFile(w, "footer.html")
|
||||
}
|
||||
indexBodyEnd(w)
|
||||
return
|
||||
}
|
||||
if route == "/install.sh" {
|
||||
writeFile(w, "install.sh")
|
||||
return
|
||||
}
|
||||
if route == "/me" {
|
||||
j, err := dumpJsonClient(r)
|
||||
if err != nil {
|
||||
fmt.Fprintln(w, "BAD ZOOT")
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(w, j)
|
||||
return
|
||||
}
|
||||
if route == "/register" {
|
||||
fname := filepath.Join(LIBDIR, "regfile.log")
|
||||
regfile, _ := os.OpenFile(fname, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
if registerClient(regfile, r) {
|
||||
fmt.Fprintln(w, "OK")
|
||||
} else {
|
||||
fmt.Fprintln(w, "FAILED")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if route == "/lookup" {
|
||||
w.Header().Set("Content-Type", "text")
|
||||
fmt.Fprintf(w, "go.wit.com/apps/utils/gowebd Version: %s\n", argv.Version())
|
||||
fmt.Fprintf(w, "\n")
|
||||
|
||||
all := forge.Repos.SortByFullPath()
|
||||
for all.Scan() {
|
||||
repo := all.Next()
|
||||
|
||||
fmt.Fprintf(w, "Namespace=%s FullPath=%s %s\n", repo.Namespace, repo.FullPath)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if route == "/goReference.svg" {
|
||||
writeFile(w, "goReference.svg")
|
||||
return
|
||||
}
|
||||
if route == "/skeleton.v2.css" {
|
||||
writeFile(w, "skeleton.v2.css")
|
||||
return
|
||||
}
|
||||
if route == "/favicon.ico" {
|
||||
writeFile(w, "ipv6.png")
|
||||
return
|
||||
}
|
||||
// used for uptime monitor checking
|
||||
if route == "/uptime" {
|
||||
writeFile(w, "uptime.html")
|
||||
return
|
||||
}
|
||||
log.Warn("BAD URL =", url, "REPO URL =", repourl)
|
||||
badurl(w, r.URL.String())
|
||||
}
|
||||
|
||||
func writeFile(w http.ResponseWriter, filename string) {
|
||||
// fmt.Fprintln(w, "GOT TEST?")
|
||||
fullname := "resources/" + filename
|
||||
pfile, err := resources.ReadFile(fullname)
|
||||
if err != nil {
|
||||
log.Println("ERROR:", err)
|
||||
// w.Write(pfile)
|
||||
return
|
||||
}
|
||||
|
||||
var repohtml string
|
||||
repohtml = string(pfile)
|
||||
if filename == "goReference.svg" {
|
||||
w.Header().Set("Content-Type", "image/svg+xml")
|
||||
}
|
||||
fmt.Fprintln(w, repohtml)
|
||||
log.Println("writeFile() found internal file:", filename)
|
||||
}
|
||||
|
||||
func badurl(w http.ResponseWriter, badurl string) {
|
||||
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||
fmt.Fprintln(w, "<html>")
|
||||
fmt.Fprintln(w, " <head>")
|
||||
fmt.Fprintln(w, " <meta http-equiv=\"refresh\" content=\"3; url=https://"+HOSTNAME+"/\">")
|
||||
fmt.Fprintln(w, " </head>")
|
||||
fmt.Fprintln(w, " <body>")
|
||||
fmt.Fprintln(w, " IPv4 IS NOT SUPPORTED<br>")
|
||||
fmt.Fprintln(w, " MANY OF THESE REPOS REQUIRE IPv6.<br>")
|
||||
fmt.Fprintln(w, " <br>")
|
||||
fmt.Fprintln(w, " bad url", badurl, "<a href=\"https://go.wit.com/\">redirecting</a>")
|
||||
fmt.Fprintln(w, " </body>")
|
||||
fmt.Fprintln(w, "</html>")
|
||||
}
|
44
indexHtml.go
44
indexHtml.go
|
@ -3,9 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func indexHeader(w http.ResponseWriter) {
|
||||
|
@ -39,8 +37,8 @@ func indexBodyStart(w http.ResponseWriter) {
|
|||
fmt.Fprintln(w, " <th>Package (IPv6 only)</th>")
|
||||
fmt.Fprintln(w, " <th>Documentation</th>")
|
||||
fmt.Fprintln(w, " <th>Version</th>")
|
||||
fmt.Fprintln(w, " <th>Age</th>")
|
||||
fmt.Fprintln(w, " <th>Dev Version</th>")
|
||||
fmt.Fprintln(w, " <th>Age</th>")
|
||||
fmt.Fprintln(w, " <th>Description</th>")
|
||||
// fmt.Fprintln(w, " <th>Authoritative sources (IPv6 only)</th>")
|
||||
// fmt.Fprintln(w, " <th></th>")
|
||||
|
@ -99,43 +97,19 @@ func indexBodyRepo(w http.ResponseWriter, gourl string, giturl string, desc stri
|
|||
// fmt.Fprintln(w, " <td>"+gourl+"</td>")
|
||||
fmt.Fprintln(w, " <td> <a href=\"//"+gourl+"\">"+gourl+"</a></td>")
|
||||
fmt.Fprintln(w, " <td> <a href=\"//pkg.go.dev/"+gourl+"\"> <img src=\"goReference.svg\" alt=\"pkg.go.dev\" /> </a> </td>")
|
||||
// for i, s := range versionMap {
|
||||
// log.Println("found i =", i, "with", "s =", s)
|
||||
// }
|
||||
var vtime, version string
|
||||
var vtime, version, dver string
|
||||
gourl = strings.TrimSpace(gourl)
|
||||
tmp, _ := versionMap[gourl]
|
||||
parts := strings.Split(tmp, " ")
|
||||
if len(parts) > 0 {
|
||||
version = parts[0]
|
||||
}
|
||||
if len(parts) > 1 {
|
||||
vtime = parts[1]
|
||||
}
|
||||
|
||||
if vtime != "" {
|
||||
// Convert the string to an integer
|
||||
gitTagTimestampInt, _ := strconv.ParseInt(vtime, 10, 64)
|
||||
|
||||
// Parse the Unix timestamp into a time.Time object
|
||||
gitTagDate := time.Unix(gitTagTimestampInt, 0)
|
||||
|
||||
// Get the current time
|
||||
currentTime := time.Now()
|
||||
|
||||
// Calculate the duration between the git tag date and the current time
|
||||
duration := currentTime.Sub(gitTagDate)
|
||||
|
||||
vtime = formatDuration(duration)
|
||||
if repo, ok := gitMap[gourl]; ok {
|
||||
version = repo.GetLastTag()
|
||||
age := repo.NewestAge()
|
||||
vtime = formatDuration(age)
|
||||
dver = repo.GetDevelVersion()
|
||||
}
|
||||
// log.Info("gopath", gourl, "dur", vtime, "version", version)
|
||||
|
||||
fmt.Fprintln(w, " <td>"+version+"</td>") // version
|
||||
fmt.Fprintln(w, " <td>"+dver+"</td>") // dev version
|
||||
fmt.Fprintln(w, " <td>"+vtime+"</td>") // dev version
|
||||
if gourl == "go.wit.com/apps/helloworld" {
|
||||
fmt.Fprintln(w, " <td><a href=\"http://mirrors.wit.com/guidemo/helloworld-demo.webm\">Video Demo</a> </td>") // dev version
|
||||
} else {
|
||||
fmt.Fprintln(w, " <td></td>") // dev version
|
||||
}
|
||||
fmt.Fprintln(w, " <td>"+desc+"</td>")
|
||||
// fmt.Fprintln(w, " <td> <a href=\"//"+gourl+"\">"+giturl+"</a></td>")
|
||||
fmt.Fprintln(w, " </tr>")
|
||||
|
|
|
@ -17,8 +17,8 @@ type RequestInfo struct {
|
|||
Headers map[string][]string `json:"headers"`
|
||||
Cookies map[string]string `json:"cookies"`
|
||||
QueryParams map[string][]string `json:"queryParams"`
|
||||
Body string `json:"body"`
|
||||
// Add other fields as needed
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
// dumpClient returns a string with JSON formatted http.Request information
|
||||
|
@ -68,41 +68,3 @@ func dumpJsonClient(r *http.Request) (string, error) {
|
|||
|
||||
return string(formattedJSON), nil
|
||||
}
|
||||
|
||||
/*
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type RequestInfo struct {
|
||||
// ... (other fields)
|
||||
Body string `json:"body"`
|
||||
// ... (other fields)
|
||||
}
|
||||
|
||||
func dumpClient(r *http.Request) (string, error) {
|
||||
// ... (rest of your code to collect other request info)
|
||||
|
||||
info := RequestInfo{
|
||||
// ... (other fields)
|
||||
Body: string(bodyBytes),
|
||||
// ... (other fields)
|
||||
}
|
||||
|
||||
// Marshal the struct to a JSON string
|
||||
jsonString, err := json.Marshal(info)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(jsonString), nil
|
||||
}
|
||||
|
||||
// ... (rest of your code)
|
||||
*/
|
||||
|
|
172
main.go
172
main.go
|
@ -4,167 +4,61 @@ import (
|
|||
"embed"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
//go:embed files/*
|
||||
var htmlFiles embed.FS
|
||||
// are sent via -ldflags at buildtime
|
||||
var VERSION string
|
||||
var BUILDTIME string
|
||||
|
||||
var accessf, clientf *os.File
|
||||
//go:embed resources/*
|
||||
var resources embed.FS
|
||||
|
||||
// var accessf, clientf *os.File
|
||||
|
||||
var repoMap map[string]string
|
||||
var versionMap map[string]string
|
||||
var gitMap map[string]*gitpb.Repo
|
||||
var configfile []string
|
||||
var keysSorted []string
|
||||
var forge *forgepb.Forge
|
||||
|
||||
// remove '?' part and trailing '/'
|
||||
func cleanURL(url string) string {
|
||||
url = "/" + strings.Trim(url, "/")
|
||||
return url
|
||||
}
|
||||
|
||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||
dumpClient(r)
|
||||
var tmp string
|
||||
// tmp = r.URL.String()
|
||||
tmp = cleanURL(r.URL.Path)
|
||||
parts := strings.Split(tmp, "?")
|
||||
log.Info("client sent url =", tmp)
|
||||
log.Info("parts are:", parts)
|
||||
requrl := parts[0]
|
||||
|
||||
url, repourl := findkey(requrl)
|
||||
log.Warn("go.wit.com URL =", url, "REPO URL =", repourl, "REQUEST URL =", requrl)
|
||||
if repourl != "" {
|
||||
repoHTML(w, url, repourl)
|
||||
return
|
||||
}
|
||||
if tmp == "/" {
|
||||
indexHeader(w)
|
||||
indexBodyStart(w)
|
||||
indexBodyScanConfig(w)
|
||||
indexDivEnd(w)
|
||||
indexBodyEnd(w)
|
||||
return
|
||||
}
|
||||
if tmp == "/old" {
|
||||
findFile(w, "files/index.html")
|
||||
return
|
||||
}
|
||||
if tmp == "/install.sh" {
|
||||
findFile(w, "files/install.sh")
|
||||
return
|
||||
}
|
||||
if tmp == "/me" {
|
||||
j, err := dumpJsonClient(r)
|
||||
if err != nil {
|
||||
fmt.Fprintln(w, "BAD ZOOT")
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(w, j)
|
||||
return
|
||||
}
|
||||
if tmp == "/update" {
|
||||
return
|
||||
}
|
||||
if tmp == "/register" {
|
||||
regfile, _ := os.OpenFile("/home/jcarr/regfile.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
if registerClient(regfile, r) {
|
||||
fmt.Fprintln(w, "OK")
|
||||
} else {
|
||||
fmt.Fprintln(w, "FAILED")
|
||||
}
|
||||
return
|
||||
}
|
||||
if tmp == "/list" {
|
||||
findFile(w, "files/repomap")
|
||||
return
|
||||
}
|
||||
if tmp == "/test" {
|
||||
findFile(w, "files/test.html")
|
||||
return
|
||||
}
|
||||
if tmp == "/goReference.svg" {
|
||||
findFile(w, "files/goReference.svg")
|
||||
return
|
||||
}
|
||||
if tmp == "/skeleton.v2.css" {
|
||||
findFile(w, "files/skeleton.v2.css")
|
||||
return
|
||||
}
|
||||
log.Warn("BAD URL =", url, "REPO URL =", repourl)
|
||||
badurl(w, r.URL.String())
|
||||
// fmt.Fprintln(w, "BAD", tmp)
|
||||
}
|
||||
|
||||
func findFile(w http.ResponseWriter, filename string) {
|
||||
// fmt.Fprintln(w, "GOT TEST?")
|
||||
pfile, err := htmlFiles.ReadFile(filename)
|
||||
if err != nil {
|
||||
log.Println("ERROR:", err)
|
||||
// w.Write(pfile)
|
||||
return
|
||||
}
|
||||
|
||||
var repohtml string
|
||||
repohtml = string(pfile)
|
||||
if filename == "files/goReference.svg" {
|
||||
w.Header().Set("Content-Type", "image/svg+xml")
|
||||
}
|
||||
fmt.Fprintln(w, repohtml)
|
||||
log.Println("findFile() found internal file:", filename)
|
||||
// w.Close()
|
||||
/*
|
||||
filename = "/tmp/" + name + ".so"
|
||||
log.Error(err, "write out file here", name, filename, len(pfile))
|
||||
f, _ := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
|
||||
f.Close()
|
||||
*/
|
||||
}
|
||||
var HOSTNAME string = "go.wit.com"
|
||||
var REPOMAP string = "/etc/gowebd/repomap"
|
||||
var FOOTER string = "/etc/gowebd/footer.html"
|
||||
var LIBDIR string = "/var/lib/gowebd/"
|
||||
|
||||
func main() {
|
||||
accessf, _ = os.OpenFile("/home/jcarr/accessclient.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
clientf, _ = os.OpenFile("/home/jcarr/httpclient.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
readconfigfile()
|
||||
readVersionFile()
|
||||
if argv.RepoMap != "" {
|
||||
REPOMAP = argv.RepoMap
|
||||
}
|
||||
if argv.Hostname != "" {
|
||||
HOSTNAME = argv.Hostname
|
||||
}
|
||||
|
||||
// make the instructions to install be:
|
||||
// curl -sSL https://go.wit.com/install.sh | bash
|
||||
gitMap = make(map[string]*gitpb.Repo)
|
||||
repoMap = make(map[string]string)
|
||||
|
||||
// build instruction:
|
||||
// go install go.wit.com/apps/getgui@latest
|
||||
forge = forgepb.Init()
|
||||
|
||||
// parse the repomap file
|
||||
readRepomap()
|
||||
// readVersionFile()
|
||||
|
||||
// for i, s := range versionMap {
|
||||
// log.Println("found i =", i, "with", "s =", s)
|
||||
// }
|
||||
log.Println("found log =", versionMap["go.wit.com/log"])
|
||||
http.HandleFunc("/", okHandler)
|
||||
go https()
|
||||
err := http.ListenAndServe(":80", nil)
|
||||
// go https() // use caddy instead
|
||||
p := fmt.Sprintf(":%d", argv.Port)
|
||||
log.Println("HOSTNAME set to:", HOSTNAME)
|
||||
log.Println("Running on port", p)
|
||||
err := http.ListenAndServe(p, nil)
|
||||
if err != nil {
|
||||
log.Println("Error starting server:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func badurl(w http.ResponseWriter, badurl string) {
|
||||
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||
fmt.Fprintln(w, "<html>")
|
||||
fmt.Fprintln(w, " <head>")
|
||||
fmt.Fprintln(w, " <meta http-equiv=\"refresh\" content=\"3; url=https://go.wit.com/\">")
|
||||
fmt.Fprintln(w, " </head>")
|
||||
fmt.Fprintln(w, " <body>")
|
||||
fmt.Fprintln(w, " IPv4 IS NOT SUPPORTED<br>")
|
||||
fmt.Fprintln(w, " MANY OF THESE REPOS REQUIRE IPv6.<br>")
|
||||
fmt.Fprintln(w, " <br>")
|
||||
fmt.Fprintln(w, " bad url", badurl, "<a href=\"https://git.wit.org/\">redirecting</a>")
|
||||
fmt.Fprintln(w, " </body>")
|
||||
fmt.Fprintln(w, "</html>")
|
||||
}
|
||||
|
||||
func formatDuration(d time.Duration) string {
|
||||
seconds := int(d.Seconds()) % 60
|
||||
minutes := int(d.Minutes()) % 60
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd /etc/gowebd/
|
||||
|
||||
# allow the binary to open ports below 1024
|
||||
setcap 'cap_net_bind_service=+ep' /usr/bin/gowebd
|
118
repoHTML.go
118
repoHTML.go
|
@ -1,118 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="go-import" content="go.wit.com/gui/gui git https://git.wit.org/gui/gui">
|
||||
<meta name="go-source" content="go.wit.com/gui/gui https://git.wit.org/gui/gui https://git.wit.org/gui/tree/master{/dir} https://git.wit.org/gui/gui/tree/master{/dir}/{file}#L{line}">
|
||||
<meta http-equiv="refresh" content="0; url=https://git.wit.org/gui/gui">
|
||||
</head>
|
||||
<body>
|
||||
Nothing to see here. Please <a href="https://git.wit.org/gui/gui">move along</a>.
|
||||
</body>
|
||||
</html>
|
||||
*/
|
||||
|
||||
func repoHTML(w http.ResponseWriter, gourl string, realurl string) {
|
||||
realurl = "https://" + realurl
|
||||
log.Info("go repo =", gourl, "real url =", realurl)
|
||||
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||
fmt.Fprintln(w, "<html>")
|
||||
fmt.Fprintln(w, "<head>")
|
||||
// fmt.Fprintln(w,
|
||||
fmt.Fprintln(w, "<meta name=\"go-import\" content=\"", gourl, "git", realurl+"\">")
|
||||
fmt.Fprintln(w, "<meta name=\"go-source\" content=\"", gourl, realurl, realurl+"/tree/master{/dir}", realurl+"tree/master{/dir}/{file}#L{line}", "\"", ">")
|
||||
|
||||
fmt.Fprintln(w, "<meta http-equiv=\"refresh\" content=\"0; url="+realurl+"\">")
|
||||
fmt.Fprintln(w, "</head>")
|
||||
fmt.Fprintln(w, "<body>")
|
||||
fmt.Fprintln(w, "Nothing to see here. Please <a href=\""+realurl+"\">move along</a>.\"")
|
||||
fmt.Fprintln(w, "</body>")
|
||||
fmt.Fprintln(w, "</html>")
|
||||
|
||||
/*
|
||||
var tmp string
|
||||
tmp = r.URL.String()
|
||||
if tmp == "/gui" {
|
||||
findFile(w)
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(w, "OK")
|
||||
*/
|
||||
}
|
||||
|
||||
func findkey(url string) (string, string) {
|
||||
key := "go.wit.com" + url
|
||||
if repoMap[key] != "" {
|
||||
return key, repoMap[key]
|
||||
}
|
||||
return key, ""
|
||||
// parts := strings.Split(key, "/")
|
||||
}
|
||||
|
||||
func readconfigfile() {
|
||||
repoMap = make(map[string]string)
|
||||
pfile, err := htmlFiles.ReadFile("files/repomap")
|
||||
if err != nil {
|
||||
log.Error(err, "missing repomap in the binary")
|
||||
return
|
||||
}
|
||||
configfile = strings.Split(string(pfile), "\n")
|
||||
for _, line := range configfile {
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
repo := fields[0]
|
||||
realurl := fields[1]
|
||||
repoMap[repo] = realurl
|
||||
|
||||
// log.Info("repo =", repo, "real url =", realurl)
|
||||
}
|
||||
|
||||
for repo, _ := range repoMap {
|
||||
// log.Info("repo =", repo, "real url =", url)
|
||||
keysSorted = append(keysSorted, repo)
|
||||
}
|
||||
log.Info("sorted:")
|
||||
sort.Strings(keysSorted)
|
||||
// sort.Reverse(keys)
|
||||
sort.Sort(sort.Reverse(sort.StringSlice(keysSorted)))
|
||||
for _, key := range keysSorted {
|
||||
log.Info("repo =", key, "real url =", repoMap[key])
|
||||
}
|
||||
}
|
||||
|
||||
func readVersionFile() {
|
||||
versionMap = make(map[string]string)
|
||||
file, err := os.Open(filepath.Join(os.Getenv("HOME"), "go.wit.com.versions"))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
tmp := scanner.Text()
|
||||
fields := strings.Split(tmp, " ")
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
// log.Println("readVersionFile() fields[0] =", fields[0])
|
||||
// log.Println("readVersionFile() fields[1:] =", fields[1:])
|
||||
versionMap[fields[0]] = strings.Join(fields[1:], " ")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package main
|
||||
|
||||
// parses /etc/gowebd/repomap
|
||||
// this file defines what repositories show up on go.wit.com
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
// this makes the "go-source" / "go-import" page
|
||||
// this redirects the go path "go.wit.com/apps/go-clone" to the git path "gitea.wit.com/wit/go-clone"
|
||||
func repoHTML(w http.ResponseWriter, gourl string, realurl string) {
|
||||
realurl = "https://" + realurl
|
||||
log.Info("go repo =", gourl, "real url =", realurl)
|
||||
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||
fmt.Fprintln(w, "<html>")
|
||||
fmt.Fprintln(w, "<head>")
|
||||
// fmt.Fprintln(w,
|
||||
fmt.Fprintln(w, "<meta name=\"go-import\" content=\"", gourl, "git", realurl+"\">")
|
||||
fmt.Fprintln(w, "<meta name=\"go-source\" content=\"", gourl, realurl, realurl+"/tree/master{/dir}", realurl+"tree/master{/dir}/{file}#L{line}", "\"", ">")
|
||||
|
||||
fmt.Fprintln(w, "<meta http-equiv=\"refresh\" content=\"0; url="+realurl+"\">")
|
||||
fmt.Fprintln(w, "</head>")
|
||||
fmt.Fprintln(w, "<body>")
|
||||
fmt.Fprintln(w, "Redirecting to git repo url. Please <a href=\""+realurl+"\">move along</a>.\"")
|
||||
fmt.Fprintln(w, "</body>")
|
||||
fmt.Fprintln(w, "</html>")
|
||||
}
|
||||
|
||||
func findkey(url string) (string, string) {
|
||||
key := "go.wit.com" + url
|
||||
if repoMap[key] != "" {
|
||||
return key, repoMap[key]
|
||||
}
|
||||
return key, ""
|
||||
// parts := strings.Split(key, "/")
|
||||
}
|
||||
|
||||
func readRepomap() {
|
||||
var pfile []byte
|
||||
var err error
|
||||
|
||||
pfile, err = os.ReadFile(REPOMAP)
|
||||
if err != nil {
|
||||
log.Error(err, "no repository map file found in /etc/gowebd/")
|
||||
log.Error(err, "falling back to the repository map file built into the gowebd binary")
|
||||
pfile, err = resources.ReadFile("resources/repomap")
|
||||
if err != nil {
|
||||
log.Error(err, "missing repomap in the binary")
|
||||
return
|
||||
}
|
||||
}
|
||||
configfile = strings.Split(string(pfile), "\n")
|
||||
for _, line := range configfile {
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) < 2 {
|
||||
continue
|
||||
}
|
||||
gopath := fields[0]
|
||||
giturl := fields[1]
|
||||
repoMap[gopath] = giturl
|
||||
|
||||
repo := forge.FindByGoPath(gopath)
|
||||
if repo != nil {
|
||||
gitMap[gopath] = repo
|
||||
} else {
|
||||
log.Info("repo =", gopath, "real url =", repoMap[gopath], "not found")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
all:
|
||||
gowebd --version
|
||||
@echo "make log # watch gowebd log"
|
||||
@echo "make restart # restart gowebd"
|
||||
@echo "make enable # enable gowebd on boot"
|
||||
@echo "make status # show the systemd status of gowebd"
|
||||
|
||||
log:
|
||||
@journalctl -f -xeu gowebd.service
|
||||
|
||||
status:
|
||||
systemctl status gowebd.service
|
||||
|
||||
enable:
|
||||
systemctl enable gowebd.service
|
||||
|
||||
restart:
|
||||
systemctl stop gowebd.service
|
||||
systemctl start gowebd.service
|
|
@ -0,0 +1,3 @@
|
|||
<br>
|
||||
your footer here<br>
|
||||
<br>
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -0,0 +1,15 @@
|
|||
# gui core packages
|
||||
|
||||
go.wit.com/gui gitea.wit.com/gui/gui The GUI API intended for Control Panels
|
||||
go.wit.com/widget gitea.wit.com/gui/widget Primitive Definitions for Buttons, Dropdowns, etc.
|
||||
|
||||
# Tutorials
|
||||
|
||||
go.wit.com/apps/helloworld gitea.wit.com/gui/helloworld A simple Demo
|
||||
go.wit.com/apps/basicwindow gitea.wit.com/jcarr/basicwindow A bit more of a Demo
|
||||
go.wit.com/apps/gadgetwindow gitea.wit.com/jcarr/gadgetwindow A more complicated Demo used for debugging the toolkits
|
||||
|
||||
# Applications (mirrors.wit.com has .deb packages)
|
||||
|
||||
go.wit.com/apps/go-clone gitea.wit.com/gui/go-clone recursively 'git clone' golang packages
|
||||
go.wit.com/apps/go-deb gitea.wit.com/jcarr/go-deb Turn anything into a .deb package
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
OK12358
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue