]> git.ipfire.org Git - ipfire.org.git/commitdiff
downloads: Add thank you page
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Nov 2020 22:12:54 +0000 (22:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Nov 2020 22:12:54 +0000 (22:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/templates/download/thank-you.html [new file with mode: 0644]
src/web/__init__.py
src/web/download.py

index c611249daf37f7ab0c3ff0eabe831a344b725051..5a91dd295ce74207ed5837681e5bf51e5dcc1866 100644 (file)
@@ -192,7 +192,8 @@ templates_donate_messages_DATA = \
 templates_donate_messagesdir = $(templates_donatedir)/messages
 
 templates_download_DATA = \
-       src/templates/download/release.html
+       src/templates/download/release.html \
+       src/templates/download/thank-you.html
 
 templates_downloaddir = $(templatesdir)/download
 
diff --git a/src/templates/download/thank-you.html b/src/templates/download/thank-you.html
new file mode 100644 (file)
index 0000000..1a62faf
--- /dev/null
@@ -0,0 +1,46 @@
+{% extends "../base.html" %}
+
+{% block title %}{{ _("Thank You For Downloading IPFire") }}{% end block %}
+
+{% block container %}
+       <div class="header">
+               <div class="container">
+                       <h1>{{ _("Thank You For Downloading IPFire") }}</h1>
+
+                       <p class="text-muted">
+                               {{ _("Your download will begin in a few seconds. If not, click the link below.") }}
+                       </p>
+
+                       <p class="download-path"></p>
+               </div>
+       </div>
+
+       <div class="container">
+               <section>
+                       XXX
+               </section>
+       </div>
+{% end block %}
+
+{% block javascript %}
+       <script type="text/javascript">
+               $("p.download-path").ready(function() {
+                       const params = new URLSearchParams(window.location.search);
+
+                       var file = params.get("file");
+
+                       // Avoid downloading files from other websites
+                       if (!file.startsWith("https://downloads.ipfire.org/"))
+                               return;
+
+                       $("p.download-path").prepend($("<a>", {
+                               href: encodeURI(file),
+                               text: file
+                       }));
+
+                       setTimeout(function() {
+                               window.location = file
+                       }, "2000");
+               });
+       </script>
+{% end %}
index 0f9c3d6a48c606b6ad800b42711a49ca9da8b78d..037496832e91ca536d1903e019fa97821317c41e 100644 (file)
@@ -135,6 +135,7 @@ class Application(tornado.web.Application):
                        # Download sites
                        (r"/downloads", tornado.web.RedirectHandler, { "url" : "/download" }),
                        (r"/download", download.IndexHandler),
+                       (r"/download/thank-you", download.ThankYouHandler),
                        (r"/download/([0-9a-z\-\.]+)", download.ReleaseHandler),
 
                        # Donate
index 6827d132eecaf6039df4e354c96afc423635f5bc..3f58579aa66a6efe372cd6fab42295a63626f7a6 100644 (file)
@@ -35,6 +35,11 @@ class ReleaseRedirectHandler(base.BaseHandler):
                self.redirect("https://www.ipfire.org/download/%s" % release, permanent=True)
 
 
+class ThankYouHandler(base.BaseHandler):
+       def get(self):
+               self.render("download/thank-you.html")
+
+
 class FileHandler(base.BaseHandler):
        def prepare(self):
                self.set_header("Pragma", "no-cache")