feat: eye arg

This commit is contained in:
Guz
2025-03-30 17:53:45 -03:00
parent d642ac4333
commit d8271e47cf
6 changed files with 130 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ func NewWeb(opts Options) App {
r.Use(rerrors.NewErrorMiddleware(pages.ErrorPage{}.Component, opts.Log))
r.Handle("/", &pages.Home{})
r.Handle("/eye", &pages.Eye{})
r.Handle("/assets/", opts.Assets)
robots, err := assets.ASSETS.ReadFile("robots.txt")

View File

@@ -11,10 +11,13 @@
.absolute{position:absolute;}
.fixed{position:fixed;}
.relative{position:relative;}
.bottom-20{bottom:5rem;}
.left-0{left:0;}
.right-0{right:0;}
.right-20{right:5rem;}
.top-0{top:0;}
.z-1{z-index:1;}
.z-10{z-index:10;}
.z-2{z-index:2;}
.z-3{z-index:3;}
.z-4{z-index:4;}
@@ -45,8 +48,10 @@
.w-0\.5rem{width:0.5rem;}
.w-100\%,
.w-full{width:100%;}
.w-100vw{width:100vw;}
.w-15rem{width:15rem;}
.w-1rem{width:1rem;}
.w-20{width:5rem;}
.flex{display:flex;}
.flex-col{flex-direction:column;}
.-translate-x-15\%{--un-translate-x:-15%;transform:translateX(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotateZ(var(--un-rotate-z)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z));}
@@ -69,8 +74,12 @@
.overflow-x-hidden{overflow-x:hidden;}
.overflow-y-hidden{overflow-y:hidden;}
.scroll-smooth{scroll-behavior:smooth;}
.border-0{border-width:0px;}
.border-b-1{border-bottom-width:1px;}
.bg-black{--un-bg-opacity:1;background-color:rgb(0 0 0 / var(--un-bg-opacity)) /* #000 */;}
.bg-current{background-color:currentColor /* currentColor */;}
.bg-gray{--un-bg-opacity:1;background-color:rgb(156 163 175 / var(--un-bg-opacity)) /* #9ca3af */;}
.bg-transparent{background-color:transparent /* transparent */;}
.from-black{--un-gradient-from-position:0%;--un-gradient-from:rgb(0 0 0 / var(--un-from-opacity, 1)) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:rgb(0 0 0 / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);}
.to-transparent{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);}
.to-50\%{--un-gradient-to-position:50%;}
@@ -80,10 +89,12 @@
.bg-bottom{background-position:bottom;}
.bg-top{background-position:top;}
.p-0{padding:0;}
.px-10{padding-left:2.5rem;padding-right:2.5rem;}
.py-20{padding-top:5rem;padding-bottom:5rem;}
.pl-3{padding-left:0.75rem;}
.pr-5{padding-right:1.25rem;}
.pt-4{padding-top:1rem;}
.text-center{text-align:center;}
.text-right{text-align:right;}
.text-justify{text-align:justify;}
.text-2xl{font-size:1.5rem;line-height:2rem;}
@@ -93,15 +104,21 @@
.text-9xl{font-size:8rem;line-height:1;}
.text-xs{font-size:0.75rem;line-height:1rem;}
.text-current{color:currentColor /* currentColor */;}
.text-gray-500{--un-text-opacity:1;color:rgb(107 114 128 / var(--un-text-opacity)) /* #6b7280 */;}
.text-green-500{--un-text-opacity:1;color:rgb(34 197 94 / var(--un-text-opacity)) /* #22c55e */;}
.text-red-500{--un-text-opacity:1;color:rgb(239 68 68 / var(--un-text-opacity)) /* #ef4444 */;}
.text-transparent{color:transparent /* transparent */;}
.text-white{--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity)) /* #fff */;}
.font-japanese{font-family:Kaisei Decol;}
.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;}
.font-serif{font-family:Quattrocento,ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;}
.italic{font-style:italic;}
.underline{text-decoration-line:underline;}
.underline-offset-3{text-underline-offset:3px;}
.no-underline{text-decoration:none;}
.opacity-10{opacity:0.1;}
.opacity-50{opacity:0.5;}
.saturate-0{--un-saturate:saturate(0);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia);}
.min-h-screen{min-height:100vh;min-height:100dvh;}
.w-screen{width:100vw;width:100dvw;}
.text-stroke-1px{-webkit-text-stroke-width:1px;text-stroke-width:1px;}

BIN
assets/img/eye.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

98
handlers/pages/eye.templ Normal file
View File

@@ -0,0 +1,98 @@
package pages
import (
"net/http"
"os"
"fmt"
"forge.capytal.company/capytalcode/project-comicverse/lib/router/rerrors"
"keikos.work/templates/layouts"
)
var WEBHOOK_URL = os.Getenv("WEBHOOK_URL")
var EYE_RESPONSE = os.Getenv("EYE_RESPONSE")
func init() {
if WEBHOOK_URL == "" {
panic("missing WEBHOOK_URL variable")
}
if EYE_RESPONSE == "" {
panic("missing EYE_RESPONSE variable")
}
}
type Eye struct{}
func (p *Eye) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet {
if err := p.page(nil).Render(r.Context(), w); err != nil {
rerrors.InternalError(err).ServeHTTP(w, r)
}
return
}
response := r.FormValue("response")
if response != EYE_RESPONSE {
f := false
if err := p.page(&f).Render(r.Context(), w); err != nil {
rerrors.InternalError(err).ServeHTTP(w, r)
}
return
}
t := true
if err := p.page(&t).Render(r.Context(), w); err != nil {
rerrors.InternalError(err).ServeHTTP(w, r)
}
message := r.FormValue("message")
if message == "" {
message = "EMPTY MESSAGE"
}
_, _ = http.Post(WEBHOOK_URL, "application/json", bytes.NewReader([]byte(fmt.Sprintf(`
{
"content": null,
"embeds": [
{
"title": "New Response",
"description": "%s",
"color": 16750848
}
],
"username": "Eye",
"attachments": []
}
`, message))))
}
templ (p *Eye) page(correct *bool) {
@layouts.Page(layouts.PageInfo{}) {
<main class="w-100vw h-100vh absolute top-0 left-0 flex justify-center items-center">
<div class="text-center px-10 text-gray-500">
<p class="font-mono text-justify">
{ `"§ \+ •|*|∆} ¥^ \§+ √^{∆√∆^: §+ {+π|{§| ∆^ √§+, ∆√|€∆ •∆} §}\{§¢∆} •§` }
<span class="bg-current">########</span>
{ `§$∆¢\∆}§| ^ €§+ \{^¥^, § ¥^ €^¥\§ •∆ √^¥~}§~∆√∆^ €§ ∆}}§¥\∆{§|, ∆^} ¢∆•^} •^ ¥•}\§"` }
</p>
<form method="post">
<input type="text" required name="response" placeholder="00:00-00" class="text-gray-500 bg-transparent border-0 border-b-1"/>
<input type="text" name="message" placeholder="Message" class="text-gray-500 bg-transparent border-0 border-b-1"/>
<button class="bg-transparent border-0 text-gray-500 border-b-1">Submit</button>
</form>
if correct != nil {
if *correct {
<p class="text-green-500">
Correct
</p>
} else {
<p class="text-red-500">
Incorrect
</p>
}
}
</div>
</main>
}
}

View File

@@ -253,6 +253,16 @@ templ (p *Home) page() {
class="absolute z-2 top-0 left-0 w-full h-full bg-gradient-to-t from-black to-transparent"
aria-hidden="true"
></span>
<div
class="absolute z-10 opacity-10 bottom-20 right-20"
>
<a href="/eye">
<img
class="w-20 saturate-0"
src="/assets/img/eye.png"
/>
</a>
</div>
</footer>
}
}

View File

@@ -24,6 +24,9 @@ in {
type = str;
default = "keikoswork";
};
envFile = mkOption {
type = path;
};
};
config = with lib;
mkIf cfg.enable {
@@ -36,6 +39,7 @@ in {
Group = cfg.group;
ExecStart = "${lib.escapeShellArg (lib.getExe cfg.package)} web -port ${toString cfg.port}";
Restart = "on-success";
EnvironmentFile = cfg.envFile;
};
};