Update develop documentation, with correct dependencies.

This commit is contained in:
John Livingston
2023-07-17 12:47:42 +02:00
parent d0ff022b51
commit 732344a37c
36 changed files with 4425 additions and 2365 deletions

View File

@ -14,13 +14,42 @@ Pull Request must be done on the `main` branch.
Until march 2023, contribution were made on the `develop` branch. This procedure is now deprecated.
{{% /notice %}}
Prerequisite for building this plugin:
## Prerequisite for building this plugin
- you must have `npm` installed
- you must have python venv installed (`python3-venv` package on Debian for example)
- you must have `build-essential` installed
It is highly recommended to be familiar with following concepts:
To clone the repository:
* Git
* NodeJS
* NPM
* Typescript
To build the plugin, you must have following packages:
* `git`
* `npm` (>=8.x)
* `nodejs` (>=14.x)
* `build-essential`
The plugin needs to build an AppImage for the Prosody XMPP server.
It appears that the way this AppImage is build requires `apt` and `dpkg` commands.
So it will only work "out of the box" on Debian-like systems.
If you are using another Linux distribution, you can try to install `apt` and `dpkg` manually.
See for example this [Github issue](https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/200).
We will provide another solution as soon as possible.
Building this AppImage also requires following packages:
* `python3-venv`
* `squashfs-tools`
{{% notice info %}}
These dependencies were tested on a Debian Bullseye.
If there is some dependencies issues on your UNIX/Linux system, please open an issue on Github.
{{% /notice }}
## Develop
Clone the repository, buid the plugin, and create your feature branch:
```bash
# Clone the repository. Dont forget the --recursive to clone submodules.
@ -43,8 +72,8 @@ git push --set-upstream me my_development
```
Once you are ready to show your code to ask for feedback, submit a *draft* Pull Request.
Once you are ready for a code review before merge, submit a Pull Request. In any case, please
link your PR to the issues it solves by using the GitHub syntax: "fixes #issue_number".
Once you are ready for a code review before merge, submit a Pull Request.
In any case, please link your PR to the issues it solves by using the GitHub syntax: "fixes #issue_number".
The front-end code is in the `client` folder, the back-end code in `server`. There are some shared code in `shared` folder.
@ -59,8 +88,7 @@ NODE_ENV=dev npm run build
## ESBuild vs Typescript
This plugin uses ESBuild for frontend code generation, as the official `peertube-plugin-quickstart` plugin.
ESBuild can handle Typescript, but does not check types
(see [ESBuild documentation](https://esbuild.github.io/content-types/#typescript)).
ESBuild can handle Typescript, but does not check types (see [ESBuild documentation](https://esbuild.github.io/content-types/#typescript)).
That's why we first compile Typescript with the `-noEmit` option, just to check types (`check:client:ts` in package.json file).
Then, if everything is okay, we run ESBuild to generate the compiled javascript.
@ -70,9 +98,7 @@ There is a debug mode for this plugin, that shorten some delay.
For example, some log files will rotate every two minutes, instead of once per day.
This permit to test more easily certain actions, for which it could normally take hours or days to wait.
To enable this mode, you juste have to create the
`/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/debug_mode` file
(replacing `/var/www/peertube/storage/` by the correct path on your installation).
To enable this mode, you juste have to create the `/var/www/peertube/storage/plugins/data/peertube-plugin-livechat/debug_mode` file (replacing `/var/www/peertube/storage/` by the correct path on your installation).
The simple existence of this file is sufficient to trigger the debug mode.
To make sure it's taken into account, you can restart your Peertube instance.
@ -88,11 +114,9 @@ This could cause security issues.
### Restart Prosody
When debug mode is enabled, you can restart Prosody using this API call:
`http://your_instance.tld/plugins/livechat/router/api/restart_prosody`.
When debug mode is enabled, you can restart Prosody using this API call: `http://your_instance.tld/plugins/livechat/router/api/restart_prosody`.
This call don't need any authentificaiton.
It can be done from a command line, for example using
`curl http://your_instance.tld/plugins/livechat/router/api/restart_prosody`.
It can be done from a command line, for example using `curl http://your_instance.tld/plugins/livechat/router/api/restart_prosody`.
### Prosody debugger
@ -117,24 +141,18 @@ Restart Peertube.
Start your debugger server.
For Prosody to connect to the debugger, call the API
`http://your_instance.tld/plugins/livechat/router/api/restart_prosody?debugger=true`.
For Prosody to connect to the debugger, call the API `http://your_instance.tld/plugins/livechat/router/api/restart_prosody?debugger=true`.
This call does not need any authentication.
It can be done from a command line, for example with
`curl http://your_instance.tld/plugins/livechat/router/api/restart_prosody?debugger=true`.
It can be done from a command line, for example with `curl http://your_instance.tld/plugins/livechat/router/api/restart_prosody?debugger=true`.
You can even configure your debug server to launch this request automatically.
Prosody will then restart, connecting to the debugger.
## Quick dev environment using Docker
There is a tutorial, in french, on the
[le Peertube forum](https://framacolibri.org/t/tutoriel-creer-un-environnement-de-developpement-de-plugin-peertube-rapidement-en-utilisant-docker-et-qui-permet-de-tester-la-federation/17631)
that explains how to quickly build a dev env using Docker.
There is a tutorial, in french, on the [Peertube forum](https://framacolibri.org/t/tutoriel-creer-un-environnement-de-developpement-de-plugin-peertube-rapidement-en-utilisant-docker-et-qui-permet-de-tester-la-federation/17631) that explains how to quickly build a dev env using Docker.
A repo was made out of it, check out [pt-plugin-dev](https://codeberg.org/mose/pt-plugin-dev).
Note: for an unknown reason, Prosody can't resolve containers DNS address when using the lua-unbound library.
There is a dirty hack in the plugin: just create a
`/data/plugins/data/peertube-plugin-livechat/no_lua_unbound` file in your docker-volumes,
then restart containers.
There is a dirty hack in the plugin: just create a `/data/plugins/data/peertube-plugin-livechat/no_lua_unbound` file in your docker-volumes, then restart containers.