diff --git a/plugins/english/daotekno.ts b/plugins/english/daotekno.ts index a3b5b7a35..0b2ccf594 100644 --- a/plugins/english/daotekno.ts +++ b/plugins/english/daotekno.ts @@ -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/'; @@ -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; }