diff --git a/README.md b/README.md index d527b17..a87893c 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,20 @@ It uses a javascript loader file, which loads plugins over the internet. This me just serving static files, but we implemented our server code, which does one more trick. The plugin is loaded at the touch of "edit" button and that is it. +## Running +Set the linked volume in `docker-compose.yml` to where you have your plugins directory. Then run the following command. +```bash +docker-compose -f docker-compose.yml up -d +``` +This will make the application available on `0.0.0.0:8085`. + ## Plugin Every plugin is a folder which is located where the server code is run from. A plugin consists of config.json file and any other file you want. config.json instructs plugin loader which files to load. Currently we support three keys in config.json: -1. javascript: list of javascript files, local files have to be written as: `"$LOCATION$/file.js" -2. css: list of css stylesheets, local css have to be written as: `"$LOCATION$/file.js" +1. javascript: list of javascript files, local files have to be written as: `"$LOCATION$/file.js"` +2. css: list of css stylesheets, local css have to be written as: `"$LOCATION$/file.js"` 3. global: key-value list of `{'name': file}` - content of a file is stored in global variable name in browser javacsript. Same rule as above applies to local files. Everytime you want to access local plugin files in javascript, css or wherever, you prepend `$LOCATION$/` to the url. The plugin server takes care, that correct url is generated. This settings is found in `URL` value in server python code. @@ -27,14 +34,14 @@ plugin_render(div, entry) plugin_save(div) ``` -# Usage +## Lexonomy Entry Editor Settings -To use it, you must first paste the [javascript loader](plugin-loader.js) into custom entry editor section of Lexonomy configuration. +To use it, you must first paste the [javascript loader](plugin.js) into custom entry editor section of Lexonomy configuration. Next, set correct url of your plugin. In order to work, the plugin must be accessible over HTTPS, if Lexonomy already runs on https. In order to run a server, you need to run a default redis server and have these python packages installed: flask and redis. Then you can run [flask server](plugin-server.py) on a server. -## Example +### Example Let's say you are hosting plugins on lexonomyplugins.example.com and that there is a plugin (a folder) called myplugin in `CWD/plugins/` of the server python process. You need to set: diff --git a/plugin.js b/plugin.js index 37ef736..f2dd831 100644 --- a/plugin.js +++ b/plugin.js @@ -1,7 +1,8 @@ { -plugin: 'vsms', +plugin: 'vsms-py-v4.1', url: '//plugins.lexonomy.cjvt.si', -editor: function(div, entry, uneditable) { +ske_gdex: ["Hungarian-bilingual-v1", 300], +editor: function(div, entry, uneditable) { $(div).append('

INIT

'); var progress_ctr = 2, config = null;