-
Jean-Baptiste Pasquier authoredJean-Baptiste Pasquier authored
A magic orchestrator that allows the Freelance Network to thrive in a decentralized way, built on top of Startin'blox.
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
To install Hubl, you'll need:
- A Hubl Server (djangoldp>2)
- A Prosody Server (with appropriate modules) (optional)
- A SMTP Server (optional)
- NodeJS on your machine
Before diving in you have to check your Hubl Server supports the following LDP packages:
- djangoldp_account
- djangoldp_uploader
- an oidc_provider (eg: django-webidoidc-provider)
Those packages are given with the last stable version tested.
Refer to the documentation to install a Hubl Server with this configuration.
Build the application
In order to find your server(s) the client application needs to be assembled with the proper configuration.
Get the code of the Hubl on your machine:
git clone ...
cd hubl
npm install
Then create a config.json
based on your needs, see Mandatory and Optional Modules on this page. For convienence a config.sample.json
exists in the source.
Then build your new Hubl:
npm run build
The application bundle is in the dist
folder, ready to be deployed everywhere as a static file.
Developpers
Serve, watch files & rebuild on change with this command:
npm run watch
Notice that you may have to restart the watcher for the config.json and for locales files.
Multiple config.json
You can have as many config.*.json
as you need.
Watch on a custom config file:
CONFIG_PATH='config.customName.json' npm run watch
Build with a custom config file:
CONFIG_PATH='config.customName.json' npm run build
Mandatory modules
By default, a Hubl includes only individual chat modules.
On Server: djangoldp_account
, djangoldp_upload
, django-webidoidc-provider
packages
On config.json
:
{
"client": {
"name": "Localhost",
"logo": "/images/logo.webp"
},
"components": []
}
Where:
-
client.name
is the name of your Hubl -
client.logo
is an URL to an image file -
components
is your modules declaration registry
Optional personalisation
On config.json
:
{
"client": {
"favicon": "/images/favicon.webp",
"css": "/path/to/custom.css",
"i18n": {
"lang": "fr",
"force": "false",
"files": [
{
"name": "yourCustomLangName",
"file": "/path/to/file.json"
},
...
]
}
}
}
Where:
-
client.favicon
is an URL to a distant favicon -
client.css
is an URL to a distant CSS that'll be the last one loaded by the Hubl -
client.i18n.lang
is the fallback langage in case the visitor's browser one does not contain the string -
client.i18n.force
allows to ignore the visitor's browser langage and force theclient.i18n.lang
one -
client.i18n.files[].name
allows to use custom client lang file. -
client.i18n.files[].file
is the path the the json lang file
Allow to login to your application
Most of other modules will need to have an user logged in, if you want to use communities, then scroll back to the User Registration module, else you'll need to activate the Auto Login module:
{
"type": "autoLogin",
"parameters": {
"authority": "http://server.url/"
}
}
Where:
-
authority
is the OpenID Provider. Usually, if you usedjangoldp_account
it's the same as your djangoldp server.
Custom lang files
Each client can overwrite langs files with their own or even create custom langs.
Overwrite langs
On config.json
:
{
"client": {
"i18n": {
"files": [
{
"name": "fr",
"file": "/path/to/custom-fr.json"
}
]
}
}
}
Custom langs
Needs client.i18n.force
to true
and client.i18n.lang
to the custom lang name.
Your custom JSON file must contain every keys, from the template and from every bloxes, prefixed by the blox namespace. See example on src/locales/fr.json
.
On config.json
:
{
"client": {
"i18n": {
"lang": "pirate",
"force": "true",
"files": [
{
"name": "pirate",
"file": "/path/to/yarr.json"
}
]
}
}
}
Setting custom langs will not allow user to choose their own lang.
Optional modules
Adding modules
You can append any module listed bellow to your components
entry on your config.json
Eg. to add the notification
module:
{
"components": [
{
"type": "notification",
"route": false
}
]
}
About
About is a short page about the technology behind Hubl.
To activate about on Hubl, add this module declaration your config.json
:
{
"type": "about",
"route": false
}
Administration
Administration is a minimal modulable admin module for all other ones.
To activate administration on Hubl, add this module declaration your config.json
:
{
"type": "admin",
"route": false
}
Analytics
Hubl support Google or Matomo as analytics trackers. To use them, add to your config.json
:
{
"type": "analytics",
"parameters": {
"type": "matomo",
"url": "https://my-personal.matomo.cloud/",
"id": "1"
},
"route": false
}
Circles
Circles define group of users that can chat & share documents togethers.
Community module is mandatory.
To activate them, you need:
On Server: djangoldp_circle
, djangoldp_communities
, djangoldp_notifications
packages
Module declaration, on config.json
:
{
"type": "circles",
"endpoints": {
"get": "http://server.url/circles/",
"post": "http://server.url/circles/",
"owners": "http://server.url/users/",
"users": "http://server.url/users/",
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
}
}
Where:
-
owners
: is your users container which contains valid owners -
users
: is your users container -
xmpp
is your Prosody with appropriate modules configured on.
Circles extensions
You can extend circles with other components, the same way you would add them to your modules.
Actually it support: Events, Resources & Polls.
Eg.:
{
"type": "circles",
"endpoints": {
"get": "http://server.url/circles/",
"post": "http://server.url/circles/",
"owners": "http://server.url/users/",
"users": "http://server.url/users/",
"xmpp": "wss://xmpp-dev.startinblox.com/xmpp-websocket"
},
"extensions": [
{
"type": "events",
"endpoints": {
"get": "http://server.url/events/",
"post": "http://server.url/events/",
"typeevents": "http://server.url/typeevents/",
"postTypeevents": "http://server.url/typeevents/"
}
}
]
}
Communities
Communities are an optional layer to add on an Hubl. They add a SOLID representation of one to many group of users on your data server.
If you're upgrading an existion Hubl, you can assign all your local users to a community this way:
./manage.py create_community --name="My community"
Don't forget to set some users as admin of the community from the Django Admin if you want to allow them to create new users from app.
To activate community on Hubl, add this module declaration your config.json
:
{
"type": "communities",
"route": false
}
Dashboard
Dashboard includes card generation from HTML. To activate them, you need:
On Server: djangoldp_dashboard
packages
Module declaration, on config.json
:
{
"type": "dashboard",
"endpoints": {
"get": "http://server.url/dashboards/"
},
"parameters": {
"target": "default"
}
}
A sample fixture can be loaded with ./manage.py loaddata sample
.
You can have multiple dashboard module, see the related documentation.
Events
The events module includes a listing of upcoming events and the capability to create new ones. To activate it, you need:
On Server: djangoldp_event
packages
Module declaration, on config.json
:
{
"type": "events",
"endpoints": {
"get": "http://server.url/events/",
"post": "http://server.url/events/",
"typeevents": "http://server.url/typeevents/",
"postTypeevents": "http://server.url/typeevents/"
}
}
You can get only future events by using:
"get": "http://server.url/events/future/",
Job Offers
Job Offers includes a job board with conversation. To activate them
Community module is mandatory.
You'll need:
On Server: djangoldp_joboffer
, djangoldp_skill
, djangoldp_upload
, djangoldp_conversation
packages
Module declaration, on config.json
:
{
"type": "jobBoard",
"endpoints": {
"get": "http://server.url/job-offers/",
"post": "http://server.url/job-offers/",
"skills": "http://server.url/skills/"
}
}
Notifications
The notification module adds a bell with user's notification list and a badge on each menus with how much notifications are related to this resource. You'll need:
On Server: djangoldp_notifications
packages