diff --git a/package.json b/package.json index e410368d6..737270de8 100644 --- a/package.json +++ b/package.json @@ -80,14 +80,10 @@ "*://www.google.com/recaptcha/api/fallback?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*" ], "exclude_matches": [ - "*://www.4chan.org/pass", - "*://www.4chan.org/pass?*", "*://www.4chan.org/advertise", "*://www.4chan.org/advertise?*", "*://www.4chan.org/donate", "*://www.4chan.org/donate?*", - "*://www.4channel.org/pass", - "*://www.4channel.org/pass?*", "*://www.4channel.org/advertise", "*://www.4channel.org/advertise?*", "*://www.4channel.org/donate", diff --git a/src/Miscellaneous/PassMessage.coffee b/src/Miscellaneous/PassMessage.coffee new file mode 100644 index 000000000..8cee3f21b --- /dev/null +++ b/src/Miscellaneous/PassMessage.coffee @@ -0,0 +1,11 @@ +PassMessage = + init: -> + msg = $.el 'div', + className: 'box-outer top-box' + , + `<%= readHTML('PassMessage.html') %>` + $.ready -> + if (hd = $.id 'hd') + $.after hd, msg + else + $.prepend d.body, msg diff --git a/src/Miscellaneous/PassMessage/PassMessage.html b/src/Miscellaneous/PassMessage/PassMessage.html new file mode 100644 index 000000000..7323c748a --- /dev/null +++ b/src/Miscellaneous/PassMessage/PassMessage.html @@ -0,0 +1,20 @@ +
+

Trouble buying a 4chan Pass? (a message from 4chan X)

+
+

+ You can buy solved CAPTCHAs at <%= meta.captchaServiceLinks.map(function(x) {return '' + x[0] + ''}).join(', ') %>, and similar services. + They're a bit slow, but sufficient for image dumping. + Depending on how much you post, this can be cheaper than a Pass, and it doesn't require cryptocurrency to purchase. + 4chan X has integrated support for services that use 2captcha's API. + Go to Advanced > Captcha Solving Service in the settings panel to set it up. +

+

+ If you're thinking of buying a Pass because of annoying "Click verify once there are none left" captchas, you may be able to get rid of them for free by checking Force Noscript Captcha in your settings. +

+

+ Most imageboards either don't require captchas to post at all or require them only in limited circumstances. + Consider using another site. + 4chan X works on many Tinyboard-based sites by default, and if your preferred site isn't on the default list, you can enable 4chan X on it by following these instructions. +

+
+
diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 55c5d4f34..50cedf55a 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -79,7 +79,11 @@ Main = Conf['Use Faster Image Host'] = 'true' # Enforce JS whitelist - if /\.4chan(?:nel)?\.org$/.test(location.hostname) and !$$('script:not([src])', d).filter((s) -> /this\[/.test(s.textContent)).length + if ( + /\.4chan(?:nel)?\.org$/.test(location.hostname) and + !SW.yotsuba.regexp.pass.test(location.href) and + !$$('script:not([src])', d).filter((s) -> /this\[/.test(s.textContent)).length + ) ($.getSync or $.get) {'jsWhitelist': Conf['jsWhitelist']}, ({jsWhitelist}) -> $.addCSP "script-src #{jsWhitelist.replace(/^#.*$/mg, '').replace(/[\s;]+/g, ' ').trim()}" diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index cb5b2e2df..c357e0b29 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -100,6 +100,8 @@ SW.yotsuba = /// quotelinkHTML: /]*\bhref="(?:(?:\/\/boards\.4chan(?:nel)?\.org)?\/([^\/]+)\/thread\/)?(\d+)?(?:#p(\d+))?"/g + pass: + /^https?:\/\/www\.4chan(?:nel)?\.org\/+pass(?:$|[?#])/ bgColoredEl: -> $.el 'div', className: 'reply' @@ -130,8 +132,11 @@ SW.yotsuba = initAuxiliary: -> switch location.hostname when 'www.4chan.org', 'www.4channel.org' - $.onExists doc, 'body', -> $.addStyle CSS.www - Captcha.replace.init() + if SW.yotsuba.regexp.pass.test(location.href) + PassMessage.init() + else + $.onExists doc, 'body', -> $.addStyle CSS.www + Captcha.replace.init() return when 'sys.4chan.org', 'sys.4channel.org' pathname = location.pathname.split /\/+/