Commit 267111a3 authored by TheTechRobo's avatar TheTechRobo
Browse files

Allow custom HTML to be configured

(Finally) fixes #24

Also tries to remove ?q urls from search results.
parent 91377c97
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -141,6 +141,9 @@ async def load_thing():
    ))
    return await render_template("noscript/fid.j2", resp=t, list=list, asd=dataclasses.asdict)

head_insertion = findyoutubevideo.types.config_yml.get("additional_head")
body_insertion = findyoutubevideo.types.config_yml.get("additional_body")

@app.route("/")
async def index():
    """
@@ -159,7 +162,9 @@ async def index():
        default=default,
        default_id=default_id,
        methods=get_enabled_methods(),
        absolute_url=absolute_url
        absolute_url=absolute_url,
        head_insertion=head_insertion,
        body_insertion=body_insertion,
    )

# The following code should be taken out and shot
+5 −0
Original line number Diff line number Diff line
@@ -91,3 +91,8 @@ user_agent: "FindYoutubeVideo/1.0 operated by XYZ"
# Your IP address WILL NOT be associated with the report.
# Current list of experiments is in EXPERIMENTS.txt.
experiment_base_url: "https://fyt-helper.thetechrobo.ca/experiment"

# Allows you to insert HTML after "How do I use this?" or at the end of the <head> block.
additional_head:
additional_body:
+5 −4
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
    <title>API Documentation - YouTube Video Archive Search</title>
    <script defer data-domain="findyoutubevideo.thetechrobo.ca"
            src="https://analytic.thetechrobo.ca/js/script.js"></script>
    <title>API Documentation | YouTube Video Finder</title>
    <link rel="shortcut icon"
          href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIZJREFUOE+l0tENgCAMBNDrQroXA7GXLnSGxiZYaADpp6GPa1GwWbLZjxC4Emj4meNzDVAaew3R9wYgQJCAtOEEbZLPqXLLkQEFrCroToBPNwYK9CLrgBtjCJTLdAdBDXdgfX7j0QvodDM/EkmKdJ5lFtDRAmQqgaXsIUtAL8ky4JFfQL34BxrdPhGLmIGXAAAAAElFTkSuQmCC">
    <link href="/static/normalize.css" rel="stylesheet">
    <link href="/static/skeleton.css" rel="stylesheet">
    <link href="/static/styles.css" rel="stylesheet">
    {% if head_insertion %}
        {{ head_insertion|safe }}
    {% endif %}
</head>
<body>
<div class="container" id="header-section">
@@ -24,7 +25,7 @@
<div class="container">
    <div class="banner">
        If you're running into rate limits or otherwise need help, please contact me!
        You can try Discord (username: thetechrobo), IRC (TheTechRobo on hackint, libera.chat, and OFTC), or email (thetechrobo@proton.me).
        You can try IRC (TheTechRobo on hackint, libera.chat, and OFTC) or email (thetechrobo@proton.me).
    </div>
    <br>
    <h4>API Documentation</h4>
+11 −7
Original line number Diff line number Diff line
@@ -10,12 +10,13 @@
    <link href="/static/skeleton.css" rel="stylesheet">
    <link href="/static/styles.css" rel="stylesheet">
    <script src="/static/script.js" type="text/javascript"></script>
    <script defer data-domain="findyoutubevideo.thetechrobo.ca" src="https://analytic.thetechrobo.ca/js/script.tagged-events.js"></script>
    <script>
        window.plausible = window.plausible || function () {
            (window.plausible.q = window.plausible.q || []).push(arguments)
        }
    </script>
    {% if default %}
        <!-- Try to avoid ?=q... URLs from appearing in search results -->
        <meta name="robots" content="noindex" />
    {% endif %}
    {% if head_insertion %}
        {{ head_insertion|safe }}
    {% endif %}
</head>
<body>
<div class="container" id="header-section">
@@ -57,6 +58,9 @@
                hackint, and OFTC).
            </p>
        </details>
        {% if body_insertion %}
            {{ body_insertion|safe }}
        {% endif %}
    </ul>
</div>
<div class="container" id="input-section">
@@ -95,7 +99,7 @@
</div>
<footer class="container" id="footer-section">
    <p style="text-align: center;"><i>Website created by <a href="https://thetechrobo.ca">TheTechRobo</a></i></p>
</div>
</footer>
{% if default %}
  <script>finishWrpa("{{default}}");</script>
{% endif %}