Difference between revisions of "Sirikata URIs"
(Add explanation of using slauncher, the basic outline of the config file.) |
(Add details on app.files) |
||
Line 33: | Line 33: | ||
"app" : { | "app" : { | ||
"name" : "demo", | "name" : "demo", | ||
− | "directory" : "demo" | + | "directory" : "demo", |
+ | "files" : { | ||
+ | "avatar.db" : "http://ahoy.stanford.edu/sdemo/avatar.db", | ||
+ | "meAvatar.em" : "http://ahoy.stanford.edu/sdemo/meAvatar.em" | ||
+ | } | ||
}, | }, | ||
"binary" : { | "binary" : { | ||
Line 47: | Line 51: | ||
* app.name - user-friendly name for the app | * app.name - user-friendly name for the app | ||
* app.directory - similar to app.name, but used for creating a private storage space for the application in the filesystem | * app.directory - similar to app.name, but used for creating a private storage space for the application in the filesystem | ||
+ | * app.files - a dictionary of filenames -> URLs; the given URL is downloaded and stored in the application's directory using the key as the local filename | ||
* binary.name - the name of the binary to run (cppoh, space, etc). | * binary.name - the name of the binary to run (cppoh, space, etc). | ||
* binary.args - custom arguments to pass to the binary | * binary.args - custom arguments to pass to the binary | ||
− | |||
− | |||
− | |||
− |
Latest revision as of 20:30, 2 November 2011
Sirikata has a small helper application, slauncher, which launches sirikata: URIs from a browser. To make use of it, a user should run slauncher (or slauncher.exe) to register the URI handler. On some platforms, e.g. Windows, this requires administrator permissions. You can also explicitly request registration
slauncher --register=true
Once registered (and possibly restarting your browser), you should be able to click on sirikata: URIs and you should be asked if you want to launch the application. Again, you can use slauncher yourself (e.g. from a script), explicitly specifying the URI:
slauncher --uri=some_sirikata_uri
Except on Mac, you can unregister the handler too:
slauncher --unregister=true
Sirikata URIs
Currently the URI format is very simple:
sirikata:config_uri
where config_uri is a URI for a JSON configuration file using a scheme supported by Sirikata (e.g. http, file, or data). For example
sirikata:http://pastebin.com/raw.php?i=MwZi4T0t
would run slauncher, telling it to load the configuration at the specified pastebin URL.
Why another application?
There are two reasons for slauncher. First, it lets us support launching different applications, and even launching multiple applications, in response to a URI click. It acts as a bootstrapper, loading a configuration file and executing the requested commands. This is useful, for example, to package a standalone application where the user runs both the space and the client. Second, slauncher can do some additional setup of the environment, e.g. syncing additional data before running the application, changing to the correct directory, etc.
Configuration
The structure of the configuration file is currently very limited. Here's a minimal example:
{ "app" : { "name" : "demo", "directory" : "demo", "files" : { "avatar.db" : "http://ahoy.stanford.edu/sdemo/avatar.db", "meAvatar.em" : "http://ahoy.stanford.edu/sdemo/meAvatar.em" } }, "binary" : { "name" : "cppoh", "args" : { "object-factory-opts" : "--db=avatar.db" } } }
The fields currently recognized are:
- app.name - user-friendly name for the app
- app.directory - similar to app.name, but used for creating a private storage space for the application in the filesystem
- app.files - a dictionary of filenames -> URLs; the given URL is downloaded and stored in the application's directory using the key as the local filename
- binary.name - the name of the binary to run (cppoh, space, etc).
- binary.args - custom arguments to pass to the binary