431 lines
14 KiB
Go
431 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>status cafe</title>
|
|
<link rel="stylesheet" href="/assets/style.css"/>
|
|
<meta name="description" content="your friends' 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>
|
|
#statuscafe {
|
|
padding: .5em;
|
|
background-color: azure;
|
|
border: 1px solid midnightblue;
|
|
}
|
|
|
|
#statuscafe-username {
|
|
margin-bottom: .5em;
|
|
}
|
|
|
|
#statuscafe-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>Status 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>Past this code into your HTML file:</p>
|
|
<textarea style="width: 100%; max-width: 500px; height: 75px;"><script src="https://status.cafe/current-status.js?name={{ .name }}"></script></textarea>
|
|
<p>Past this code into your CSS file:</p>
|
|
<textarea style="width: 100%; max-width: 500px; height: 175px;">#statuscafe {
|
|
padding: .5em;
|
|
background-color: azure;
|
|
border: 1px solid midnightblue;
|
|
}
|
|
#statuscafe-username {
|
|
margin-bottom: .5em;
|
|
}
|
|
#statuscafe-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://status.cafe/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="cols">
|
|
<section>
|
|
{{ if .logged }}
|
|
<h2>Set your status</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">status updater</a> bookmarklet<br>
|
|
<a href="/current-status">status 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://status.cafe/users/{{ .logged }}"><img src="https://status.cafe/users/{{ .logged }}/badge.png" alt="Status Cafe Profile"/></a></textarea></p>
|
|
{{ else }}
|
|
<h2>Welcome!</h2>
|
|
<p>status.cafe is a place to share your current status.</p>
|
|
<p><a href="/register">Register now!</a></p>
|
|
{{ end }}
|
|
<p><img src="/assets/button.png"/><br><textarea style="width: 100%; max-width: 500px; box-sizing: border-box;"><a href="https://status.cafe"><img src="https://status.cafe/assets/button.png" alt="Status Cafe"/></a></textarea></p></p>
|
|
<p><a href="/feed.atom">Subscribe via Atom</a></p>
|
|
</section>
|
|
<section>
|
|
<h2>Status stream</h2>
|
|
<p class="flash">The <a href="https://forum.status.cafe">forum</a> has opened! <a href="/forum-key">Generate your key</a> to <a href="https://forum.status.cafe/register">register</a>. Best viewed with a hot beverage.</p>
|
|
{{ range .statuses }}
|
|
<article class="status">
|
|
{{ template "status" . }}
|
|
</article>
|
|
{{ end }}
|
|
</section>
|
|
</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 statuses</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>
|
|
<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 status.cafe?</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>
|
|
</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>
|
|
<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 (accepts HTML, including a style tag)</label>
|
|
<textarea name="about" id="about" rows="20">{{ .User.About }}</textarea>
|
|
</div>
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
{{ end }}`,
|
|
"status": `<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>status cafe</title>
|
|
<link rel="stylesheet" href="/assets/style.css"/>
|
|
<meta name="description" content="your friends' updates">
|
|
</head>
|
|
<body>
|
|
{{ if .status.Content }}
|
|
{{ template "status" .status }}
|
|
{{ end }}
|
|
</body>
|
|
</html>`,
|
|
"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://status.cafe/add','status.cafe','resizable,scrollbars,width=350,height=350'))">status updater</a>
|
|
</p>
|
|
<p>That's it! From now on, whenever you want to update your status, click the status 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 Status Cafe, 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, bigoted or otherwise hate speech</b> is not permitted. Status Cafe 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>Pornographic content</b> is not allowed.</p>
|
|
<p><b>Spamming</b>, including unsolicited advertising isn't allowed. While it's perfectly fine to talk about your projects and link them, using Status Cafe only as a way to drive traffic to an external site isn't 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 }}" width="100" class="profile-picture"/>
|
|
{{ end }}
|
|
<p><a href="/users/{{ .user }}.atom">Subscribe via Atom</a></p>
|
|
<dl>
|
|
<dt>Homepage</dt>
|
|
<dd>
|
|
{{ if .homepage }}
|
|
<a href="{{ .homepage }}" target="_blank">{{ .homepage }}</a></dd>
|
|
{{ else }}
|
|
Not defined
|
|
{{ end }}
|
|
<dt>Email</dt>
|
|
<dd>
|
|
{{ if .email }}
|
|
<a href="mailto:{{ .email }}" target="_blank">{{ .email }}</a></dd>
|
|
{{ else }}
|
|
Not defined
|
|
{{ end }}
|
|
<dt>About</dt>
|
|
<dd>
|
|
{{ if .about }}
|
|
{{ .about }}
|
|
{{ else }}
|
|
Not defined
|
|
{{ end }}
|
|
</dd>
|
|
</dl>
|
|
</section>
|
|
<section>
|
|
<h2>Statuses</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 }}`,
|
|
}
|