mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-03-02 10:41:36 +00:00
Better notice when instance is blocked
This commit is contained in:
parent
4af41e3c7f
commit
f78ee4ff0f
3 changed files with 55 additions and 2 deletions
35
api/video.js
35
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})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue