Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added oreo.elixpo/public/og-banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions oreo.elixpo/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import PageTransition from "@/components/PageTransition";
// Keeping a single image for both surfaces means a contributor only
// has to refresh one file when the brand shifts.

const SITE_TITLE = "OreoOS — a Python OS in a pocket-sized badge";
const SITE_TITLE = "OreoOS — an open-source OS in a pocket-sized badge";
const SITE_DESCRIPTION =
"Open hardware. Open firmware. 20+ apps, on-device store, OTA over " +
"WiFi, AirDrop-style file transfer. MicroPython on ESP32-S3.";
"OreoOS - Micropython inside your pocket";
const SITE_URL = "https://oreo.elixpo.com";
const OG_IMAGE = "/og-banner.png";
const OG_IMAGE = "/og-banner.jpg";

export const metadata: Metadata = {
metadataBase: new URL(SITE_URL),
Expand Down Expand Up @@ -49,7 +48,7 @@ export const metadata: Metadata = {
url: OG_IMAGE,
width: 1200,
height: 630,
alt: "Oreo Badge — a Python OS in a pocket-sized conference badge",
alt: "Oreo Badge, with your favourite mascot and a stylish lanyard!"
}],
},
twitter: {
Expand Down
2 changes: 1 addition & 1 deletion oreo.elixpo/src/app/upload/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function UploadPage() {
return;
}
const url = new URL(`http://${normalizedHost}/`);
url.searchParams.set("prefill", hashHex);
url.searchParams.set("prefill", hash);
const safeTargetUrl = url.toString();

// ── Fire window.open SYNCHRONOUSLY inside the user gesture ──
Expand Down
59 changes: 59 additions & 0 deletions tools/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
python tools/deploy.py # auto-detect port
python tools/deploy.py /dev/ttyACM0
python tools/deploy.py --clean # wipe device first
python tools/deploy.py --website # build + ship the
# Cloudflare Pages site
# in oreo.elixpo/ (no
# badge interaction)
python tools/deploy.py --website --preview # deploy to branch alias
# instead of production
python tools/deploy.py --override=gallery,reader
# before the push, wipe the named app dirs on device (and force
# any of their files in our hash cache to re-push). Use this when
Expand Down Expand Up @@ -469,9 +475,62 @@ def write_secrets_local():
remote_dirs = sorted(remote_dirs, key=lambda p: p.count("/"))


# ── website deploy ───────────────────────────────────────────────────────────

WEBSITE_DIR = Path("oreo.elixpo")
WEBSITE_PROJECT = "oreo" # Cloudflare Pages project name

def deploy_website():
"""Build the Next.js static export and push it to Cloudflare Pages.
Production by default; pass `--preview` for a branch-alias deploy.

The site lives in oreo.elixpo/ and exports to oreo.elixpo/out/. We
shell out to the project's own `next build` + `wrangler pages
deploy` so behaviour stays identical whether the user runs this
helper or the package.json `deploy` script directly.
"""
if not WEBSITE_DIR.is_dir():
print("Cannot find website directory: %s/" % WEBSITE_DIR)
sys.exit(1)
preview = "--preview" in sys.argv

print("Building Next.js static export in %s/..." % WEBSITE_DIR)
rc = subprocess.call(["npx", "next", "build"], cwd=str(WEBSITE_DIR))
if rc != 0:
print("next build failed (exit %d)" % rc)
sys.exit(rc)

out_dir = WEBSITE_DIR / "out"
if not out_dir.is_dir():
print("Build did not produce %s/" % out_dir)
sys.exit(1)

# `--branch=main` pins the deploy to the production alias so the
# custom domain (oreo.elixpo.com) actually serves the new bytes.
# Without it wrangler defaults to the current git branch, which
# only updates the branch-alias preview URL.
cmd = ["npx", "wrangler", "pages", "deploy", "out",
"--project-name=" + WEBSITE_PROJECT]
if not preview:
cmd.append("--branch=main")
print("Deploying to Cloudflare Pages (%s)..." %
("preview" if preview else "production"))
rc = subprocess.call(cmd, cwd=str(WEBSITE_DIR))
if rc != 0:
print("wrangler deploy failed (exit %d)" % rc)
sys.exit(rc)
print("Website deploy complete.")


# ── main ──────────────────────────────────────────────────────────────────────

def main():
# Website-only path — short-circuits everything ESP-related so the
# user can ship the site without a badge attached.
if "--website" in sys.argv:
deploy_website()
return

import time as _t
t0 = _t.time()
if "--no-bump" not in sys.argv:
Expand Down
Loading