From c0fdc28a8439cd9f6255a4c5b84c4fae06b4912b Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 27 Jan 2019 21:20:52 -0600 Subject: [PATCH] Fix colors and data-url in download widget --- assets/css/default.css | 8 ++++++-- assets/js/watch.js | 2 -- src/invidious.cr | 11 ++++++++++- src/invidious/views/watch.ecr | 8 ++++---- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/assets/css/default.css b/assets/css/default.css index 4f0db4cf..244a5edd 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -22,11 +22,13 @@ div { padding-right: 10px; } +button.pure-button-primary, a.pure-button-primary { background-color: #a0a0a0; color: rgba(35, 35, 35, 1); } +button.pure-button-primary:hover, a.pure-button-primary:hover { background-color: rgba(0, 182, 240, 1); color: #fff; @@ -271,14 +273,16 @@ img.thumbnail { #progress-container { width: 100%; border-radius: 2px; - background: #aaa; + background-color: #a0a0a0; + color: rgba(35, 35, 35, 1); } #download-progress { width: 0%; border-radius: 2px; height: 10px; - background-color: #0078e7; + background-color: rgba(0, 182, 240, 1); + color: #fff; margin-top: 0.5em; margin-bottom: 0.5em; } diff --git a/assets/js/watch.js b/assets/js/watch.js index 81fa6288..0126c586 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -65,8 +65,6 @@ function download_video(target) { } } - url = "/videoplayback" + url.split("/videoplayback")[1]; - var xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr.responseType = "arraybuffer"; diff --git a/src/invidious.cr b/src/invidious.cr index b90e9913..a720670a 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -3658,6 +3658,10 @@ get "/latest_version" do |env| id = env.params.query["id"]? itag = env.params.query["itag"]? + local = env.params.query["local"]? + local ||= "false" + local = local == "true" + if !id || !itag halt env, status_code: 400 end @@ -3674,7 +3678,12 @@ get "/latest_version" do |env| halt env, status_code: 409 end - env.redirect urls[0]["url"] + url = urls[0]["url"] + if local + url = URI.parse(url).full_path.not_nil! + end + + env.redirect url end options "/videoplayback" do |env| diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index da45011b..dc58d48d 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -59,13 +59,13 @@ @@ -77,7 +77,7 @@