first commit

This commit is contained in:
2025-08-08 20:47:01 +02:00
commit e200f52f40
32 changed files with 325777 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
include "pages/page.wl"
let posts = [
{ title: "Show HN: Kitten TTS - 25MB CPU-Only, Open-Source TTS Model", date: "3 hours ago", num_comments: 127, link: "https://github.com/KittenML/KittenTTS" },
{ title: "Open models by OpenAI", date: "15 hours ago", num_comments: 651, link: "https://openai.com/open-models/" },
{ title: "Anthropic rejects the main developer of the library they use", date: "40 minutes ago", num_comments: 437, link: "https://grell.dev/blog/ai_rejection" }
]
let style =
<style>
.item {
overflow: auto;
border-bottom: 1px solid #E8D4A9;
font-size: 14px;
}
.item:last-child {
border-bottom: 0;
}
.item span {
color: #7A5F2A;
text-decoration: none;
}
.item div {
color: #E8D4A9;
float: left
}
.item div:first-child {
width: calc(100% - 250px);
}
.item div:last-child {
width: 250px;
text-align: right;
}
</style>
let main =
<main>
\for post in posts:
<div class="item">
<div>
<a href=post.link>\post.title</a>
</div>
<div>
<span>\post.date</span> | <span><a href="/thread">\post.num_comments comments</a></span>
</div>
</div>
</main>
page("Index", $login_user_id, style, main)
+19
View File
@@ -0,0 +1,19 @@
include "pages/page.wl"
include "pages/login_and_signup_style.wl"
let main =
<main>
<span>Welcome back!</span>
<form action="/api/login" method="POST">
<input type="text" name="username" placeholder="username" />
<input type="password" name="password" placeholder="password" />
<input type="submit" value="Log-In" />
<div class="form-links">
<a href="">forgot password?</a>
|
<a href="">create account</a>
</div>
</form>
</main>
page("Log-In", none, style, main)
+62
View File
@@ -0,0 +1,62 @@
let style =
<style>
span {
text-align: center;
color: #1D2B42;
font-size: 18px;
display: inline-block;
width: 100%;
margin-top: 30px;
}
form {
max-width: 300px;
margin: 30px auto;
}
form input {
border: 0;
outline: 0;
width: 100%;
border-radius: 3px;
padding: 8px;
margin-bottom: 15px;
}
form input[type=text],
form input[type=email],
form input[type=password] {
background: #E8D4A9;
border: 1px solid #D4C298;
}
form input[type=text]:focus,
form input[type=email]:focus,
form input[type=password]:focus {
border-color: #5780C9;
background: #fff;
}
form input[type=submit] {
cursor: pointer;
background: #5780C9;
color: #F7E6C0;
}
form input[type=submit]:hover {
background: #1D2B42;
}
.form-links {
text-align: center;
font-size: 12px;
}
.form-links a {
color: #7A5F2A;
margin: 0 10px;
}
.form-links a:hover {
color: #1D2B42;
}
</style>
+60
View File
@@ -0,0 +1,60 @@
include "pages/page.wl"
let style =
<style>
.not-found-container {
text-align: center;
padding: 60px 20px;
}
.error-code {
font-size: 72px;
font-weight: bold;
color: #7A5F2A;
margin-bottom: 20px;
line-height: 100%;
}
.error-message {
font-size: 24px;
color: #1D2B42;
margin-bottom: 15px;
}
.error-description {
font-size: 14px;
color: #7A5F2A;
margin-bottom: 40px;
max-width: 500px;
margin-left: auto;
margin-right: auto;
line-height: 160%;
}
.home-button {
display: inline-block;
background: #5780C9;
color: #F7E6C0;
padding: 12px 24px;
text-decoration: none;
border-radius: 5px;
font-size: 14px;
margin-top: 20px;
border: none;
cursor: pointer;
}
.home-button:hover {
background: #1D2B42;
color: #F7E6C0;
}
</style>
let main =
<main>
<div class="not-found-container">
<div class="error-code">404</div>
<div class="error-message">Page Not Found</div>
<div class="error-description">
Looks like this page wandered off somewhere.
</div>
</div>
</main>
page("Not Found", $login_user_id, style, main)
+73
View File
@@ -0,0 +1,73 @@
fun page(title, login_user_id, style, main)
<html>
<head>
<title>CN - \title</title>
<style>
body {
line-height: 200%;
font-family: monospace;
max-width: 800px;
margin: 20px auto;
}
nav {
overflow: auto;
background: #5780C9;
color: #6E93D4;
padding: 5px 10px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
nav div {
float: left
}
nav div:last-child {
float: right
}
nav a {
font-size: 14px;
color: #1D2B42;
}
nav a.current {
font-weight: bold;
}
main {
padding: 5px 10px;
background: #F7E6C0;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
footer {
padding: 5px 10px;
}
</style>
\(style)
</head>
<body>
<nav>
<div>
<a href="/index">index</a>
\if login_user_id != none: {
"|\n"
<a href="/write">write</a>
}
</div>
\if login_user_id == none:
<div>
<a href="/login">log-in</a>
|
<a href="/signup">sign-up</a>
</div>
else
<div>
<a href="">settings</a>
|
<a href="/api/logout">log-out</a>
</div>
</nav>
\main
<footer>
Made with love by cozis
</footer>
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
include "pages/page.wl"
include "pages/login_and_signup_style.wl"
let main =
<main>
<span>Welcome!</span>
<form action="/api/signup" method="POST">
<input type="text" name="username" placeholder="username" />
<input type="email" name="email" placeholder="email" />
<input type="password" name="password1" placeholder="password" />
<input type="password" name="password2" placeholder="repeat password" />
<input type="submit" value="Sign-Up" />
<div class="form-links">
<a href="">forgot password?</a>
|
<a href="">already have an account?</a>
</div>
</form>
</main>
page("Log-In", none, style, main)
+5
View File
@@ -0,0 +1,5 @@
<ul>
<li>1. Post A</li>
<li>2. Post B</li>
<li>3. Post C</li>
</ul>
+16
View File
@@ -0,0 +1,16 @@
include "pages/page.wl"
let style =
<style>
</style>
let main =
<main>
<form action="api/post" method="POST">
<input type="text" name="title" />
<textarea name="content"></textarea>
<input type="submit" value="Publish" />
</form>
</main>
page("Write Post", $login_user_id, style, main)