From 1e6d5f39043048c3111e39753e5b33569f64794c Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 19 Sep 2020 17:06:04 +0200 Subject: [PATCH] rename 'dangerous' blueprint, as its safe has been running long enough in production now that I'm relatively confident that it doesn't get blocked by Big Goog' (*knocks on wood*). --- README.md | 6 ++---- app/{dangerous => browse}/__init__.py | 7 ++----- app/{dangerous => browse}/lib.py | 0 app/{dangerous => browse}/protobuf.py | 0 app/{dangerous => browse}/static/style.css | 0 app/{dangerous => browse}/templates/channel.html.j2 | 6 +++--- app/{dangerous => browse}/templates/playlist.html.j2 | 1 - app/{dangerous => browse}/templates/search.html.j2 | 2 +- config/config.ini | 2 +- 9 files changed, 9 insertions(+), 15 deletions(-) rename app/{dangerous => browse}/__init__.py (94%) rename app/{dangerous => browse}/lib.py (100%) rename app/{dangerous => browse}/protobuf.py (100%) rename app/{dangerous => browse}/static/style.css (100%) rename app/{dangerous => browse}/templates/channel.html.j2 (84%) rename app/{dangerous => browse}/templates/playlist.html.j2 (92%) rename app/{dangerous => browse}/templates/search.html.j2 (96%) diff --git a/README.md b/README.md index 8edc37b..282977d 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,8 @@ TODO: ratelimiting ourselves. - abstract database access we want to be able to choose between at least sqlite and postgres - - implement 'dangerous' functions as disablable blueprint - - search through invidious-api - - proxy hls/dash manifests - - hls.js for livestreams + - proxy hls/dash manifests + - hls.js for livestreams - document all the things - quality of life improvements: - asynchronically call update-subs and pull-subs on subscribing, iff necessary diff --git a/app/dangerous/__init__.py b/app/browse/__init__.py similarity index 94% rename from app/dangerous/__init__.py rename to app/browse/__init__.py index f3f89b3..77fe880 100644 --- a/app/dangerous/__init__.py +++ b/app/browse/__init__.py @@ -1,6 +1,3 @@ -# this is an alternative to proxying through invidious. the search endpoint has only been (loosely) tested by -#17:50 < perflyst[m]> appears to be working -#, so i hope™ this works. if not, that's why it's in the 'dangerous' blueprint import requests from flask import Blueprint, render_template, request, flash, g, url_for, redirect from werkzeug.exceptions import NotFound @@ -10,7 +7,7 @@ from ..common.innertube import * from .lib import * from .protobuf import make_sp, make_channel_params, make_playlist_params -frontend = Blueprint('dangerous', __name__, +frontend = Blueprint('browse', __name__, template_folder='templates', static_folder='static', static_url_path='/static/ys') @@ -147,7 +144,7 @@ def inject_button(): g.header_items = [] g.header_items.append({ 'name': 'search', - 'url': url_for('dangerous.search'), + 'url': url_for('browse.search'), 'parent': frontend.name, 'priority': 15, }) diff --git a/app/dangerous/lib.py b/app/browse/lib.py similarity index 100% rename from app/dangerous/lib.py rename to app/browse/lib.py diff --git a/app/dangerous/protobuf.py b/app/browse/protobuf.py similarity index 100% rename from app/dangerous/protobuf.py rename to app/browse/protobuf.py diff --git a/app/dangerous/static/style.css b/app/browse/static/style.css similarity index 100% rename from app/dangerous/static/style.css rename to app/browse/static/style.css diff --git a/app/dangerous/templates/channel.html.j2 b/app/browse/templates/channel.html.j2 similarity index 84% rename from app/dangerous/templates/channel.html.j2 rename to app/browse/templates/channel.html.j2 index bf08a39..893bb0e 100644 --- a/app/dangerous/templates/channel.html.j2 +++ b/app/browse/templates/channel.html.j2 @@ -11,9 +11,9 @@
- videos | - playlists | -
+ videos | + playlists | +
diff --git a/app/dangerous/templates/playlist.html.j2 b/app/browse/templates/playlist.html.j2 similarity index 92% rename from app/dangerous/templates/playlist.html.j2 rename to app/browse/templates/playlist.html.j2 index 82083a1..7508202 100644 --- a/app/dangerous/templates/playlist.html.j2 +++ b/app/browse/templates/playlist.html.j2 @@ -6,7 +6,6 @@

{{ title | e }}
{{ author | e }}

- {# TODO: copy pasted from dangerous/search.j2 #} {% for card in rows %} {{ macros.typed_card(card) }} {% endfor %} diff --git a/app/dangerous/templates/search.html.j2 b/app/browse/templates/search.html.j2 similarity index 96% rename from app/dangerous/templates/search.html.j2 rename to app/browse/templates/search.html.j2 index 22c19c3..0502052 100644 --- a/app/dangerous/templates/search.html.j2 +++ b/app/browse/templates/search.html.j2 @@ -3,7 +3,7 @@ {% block favicon %} {{ super() }} - + {% endblock %} {% block title %} diff --git a/config/config.ini b/config/config.ini index 1a19dea..1f8cd8c 100644 --- a/config/config.ini +++ b/config/config.ini @@ -22,7 +22,7 @@ welcome_message =

Welcome to subscriptions.gir.st

# shadow routes of those mentioned last. the 'proxy' endpoint is disabled by # default. if you run webhooks on a different server/port, you can disable it # here (although it doesn't hurt). -modules = invidious,youtube,webhooks,reddit +modules = browse,youtube,webhooks,reddit [websub] # how long (in seconds) to request updates from websub-hub before having to -- 2.39.3