davecburke / silverbullet-clipper

SilverBullet Clipper is a browser extension that allows you to save either a URL or selected content from a page as markdown to SilverBullet. By default, the capture is added as a Quick Note in the default SilverBullet inbox
MIT License
7 stars 2 forks source link

No empty auth token possible (for local usage) #7

Closed zeus-web closed 3 weeks ago

zeus-web commented 1 month ago

I want to use the clipper with a local (on my PC) running silverbullet server. For this I do not use any authentication. However, if I leave the token config field empty (in the clipper config page), every time I open the clipper applet, it opens the config page first. Could the auth token be made optional?

Thanks a lot!

davecburke commented 4 weeks ago

SilverBullet Clipper uses API calls provided by SilverBullet. SilverBullet requires authentication for API calls. I suggest that you add the SB_AUTH_TOKEN as described below. You only have to add the one time.

  1. The host URL points to the instance of your SilverBullet installation. If you're running SilverBullet locally the URL will be something like http://192.168.86.54:3000. If you are running SilverBullet externally, or accessing it via a proxy, the host URL will be something like https://silverbullet.mydomain.com
  2. The token will be whatever token you specified in the SB_AUTH_TOKEN environment variable.

    Command Line Example

    SB_USER=admin:mypassword SB_AUTH_TOKEN=mysuperlongtoken SB_HOSTNAME=0.0.0.0 /root/.deno/bin/silverbullet /root/Silverbullet/space

    Docker Compose Example

    services:
       silverbullet:
           image: zefhemel/silverbullet
           restart: unless-stopped
           environment:
           - SB_AUTH_TOKEN=mysuperlongtoken
           - SB_USER=admin:mypassword
           volumes:
           - ./space:/space
           ports:
           - 3000:3000
zeus-web commented 4 weeks ago

Thanks for the explanation! I'm aware of the auth features, but I do not want to use them locally (in fact, I could not get them to work probably running it on a windows machine yet, anyway): However, everything works without the auth token, I can create new clipped notes. The only thing is, webclipper starts with the config page, as soon as the auth field is empty. If I click on save, the capture page opens and I can fill out the title and so on. After clicking on capture, the page gets created.

So from my point of view, Silverbullet does not have a problem with no/empty token.

So my only "complain" is that clipper does not want to have a empty token field :-) Maybe you could add an option to intentionally have an empty field? Or one could enter "none" in the field, which then is used to ignore the setting or use an empty token instead?

I'm aware, that this would work with local installations only and does not make sense with public ones.

On the other hand, I DO use an (other) instance, which is reachable via internet / Https, too. However, in that case I use an authentication feature of my reverse-proxy. So the webclipper does not work anyway, as there is no way to give the authentication credentials of the proxy, which asks for them before getting to the API :-) (But THAT works as designed, and is not any fault of the clipper, of course ;-) )

davecburke commented 4 weeks ago

Interesting! I couldn't get clipper working without an auth token locally. I'll make the change to allow an empty token ASAP for you.

davecburke commented 3 weeks ago

I've stopped the config page opening by default if the token is missing. This is available in v1.2.2

zeus-web commented 3 weeks ago

Thank you very much, Dave! That's excellent service :-) On Chrome now everything works as expected!

I don't want to complain, but on Firefox I still have the same behavior (although the new 1.2.2 Version of the plugin is running).

However, I just realized, that clipper does not work correctly in Firefox anyway, here (new notes are empty). I will open a new issue for that.

zeus-web commented 3 weeks ago

Nevermind! After clicking some of the other config checkboxes and saving the config again, now also Firefox opens just the "new note" popup.