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

View file

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

View file

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