remove cookie token garbage
This commit is contained in:
parent
ed0c6b4f0a
commit
7fe997acff
12 changed files with 164 additions and 235 deletions
|
@ -10,13 +10,18 @@ html {
|
|||
padding-left: 20%;
|
||||
}
|
||||
|
||||
img {
|
||||
.social-icon {
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
}
|
||||
|
||||
.post-img {
|
||||
width: 50%;
|
||||
padding: 20px 0px 20px 0px;
|
||||
}
|
||||
|
||||
article {
|
||||
padding-top: 2em;
|
||||
padding-top: 2rem;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
@ -29,20 +34,21 @@ article {
|
|||
}
|
||||
|
||||
.post-publish-date {
|
||||
font-size: 0.7em;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.post-body {
|
||||
padding-top: 1em;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
#submit-form {
|
||||
padding-top: 2em;
|
||||
padding-top: 2rem;
|
||||
}
|
||||
|
||||
#submit-body, #submit-title {
|
||||
#submit-body,
|
||||
#submit-title {
|
||||
width: 100%;
|
||||
margin-bottom: 2em;
|
||||
margin-bottom: 2rem;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
|
@ -60,4 +66,4 @@ article {
|
|||
width: 90%;
|
||||
padding-left: 5%;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
padding: 20px;
|
||||
width: 60%;
|
||||
padding-left: 20%;
|
||||
}
|
||||
|
||||
.social-icon {
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
@media (max-width:1080px) {
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
padding: 20px;
|
||||
width: 90%;
|
||||
padding-left: 5%;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
function setTokenCookie() {
|
||||
let token = document.getElementById('set-token').value;
|
||||
let tokenCookie = 'token=' + token + "; SameSite=None; secure";
|
||||
document.cookie = tokenCookie;
|
||||
setFormTokens(token);
|
||||
document.getElementById("cookie-block").hidden = true;
|
||||
}
|
||||
|
||||
function clearTokenCookie() {
|
||||
document.cookie = "token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=None; secure";
|
||||
document.getElementById("cookie-block").hidden = false;
|
||||
}
|
||||
|
||||
function setFormTokens(token) {
|
||||
let tokenFields = document.querySelectorAll(".token");
|
||||
for (t of tokenFields) {
|
||||
t.value = token;
|
||||
}
|
||||
}
|
||||
|
||||
// if cookie is set, use it to pass the token
|
||||
let c_pairs = document.cookie.split(";");
|
||||
let cookie_set = false;
|
||||
for (c of c_pairs) {
|
||||
if (c.trim().split("=")[0].startsWith("token")){
|
||||
// stick token into all the form input fields
|
||||
let token = c.split("=")[1];
|
||||
setFormTokens(token);
|
||||
cookie_set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!cookie_set) {
|
||||
document.getElementById("cookie-block").hidden = false;
|
||||
}
|
|
@ -1,43 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="{{ username }}' site'" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<title>{{ username }}' site</title>
|
||||
<link rel="stylesheet" href="/static/css/index.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico"/>
|
||||
</head>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="{{ username }}' site'" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<body>
|
||||
<h1>Hi, I'm {{ username }}</h1>
|
||||
<p style="text-align: right">
|
||||
<a href="/">Back to the blog</a>
|
||||
</p>
|
||||
<p>
|
||||
This is my blog. If you have questions or input for me please send me an E-Mail to {{ email }}
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
<ul style="list-style: none;">
|
||||
{% if github_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/github.ico"><a href="https://github.com/{{ github_account }}"> {{ github_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if twitter_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/twitter.ico"><a href="https://twitter.com/{{ twitter_account }}"> {{ twitter_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if reddit_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/reddit.ico"><a href="https://reddit.com/u/{{ reddit_account }}"> {{ reddit_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if mastodon_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/mastodon.ico"><a href="https://mastodon.social/"> {{ mastodon_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if discord_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/discord.ico"><a href="https://discord.com/"> {{ discord_account }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
<title>{{ username }}' site</title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Hi, I'm {{ username }}</h1>
|
||||
<p style="text-align: right">
|
||||
<a href="/">Back to the blog</a>
|
||||
</p>
|
||||
<p>
|
||||
This is my blog.
|
||||
|
||||
{% if email %}
|
||||
If you have questions or input for me please send me an E-Mail to <img class="social-icon"
|
||||
src="/static/social-icons/mail.png" /> {{ email }}
|
||||
{% endif %}
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
<ul style="list-style: none;">
|
||||
{% if github_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/github.ico"><a
|
||||
href="https://github.com/{{ github_account }}"> {{ github_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if twitter_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/twitter.ico"><a
|
||||
href="https://twitter.com/{{ twitter_account }}"> {{ twitter_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if reddit_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/reddit.ico"><a
|
||||
href="https://reddit.com/u/{{ reddit_account }}"> {{ reddit_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if mastodon_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/mastodon.ico"><a href="https://mastodon.social/"> {{
|
||||
mastodon_account }}</a></li>
|
||||
{% endif %}
|
||||
{% if discord_account %}
|
||||
<li><img class="social-icon" src="/static/social-icons/discord.ico"><a href="https://discord.com/"> {{
|
||||
discord_account }}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</p>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,42 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="Edit '{{ title }}'"/>
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<title>Edit '{{ title }}'</title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cookie-block" hidden>
|
||||
<p>Please set your token cookie first.</p>
|
||||
<input id="set-token" type="text" name="set-token">
|
||||
<button onclick="setTokenCookie()">Set Token Cookie</button>
|
||||
</div>
|
||||
<button onclick="clearTokenCookie()">Clear Token Cookie</button>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="Edit '{{ title }}'" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<form id="submit-form" action="/api/blog/posts/edit/{{ id }}" method=POST>
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<label for="title">Title</label>
|
||||
<textarea id="submit-title" type="text" name="title">{{ title }}</textarea>
|
||||
<br>
|
||||
<label for="submit-body">Content</label>
|
||||
<textarea id="submit-body" type="text" name="body">{{ body }}</textarea>
|
||||
<br>
|
||||
<button id="submit-button" type="submit">Edit post</button>
|
||||
</form>
|
||||
<title>Edit '{{ title }}'</title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico" />
|
||||
</head>
|
||||
|
||||
<form action="/api/blog/posts/hide/{{ id }}" method="POST">
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<button type="submit">Hide post</button>
|
||||
</form>
|
||||
<form action="/api/blog/posts/delete/{{ id }}" method="POST">
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<button type="submit">Delete post</button>
|
||||
</form>
|
||||
<script src="/static/js/blog.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<body>
|
||||
<div id="cookie-block" hidden>
|
||||
<label for="token">Password</label>
|
||||
</br>
|
||||
<input id="token" type="password" name="token">
|
||||
</div>
|
||||
|
||||
<form id="submit-form" action="/api/blog/posts/edit/{{ id }}" method=POST>
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<label for="title">Title</label>
|
||||
<textarea id="submit-title" type="text" name="title">{{ title }}</textarea>
|
||||
<br>
|
||||
<label for="submit-body">Content</label>
|
||||
<textarea id="submit-body" type="text" name="body">{{ body }}</textarea>
|
||||
<br>
|
||||
<button id="submit-button" type="submit">Edit post</button>
|
||||
</form>
|
||||
|
||||
<form action="/api/blog/posts/hide/{{ id }}" method="POST">
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<button type="submit">Hide post</button>
|
||||
</form>
|
||||
<form action="/api/blog/posts/delete/{{ id }}" method="POST">
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<button type="submit">Delete post</button>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,33 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="Submit post" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<title>Submit post</title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cookie-block" hidden>
|
||||
<p>Please set your token cookie first.</p>
|
||||
<input id="set-token" type="text" name="set-token">
|
||||
<button onclick="setTokenCookie()">Set Token Cookie</button>
|
||||
</div>
|
||||
<button onclick="clearTokenCookie()">Clear Token Cookie</button>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta property="og:title" content="Submit post" />
|
||||
<meta property="og:image" content="/static/site-image.png" />
|
||||
|
||||
<form id="submit-form" action="/api/blog/create" method=POST>
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<label for="title">Title</label>
|
||||
<textarea id="submit-title" type="text" name="title">{{ title }}</textarea>
|
||||
<br>
|
||||
<label for="submit-body">Content</label>
|
||||
<textarea id="submit-body" type="text" name="body">{{ body }}</textarea>
|
||||
<br>
|
||||
<button id="submit-button" type="submit">Submit</button>
|
||||
</form>
|
||||
<script src="/static/js/blog.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<title>Submit post</title>
|
||||
<link rel="stylesheet" href="/static/css/blog.css">
|
||||
<link rel="shortcut icon" type="image/jpg" href="/static/favicon.ico" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cookie-block" hidden>
|
||||
<label for="token">Password</label>
|
||||
<br />
|
||||
<input id="token" type="password" name="token">
|
||||
</div>
|
||||
|
||||
<form id="submit-form" action="/api/blog/create" method=POST>
|
||||
<input class="token" type="text" name="token" hidden>
|
||||
<label for="title">Title</label>
|
||||
<textarea id="submit-title" type="text" name="title">{{ title }}</textarea>
|
||||
<br>
|
||||
<label for="submit-body">Content</label>
|
||||
<textarea id="submit-body" type="text" name="body">{{ body }}</textarea>
|
||||
<br>
|
||||
<button id="submit-button" type="submit">Submit</button>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue