From d8ebcd0ef71da8fb78642d09a79163aa3de9842d Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 4 Jul 2022 22:13:28 +0200 Subject: [PATCH] lol dpi --- copyparty/httpcli.py | 2 +- copyparty/web/browser.js | 2 +- copyparty/web/util.js | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 79355774..19e2cf5e 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -915,7 +915,7 @@ class HttpCli(object): except: raise Pebkac(422, "you POSTed invalid json") - # self.reply(b" DDoS Protection ", 503) + # self.reply(b" DD" + b"oS Protection ", 503) # return True if "srch" in self.uparam or "srch" in body: diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 9767ed98..d93b4f9b 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -248,7 +248,7 @@ var Ls = { "md_eshow": "cannot show ", "xhr403": "403: Access denied\n\ntry pressing F5, maybe you got logged out", - "cf_ok": "sorry about that -- DDoS protection kicked in\n\nthings should resume in about 30 sec\n\nif nothing happens, hit F5 to reload the page", + "cf_ok": "sorry about that -- DD" + wah + "oS protection kicked in\n\nthings should resume in about 30 sec\n\nif nothing happens, hit F5 to reload the page", "tl_xe1": "could not list subfolders:\n\nerror ", "tl_xe2": "404: Folder not found", "fl_xe1": "could not list files in folder:\n\nerror ", diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 67135f8a..4cf82a8d 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -6,7 +6,8 @@ if (!window['console']) }; -var is_touch = 'ontouchstart' in window, +var wah = '', + is_touch = 'ontouchstart' in window, is_https = (window.location + '').indexOf('https:') === 0, IPHONE = is_touch && /iPhone|iPad|iPod/i.test(navigator.userAgent), WINDOWS = navigator.platform ? navigator.platform == 'Win32' : /Windows/.test(navigator.userAgent); @@ -1455,7 +1456,7 @@ var favico = (function () { })(); -var cf_ddos_t = 0; +var cf_cha_t = 0; function xhrchk(xhr, prefix, e404) { if (xhr.status < 400 && xhr.status >= 200) return true; @@ -1469,13 +1470,13 @@ function xhrchk(xhr, prefix, e404) { var errtxt = (xhr.response && xhr.response.err) || xhr.responseText, fun = toast.err; - if (xhr.status == 503 && /\bDDoS [Pp]rotection|>Just a moment|#cf-bubbles|Checking your browser/.test(errtxt)) { - var now = Date.now(), td = now - cf_ddos_t; + if (xhr.status == 503 && /\bDD(?:wah){0}[o]S [Pp]rote[c]tion|>Just a mo[m]ent|#cf-b[u]bbles|Chec[k]ing your br[o]wser/.test(errtxt)) { + var now = Date.now(), td = now - cf_cha_t; if (td < 15000) return; - cf_ddos_t = now; - errtxt = 'Cloudflare DDoS protection kicked in\n\ntrying to fix it...'; + cf_cha_t = now; + errtxt = 'Cloudflare DD' + wah + 'oS protection kicked in\n\ntrying to fix it...'; fun = toast.warn; qsr('#cf_frame');