Compare commits
8 Commits
21df015a3a
...
a71691854e
Author | SHA1 | Date |
---|---|---|
metalune | a71691854e | |
metalune | dda3b3dbec | |
metalune | 8ed26b7b87 | |
metalune | 9ea537820a | |
metalune | ce98f4408d | |
metalune | 7d7b89b8ca | |
metalune | 5a84312706 | |
metalune | 3692b57942 |
|
@ -0,0 +1 @@
|
|||
__pycache__/
|
15
main.py
15
main.py
|
@ -2,6 +2,10 @@ from quart import Quart, request, render_template, redirect
|
|||
from datetime import datetime
|
||||
from math import ceil
|
||||
import peertube
|
||||
import html2text
|
||||
|
||||
h2t = html2text.HTML2Text()
|
||||
h2t.ignore_links = True
|
||||
|
||||
commit = "not found"
|
||||
with open(".git/refs/heads/main") as file:
|
||||
|
@ -241,7 +245,6 @@ async def search(domain, term, page):
|
|||
pages_total=(results["total"] / 10)
|
||||
)
|
||||
|
||||
|
||||
@app.route("/<string:domain>/videos/watch/<string:id>/")
|
||||
async def video(domain, id):
|
||||
data = peertube.video(domain, id)
|
||||
|
@ -256,6 +259,16 @@ async def video(domain, id):
|
|||
if data["commentsEnabled"]:
|
||||
comments = peertube.get_comments(domain, id)
|
||||
|
||||
# Strip the HTML from the comments and convert them to plain text
|
||||
new_comments = {"total": comments["total"], "data": []}
|
||||
for comment in comments["data"]:
|
||||
text = h2t.handle(comment["text"]).strip().strip("\n")
|
||||
comment["text"] = text
|
||||
new_comments["data"].append(comment)
|
||||
comments = new_comments
|
||||
|
||||
|
||||
|
||||
return await render_template(
|
||||
"video.html",
|
||||
domain=domain,
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
body {
|
||||
background-color: lightyellow;
|
||||
max-width: 800px;
|
||||
margin: 10px auto;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
background-color: lightgrey;
|
||||
padding: 3px 7px;
|
||||
display: inline;
|
||||
}
|
|
@ -2,64 +2,67 @@
|
|||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
{% block head %}
|
||||
<title>{% block full_title %}{% block title %}{% endblock %} - SimpleerTube{% endblock %}</title>
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<!-- I know that inline CSS is not .. the best, but I'll move it to an external file for sure! definitely! -->
|
||||
<body>
|
||||
<h2>{{ instance_name }}</h2>
|
||||
<form action="/{{ domain }}/search" method="POST">
|
||||
<label for="query"><b>{{ instance_name }}</b></label>
|
||||
<input type="text" name="query" id="query" placeholder="Search" value="{{ search_term }}"/>
|
||||
<input size="45" type="text" name="query" id="query" placeholder="Search" value="{{ search_term }}"/>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<a href="/{{ domain }}/videos/local">Local</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/trending">Trending</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/most-liked">Most Liked</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/recently-added">Recently Added</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="/{{ domain }}/videos/local">Local</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/trending">Trending</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/most-liked">Most Liked</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}/videos/recently-added">Recently Added</a>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
{% block head_content %}{% endblock %}
|
||||
{% block head_content %}{% endblock %}
|
||||
|
||||
{% if pagination_url %}
|
||||
{% if pages_total > 1 %}
|
||||
{% if page > 1 %}
|
||||
<a href="{{ pagination_url }}{{ page - 1 }}">Previous</a>
|
||||
<b> | </b>
|
||||
{% if pagination_url %}
|
||||
{% if pages_total > 1 %}
|
||||
{% if page > 1 %}
|
||||
<a href="{{ pagination_url }}{{ page - 1 }}">Previous</a>
|
||||
<b> | </b>
|
||||
{% endif %}
|
||||
Page {{ page }} of {{ pages_total }}
|
||||
{% if page < pages_total %}
|
||||
<b> | </b>
|
||||
<a href="{{ pagination_url }}{{ page + 1}}">Next</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
Page {{ page }} of {{ pages_total }}
|
||||
{% if page < pages_total %}
|
||||
<b> | </b>
|
||||
<a href="{{ pagination_url }}{{ page + 1}}">Next</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br>
|
||||
<br>
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
{% if pagination_url %}
|
||||
{% if pages_total > 1 %}
|
||||
{% if page > 1 %}
|
||||
<a href="{{ pagination_url }}{{ page - 1 }}">Previous</a>
|
||||
<b> | </b>
|
||||
{% if pagination_url %}
|
||||
{% if pages_total > 1 %}
|
||||
{% if page > 1 %}
|
||||
<a href="{{ pagination_url }}{{ page - 1 }}">Previous</a>
|
||||
<b> | </b>
|
||||
{% endif %}
|
||||
Page {{ page }} of {{ pages_total }}
|
||||
{% if page < pages_total %}
|
||||
<b> | </b>
|
||||
<a href="{{ pagination_url }}{{ page + 1}}">Next</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
Page {{ page }} of {{ pages_total }}
|
||||
{% if page < pages_total %}
|
||||
<b> | </b>
|
||||
<a href="{{ pagination_url }}{{ page + 1}}">Next</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<footer>
|
||||
<a href="https://git.sr.ht/~metalune/peertube/tree/{{ commit }}">Commit: {{ commit }}</a>
|
||||
</footer>
|
||||
<footer>
|
||||
<a href="https://git.sr.ht/~metalune/peertube/tree/{{ commit }}">Commit: {{ commit }}</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,15 +2,23 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SimpleerTube - Search</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<form action="/search" method="POST">
|
||||
<label for="query"><b>SimpleerTube</b></label>
|
||||
<input type="text" name="query" id="query" placeholder="Search"/>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
<footer>
|
||||
<a href="https://codeberg.org/simple-web/peertube/src/commit/{{ commit }}">Commit: {{ commit }}</a>
|
||||
</footer>
|
||||
<center>
|
||||
<h2>SimpleerTube</h2>
|
||||
<h5>A simple frontend for PeerTube</h5>
|
||||
|
||||
<form action="/search" method="POST">
|
||||
<input size="45" type="text" name="query" id="query" placeholder="SepiaSearch"/>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
<br>
|
||||
<br>
|
||||
<footer>
|
||||
<a href="https://codeberg.org/simple-web/peertube/src/commit/{{ commit }}">Commit: {{ commit }}</a>
|
||||
</footer>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SimpleerTube - Search Results</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>SimpleerTube</h2>
|
||||
<form action="/search" method="POST">
|
||||
<label for="query"><b>SimpleerTube</b></label>
|
||||
<input type="text" name="query" id="query" placeholder="Search" value="{{ query }}"/>
|
||||
<input size="45" type="text" name="query" id="query" placeholder="Search" value="{{ query }}"/>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
<br>
|
||||
|
|
|
@ -22,7 +22,7 @@ By:
|
|||
<b>Resolutions:</b>
|
||||
{% else %}
|
||||
<video height="300" controls>
|
||||
<source src="{{ video.video }}">
|
||||
<source src="{{ video.video }}">
|
||||
</video>
|
||||
<br>
|
||||
<b>Resolutions:</b>
|
||||
|
@ -62,9 +62,9 @@ Views: <b>{{ video.views }}</b> Likes: <b>{{ video.likes }}</b> Dislikes: <b>{{
|
|||
<tr>
|
||||
<td><b>Tags</b></td>
|
||||
<td>
|
||||
{% for tag in video.tags %}
|
||||
{{ tag }}
|
||||
{% endfor %}
|
||||
{% for tag in video.tags %}
|
||||
<span class="tag">{{ tag }}</span>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue