All Projects → dcSpark → urbit-visor

dcSpark / urbit-visor

Licence: MIT License
Urbit Visor is an extension which transforms your web browser into a first class Urbit client.

Programming Languages

typescript
32286 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to urbit-visor

Flask-GraphQL-Auth
(UNMAINTAINED. FEEL FREE TO FORK) 🐍A Pythonic way to provide JWT authentication for Flask-GraphQL
Stars: ✭ 64 (-1.54%)
Mutual labels:  extension, auth
phper
A library that allows us to write PHP extensions using pure Rust and using safe Rust whenever possible.
Stars: ✭ 24 (-63.08%)
Mutual labels:  extension
testup-2
TestUp 2 for SketchUp - A GUI wrapper for running Minitest in SketchUp
Stars: ✭ 21 (-67.69%)
Mutual labels:  extension
mw-discord
📝 MediaWiki extension that sends notifications to Discord, used on https://runescape.wiki.
Stars: ✭ 16 (-75.38%)
Mutual labels:  extension
PlayniteVndb
Enables VNDB as a Metadata source for Playnite
Stars: ✭ 47 (-27.69%)
Mutual labels:  extension
Linkaro
A browser extension to easily store your social links and share them from right within your browser.
Stars: ✭ 31 (-52.31%)
Mutual labels:  extension
auth-flow-react-apollo-saga
Full stack login/register flow with React, Apollo, Redux, Redux-saga and MongoDB.
Stars: ✭ 22 (-66.15%)
Mutual labels:  auth
CSEDevOps
Azure DevOps extensions from CSE DevOps team
Stars: ✭ 18 (-72.31%)
Mutual labels:  extension
react-native-sms-user-consent
React Native wrapper for Android's SMS User Consent API, ready to use in React Native apps with minimum effort.
Stars: ✭ 45 (-30.77%)
Mutual labels:  auth
leafserver
🍃A high performance distributed unique ID generation system
Stars: ✭ 31 (-52.31%)
Mutual labels:  id
yii2-jwt-user
JWT (JSON Web Token) User component for Yii 2
Stars: ✭ 16 (-75.38%)
Mutual labels:  auth
cake-vso
Cake integration for Azure DevOps.
Stars: ✭ 19 (-70.77%)
Mutual labels:  extension
tsid-creator
A Java library for generating Time Sortable Identifiers (TSID).
Stars: ✭ 16 (-75.38%)
Mutual labels:  id
yithemes
Atom One Dark & One Light themes ported for VS Code.
Stars: ✭ 12 (-81.54%)
Mutual labels:  extension
jwt
Community maintained clone of https://github.com/dgrijalva/jwt-go
Stars: ✭ 2,080 (+3100%)
Mutual labels:  auth
eshteb
Reduces the anger of an Iranian when typing in the wrong language!
Stars: ✭ 42 (-35.38%)
Mutual labels:  extension
horse-jwt
Middleware for JWT in HORSE
Stars: ✭ 39 (-40%)
Mutual labels:  auth
AndroidSDKSearchExtension-Firefox
A Firefox port of the Chrome extension that adds an 'ad' Awesome Bar command and view source links for the Android SDK.
Stars: ✭ 19 (-70.77%)
Mutual labels:  extension
Userscript
Userscripts collection written by me
Stars: ✭ 92 (+41.54%)
Mutual labels:  extension
AntiRickRoll
Chrome extension that blocks Rickrolls!
Stars: ✭ 22 (-66.15%)
Mutual labels:  extension


Urbit Visor

Urbit Visor is an extension which transforms your web browser into a first class Urbit client. Its goal is to allow existing web tech to seamlessly integrate together with the novel functionality of Urbit.

  license

Getting Started

The fastest way to get started using Urbit Visor is via the Chrome Web Store.

This will provide you with a seamless install process and allow you to get up and running instantly. Alternatively the instructions below allow you to compile Urbit Visor locally.

Compile It Yourself

To get started first clone this repo:

$ git clone https://github.com/dcSpark/urbit-visor

Once you have done that simply use npm to compile it yourself:

$ cd visor-extension
$ nvm use
$ npm install
$ npm start

This will install all of the dependencies and build the extension. Now that the project has been built, you can add the extension to your Chrome browser via the following steps:

  1. Open Chrome.
  2. Navigate to chrome://extensions.
  3. Enable Developer mode.
  4. Click Load unpacked.
  5. Select the dist directory which has been created through the compilation process.

⚙️ Urbit Visor API

After a user installs the Urbit Visor extension into their web browser, the extension will inject a listener into each webpage that they visit. This allows both Urbit Web Apps and UV Extensions to import the uv-core library to use the exposed urbitVisor API object which seamlessly handles interacting directly with Urbit Visor, and thus the user's ship, without having to do any extra setup at all. (Note: Originally Urbit Visor injected the API directly into each web page, however in order to unify the Urbit Web App and UV Extension development experience and enable a unified uv-components library to be built, this approach was reworked into the current solution)

Below you will find the API which the current version of Urbit Visor supports. If a given method requires permission, this means that the user must grant the website permission to have access to use this method. If this authorization has not yet been given, Urbit Visor will automatically ask the user to authorize said permission upon attempt to use said method.

Method Description Requires Permission Input Returns
isConnected Returns whether or not the user actively has an Urbit ship connected. No () boolean
getShip Returns the user's ship @p. Yes () string
getURL Returns the user's ship URL. Yes () string
scry Issues a scry on the user's ship and returns the result. Yes ({app: string, path: string}) any
poke Issues a poke on the user's ship and returns the result. Yes ({app: string, mark: string, json: object}) number (request id)
thread Runs a spider thread on the user's ship and returns the result. Yes ({threadName: string, inputMark: string, outputMark: string, body: any}) any
subscribe Subscribes to a gall app. Yes ({app: gall-app, path: /path}) number (request id)
unsubscribe Unsubscribes from a gall app. Yes ({app: gall-app, path: /path}) number (request id)
requestPermissions Requests permissions from a given URL to Urbit Visor. No Array<Permission> void
authorizedPermissions Returns the permissions that the user has authorized for the current domain. No () Array<Permission>
on Adds an event listener for a subscription to Urbit Visor Events. No (eventType: string, keys: Array<string>, callback: Function) Subscription
off Removes an event listener set up by on(). No Subscription (returned by .on()) undefined
require Sets the required permissions for your app and ensures their presence. No (perms: Array<Permission>, callback: Function) undefined

.on()

The .on() method is a useful helper method which simplifies adding event listeners for both Urbit Visor and Urbit ship events.

eventType is an UrbitVisorEventType, which you can find defined in types.ts. The second argument, an array of strings, is the keys of the expected data structure sent by your urbit.

E.g. Let's take a look at a graph-store chat message json:

{"graph-update": {"add-nodes": {"resource": resource, "nodes": {"post": post, "children: []}}}

You can add a listener for the exact key you need by passing an array of keys:

urbitVisor.on("sse", ["graph-update", "add-nodes", "nodes", "children"] , (data) => someCallback(data))

This will thus sent the sole argument, children, to the callback function that you call.

If you are looking for the whole data structure you can just pass an empty array.

.require()

Visor offers a new endpoint to make the initial setup of your app much easier, thereby cleaning up most of the boilerplate. Any app will need a defined set of permissions required to run it, e.g. you might want the ship name early on to display it to the user, as well as making sure you can scry or poke. On the top page of your app (e.g. App.tsx) run urbitVisor.require and pass it two pieces of data: one array with the permissions you want, and a callback function to automatically query for the data that you know you will need.

e.g.

urbitVisor.require(["shipName", "scry", "subscribe"], setData);

function setData() {
  urbitVisor.getShip().then((res) => setShip(res.response));
  urbitVisor.subscribe({ app: "graph-store", path: "/updates" })
    .then((res) => console.log(res, "subscribed to graph-store"));
  const subscription = urbitVisor.on("sse", ["graph-update"], (data) => {
    handleGraphUpdate(data)
  });
};
function handleGraphUpdate(data){...}

The code above will make sure that your app checks the active ship on your Urbit visor for permissions to read the ship name, scry and subscribe; if they exist, it will run the setData callback, which sets the ship name into your application and subscribes to graph-store updates, then passes those updates to another function (with whatever behavior you need). If the ship does not have the permissions required, it will automatically request them, and once granted, it will know that they were granted and automatically run the setData callback, greatly reducing the amount of initial code you need to write so you can focus on your business logic.

FAQ

What does the "Your ship needs an OS update" error mean?

This typically happens when you have spawned a brand new comet which has not gone through any OTA updates and as such is running on an old version that makes it incompatible with Urbit Visor. Simply OTA using the following command in dojo:


|ota (sein:title our now our) %kids

Credit

Urbit Visor was designed and built from scratch by dcSpark and was made possible thanks to the Urbit Foundation Grant Program.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].