Commit 7c3fd400 authored by TheTechRobo's avatar TheTechRobo
Browse files

Add support for q url param to noscript

parent 60f6b7ee
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
from flask import Flask, render_template, request, Response
from flask import Flask, render_template, request, Response, redirect

import re, urllib.parse

@@ -47,6 +47,8 @@ async def youtube(v, id, site="youtube", json=True):

@app.route("/noscript_init.html")
async def noscript_init():
    if id := request.args.get("d"):
        return redirect("/noscript_load.html?d=" + id)
    return """
    <!DOCTYPE html>
    <html>
@@ -111,7 +113,8 @@ async def index():
    Shows the landing page
    """
    default = request.args.get("q") or ""
    return render_template("init.html", default=default)
    default_id = coerce_to_id(default) or ""
    return render_template("init.html", default=default,default_id=default_id)

def parse_changelog(changelog):
    """
+2 −2
Original line number Diff line number Diff line
@@ -283,7 +283,7 @@ button[disabled] {
      </div>
      <div id="data">
        <noscript>
          <iframe name="data-frame" src="/noscript_init.html" style="height:100%;width:100%;">
          <iframe name="data-frame" src="/noscript_init.html?d={{default_id}}" style="height:100%;width:100%;">
            Your browser doesn't support JavaScript or iframes.<br />
            This website requires at least one of them.
          </iframe>