From fd42ecda2f38b4a0163d62f2d9247fe5c3df0d11 Mon Sep 17 00:00:00 2001 From: prettysunflower Date: Mon, 16 Jun 2025 09:27:04 -0400 Subject: [PATCH] Added /wp-cli.sh endpoint --- pages/init.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pages/init.go b/pages/init.go index d9eb622..d4871dd 100644 --- a/pages/init.go +++ b/pages/init.go @@ -2,6 +2,7 @@ package pages import ( "embed" + "io" "net/http" ) @@ -12,4 +13,18 @@ func InitHttpHandlers() { http.HandleFunc("/{$}", homepage) http.HandleFunc("/.well-known/autoconfig/mail/config-v1.1.xml", emailAutoconfig) http.HandleFunc("/mail/config-v1.1.xml", emailAutoconfig) + http.HandleFunc("/wp-cli.sh", wpCliSh) +} + +func wpCliSh(w http.ResponseWriter, r *http.Request) { + cliScript := `#!/bin/bash + +curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar +chmod +x wp-cli.phar +mv wp-cli.phar wp +./wp +` + + w.Header().Set("Content-Type", "text/plain") + _, _ = io.WriteString(w, cliScript) }