From f78ee4ff0f3ef16efd79033e7e50bc54441ddcbb Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Sun, 18 Oct 2020 22:44:50 +1300 Subject: [PATCH] Better notice when instance is blocked --- api/video.js | 35 +++++++++++++++++++++++-- html/static/images/instance-blocked.svg | 1 + sass/includes/video-page.sass | 21 +++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 html/static/images/instance-blocked.svg diff --git a/api/video.js b/api/video.js index 2f1f107..2a6e0dd 100644 --- a/api/video.js +++ b/api/video.js @@ -68,13 +68,44 @@ p Requested URL: #[a(href=url)= url] ` message = pug.render(template, {instanceOrigin, url: outURL}) } else if (e instanceof InstanceError) { - const template = ` + if (e.identifier === "RATE_LIMITED_BY_YOUTUBE") { + const template = ` +.blocked-explanation + img(src="/static/images/instance-blocked.svg" width=552 height=96) + .rows + .row + h3.actor You + | Working + .row + h3.actor CloudTube + | Working + .row + h3.actor Instance + | Blocked by YouTube + .row + h3.actor YouTube + | Working +p. + CloudTube needs to a working Second/Invidious instance in order to get data about videos. + However, the selected instance, #[code= instanceOrigin], has been temporarily blocked by YouTube. +p. + You will be able to watch this video if you select a working instance in settings. + #[br]#[a(href="/settings") Go to settings →] +p. + (Tip: Try #[code https://invidious.snopyta.org] or #[code https://invidious.site].) +p. + This situation #[em will] be improved in the future! +` + message = pug.render(template, {instanceOrigin}) + } else { + const template = ` p #[strong= error.message] if error.identifier p #[code= error.identifier] p That error was generated by #[code= instanceOrigin]. ` - message = pug.render(template, {instanceOrigin, error: e}) + message = pug.render(template, {instanceOrigin, error: e}) + } } return render(500, "pug/video.pug", {video: {videoId: id}, error: true, message}) } diff --git a/html/static/images/instance-blocked.svg b/html/static/images/instance-blocked.svg new file mode 100644 index 0000000..3801432 --- /dev/null +++ b/html/static/images/instance-blocked.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/sass/includes/video-page.sass b/sass/includes/video-page.sass index 3fbf6fc..643358a 100644 --- a/sass/includes/video-page.sass +++ b/sass/includes/video-page.sass @@ -90,3 +90,24 @@ padding: 40px 20px 20px margin: 0 auto max-width: 600px + line-height: 1.4 + +.blocked-explanation + text-align: center + margin-bottom: 32px + + img + width: 552px + height: 96px + + .rows + display: grid + grid-template-columns: 22% 20% 20% 20% + grid-gap: 4% + justify-content: center + + .row + margin: 0 + + .actor + margin: 4px 0px 10px