Merge pull request 'Move upload to a seperate page' (#1) from seperate-upload-page into main
Reviewed-on: #1
This commit is contained in:
commit
6b2345a726
3 changed files with 101 additions and 23 deletions
|
@ -93,28 +93,9 @@
|
||||||
|
|
||||||
{% if q is not defined and "s=newest" not in request.url %} <a href="/?s=newest">Sort by newest</a> {% endif %}
|
{% if q is not defined and "s=newest" not in request.url %} <a href="/?s=newest">Sort by newest</a> {% endif %}
|
||||||
|
|
||||||
<details>
|
<form action="upload">
|
||||||
<summary>Or post an image</summary>
|
<input type="submit" value="Upload an image" />
|
||||||
|
</form>
|
||||||
<form method="POST" enctype="multipart/form-data">
|
|
||||||
<label for="desc">Image description:</label>
|
|
||||||
<input type="text" name="desc" id="desc" placeholder="description" autocomplete="off" maxlength="{{ desc_len }}" />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<label for="key">Access key:</label>
|
|
||||||
<input type="password" name="key" id="key" placeholder="key" maxlength="{{ key_len }}" required />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<label for="image">Image:</label>
|
|
||||||
<input type="file" accept="image/*" name="image" id="image" placeholder="the image" required />
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
<button type="post">Post</button>
|
|
||||||
</form>
|
|
||||||
</details>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
90
src/imag/templates/upload.j2
Normal file
90
src/imag/templates/upload.j2
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
{% if title is defined %}
|
||||||
|
<title>Imag - {{ title | escape }}</title>
|
||||||
|
<meta name="description" content="The Imag image board | {{ title | escape }}" />
|
||||||
|
{% else %}
|
||||||
|
<title>Imag</title>
|
||||||
|
<meta name="description" content="The Imag image board" />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<meta
|
||||||
|
name="keywords"
|
||||||
|
content="imageboard, image board, image, image hosting"
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="robots"
|
||||||
|
content="follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large"
|
||||||
|
/>
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
|
||||||
|
<meta name="color-scheme" content="dark" />
|
||||||
|
<meta name="theme-color" content="black" />
|
||||||
|
|
||||||
|
<meta name="license" content="WTFPL" />
|
||||||
|
|
||||||
|
<!-- preloads the css ( technically you can replace it with a style tag -->
|
||||||
|
<link
|
||||||
|
href="{{ url_for("static", filename="index.css") }}"
|
||||||
|
rel="preload"
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
type="text/css"
|
||||||
|
as="style"
|
||||||
|
onload="this.onload=null;this.rel='stylesheet'"
|
||||||
|
/>
|
||||||
|
<noscript>
|
||||||
|
<link
|
||||||
|
href="{{ url_for("static", filename="index.css") }}"
|
||||||
|
rel="stylesheet"
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
type="text/css"
|
||||||
|
/>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<script src="{{ url_for("static", filename="index.js") }}" defer></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>The <a href="https://git.everypizza.im/n/imag/src/branch/main">Imag</a> image board ({{ imagv }}). | upload</h1>
|
||||||
|
<center>
|
||||||
|
Matrix chat: <a href="https://matrix.to/#/#quotes:everypizza.im">#quotes:everypizza.im</a> |
|
||||||
|
Matrix bot: <a href="https://matrix.to/#/@quotes:everypizza.im">@quotes:everypizza.im</a> <br>
|
||||||
|
<hr class="thin">
|
||||||
|
<small>
|
||||||
|
There's a very WIP complete rewrite of the bot in Python currently:
|
||||||
|
<a href="https://matrix.to/#/@quotes-python:everypizza.im">@quotes-python:everypizza.im</a>
|
||||||
|
</small>
|
||||||
|
</center>
|
||||||
|
<hr class="tiny">
|
||||||
|
<center>
|
||||||
|
<small>
|
||||||
|
Board message: {{ imagmessage }}
|
||||||
|
</small>
|
||||||
|
</center>
|
||||||
|
<hr class="thin">
|
||||||
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
<label for="desc">Image description:</label>
|
||||||
|
<input type="text" name="desc" id="desc" placeholder="description" autocomplete="off" maxlength="{{ desc_len }}" />
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<label for="key">Access key:</label>
|
||||||
|
<input type="password" name="key" id="key" placeholder="key" maxlength="{{ key_len }}" required />
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<label for="image">Image:</label>
|
||||||
|
<input type="file" accept="image/*" name="image" id="image" placeholder="the image" required />
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<button onclick="history.back()">Back</button>
|
||||||
|
<button type="post">Post</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -25,8 +25,15 @@ def index() -> str:
|
||||||
images=models.Image.query.order_by((models.Image.created if flask.request.args.get("s") == "newest" else models.Image.score).desc()).all(), # type: ignore
|
images=models.Image.query.order_by((models.Image.created if flask.request.args.get("s") == "newest" else models.Image.score).desc()).all(), # type: ignore
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@views.get("/upload")
|
||||||
|
def upload() -> str:
|
||||||
|
"""upload page"""
|
||||||
|
return flask.render_template(
|
||||||
|
"upload.j2",
|
||||||
|
images=models.Image.query.order_by((models.Image.created if flask.request.args.get("s") == "newest" else models.Image.score).desc()).all(), # type: ignore
|
||||||
|
)
|
||||||
|
|
||||||
@views.post("/")
|
@views.post("/upload")
|
||||||
@util.with_access(models.AccessLevel.write)
|
@util.with_access(models.AccessLevel.write)
|
||||||
def post_image() -> Response:
|
def post_image() -> Response:
|
||||||
"""post image"""
|
"""post image"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue