feat: Upgrade template based on projects made with it
Some checks failed
Build, check & Test / run (push) Failing after 42s
Some checks failed
Build, check & Test / run (push) Failing after 42s
Signed-off-by: Florian Bouillon <f.bouillon@aptatio.com>
This commit is contained in:
24
src/pages/404.astro
Normal file
24
src/pages/404.astro
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
import MainLayout from 'layouts/MainLayout.astro'
|
||||
import I404 from 'assets/pages/404/404.svg'
|
||||
import I404Light from 'assets/pages/404/404.light.svg'
|
||||
import Button from 'components/global/Button.astro'
|
||||
import Picture from 'components/global/Picture.astro'
|
||||
---
|
||||
|
||||
<MainLayout>
|
||||
<main class="container flex flex-col gap-24 justify-center items-center md:mt-6">
|
||||
<h1 class="text-6xl text-center font-bold">404 La page recherché n'existe pas :(</h1>
|
||||
<Picture src={I404Light} srcDark={I404} alt="404 error image" />
|
||||
<div class="flex gap-6">
|
||||
<Button href="/">Retour à la page d'accueil</Button>
|
||||
<Button id="back_button">Retour à la page précédente</Button>
|
||||
</div>
|
||||
</main>
|
||||
</MainLayout>
|
||||
|
||||
<script>
|
||||
(document.querySelector('button.back_button') as HTMLButtonElement).addEventListener('click', () => {
|
||||
history.back()
|
||||
})
|
||||
</script>
|
23
src/pages/api/event.ts
Normal file
23
src/pages/api/event.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import ResponseBuilder from '../../libs/ResponseBuilder'
|
||||
|
||||
/**
|
||||
* Plausible proxy
|
||||
*/
|
||||
export const POST: APIRoute = async ({ request, clientAddress }) => {
|
||||
// const body = await request.json()
|
||||
// console.log(body, clientAddress)
|
||||
const res = await fetch('https://plausible.io/api/event', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'User-Agent': request.headers.get('User-Agent') as string,
|
||||
'X-Forwarded-For': clientAddress,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: await request.text()
|
||||
})
|
||||
return new ResponseBuilder()
|
||||
.status(res.status)
|
||||
.body(await res.text())
|
||||
.build()
|
||||
}
|
23
src/pages/event.ts
Normal file
23
src/pages/event.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import ResponseBuilder from '../../libs/ResponseBuilder'
|
||||
|
||||
/**
|
||||
* Plausible proxy
|
||||
*/
|
||||
export const POST: APIRoute = async ({ request, clientAddress }) => {
|
||||
// const body = await request.json()
|
||||
// console.log(body, clientAddress)
|
||||
const res = await fetch('https://plausible.io/api/event', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'User-Agent': request.headers.get('User-Agent') as string,
|
||||
'X-Forwarded-For': clientAddress,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: await request.text()
|
||||
})
|
||||
return new ResponseBuilder()
|
||||
.status(res.status)
|
||||
.body(await res.text())
|
||||
.build()
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
---
|
||||
import Layout from '../layouts/Layout.astro'
|
||||
---
|
||||
|
||||
<Layout title="Welcome to Astro.">
|
||||
<main>
|
||||
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
|
||||
<p class="instructions">
|
||||
To get started, open the directory <code>src/pages</code> in your project.<br />
|
||||
<strong>Code Challenge:</strong> Tweak the "Welcome to Astro" message above.
|
||||
</p>
|
||||
</main>
|
||||
</Layout>
|
||||
---
|
||||
import MainLayout from 'layouts/MainLayout.astro'
|
||||
---
|
||||
|
||||
<MainLayout title="Dzeio - Website Template">
|
||||
<main class="container flex flex-col justify-center items-center h-screen gap-6">
|
||||
<h1 class="text-8xl text-center">Dzeio Astro Template</h1>
|
||||
<h2 class="text-2xl text-center">Start editing src/pages/index.astro to see your changes!</h2>
|
||||
</main>
|
||||
</MainLayout>
|
||||
|
13
src/pages/js/script.js.ts
Normal file
13
src/pages/js/script.js.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import ResponseBuilder from '../../libs/ResponseBuilder'
|
||||
|
||||
/**
|
||||
* Plausible proxy
|
||||
*/
|
||||
export const GET: APIRoute = async () => {
|
||||
const res = await fetch('https://plausible.io/js/script.outbound-links.tagged-events.js')
|
||||
return new ResponseBuilder()
|
||||
.status(200)
|
||||
.body(await res.text())
|
||||
.build()
|
||||
}
|
Reference in New Issue
Block a user