-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
301c885
commit b719d0c
Showing
23 changed files
with
480 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import Features from "./Features.tsx"; | ||
import Features from "~/components/Features.tsx"; | ||
|
||
export function Content() { | ||
return ( | ||
<div class="mt-4 pb-8 flex justify-center rounded-lg text-black text-1xl lg:text-1xl bg-primary"> | ||
<Features/> | ||
</div> | ||
); | ||
return ( | ||
<div class="mt-4 pb-8 flex justify-center rounded-lg text-black text-1xl lg:text-1xl bg-primary"> | ||
<Features /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Button() { | ||
return ( | ||
<button class="btn px-24 py-4 bg-primary text-secondary rounded hover:(animate-once animate-pulse)"> | ||
UPLOAD | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Handlers, Status } from "$fresh/server.ts"; | ||
|
||
import { SessionState } from "~/middlewares/session.ts"; | ||
import { getScript } from "~/models/script.ts"; | ||
|
||
export const handler: Handlers<unknown, SessionState> = { | ||
async GET(_req, _ctx) { | ||
return Response.json({}); | ||
}, | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Handlers, Status } from "$fresh/server.ts"; | ||
import { Head } from "$fresh/runtime.ts"; | ||
|
||
import { SessionState } from "~/middlewares/session.ts"; | ||
|
||
import { getScript, Script } from "~/models/script.ts"; | ||
import { Session } from "~/models/session.ts"; | ||
|
||
import { Footer } from "~/components/Footer.tsx"; | ||
import { Header } from "~/components/Header.tsx"; | ||
import { Layout } from "~/components/Layout.tsx"; | ||
|
||
export interface ScriptPageProps { | ||
session?: Session; | ||
script: Script; | ||
} | ||
|
||
export const handler: Handlers<ScriptPageProps, SessionState> = { | ||
async GET(req, ctx) { | ||
const isHtml = req.headers.get("accept")?.includes("html"); | ||
const script = await getScript(ctx.params.id); | ||
|
||
if (isHtml) { | ||
if (script == null) { | ||
// return ctx.renderNotFound(); | ||
return ctx.render("hi"); | ||
} | ||
return ctx.render({ session: ctx.state.session, script }); | ||
} | ||
|
||
if (script == null) { | ||
return Response.json( | ||
{ | ||
message: `Could not find script with id ${ctx.params.id}`, | ||
}, | ||
{ | ||
status: Status.NotFound, | ||
}, | ||
); | ||
} | ||
|
||
return new Response(script.content, { | ||
status: Status.OK, | ||
headers: new Headers({ | ||
"Content-Type": `${script.contentType!}; charset=utf-8`, | ||
}), | ||
}); | ||
}, | ||
}; | ||
|
||
export default function Script({ | ||
data: { script }, | ||
}: { | ||
data: { script: Script }; | ||
}) { | ||
return ( | ||
<> | ||
<Head> | ||
<meta charSet="UTF-8" /> | ||
<title> | ||
crux.land | Registry for permanently hosting small scripts | ||
</title> | ||
<meta content="Crux.land" property="og:title" /> | ||
<meta | ||
content="Free registry service meant for hosting small (≤ 20kB) single deno scripts." | ||
property="og:description" | ||
/> | ||
<meta content="https://crux.land" property="og:url" /> | ||
<meta content="#3f72a0" data-react-helmet="true" name="theme-color" /> | ||
<link rel="stylesheet" href="styles.css" /> | ||
</Head> | ||
<Layout> | ||
<Header authenticated={false} /> | ||
<div class="mt-4 pb-8 flex rounded-lg text-black text-1xl lg:text-1xl bg-primary"> | ||
<code>{script.content}</code> | ||
</div> | ||
<Footer /> | ||
</Layout> | ||
</> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Handlers, Status } from "$fresh/server.ts"; | ||
|
||
import { SessionState } from "~/middlewares/session.ts"; | ||
import { getScript } from "~/models/script.ts"; | ||
|
||
export const handler: Handlers<{ id: string }, SessionState> = { | ||
async GET(_req, ctx) { | ||
const script = await getScript(ctx.params.id); | ||
|
||
if (script == null) { | ||
return Response.json({ | ||
message: `Could not find script with id ${ctx.params.id}`, | ||
}, { | ||
status: Status.NotFound, | ||
}); | ||
} | ||
|
||
return Response.json(script, { status: Status.OK }); | ||
}, | ||
}; |
Oops, something went wrong.
b719d0c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to deploy: