Skip to content

Commit

Permalink
Merge pull request #67 from joncrangle/proxy_v2/playground
Browse files Browse the repository at this point in the history
feat: Playground
  • Loading branch information
deoxykev authored Dec 11, 2023
2 parents 82b5a74 + 70033b8 commit 0940bbb
Show file tree
Hide file tree
Showing 12 changed files with 1,132 additions and 100 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-css.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
paths:
- "handlers/form.html"
- "handlers/playground.html"
- "proxychain/responsemodifiers/vendor/generate_readable_outline.html"
workflow_dispatch:

Expand Down Expand Up @@ -38,6 +39,7 @@ jobs:
git config --global user.name "Github action"
git config --global user.email "[email protected]"
git add handlers
git add proxychain/responsemodifiers/vendor/
git commit -m "Generated stylesheet"
git push
fi
13 changes: 2 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
_ "embed"
"fmt"
"html/template"
"log"
"os"

Expand All @@ -15,7 +14,6 @@ import (

"github.com/akamensky/argparse"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
)

//go:embed VERSION
Expand Down Expand Up @@ -130,21 +128,12 @@ func main() {
rs = ruleset_v2.NewRulesetFromEnv()
}

engine := html.New("./handlers", ".html")
engine.AddFunc(
// add unescape function
"unescape", func(s string) template.HTML {
return template.HTML(s)
},
)

app := fiber.New(
fiber.Config{
Prefork: *prefork,
GETOnly: false,
ReadBufferSize: 4096 * 4, // increase max header size
DisableStartupMessage: true,
Views: engine,
},
)

Expand All @@ -168,6 +157,7 @@ func main() {

app.Get("styles.css", handlers.Styles)
app.Get("script.js", handlers.Script)
app.Get("playground-script.js", handlers.Script)

app.All("api/raw/*", handlers.NewRawProxySiteHandler(proxyOpts))

Expand All @@ -176,6 +166,7 @@ func main() {
app.Get("api/content/*", handlers.NewAPIContentHandler("api/outline/*", proxyOpts))

app.Get("outline/*", handlers.NewOutlineHandler("outline/*", proxyOpts))
app.All("playground/*", handlers.PlaygroundHandler("playground/*", proxyOpts))

app.All("/*", handlers.NewProxySiteHandler(proxyOpts))

Expand Down
128 changes: 64 additions & 64 deletions handlers/api_modifiers_structdef.gen.go

Large diffs are not rendered by default.

41 changes: 30 additions & 11 deletions handlers/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<div class="place-self-end z-10">
<div class="relative" id="dropdown">
<button
aria-expanded="closed"
aria-expanded="false"
id="dropdownButton"
aria-label="Toggle dropdown menu"
onclick="toggleDropdown()"
type="button"
class="inline-flex items-center justify-center whitespace-nowrap rounded-full h-12 px-4 py-2 text-sm font-medium text-slate-600 dark:text-slate-400 ring-offset-white dark:ring-offset-slate-900 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-white dark:bg-slate-900 hover:bg-slate-200 dark:hover:bg-slate-700 hover:text-slate-500 dark:hover:text-slate-200"
Expand Down Expand Up @@ -248,27 +250,44 @@
</button>
<button
type="submit"
id="submitButton"
class="inline-flex items-center justify-center h-11 px-8 whitespace-nowrap rounded-md text-sm font-medium text-slate-200 dark:text-slate-900 ring-offset-white dark:ring-offset-slate-900 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-slate-800 dark:bg-slate-200 hover:bg-slate-800/90 dark:hover:bg-slate-200/90"
>
Proxy Search
</button>
</div>
</form>

<div class="flex flex-col justify-center my-4 mx-auto">
<a
href="/playground"
class="inline-flex items-center justify-center h-8 px-8 whitespace-nowrap no-underline rounded-md text-sm font-medium text-slate-900 dark:text-slate-200 hover:text-slate-900 hover:dark:text-slate-200 ring-offset-white dark:ring-offset-slate-900 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none hover:bg-slate-200/90 dark:hover:bg-slate-800/90 border border-slate-600 dark:border-slate-400"
>
Experiment with modifiers in the playground
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="h-4 w-4 ml-1"
>
<path d="M13 5H19V11" />
<path d="M19 5L5 19" />
</svg>
</a>
</div>

<footer class="mx-4 text-center text-slate-600 dark:text-slate-400">
<p>
Code Licensed Under GPL v3.0 |
<a
href="https://github.com/everywall/ladder"
class="hover:text-blue-500 dark:hover:text-blue-500 hover:underline underline-offset-2 transition-colors duration-300"
>View Source</a
>
<a href="https://github.com/everywall/ladder">View Source</a>
|
<a
href="https://github.com/everywall"
class="hover:text-blue-500 dark:hover:text-blue-500 hover:underline underline-offset-2 transition-colors duration-300"
>Everywall</a
>
<a href="https://github.com/everywall">Everywall</a>
</p>
</footer>
</div>
Expand Down
Loading

0 comments on commit 0940bbb

Please sign in to comment.