# Zero-OS Hub
This is the repository for the Zero-OS Hub website.
It contains all the source code needed to make the public Zero-OS Hub website.
## Releases
- [master](https://github.com/threefoldtech/0-hub/tree/master) - stable production version
- [playground](https://github.com/threefoldtech/0-hub/tree/playground) - development playground version
# The Hub
The Zero OS Hub allows you to do multiple things.
## Public centralization of flists
The hub is mainly there to gives an easy way to distribute flist files.
Flist are database of metadata you can use in any Zero-OS container/vm.
## Uploading your files
In order to publish easily your files, you can upload a `.tar.gz` and the hub will convert it automatically to a flist
and store the contents in the hub backend. After that you can use your flist directly on a container.
## Merging multiple flists
In order to reduce the maintenance of your images, products, etc. flist allows you to keep your
different products and files separately and then merge them with another flist to make it usable without
keeping the system up-to-date.
Example: there is an official `ubuntu 16.04` flist image, you can make a flist which contains your application files
and then merge your flist with ubuntu, so the resulting flist is your product on the last version of ubunbu.
You don't need to take care about the base system yourself, just merge it with the one provided.
## Convert a docker hub's image to a flist on-the-fly
You can convert a docker image (eg: `busybox`, `ubuntu`, `fedora`, `couchdb`, ...) to a flist directly from
the backend, this allows you to use your existing docker image in our infrastructure out-of-the-box.
## Upload your existing flist to reduce bandwidth
In addition with the hub-client (a side product) you can upload efficiently contents of file
to make the backend up-to-date and upload a self-made flist. This allows you to do all the jobs yourself
and gives you the full control of the chain. The only restriction is that the contents of the files you host
on the flist needs to exists on the backend, otherwise your flist will be rejected.
## Authentication via 3bot or itsyou.online
All the operations on the hub needs to be done via a `3bot` (default) or `itsyou.online` (deprecated) authentication.
Only downloading a flist can be done anonymously.
## Getting information through API
The hub host a basic REST API which can gives you some informations about flists, renaming them, remove them, etc.
To use authenticated endpoints, you need to provide a itsyou.online valid `jwt` via `Authorization: bearer ` header.
This `jwt` can contains special `memberof` to allows you cross-repository actions.
If your `jwt` contains memberof, you can choose which user you want to use by specifying cookie `active-user`.
See example below.
### Public API endpoints (no authentication needed)
- `/api/flist` (**GET**)
- Returns a json array with all repository/flists found
- `/api/repositories` (**GET**)
- Returns a json array with all repositories found
- `/api/fileslist` (**GET**)
- Returns a json array with all repositories and files found
- `/api/flist/` (**GET**)
- Returns a json array of each flist found inside specified repository.
- Each entry contains `filename`, `size`, `updated` date and `type` (regular, symlink, taglink) and optionally `target` if it's a link.
- `/api/flist//` (**GET**, **INFO**)
- **GET**: returns json object with flist dumps (full file list)
- **INFO**: returns a reduced information (no files dumps) about flist
- `/api/flist///light` (**GET**)
- Same as **INFO** above
- `/api/flist///taglink` (**GET**)
- Get target of a `taglink` (link to a tag)
- `/api/flist//tags/` (**GET**)
- Returns content of a tags (links inside a tag)
### Restricted API endpoints (authentication required)
- `/api/flist/me` (**GET**)
- Returns json object with some basic information about yourself (authenticated user)
- `/api/flist/me/` (**GET**, **DELETE**)
- **GET**: same as `/api/flist//`
- **DELETE**: remove that specific flist (or taglink)
- `/api/flist/me/