From 81050b04e6d47b8f4e23104870947e6d59768a58 Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 17 Mar 2026 16:22:03 +0400 Subject: [PATCH 1/2] refactor: DRY `links.js` a little --- js/links.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/js/links.js b/js/links.js index 2067f4a..03403d4 100644 --- a/js/links.js +++ b/js/links.js @@ -1,16 +1,18 @@ window.addEventListener("load", () => { let list = h("div", {class: "list"}); list.append( - h("div", {}, h("a", {target:"_blank", href: "https://delta.chat"}, "Normal link: https://delta.chat (should ask to open externally)")), - h("div", {}, h("a", {target:"_blank", href: "https://wikipediа.org"}, "punycode link (should ask to open externally, this must not show wikipediа.org but xn--wikipedi-86g.org)")), - h("div", {}, h("a", {target:"_blank", href: "https://xn--wikipedi-86g.org"}, "punycode link2 (should ask to open externally, this as well must not show wikipediа.org but xn--wikipedi-86g.org)")), - h("div", {}, h("a", {href: "mailto:delta@example.org?body=test+message"}, "Mailto link")), - h("div", {}, h("a", {href: "OPENPGP4FPR:571E6FDC22C1605512A1B0C8F7AC9331B82AFB5B#a=delta%40example.org&n=TestContact&i=pHMb3fRw-JV&s=VcWU-pQSEeB"}, "old openpgp4fpr: QR verification link")), - h("div", {}, h("a", {target:"_blank", href: "https://i.delta.chat/#9AF055DB87EC48A1C009B6CA55E3712A6F7D346F&a=botsindex%40nine.testrun.org&n=Public%20Bots&i=QpBSronexvP&s=nAfQ0q_JomN"}, "New i.delta.chat invite link")), - h("div", {}, h("a", {href: "geo:48.844,2.395"}, "geo-url link (geo:)")), - h("div", {}, h("a", {href: "cabal://cabal.chat"}, "Custom scheme link")), - h("div", {}, h("a", {href: "./page.html"}, "Link to an internal HTML page")), - h("div", {}, h("a", {href: "chrome://crash"}, "chrome://crash")), + ...[ + h("a", {target:"_blank", href: "https://delta.chat"}, "Normal link: https://delta.chat (should ask to open externally)"), + h("a", {target:"_blank", href: "https://wikipediа.org"}, "punycode link (should ask to open externally, this must not show wikipediа.org but xn--wikipedi-86g.org)"), + h("a", {target:"_blank", href: "https://xn--wikipedi-86g.org"}, "punycode link2 (should ask to open externally, this as well must not show wikipediа.org but xn--wikipedi-86g.org)"), + h("a", {href: "mailto:delta@example.org?body=test+message"}, "Mailto link"), + h("a", {href: "OPENPGP4FPR:571E6FDC22C1605512A1B0C8F7AC9331B82AFB5B#a=delta%40example.org&n=TestContact&i=pHMb3fRw-JV&s=VcWU-pQSEeB"}, "old openpgp4fpr: QR verification link"), + h("a", {target:"_blank", href: "https://i.delta.chat/#9AF055DB87EC48A1C009B6CA55E3712A6F7D346F&a=botsindex%40nine.testrun.org&n=Public%20Bots&i=QpBSronexvP&s=nAfQ0q_JomN"}, "New i.delta.chat invite link"), + h("a", {href: "geo:48.844,2.395"}, "geo-url link (geo:)"), + h("a", {href: "cabal://cabal.chat"}, "Custom scheme link"), + h("a", {href: "./page.html"}, "Link to an internal HTML page"), + h("a", {href: "chrome://crash"}, "chrome://crash"), + ].map(el => h("div", {}, el)) ); document.getElementById("links-output").append( From acad974b65c88417e9e8e15f7492b5bd9b22558c Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 17 Mar 2026 16:57:13 +0400 Subject: [PATCH 2/2] feat: add link click spam test Related: - https://github.com/deltachat/deltachat-desktop/pull/5852. - https://github.com/deltachat/deltachat-desktop/issues/5785. - https://github.com/deltachat/deltachat-android/issues/4054. - https://github.com/deltachat/deltachat-ios/issues/2924. --- js/links.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/links.js b/js/links.js index 03403d4..30227b2 100644 --- a/js/links.js +++ b/js/links.js @@ -12,10 +12,22 @@ window.addEventListener("load", () => { h("a", {href: "cabal://cabal.chat"}, "Custom scheme link"), h("a", {href: "./page.html"}, "Link to an internal HTML page"), h("a", {href: "chrome://crash"}, "chrome://crash"), - ].map(el => h("div", {}, el)) + ].map(el => h("div", {}, el, makeSpamButton(el))) ); document.getElementById("links-output").append( createHeader("Links"), h("div", {class: "container"}, list) ); }); + +function makeSpamButton(elToSpam) { + const button = document.createElement("button") + button.innerText = "Spam" + button.onclick = () => { + const interval = setInterval(() => { + elToSpam.click() + }, 250) + setTimeout(() => clearInterval(interval), 5000) + } + return button +}