Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions plugins/english/daotekno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { defaultCover } from '@libs/defaultCover';
class DaoTekno implements Plugin.PluginBase {
id = 'daotekno';
name = 'DaoTekno';
version = '1.0.1';
version = '1.0.2';
icon = 'src/en/daotekno/icon.png';
site = 'https://daotekno.com/';

Expand Down Expand Up @@ -56,9 +56,22 @@ class DaoTekno implements Plugin.PluginBase {
private async fetchSite(url: string, init?: FetchInit) {
const res = await fetchApi(url, init);
if (!res.ok) {
throw Object.assign(new Error('Request failed: ' + res.status), {
status: res.status,
});
let message = 'Request failed: ' + res.status;
if (res.headers.get('cf-mitigated') === 'challenge') {
message =
'Cloudflare challenge (HTTP ' +
res.status +
'). Open daotekno.com in WebView to pass it, then retry.';
} else if (
res.status === 403 &&
/in-app browser is not allowed/i.test(await res.text())
) {
message =
'daotekno.com blocks reading in apps and in-app browsers ' +
'(HTTP 403 "Access Denied") and asks readers to open the site ' +
'in Google Chrome instead.';
}
throw Object.assign(new Error(message), { status: res.status });
}
return res;
}
Expand Down
Loading