However, the /api/v0/epub endpoint does not return a proper CORS header, so the browser blocks the request originating from SB or what have you - it's a common issue with APIs like that.
The fix is to make the endpoint return Access-Control-Allow-Origin: * header.
My personal workaround for now is to have my very own server proxying this request (and adding the header) lul
if you read this you can use my thing until this is fixed ig, works great
```js
fetch('https://fichub.necauq.ua?q=' + encodeURIComponent(location.href))
.then(r => r.json())
.then(j => location.href = 'https://fichub.net' + j.epub_url)
//
// =>
//
// javascript:fetch("https://fichub.necauq.ua?q="+encodeURIComponent(location.href)).then(r=>r.json()).then(j=>location.href="https://fichub.net"+j.epub_url);
```
So I made a better bookmarklet so that there's less annoying clicks to download the thing (esp. on mobile)
Here's its source, very simple:
However, the
/api/v0/epub
endpoint does not return a proper CORS header, so the browser blocks the request originating from SB or what have you - it's a common issue with APIs like that.The fix is to make the endpoint return
Access-Control-Allow-Origin: *
header.My personal workaround for now is to have my very own server proxying this request (and adding the header) lul
if you read this you can use my thing until this is fixed ig, works great
```js fetch('https://fichub.necauq.ua?q=' + encodeURIComponent(location.href)) .then(r => r.json()) .then(j => location.href = 'https://fichub.net' + j.epub_url) // // => // // javascript:fetch("https://fichub.necauq.ua?q="+encodeURIComponent(location.href)).then(r=>r.json()).then(j=>location.href="https://fichub.net"+j.epub_url); ```