mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-03-02 02:31:35 +00:00
Refactor video access route
- Move errors to separate files instead of embedding
- Consistent interface for error generation
- Move renderVideo function into route
- Fix unhandled FetchError regression from dbbe950
This commit is contained in:
parent
94e12a2ee8
commit
81a4d10474
7 changed files with 110 additions and 94 deletions
5
pug/errors/fetch-error.pug
Normal file
5
pug/errors/fetch-error.pug
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
p The selected instance, #[code= instanceOrigin], was unreachable.
|
||||
details
|
||||
summary If the instance is on a private network
|
||||
p The instance URL was resolved by the server. If the instance is on a private network, CloudTube will not be able to connect back to it.
|
||||
p To get around this error, you may be able to use local mode, or you can run your own CloudTube within the network.
|
||||
4
pug/errors/instance-error.pug
Normal file
4
pug/errors/instance-error.pug
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
p #[strong= error.message]
|
||||
if error.identifier
|
||||
p #[code= error.identifier]
|
||||
p That error was generated by #[code= instanceOrigin].
|
||||
1
pug/errors/message-error.pug
Normal file
1
pug/errors/message-error.pug
Normal file
|
|
@ -0,0 +1 @@
|
|||
pre= error.toString()
|
||||
25
pug/errors/rate-limited.pug
Normal file
25
pug/errors/rate-limited.pug
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.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 a working NewLeaf/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!
|
||||
1
pug/errors/unrecognised-error.pug
Normal file
1
pug/errors/unrecognised-error.pug
Normal file
|
|
@ -0,0 +1 @@
|
|||
pre= error.stack || error.toString()
|
||||
Loading…
Add table
Add a link
Reference in a new issue