Skip to content
This repository has been archived by the owner on Aug 27, 2020. It is now read-only.

Commit

Permalink
webui client
Browse files Browse the repository at this point in the history
  • Loading branch information
lzjluzijie committed Jul 7, 2018
1 parent 66a6a11 commit c22c5a9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
22 changes: 20 additions & 2 deletions templates/client.html
@@ -1,4 +1,4 @@
{% extends "base/base.html" %}
{% extends "base/base.html" %} {% block body %}
<section class="section">
<div class="container">
<h1 class="title">
Expand All @@ -7,6 +7,24 @@ <h1 class="title">
<p class="subtitle">
A secure proxy based on websocket.
</p>

<form action="/api/client" method="post">
<div class="field">
<label class="label">Server URL</label>
<div class="control">
<input class="input" type="text" placeholder="wss://server.com:2333/password">
</div>

<div class="field">
<p class="control">
<button class="button">
Start
</button>
</p>
</div>
</div>
</form>

</div>
</section>
{% block body %}
{% endblock %}
31 changes: 26 additions & 5 deletions websocks.go
Expand Up @@ -8,11 +8,16 @@ import (
"errors"
"runtime"

"os/exec"

"net/http"

"github.com/go-macaron/pongo2"
"github.com/juju/loggo"
"github.com/lzjluzijie/websocks/config"
"github.com/lzjluzijie/websocks/core"
"github.com/urfave/cli"
"golang.org/x/sys/windows/registry"
"gopkg.in/macaron.v1"
)

func main() {
Expand Down Expand Up @@ -151,12 +156,28 @@ func main() {
return
}

k, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Internet Settings`, registry.ALL_ACCESS)
if err != nil {
err = exec.Command("REG", "ADD", `HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings`, "/v", "AutoConfigURL", "/d", "http://127.0.0.1:10801/pac", "/f").Run()
return
},
},
{
Name: "webclient",
Aliases: []string{"wc"},
Usage: "test webui client",
Action: func(c *cli.Context) (err error) {
m := macaron.New()
m.Use(pongo2.Pongoer())
m.Get("/", func(ctx *macaron.Context) {
ctx.HTML(200, "client")
return
}
})

//todo pac
m.Get("/pac", func(ctx *macaron.Context) {
return
})

err = k.SetStringValue("AutoConfigURL", "http://127.0.0.1:10801/pac")
err = http.ListenAndServe(":10801", m)
return
},
},
Expand Down

0 comments on commit c22c5a9

Please sign in to comment.