From 9ef7d4bb86ab33d8d38e4124da4a73eca9749a48 Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Sat, 20 Jun 2026 00:05:19 +0200 Subject: [PATCH] copy link action in wtoggle --- copyparty/web/browser.css | 7 +++--- copyparty/web/browser.js | 48 +++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 2e6be2cf..9f2093cc 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -1466,10 +1466,10 @@ html:not(.e) #ggrid>a.thumbed.dir:before { white-space: nowrap; text-align: center; max-width: 79vw; - max-width: calc(100% - 3.5em); + max-width: calc(100% - 3.4em); overflow-x: auto; overflow-y: hidden; - margin: 0 .1em .1em .2em; + margin: 0 .1em .1em .1em; box-shadow: 0 0 .5em var(--mp-sh); border-radius: 5px; border-radius: var(--radius); @@ -1605,7 +1605,7 @@ html:not(.e):not(.d) #up_quick .btn.on { #wtoggle a { font-size: .5em; padding: .5em .5em; - margin: 0em .1em -.3em .1em; + margin: 0em .1em -.23em .1em; display: inline-block; } #wtoggle #zip1 { @@ -4293,7 +4293,6 @@ html.e #wrap.thin .ghead { #wtoggle.sel { display: block; max-width: 100%; - margin: 0 .1em .1em .1em; } #wstack.sel #up_quick, #wstack.sel #wtico { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 4f2d61d5..aa666b7a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -978,6 +978,7 @@ ebi('widget').innerHTML = ( '×cancel📨share🔗link' + (fun_tgl ? '✏️' : '✎') + 'name🗑️del.' + (fun_tgl ? '✂️' : '✂') + 'cut 1 ? 'Sharing files from ' : 'Sharing a file from ') + + ebi('srv_name').textContent, + url: vps.join('\n'), + }; + if(navigator.canShare && (MOBILE || !FIREFOX)){ + //desktop firefox CAN technically use this, but it sucks :P + // within 2min of testing on KDE i encountered the share being broken until browser restart + // + FF copying the "file", which can't be pasted depending on get perms, with no fallback, + // so for example pasting in discord didn't work ~Til 2026-06-19 + if(navigator.canShare(shareData)) + navigator.share(shareData) + } + else + cliptxt(shareData.url, function () { toast.ok(2, L.clipped) }); + } + r.rename = function (e) { ev(e); var sel = msel.getsel(), @@ -5717,6 +5751,7 @@ var fileman = (function () { bcpy.onclick = r.cpy; bpst.onclick = r.paste; bshr.onclick = r.share; + bcpl.onclick = r.link; bclr.onclick = r.clear; return r; @@ -10918,18 +10953,7 @@ var rcm = (function () { case 'pla': play('f-' + selFile.id); break; case 'txt': showfile.show(selFile.name); break; case 'md': location = selFile.path + (has(selFile.path, '?') ? '&v' : '?v'); break; - case 'cpl': - if(navigator.canShare){ - let shareData = { - title: selFile.name, - url: selFile.url, - }; - if(navigator.canShare(shareData)) - navigator.share(shareData) - } - else - cliptxt(selFile.url, function () { toast.ok(2, L.clipped) }); - break; + case 'cpl': fileman.link(); break; case 'dl': ebi('seldl').click(); break; case 'zip': ebi('selzip').click(); break; case 'del': fileman.delete(); break;