Browse Source

Update docs

pull/159/head
squeaky otter 2 years ago
parent
commit
2aeec6a1ff
Signed by: dashie GPG Key ID: C2D57B325840B755
  1. 33
      CONTRIBUTING.rst
  2. 63
      DEVELOPMENT.md

33
CONTRIBUTING.rst

@ -272,7 +272,7 @@ will pull all the strings from source files and put them in a PO files.
You can then inspect the PO files to ensure everything is fine (but don't commit them, it's not needed).
Contributing to the API
Contributing to the Backend API
-----------------------
Project structure
@ -347,10 +347,30 @@ painless as possible.
The back-end test suite coverage is still pretty low
Linters & format
^^^^^^^^^^^^^^^^
We use black and flake8::
flake8 .
black .
Various notes
^^^^^^^^^^^^^
- Authlib doesn't handle JSON, do crimes like in controllers/api/v1/auth.py#oauth_token()
- Authlib revoke token wants basic auth, no idea what to give, so it doesn't works
- Authlib does handle optional bearer auth, uses: @require_oauth(optional=True)
Contributing to the front-end
-----------------------------
Backend proxy
^^^^^^^^^^^^^
The frontend will automatically proxy the backend configured in ``config/local.json``.
Running tests
^^^^^^^^^^^^^
@ -362,3 +382,14 @@ To run the front-end test suite, use the following command::
.. note::
The front-end test suite coverage is still pretty low
Linters & format
^^^^^^^^^^^^^^^^
Check::
npm run lint
Lazy autofix (check if nothing gots wrong)::
npm run lint-fix

63
DEVELOPMENT.md

@ -1,63 +0,0 @@
# Various development notes
## Backend
Use the doc in the README.md
Run server with:
```shell
export AUTHLIB_INSECURE_TRANSPORT=1
export FLASK_ENV=development
flask run
```
All ActivityPub code (inbound or outbound) needs to have the celery worker running.
## Unittests (backend)
```shell
export CONFIGTEST=configtest.py
pytest
```
## Unittests (frontend)
None yet
## Frontend
Create `front/config/local.json` with:
```json
{
"target": "http://127.0.0.1:5000/"
}
```
Also comment `SERVER_NAME` and `BASE_URL` in `config.py` when in dev.
Run the front with: `cd front && npm run dev`
Then access to the front on: http://localhost:8081
The backend will be automatically proxified.
## Linters
Backend:
```
flake8 .
black .
```
Frontend:
```
npm run lint
```
## Various tips
- Authlib doesn't handle JSON, do crimes like in `controllers/api/v1/auth.py#oauth_token()`
- Authlib revoke token wants basic auth, no idea what to give, so it doesn't works
- Authlib does handle optional bearer auth, uses: `@require_oauth(optional=True)`
Loading…
Cancel
Save