Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Add blockstack: protocol handler to Linux #324

Closed
larrysalibra opened this issue Mar 20, 2017 · 3 comments
Closed

Add blockstack: protocol handler to Linux #324

larrysalibra opened this issue Mar 20, 2017 · 3 comments
Labels

Comments

@larrysalibra
Copy link
Collaborator

For Ubuntu, to create a blockstack: handler, create the following file:

/usr/share/applications/blockstack.desktop

With the following contents:

[Desktop Entry]
Name=Blockstack
Exec=blockstack.sh %u
Type=Application
NoDisplay=true
Categories=System;
MimeType=x-scheme-handler/blockstack;

We'll need to point the Exec= to a script that opens the user's default browser with the Portal's authentication path.

@jcnelson
Copy link
Contributor

You can find the default browser with xdg-mime query default text/html. This can be fed into the Exec= string. You can use a .desktop launcher like gtk-launch, or you can grab the command directly from the .desktop file with the following:

$ cat "/usr/share/applications/$(xdg-mime query default text/html)" | grep "Exec=" | sed -r 's/Exec=([^ ]+) .*/\1/g' | xargs sh -c -

@larrysalibra larrysalibra changed the title Add blockstack: protocol handler to Ubuntu Add blockstack: protocol handler to Linux Mar 20, 2017
@jcnelson
Copy link
Contributor

I've gotten this to work on Linux.

My blockstack.sh:

#!/bin/sh

PORTAL_URL="http://localhost:3000"

# logging...
echo "request: $@" >> /tmp/blockstack.log

# expect blockstack:AUTHENTICATION_TOKEN
if [ -z "$1" ]; then 
   exit 1
fi

AUTH_TOKEN="$(echo "$1" | sed -r 's/blockstack://g')"
exec chromium-browser "$PORTAL_URL/auth?authRequest=$AUTH_TOKEN"

My .desktop file (in ~/.local/share/applications/blockstack.desktop):

[Desktop Entry]
Name=Blockstack
Exec=blockstack.sh %u
Type=Application
NoDisplay=true
Categories=System;
MimeType=x-scheme-handler/blockstack;

@jackzampolin
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants