s1llyw0rdz/web/handler/html.go
2025-11-22 00:44:49 -05:00

427 lines
14 KiB
Go

// Code generated by go generate; DO NOT EDIT.
package handler
var TplMap = map[string]string{
"admin": `{{ define "content" }}
<section>
<h1>Admin</h1>
{{ range .inactive }}
<div>
<div><b>{{ .Name }}</b> ({{ .SignupEmail }}) <a href="/activate-user?name={{ .Name }}">Activate</a> | <a href="/delete-user?name={{ .Name }}">Delete</a></div>
<p>{{ .SignupMsg }}</p>
</div>
{{ end }}
</section>
{{ end }}`,
"confirm_remove_status": `{{ define "content" }}
<section>
Are you sure you you want to delete the following status?
<p>{{ .status.Content }}</p>
<form action="/remove?id={{ .status.Id }}" method="post">
{{ .csrfField }}
<input type="hidden" name="id"/>
<input type="submit" value="Submit">
</form>
</section>
{{ end }}`,
"create_status": `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sillywordz</title>
<link rel="stylesheet" href="/assets/style.css"/>
<meta name="description" content="your friends' writing updates">
<style>
body {
background-color: azure;
font-family: Verdana;
}
</style>
</head>
<body>
<main>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<form action="/add?silent=1" method="post" name="update-status">
{{ .csrfField }}
{{ template "status_form" .status }}
</form>
</main>
</div>
<script>
document.forms["update-status"].onsubmit = function (event) {
event.preventDefault();
fetch("/add?silent=1", {
method: "POST",
body: new FormData(document.forms["update-status"])
})
.then(response => response.ok)
.then(submitted => {
if (submitted) {
window.close()
window.location = "/"
}
})
}
</script>
</body>
</html>
`,
"current_status": `{{ define "content" }}
<style>
#sillywordz {
padding: .5em;
background-color: azure;
border: 1px solid midnightblue;
}
#sillywordz-username {
margin-bottom: .5em;
}
#sillywordz-content {
margin: 0 1em 0.5em 1em;
}
@media (min-width: 650px) {
.cols {
grid-template-columns: 1fr 1fr;
grid-gap: 2em;
}
}
</style>
<div class="cols">
<div>
<h1>Sillywordz widget</h1>
<form method="get" action="/current-status">
<table>
<tr>
<td>name:</td>
<td><input type="text" name="name" id="name" value="{{ .name }}"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="create HTML"/></td>
</tr>
</table>
</form>
<p>Paste this code into your HTML file:</p>
<textarea style="width: 100%; max-width: 500px; height: 75px;"><div id="sillywordz"><div id="sillywordz-username"></div><div id="sillywordz-number"></div><div id="sillywordz-content"></div></div><script src="https://sillywordz.kissing.computer/current-status.js?name={{ .name }}"></script></textarea>
<p>Paste this code into your CSS file:</p>
<textarea style="width: 100%; max-width: 500px; height: 175px;">#sillywordz {
padding: .5em;
background-color: azure;
border: 1px solid midnightblue;
}
#sillywordz-number {
margin-bottom: 1.2em;
}
#sillywordz-username {
margin-bottom: .5em;
}
#sillywordz-content {
margin: 0 1em 0.5em 1em;
}</textarea>
<p>Make it your own! The CSS above is only an example. Tweak it so that it integrates well with your sites's colors.</p>
</div>
<div>
<h2>Preview</h2>
{{ if .name }}
<script src="https://sillywordz.kissing.computer/current-status.js?name={{ .name }}"></script>
{{ else }}
<p>Add your name and click "generate HTML" to see a preview.</p>
{{ end }}
</div>
</div>
{{ end }}
`,
"edit_status": `{{ define "content" }}
<h1>Edit status</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
{{ template "flash" .flash }}
<form action="/edit?id={{ .status.Id }}" method="post">
{{ .csrfField }}
{{ template "status_form" .status }}
</form>
{{ end }}`,
"forum-key": `{{ define "content" }}
<h1>Forum key</h1>
<p>Your forum key is:</p>
<pre>{{ .key }}</pre>
{{ end }}`,
"index": `{{ define "head" }}
<link rel="alternate" type="application/atom+xml" title="Atom feed" href="/feed.atom" />
{{ end }}
{{ define "content" }}
<div class="home"><div class="cols"> <section>
{{ if .logged }}
<h2>Update your word count!</h2>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/add" method="post">
{{ .csrfField }}
{{ template "status_form" .status }}
</form>
<p>
<a href="/about/status-updater">word count updater</a> bookmarklet<br>
<a href="/current-status">word count widget</a> for your homepage
</p>
<p><img src="/users/{{ .logged }}/badge.png"/><br><textarea style="width: 100%; max-width: 500px; box-sizing: border-box;"><a href="https://sillywordz.kissing.computer/users/{{ .logged }}"><img src="https://sillywordz.kissing.computer/users/{{ .logged }}/badge.png" alt="Sillywordz Profile"/></a></textarea></p>
{{ else }}
<h2>Welcome!</h2>
<p>sillywordz is a place to share progress on your current writing projects.</p>
<p><a href="/register">Register now!</a></p>
{{ end }}
<p><img src="https://file.garden/aJzQmzrHVB4BLKwu/button(2).png"/><br><textarea style="width: 100%; max-width: 500px; box-sizing: border-box;"><a href="https://sillywordz.kissing.computer/"><img src="https://file.garden/aJzQmzrHVB4BLKwu/button(2).png" alt="Sillywordz"/></a></textarea></p></p>
</section>
<section>
<h2>Stream of updates!</h2>
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
</article>
{{ end }}
</section>
</div></div>
{{ end }}
`,
"login": `{{ define "content" }}
<section>
<h1>Login</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/check-login" method="post" class="auth-form">
{{ .csrfField }}
<div class="field">
<label for="name">Username</label>
<input type="text" id="name" name="name" autocomplete="off" required autofocus/>
</div>
<div class="field">
<label for="password">Password</label>
<input type="password" id="password" name="password" required/>
</div>
<input type="submit" value="Submit">
</form>
</section>
{{ end }}`,
"manage": `{{ define "content" }}
<h1>Manage updates</h1>
{{ template "flash" .flash }}
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
{{ if eq $.logged .User }}
<nav><a href="/edit?id={{ .Id }}">Edit</a> <a href="/remove?id={{ .Id }}">Delete</a></nav>
{{ end }}
</article>
{{ end }}
{{ if or .showMore (ne 0 .page) }}
<p>
{{ if ne 0 .page }}
{{ if eq 0 .prev_page }}
<a href="manage">Newer statuses</a>
{{ else }}
<a href="manage?page={{ .prev_page }}">Newer statuses</a>
{{ end }}
{{ end }}
{{ if .showMore }}
<a href="manage?page={{ .next_page }}">Older statuses</a>
{{- end }}
</p>
{{ end }}
{{ end }}
`,
"register": `{{ define "content" }}
<section>
<div class="authform"> <h1>Register</h1>
{{ if .form.Error }}
<p>{{ .form.Error }}</p>
{{ end }}
<form action="/register" method="post" class="auth-form">
{{ .csrfField }}
<div class="field">
<label for="name">Username</label>
<input type="text" id="name" name="name" autocomplete="off" required maxlength="20" autofocus/>
</div>
<div class="field">
<label for="email">Email</label>
<input type="email" id="email" name="email" autocomplete="off" required/>
</div>
<div class="field">
<label for="show-email">Show e-mail</label>
<input type="checkbox" name="show-email" value="1" id="show-email" style="width: inherit;">
</div>
<div class="field">
<label for="password">Password</label>
<input type="password" id="password" name="password" required/>
</div>
<div class="field">
<label for="password-confirm">Confirm password</label>
<input type="password" id="password-confirm" name="password-confirm" required/>
</div>
<div class="field">
<label for="answer">How did you discover sillywordz?</label>
<textarea id="answer" name="answer" required></textarea>
</div>
<p>By clicking the following button you agree to our <a href="/tos" target="_blank">Terms of Service</a>.</p>
<input type="submit" value="Submit">
</form></div>
</section>
{{ end }}
`,
"register-success": `{{ define "content" }}
<section>
<h1>Thank you!</h1>
<p>Thanks for registering, {{ .name }}!</p>
<p>You should receive a confirmation email on {{ .email }} as soon as your account is activated.</p>
</section>
{{ end }}`,
"settings": `{{ define "content" }}
<h1>Settings</h1>
{{ if .flash }}
<p>{{ .flash }}</p>
{{ end }}
<p><a href="/manage">Manage statuses</a></p>
<div class="settings"><form action="/settings-update" method="post">
{{ .csrfField }}
<div class="field">
<label for="homepage">Homepage</label>
<input type="text" name="homepage" id="homepage" value="{{ .User.Homepage }}" autocomplete="off"/>
</div>
<div class="field">
<label for="email">Email</label>
<input type="text" name="email" id="email" value="{{ .User.Email }}" autocomplete="off"/>
</div>
<div class="field">
<label for="picture">Picture URL</label>
<input type="text" name="picture" id="picture" value="{{ .User.Picture }}" autocomplete="off"/>
</div>
<div class="field">
<label for="about">About (now accepts style tags!)</label>
<textarea name="about" id="about" rows="20">{{ .User.About }}</textarea>
</div>
<input type="submit" value="Submit"></div></form>
{{ end }}
`,
"status": `{{ define "content" }}
<section>
<h1>Status</h1>
{{ template "status" .status }}
</section>
{{ end }}`,
"status-updater": `{{ define "content" }}
<section>
<h1>Status Updater</h1>
<p>
Instead of having to come back each time you want to set a new status, you can install the
status updater bookmarklet directly to your web browser. That way, you will be able to update your status
from anywhere.
</p>
<p>
Curious about what a bookmarklet is? It's simply a little javascript link that's placed on your browser's bookmark toolbar.
You can think about them as tiny programs.
</p>
<h2>Instructions</h2>
<p>
Drag the following link to your bookmarks toolbar:
</p>
<p>
<a href="javascript:void(open('https://sillywordz.kissing.computer/add','sillywordz','resizable,scrollbars,width=350,height=350'))">word count updater</a>
</p>
<p>That's it! From now on, whenever you want to update your word count, click the word count updater button from your bookmarks and a pop-up window will launch to let you update it.</p>
</section>
{{ end }}
`,
"tos": `{{ define "content" }}
<section>
<h1>Terms of service</h1>
<p>In order to use Sillywordz, you must agree to the following rules. A user not respecting these rules will have their account removed and will be banned from the service. The general rule is to be nice, friendly and respectful to anyone and their status.</p>
<p><b>Racist, transphobic, ableist, homophobic etc bigoted or otherwise hate speech</b> is not permitted. SILLYWORDZ is an inclusive place that will not tolerate anyone promoting hateful ideas and language.</p>
<p><b>Illegal activities</b> such as promoting malware, phishing or publishing something that promotes content that infringes copyright, patent or trademark you do not own is not permitted.</p>
<p><b>Spamming</b> is not allowed.</p>
<p><b>Harassing</b>, bullying, picking on a user isn't permitted.</p>
<p><b>Revealing information (doxing)</b> from a user isn't allowed.</p>
</section>
{{ end }}
`,
"user": `{{ define "head" }}
<link rel="alternate" type="application/atom+xml" title="Atom feed" href="/users/{{ .user }}.atom" />
{{ end }}
{{ define "title" }}{{ .user }} - {{ end }}
{{ define "content" }}
<div class="cols">
<section>
<h2>{{ .user }}</h2>
{{ if .picture }}
<img src="{{ .picture }}" class="profile-picture"/>
{{ end }}
<dl>
<dt class="homepage">Homepage</dt>
<dd class="homepage">
{{ if .homepage }}
<a href="{{ .homepage }}" target="_blank">{{ .homepage }}</a></dd>
{{ else }}
Not defined
{{ end }}
<dt class="email">Email</dt>
<dd class="email">
{{ if .email }}
<a href="mailto:{{ .email }}" target="_blank">{{ .email }}</a></dd>
{{ else }}
Not defined
{{ end }}
<dt class="about">About</dt>
<dd class="about">
{{ if .about }}
{{ .about }}
{{ else }}
Not defined
{{ end }}
</dd>
</dl>
</section>
<section>
<h2>Updates</h2>
{{ range .statuses }}
<article class="status">
{{ template "status" . }}
</article>
{{ end }}
{{ if or .showMore (ne 0 .page) }}
<p>
{{ if ne 0 .page }}
{{ if eq 0 .prev_page }}
<a href="{{ .user }}">Newer statuses</a>
{{ else }}
<a href="{{ .user }}?page={{ .prev_page }}">Newer statuses</a>
{{ end }}
{{ end }}
{{ if .showMore }}
<a href="{{ .user }}?page={{ .next_page }}">Older statuses</a>
{{- end }}
</p>
{{ end }}
</section>
</div>
{{ end }}
`,
}