add ascii art
This commit is contained in:
@@ -189,7 +189,8 @@ There is a basic ruleset available in a separate repository [ruleset.yaml](https
|
|||||||
To run a development server at http://localhost:8080:
|
To run a development server at http://localhost:8080:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo "dev" > handlers/VERSION
|
echo "dev " > handlers/VERSION
|
||||||
|
echo "dev " > cmd/VERSION
|
||||||
RULESET="./ruleset.yaml" go run cmd/main.go
|
RULESET="./ruleset.yaml" go run cmd/main.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ var faviconData string
|
|||||||
//go:embed styles.css
|
//go:embed styles.css
|
||||||
var cssData embed.FS
|
var cssData embed.FS
|
||||||
|
|
||||||
|
//go:embed VERSION
|
||||||
|
var version string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
parser := argparse.NewParser("ladder", "Every Wall needs a Ladder")
|
parser := argparse.NewParser("ladder", "Every Wall needs a Ladder")
|
||||||
|
|
||||||
@@ -103,6 +106,7 @@ func main() {
|
|||||||
Prefork: *prefork,
|
Prefork: *prefork,
|
||||||
GETOnly: false,
|
GETOnly: false,
|
||||||
ReadBufferSize: 4096 * 4, // increase max header size
|
ReadBufferSize: 4096 * 4, // increase max header size
|
||||||
|
DisableStartupMessage: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -158,5 +162,6 @@ func main() {
|
|||||||
app.Get("/*", handlers.NewProxySiteHandler(proxyOpts))
|
app.Get("/*", handlers.NewProxySiteHandler(proxyOpts))
|
||||||
app.Post("/*", handlers.NewProxySiteHandler(proxyOpts))
|
app.Post("/*", handlers.NewProxySiteHandler(proxyOpts))
|
||||||
|
|
||||||
|
fmt.Println(cli.StartupMessage("1.0.1", *port, *ruleset))
|
||||||
log.Fatal(app.Listen(":" + *port))
|
log.Fatal(app.Listen(":" + *port))
|
||||||
}
|
}
|
||||||
|
|||||||
40
internal/cli/art.go
Normal file
40
internal/cli/art.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
var art string = `
|
||||||
|
_____╬═╬____________________________________________
|
||||||
|
|_|__╬═╬___|___|___|___| EVERYWALL |___|___|___|___|
|
||||||
|
|___|╬═╬|___▄▄▌ ▄▄▄· ·▄▄▄▄ ·▄▄▄▄ ▄▄▄ .▄▄▄ __|_|
|
||||||
|
|_|__╬═╬___|██• ▐█ ▀█ ██▪ ██ ██▪ ██ ▀▄.▀·▀▄ █·|___|
|
||||||
|
|___|╬═╬|___██▪ ▄█▀▀█ ▐█· ▐█▌▐█· ▐█▌▐▀▀▪▄▐▀▀▄ __|_|
|
||||||
|
|_|__╬═╬___|▐█▌▐▌▐█ ▪▐▌██. ██ ██. ██ ▐█▄▄▌▐█•█▌|___|
|
||||||
|
|___|╬═╬|___.▀▀▀ ▀ ▀ ▀▀▀▀▀• ▀▀▀▀▀• ▀▀▀ .▀ ▀__|_|
|
||||||
|
|_|__╬═╬___|___|___|__ VERSION %s __|___|___|___|
|
||||||
|
|___|╬═╬|____|___|___|___|___|___|___|___|___|___|_|
|
||||||
|
`
|
||||||
|
|
||||||
|
func StartupMessage(version string, port string, ruleset string) string {
|
||||||
|
buf := fmt.Sprintf(art, version)
|
||||||
|
buf += fmt.Sprintf("\n > listening on http://localhost:%s\n", port)
|
||||||
|
if ruleset == "" {
|
||||||
|
buf += " ! no ruleset specified.\n > for better performance, use a ruleset using --ruleset\n"
|
||||||
|
} else {
|
||||||
|
buf += fmt.Sprintf(" > using ruleset: %s\n", ruleset)
|
||||||
|
}
|
||||||
|
return colorizeNonASCII(buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
func colorizeNonASCII(input string) string {
|
||||||
|
result := ""
|
||||||
|
for _, r := range input {
|
||||||
|
if r > 127 {
|
||||||
|
// If the character is non-ASCII, color it blue
|
||||||
|
result += fmt.Sprintf("\033[94m%c\033[0m", r)
|
||||||
|
} else {
|
||||||
|
// ASCII characters remain unchanged
|
||||||
|
result += string(r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user