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{}) {

{ `"§ \+ •|*|∆} ¥^ \§+ √^{∆√∆^: §+ {+π|{§| ∆^ √§+, ∆√|€∆ •∆} §}\{§¢∆} •§` } ######## { `§$∆¢\∆}§| ^ €§+ \{^¥^, § ¥^ €^¥\§ •∆ √^¥~}§~∆√∆^ €§ ∆}}§¥\∆{§|, ∆^} ¢∆•^} •^ ¥•}\§"` }

if correct != nil { if *correct {

Correct

} else {

Incorrect

} }
} }