From 62e8eae7602bef93096a4d2b345a676e5d52ff09 Mon Sep 17 00:00:00 2001 From: Pelican Installer Bot Date: Sun, 17 May 2026 12:36:02 +0000 Subject: [PATCH] Update worker to ES module format (deployed to Cloudflare) --- cloudflare-worker/worker.js | 57 ++++++++++++++----------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/cloudflare-worker/worker.js b/cloudflare-worker/worker.js index e5e6b7d..6e6be54 100644 --- a/cloudflare-worker/worker.js +++ b/cloudflare-worker/worker.js @@ -10,36 +10,15 @@ const SCRIPT_URL = 'https://raw.githubusercontent.com/everestmcarthur/pelican-in function isCurl(request) { const ua = (request.headers.get('User-Agent') || '').toLowerCase(); const accept = (request.headers.get('Accept') || ''); - // curl, wget, httpie, fetch without html accept return ua.includes('curl') || ua.includes('wget') || ua.includes('httpie') || ua.includes('powershell') || !accept.includes('text/html'); } -async function handleRequest(request) { - const url = new URL(request.url); - - // Direct script path always returns script - if (url.pathname === '/install.sh' || url.pathname === '/script') { - return serveScript(); - } - - // Root: detect curl vs browser - if (url.pathname === '/' || url.pathname === '') { - if (isCurl(request)) { - return serveScript(); - } - return serveLanding(); - } - - // 404 - return new Response('Not Found', { status: 404 }); -} - async function serveScript() { const resp = await fetch(SCRIPT_URL, { cf: { cacheTtl: 300, cacheEverything: true } }); - + if (!resp.ok) { return new Response('#!/bin/bash\necho "Error: Could not fetch installer. Try: curl -sSL https://raw.githubusercontent.com/everestmcarthur/pelican-installer/main/install.sh | sudo bash"\nexit 1', { status: 502, @@ -94,7 +73,6 @@ function serveLanding() {

🐦 Pelican Installer

The best way to install Pelican Panel & Wings — one command, fully automated.

-
Quick Install
@@ -102,15 +80,13 @@ function serveLanding() { click to copy
-
Or with options
-
+
curl -sSL https://install.jarviscli.dev | sudo bash -s -- install \\
--panel --domain panel.example.com --webserver nginx \\
--database postgres --ssl --email you@example.com \\
--cache-driver redis --session-driver redis \\
--queue-driver redis --admin-email admin@example.com \\
--admin-user admin --admin-pass MyPassword -y
click to copy
-
Features
@@ -126,25 +102,19 @@ function serveLanding() {
ARM64 support
- -

Powered by JarvisCLI

- @@ -154,6 +124,21 @@ function serveLanding() { }); } -addEventListener('fetch', event => { - event.respondWith(handleRequest(event.request)); -}); +export default { + async fetch(request) { + const url = new URL(request.url); + + if (url.pathname === '/install.sh' || url.pathname === '/script') { + return serveScript(); + } + + if (url.pathname === '/' || url.pathname === '') { + if (isCurl(request)) { + return serveScript(); + } + return serveLanding(); + } + + return new Response('Not Found', { status: 404 }); + } +};