Can't copy to clipboard

Hi,
I’ve been happily using silverbullet for a couple of months now. But I still encounter one problem. I can’t copy anything out of silverbullet using the CMD+S command for the share option.

I always get the following error in safari web browser and its PWA.:
Error running command: undefined is not an object (evaluating 'navigator.clipboard.writeText')

On Brave I get the following error:
Error running command: Cannot read properties of undefined (reading 'writeText')

On Firefox the error is:
Error running command: navigator.clipboard is undefined

So I guess the same thing on all of them.
Has anyone encountered this problem or knows a fix? Does it have to do with permissions? I’m running silverbullet selfhosted as a docker container.
I read that it could be something with https? I’m running it locally as http at the moment but could put it behind traefik with domain if necessary. Prefer the local way at the moment as I’m the only one accessing and I’m on VPN constantly anyway.

1 Like

I don’t use Brave, could this be a security restriction specifically to their browser? I use this on Chrome all the time and it works fine.

I found this: Big Regression: Latest version broke keyboard commands for copying text and pasting it · Issue #29074 · brave/brave-browser · GitHub

That seems to document this behavior. Apparently you can “fix it” by disabling a flag: Big Regression: Latest version broke keyboard commands for copying text and pasting it · Issue #29074 · brave/brave-browser · GitHub

Thanks for getting back. I tried those fixes you linked for Brave. It didn’t do it. But it happens on all browsers I tried.

I found this which I don’t know if it relates to it:

I’m using silverbullet through http as I have it running locally only and access it via vpn when away. I’ll have to try to put it behind traefik and maybe as https it will work then? Or is it working as http for you?

Ah right, yes that must be it. No I’m using it only on localhost http (where those security restrictions don’t apply) and HTTPS. http on a remote server is not a supported configuration, a bunch of things don’t work that way (like service worker, offline capability etc.)

1 Like

i have the same’ish predicament…

does this mean that if i host silverbullet locally & WITHOUT ‘https’, i won’t be able to use the ‘copy to clipboard’ feature?

i also saw: TSDproxy to Simplify Docker Self-Hosting, but i would like to have my silverbullet to be local

do i have any options to make the copy to clipboard work?

A lot more than clipboards don’t work if you are not connecting through https.

I don’t know your setup, but I’d suggest you just use https, I don’t see a reason not to. Different ways are described here

1 Like

ah, noted…
i thought that: ‘copy to clipboard’ is not affected by:

In all scenarios (that are not local) you have to access SilverBullet via HTTPS, otherwise certain features (such offline-support) won’t work.

i guess i have to go back to the drawing board to redesign network & things…

thank you!

Even if you’d work around this issue, it’d really recommend figuring out how to set this up via HTTPS. A fair amount of functionality will not work over plain HTTP, including offline mode for instance.

1 Like

@zef Why? I use VPN as well and there is absolutely no need for the HTTPS overhead in such cases (IMHO)! There should be no restrictions like that. Are they hardcoded by you or perhaps by Deno itself?

Browser vendors. These limitations are security constraints part of web standards, nothing I can do.

@zef Speaking of HTTP/1.x, what are the constraints? The protocol has not been yet obsoleted AFAIK. Even H2 can run without TLS, again AFAIK, although it’s not as typical. What are the constrains by the way? Don’t you mean that those “modern” browsers disallows parts on their API when the channel is not encrypted, do you? That sounds like pretty much as ill politics… :wink:

OT: To be honest, the “HTTPS everywhere” movement, even across already well-secured channels, is ill. The “mTLS everywhere”, even across completely dedicated and secured lines within a DC (dedicated/isolated VLAN for example), is ill. It costs money (in many ways).

There are confidential data and those non-confidential. I strongly believe that it’s my business to decide what’s what… :smiley:

It’s about what browser vendors deem as secure environment to enable “modern” APIs like e.g. every service workers (which are used to the client code so you can use SB even 100% offline). See Using Service Workers - Web APIs | MDN which states that service workers are only available on HTTPS urls and localhost. More and more web APIs like this will likely be HTTPS only.

Honestly, you may agree or disagree, it’s not a super useful conversation to have. As long as SilverBullet runs in a browser client, it will need to follow the constraints that are there.

Yeah. I am confident with the fact I can do nothing about it. But I strongly warn against any limiting efforts or we can end up with Internet that will be broken by design. :laughing: (P.S. I will read the MDN docs as soon as possible to know more, thank you.)

I think this caters to 99+% of Internet users that should really only ever use HTTPS sites and if they don’t shouldn’t allow scary things like modifying or accessing your clipboard. I suppose this is the reasoning.