make an embeddable version which can be kept alive
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
toopie.html
|
||||||
|
import/jtoopie/jtoopie
|
||||||
|
import/jtoopie/toopie
|
||||||
|
bin
|
||||||
|
toopie
|
3
Makefile
3
Makefile
@ -5,6 +5,9 @@ build: fmt gen
|
|||||||
run: fmt gen
|
run: fmt gen
|
||||||
go run ./ -port 9001 #-ribbon true
|
go run ./ -port 9001 #-ribbon true
|
||||||
|
|
||||||
|
test:
|
||||||
|
cd import && go test
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
gofmt -w -s *.go */*.go
|
gofmt -w -s *.go */*.go
|
||||||
|
|
||||||
|
23
README.md
23
README.md
@ -1,3 +1,22 @@
|
|||||||
# toopie.html
|
toopie.html I2P standalone monitoring panel
|
||||||
|
===========================================
|
||||||
|
|
||||||
|
This is a very simple monitoring panel for interacting with I2P and monitoring
|
||||||
|
I2P statistics. It can stop, or restart an I2P router, as well as provide concise
|
||||||
|
output about I2P router status from I2PControl. It depends on the presence of an
|
||||||
|
I2P router implementing the i2pcontrol jsonrpc interface.
|
||||||
|
|
||||||
|
To enable jsonrpc on the Java I2P router, go to this the webapps config page:
|
||||||
|
[http://localhost:7657/configwebapps](http://localhost:7657/configwebapps) and
|
||||||
|
enable the `jsonrpc` app as seen in the screenshot below:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
HELP WANTED!!!
|
||||||
|
--------------
|
||||||
|
|
||||||
|
I don't have a Mac, mine bit the dust. I need help creating a Mac package
|
||||||
|
of this. Please, if you want a Mac version of this application and have
|
||||||
|
Mac packaging experience, create an issue so we can work together to figure
|
||||||
|
out how to support Mac users best.
|
||||||
|
|
||||||
Still real crude, but it works now.
|
|
||||||
|
12
gen.go
12
gen.go
@ -2,10 +2,20 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/zserge/lorca"
|
import (
|
||||||
|
"github.com/zserge/lorca"
|
||||||
|
|
||||||
|
"log"
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// You can also run "npm build" or webpack here, or compress assets, or
|
// You can also run "npm build" or webpack here, or compress assets, or
|
||||||
// generate manifests, or do other preparations for your assets.
|
// generate manifests, or do other preparations for your assets.
|
||||||
lorca.Embed("toopie", "lib/assets.go", "www")
|
lorca.Embed("toopie", "lib/assets.go", "www")
|
||||||
|
err := exec.Command("go", "build", "-tags", "netgo", "-o", "bin/toopie").Run()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
|
lorca.Embed("toopiexec", "import/assets.go", "bin/")
|
||||||
}
|
}
|
||||||
|
BIN
i2pcontrol.png
Normal file
BIN
i2pcontrol.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
65
import/assets.go
Normal file
65
import/assets.go
Normal file
File diff suppressed because one or more lines are too long
27
import/jtoopie/main.go
Normal file
27
import/jtoopie/main.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//go:generate go run -tags generate gen.go
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"github.com/eyedeekay/toopie.html/import"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
port = flag.String("port", "0", "Port to run the web interface on, default is randomly assigned.")
|
||||||
|
pport = flag.Int("proxy-port", 7677, "Port to use to proxy requests to i2p-control")
|
||||||
|
ribbon = flag.Bool("ribbon", false, "use a horizontal ribbon instead of a vertical panel")
|
||||||
|
)
|
||||||
|
|
||||||
|
func update(){
|
||||||
|
err := toopiexec.Run()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
flag.Parse()
|
||||||
|
go update()
|
||||||
|
}
|
40
import/main.go
Normal file
40
import/main.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package toopiexec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Run() error {
|
||||||
|
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Path detection error %s", err)
|
||||||
|
}
|
||||||
|
filelist, err := FS.Readdir(-1)
|
||||||
|
for index, file := range filelist{
|
||||||
|
fmt.Println(index, file.Name())
|
||||||
|
}
|
||||||
|
toopie, err := FS.Open("toopie")
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Toopie open error %s", err)
|
||||||
|
}
|
||||||
|
sys := bytes.NewBuffer(nil)
|
||||||
|
if _, err := io.Copy(sys, toopie); err != nil {
|
||||||
|
return fmt.Errorf("File copy error %s", err)
|
||||||
|
}
|
||||||
|
exepath := filepath.Join(dir, "toopie")
|
||||||
|
err = ioutil.WriteFile(exepath, sys.Bytes(), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("File write error %s %s", err, exepath)
|
||||||
|
}
|
||||||
|
err = exec.Command(exepath).Run()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Runtime error %s", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
9
import/main_test.go
Normal file
9
import/main_test.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package toopiexec
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestMain(t *testing.T) {
|
||||||
|
Run()
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
BIN
toopie.html
BIN
toopie.html
Binary file not shown.
Reference in New Issue
Block a user