feat(cozy): use my-head & awesome-header

This commit is contained in:
Ayo Ayco 2025-06-28 09:20:09 +02:00
parent 270a6ca76c
commit a1b1451913
3 changed files with 10 additions and 7 deletions

View file

@ -28,7 +28,7 @@ export async function evaluateServerScripts(_html: string, event: H3Event) {
// Try to read request body // Try to read request body
const body = await readBody(event).catch(() => {}) const body = await readBody(event).catch(() => {})
// Echo back request as response // The McFly object
McFlyGlobal = { McFlyGlobal = {
path: event.path, path: event.path,
method: event.method, method: event.method,
@ -36,8 +36,6 @@ export async function evaluateServerScripts(_html: string, event: H3Event) {
body, body,
} }
// console.log('>>> Event (from core)', McFlyGlobal)
let html = evaluateServerScript(_html) let html = evaluateServerScript(_html)
html = deleteServerScripts(html) html = deleteServerScripts(html)
return html return html

View file

@ -16,3 +16,9 @@
</a> </a>
<slot /> <slot />
</header> </header>
<style>
/* does not work on Firefox yet */
@scope {
a {color: white}
}
</style>

View file

@ -1,16 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <my-head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cozy</title> <title>Cozy</title>
<link rel="stylesheet" href="/prism.css" /> <link rel="stylesheet" href="/prism.css" />
<script server:setup> <script server:setup>
const url = McFly.query.url const url = McFly.query.url
</script> </script>
</head> </my-head>
<body> <body>
<h1>Cozy</h1> <awesome-header>A Cozy test page.</awesome-header>
<form method="get"> <form method="get">
<input required type="url" name="url" id="url" value={{ url }} /> <input required type="url" name="url" id="url" value={{ url }} />
<button type="submit">Extract</button> <button type="submit">Extract</button>