From 94352f278b74a62e550cfa9f35b33929049d3c6d Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 28 Apr 2025 19:00:13 +0000 Subject: [PATCH] non-https clipboard newlines; fixes #161 --- copyparty/web/util.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/copyparty/web/util.js b/copyparty/web/util.js index e2c37ec2..02423036 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -1229,7 +1229,7 @@ function dl_file(url) { function cliptxt(txt, ok) { var fb = function () { console.log('clip-fb'); - var o = mknod('input'); + var o = mknod('textarea'); o.value = txt; document.body.appendChild(o); o.focus(); @@ -1239,6 +1239,8 @@ function cliptxt(txt, ok) { ok(); }; try { + if (!window.isSecureContext) + throw 1; navigator.clipboard.writeText(txt).then(ok, fb); } catch (ex) { fb(); }