chore: format files using prettier (pre-commit)
This commit is contained in:
parent
df7b1763a3
commit
6d7dc2f1b5
87 changed files with 4496 additions and 5178 deletions
|
|
@ -97,8 +97,8 @@ To fetch an authorization code, you need to send the user to their Funkwhale pod
|
|||
|
||||
To do this, call the `/authorize` endpoint with the following URL encoded query parameters:
|
||||
|
||||
- `client_id`* - Your application's client ID
|
||||
- `response_type`* - Must be set to `code`.
|
||||
- `client_id`\* - Your application's client ID
|
||||
- `response_type`\* - Must be set to `code`.
|
||||
- `redirect_uri` - Your redirect URI
|
||||
- `scope` - A list of scopes
|
||||
- `state` - Used to maintain state between the request and the callback to prevent cross-site request forgery. Typically corresponds with a location in the app (e.g. `/library`)
|
||||
|
|
@ -111,10 +111,10 @@ When the user authorizes your app, the server responds with an authorization cod
|
|||
|
||||
Once you receive your authorization code, you need to [request an access token](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3). To request an access token, call the `/api/v1/oauth/token` endpoint with the following information:
|
||||
|
||||
- `grant_type`* - Must be set to `authorization_code`
|
||||
- `code`* - Your application's authorization code
|
||||
- `redirect_uri`* - Your redirect URI
|
||||
- `client_id`* Your application's client ID
|
||||
- `grant_type`\* - Must be set to `authorization_code`
|
||||
- `code`\* - Your application's authorization code
|
||||
- `redirect_uri`\* - Your redirect URI
|
||||
- `client_id`\* Your application's client ID
|
||||
|
||||
The server responds with an [`access_token`](https://www.rfc-editor.org/rfc/rfc6749#section-1.4) and a [`refresh_token`](https://www.rfc-editor.org/rfc/rfc6749#section-1.5). See [the OAuth spec](https://www.rfc-editor.org/rfc/rfc6749#section-4.1.4) for more information about this response.
|
||||
|
||||
|
|
@ -130,8 +130,8 @@ By default, Funkwhale access tokens are valid for **10 hours**. Pod admins can c
|
|||
|
||||
After the access token expires, you must request a new access token by calling the `/api/v1/oauth/token` endpoint with the following information:
|
||||
|
||||
- `grant_type`* - Must be set to `refresh_token`
|
||||
- `refresh_token`* - Your current refresh token
|
||||
- `grant_type`\* - Must be set to `refresh_token`
|
||||
- `refresh_token`\* - Your current refresh token
|
||||
- `scope` - A list of scopes
|
||||
|
||||
See [the OAuth spec](https://www.rfc-editor.org/rfc/rfc6749#section-6) for more information about this response.
|
||||
|
|
|
|||
|
|
@ -14,17 +14,17 @@ UI strings can be added to both the `<script>` and `<template>` part of a Vue fi
|
|||
|
||||
```json
|
||||
{
|
||||
"components": {
|
||||
"About": {
|
||||
"title": "About",
|
||||
"header": {
|
||||
"funkwhale": "A social platform to enjoy and share music"
|
||||
},
|
||||
"button": {
|
||||
"cancel": "Cancel"
|
||||
}
|
||||
"components": {
|
||||
"About": {
|
||||
"title": "About",
|
||||
"header": {
|
||||
"funkwhale": "A social platform to enjoy and share music"
|
||||
},
|
||||
"button": {
|
||||
"cancel": "Cancel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -33,13 +33,13 @@ UI strings can be added to both the `<script>` and `<template>` part of a Vue fi
|
|||
:::{tab-item} Script
|
||||
|
||||
```typescript
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useI18n } from "vue-i18n";
|
||||
//...
|
||||
const { t } = useI18n()
|
||||
const { t } = useI18n();
|
||||
//...
|
||||
const labels = computed(() => ({
|
||||
title: t('components.About.title')
|
||||
}))
|
||||
title: t("components.About.title"),
|
||||
}));
|
||||
```
|
||||
|
||||
:::
|
||||
|
|
@ -47,12 +47,8 @@ const labels = computed(() => ({
|
|||
:::{tab-item} Template
|
||||
|
||||
```html
|
||||
<h2>
|
||||
{{ $t('components.About.header.funkwhale') }}
|
||||
</h2>
|
||||
<button>
|
||||
{{ $t('components.About.button.cancel') }}
|
||||
</button>
|
||||
<h2>{{ $t('components.About.header.funkwhale') }}</h2>
|
||||
<button>{{ $t('components.About.button.cancel') }}</button>
|
||||
```
|
||||
|
||||
:::
|
||||
|
|
@ -84,24 +80,24 @@ Some strings change depending on whether they are plural or not. You can create
|
|||
|
||||
```html
|
||||
<div class="description">
|
||||
<span
|
||||
<span
|
||||
v-if="object.artist?.content_category === 'podcast'"
|
||||
class="meta ellipsis"
|
||||
>
|
||||
{{ $t('components.audio.ChannelCard.meta.episodes', {episode_count: object.artist.tracks_count}) }}
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
>
|
||||
{{ $t('components.audio.ChannelCard.meta.tracks', {tracks_count: object.artist?.tracks_count}) }}
|
||||
</span>
|
||||
<tags-list
|
||||
>
|
||||
{{ $t('components.audio.ChannelCard.meta.episodes', {episode_count:
|
||||
object.artist.tracks_count}) }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ $t('components.audio.ChannelCard.meta.tracks', {tracks_count:
|
||||
object.artist?.tracks_count}) }}
|
||||
</span>
|
||||
<tags-list
|
||||
label-classes="tiny"
|
||||
:truncate-size="20"
|
||||
:limit="2"
|
||||
:show-more="false"
|
||||
:tags="object.artist?.tags ?? []"
|
||||
/>
|
||||
/>
|
||||
</div>
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ We currently use [Fomantic UI](https://fomantic-ui.com) as our UI framework. We
|
|||
|
||||
We apply changes to the Fomantic CSS files before we import them:
|
||||
|
||||
1. We replace hardcoded color values with CSS variables to make themin easier. For example: ``color: orange`` is replaced by ``color: var(--vibrant-color)``
|
||||
1. We replace hardcoded color values with CSS variables to make themin easier. For example: `color: orange` is replaced by `color: var(--vibrant-color)`
|
||||
2. We remove unused values from the CSS files to keep the size down
|
||||
|
||||
These changes are applied when you run `yarn install` through a `postinstall` hook. If you want to modify these changes, check the `front/scripts/fix-fomantic-css.py` script.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ You can find the code for our routing logic here:
|
|||
- [Routing logic for activities](https://dev.funkwhale.audio/funkwhale/funkwhale/blob/develop/api/funkwhale_api/federation/routes.py)
|
||||
- [Delivery logic for activities](https://dev.funkwhale.audio/funkwhale/funkwhale/blob/develop/api/funkwhale_api/federation/tasks.py)
|
||||
|
||||
|
||||
## Service actor
|
||||
|
||||
Funkwhale uses a dedicated service actor to send messages or authenticate fetches. This actor isn't associated to a user.
|
||||
|
|
@ -654,13 +653,17 @@ An `Audio` object is a custom object used to store upload information. It extend
|
|||
::::{tab-set}
|
||||
|
||||
:::{tab-item} Library
|
||||
|
||||
- Public libraries can be accessed by actors without restriction
|
||||
- Restricted libraries can only be accessed if the HTTP request is signed by an actor who has an associated **approved** [`Follow` activity](#follow)
|
||||
|
||||
:::
|
||||
|
||||
:::{tab-item} Audio
|
||||
|
||||
- Audio items in public libraries can be accessed by actors without restriction
|
||||
- Audio items in restricted libraries can only be accessed if the HTTP request is signed by an actor who has an associated **approved** [`Follow` activity](#follow)
|
||||
|
||||
:::
|
||||
|
||||
::::
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ User-level plugins can also be used to import files from a third-party service,
|
|||
|
||||
### Hooks
|
||||
|
||||
**Hooks** are entrypoints that allow your plugin to listen to changes. You can create hooks to react to different events that occur in the Funkwhale application.
|
||||
**Hooks** are entrypoints that allow your plugin to listen to changes. You can create hooks to react to different events that occur in the Funkwhale application.
|
||||
|
||||
An example of this can be seen in our Scrobbler plugin. We register a `LISTENING_CREATED` hook to notify any registered callback function when a listening is recorded. When a user listens to a track, the `notfy_lastfm` function fires.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,27 +6,27 @@ Funkwhale can be run in Docker containers for local development. You can work on
|
|||
2. [Install docker-compose](https://docs.docker.com/compose/install)
|
||||
3. Clone the Funkwhale repository to your system. The `develop` branch is checked out by default
|
||||
|
||||
::::{tab-set}
|
||||
::::{tab-set}
|
||||
|
||||
:::{tab-item} SSH
|
||||
:::{tab-item} SSH
|
||||
|
||||
```sh
|
||||
git clone git@dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale
|
||||
```
|
||||
```sh
|
||||
git clone git@dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::{tab-item} HTTPS
|
||||
:::{tab-item} HTTPS
|
||||
|
||||
```sh
|
||||
git clone https://dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale
|
||||
```
|
||||
```sh
|
||||
git clone https://dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
## Set up your Docker environment
|
||||
|
||||
|
|
@ -44,22 +44,22 @@ To set up your Docker environment:
|
|||
|
||||
1. Create a `.env` file to enable customization of your setup.
|
||||
|
||||
```sh
|
||||
touch .env
|
||||
```
|
||||
```sh
|
||||
touch .env
|
||||
```
|
||||
|
||||
2. Add the following variables to load images and enable access to Django admin pages:
|
||||
|
||||
```text
|
||||
MEDIA_URL=http://localhost:8000/media/
|
||||
STATIC_URL=http://localhost:8000/staticfiles/
|
||||
```
|
||||
```text
|
||||
MEDIA_URL=http://localhost:8000/media/
|
||||
STATIC_URL=http://localhost:8000/staticfiles/
|
||||
```
|
||||
|
||||
3. Create a network for federation support
|
||||
|
||||
```sh
|
||||
docker network create federation
|
||||
```
|
||||
```sh
|
||||
docker network create federation
|
||||
```
|
||||
|
||||
Once you've set everything up, you need to build the containers. Run this command any time there are upstream changes or dependency changes to ensure you're up-to-date.
|
||||
|
||||
|
|
@ -83,17 +83,17 @@ You need to create some local data to mimic a production environment.
|
|||
|
||||
1. Create a superuser so you can log in to your local app:
|
||||
|
||||
```sh
|
||||
docker-compose -f dev.yml run --rm api pythong manage.py createsuperuser
|
||||
```
|
||||
```sh
|
||||
docker-compose -f dev.yml run --rm api pythong manage.py createsuperuser
|
||||
```
|
||||
|
||||
2. Add some fake data to populate the database. The following command creates 25 artists with random albums, tracks, and metadata.
|
||||
|
||||
```sh
|
||||
artists=25 # Adds 25 fake artists
|
||||
command="from funkwhale_api.music import fake_data; fake_data.create_data($artists)"
|
||||
echo $command | docker-compose -f dev.yml run --rm -T api python manage.py shell -i python
|
||||
```
|
||||
```sh
|
||||
artists=25 # Adds 25 fake artists
|
||||
command="from funkwhale_api.music import fake_data; fake_data.create_data($artists)"
|
||||
echo $command | docker-compose -f dev.yml run --rm -T api python manage.py shell -i python
|
||||
```
|
||||
|
||||
## Manage services
|
||||
|
||||
|
|
@ -101,15 +101,15 @@ Once you have set up your containers, bring them up to start working on them.
|
|||
|
||||
1. Compile the translations:
|
||||
|
||||
```sh
|
||||
docker-compose -f dev.yml run --rm front yarn run i18n-compile
|
||||
```
|
||||
```sh
|
||||
docker-compose -f dev.yml run --rm front yarn run i18n-compile
|
||||
```
|
||||
|
||||
2. Launch all services:
|
||||
|
||||
```sh
|
||||
docker-compose -f dev.yml up front api nginx celeryworker
|
||||
```
|
||||
```sh
|
||||
docker-compose -f dev.yml up front api nginx celeryworker
|
||||
```
|
||||
|
||||
This gives you access to the following:
|
||||
|
||||
|
|
@ -172,31 +172,31 @@ To run a reverse proxy for your app:
|
|||
|
||||
1. Add the following configuration to your `.env` file:
|
||||
|
||||
```text
|
||||
# Remove any port binding so you can specify this per-instance
|
||||
VUE_PORT_BINDING=
|
||||
# Disable certificate validation
|
||||
EXTERNAL_REQUESTS_VERIFY_SSL=false
|
||||
# Ensure all links use https
|
||||
FUNKWHALE_PROTOCOL=https
|
||||
# Disable host ports binding for the nginx container so that traefik handles everything
|
||||
NGINX_PORTS_MAPPING=80
|
||||
```
|
||||
```text
|
||||
# Remove any port binding so you can specify this per-instance
|
||||
VUE_PORT_BINDING=
|
||||
# Disable certificate validation
|
||||
EXTERNAL_REQUESTS_VERIFY_SSL=false
|
||||
# Ensure all links use https
|
||||
FUNKWHALE_PROTOCOL=https
|
||||
# Disable host ports binding for the nginx container so that traefik handles everything
|
||||
NGINX_PORTS_MAPPING=80
|
||||
```
|
||||
|
||||
2. Launch traefik using the bundled configuration:
|
||||
|
||||
```sh
|
||||
docker-compose -f docker/traefik.yml up -d
|
||||
```
|
||||
```sh
|
||||
docker-compose -f docker/traefik.yml up -d
|
||||
```
|
||||
|
||||
3. Set up as many different projects as you need. Make sure the `COMPOSE_PROJECT_NAME` and `VUE_PORT` variables are unique per instance
|
||||
|
||||
```sh
|
||||
export COMPOSE_PROJECT_NAME=node2
|
||||
export VUE_PORT=1234 # this has to be unique for each instance
|
||||
docker-compose -f dev.yml run --rm api python manage.py migrate
|
||||
docker-compose -f dev.yml run --rm api python manage.py createsuperuser
|
||||
docker-compose -f dev.yml up nginx api front nginx api celeryworker
|
||||
```
|
||||
```sh
|
||||
export COMPOSE_PROJECT_NAME=node2
|
||||
export VUE_PORT=1234 # this has to be unique for each instance
|
||||
docker-compose -f dev.yml run --rm api python manage.py migrate
|
||||
docker-compose -f dev.yml run --rm api python manage.py createsuperuser
|
||||
docker-compose -f dev.yml up nginx api front nginx api celeryworker
|
||||
```
|
||||
|
||||
You can access your project at `https://{COMPOSE_PROJECT_NAME}.funkwhale.test`.
|
||||
|
|
|
|||
|
|
@ -4,45 +4,45 @@ If you want to make changes to the frontend, you can use Vite to run a developme
|
|||
|
||||
1. Clone the repository:
|
||||
|
||||
::::{tab-set}
|
||||
::::{tab-set}
|
||||
|
||||
:::{tab-item} SSH
|
||||
:::{tab-item} SSH
|
||||
|
||||
```sh
|
||||
git clone git@dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale/front
|
||||
```
|
||||
```sh
|
||||
git clone git@dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale/front
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::{tab-item} HTTPS
|
||||
:::{tab-item} HTTPS
|
||||
|
||||
```sh
|
||||
git clone https://dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale/front
|
||||
```
|
||||
```sh
|
||||
git clone https://dev.funkwhale.audio/funkwhale/funkwhale.git
|
||||
cd funkwhale/front
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
2. Install [Node.js](https://nodejs.org/en/download/package-manager/) and [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
|
||||
3. Install all dependencies:
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
```
|
||||
```sh
|
||||
yarn install
|
||||
```
|
||||
|
||||
4. Compile the translations:
|
||||
|
||||
```sh
|
||||
yarn i18n-compile
|
||||
```
|
||||
```sh
|
||||
yarn i18n-compile
|
||||
```
|
||||
|
||||
5. Launch the devlopment server:
|
||||
|
||||
```sh
|
||||
yarn dev
|
||||
```
|
||||
```sh
|
||||
yarn dev
|
||||
```
|
||||
|
||||
You can access the Funkwhale web app at `http://localhost:8000/front`. Connect this app to your pod by selecting {guilabel}`Switch instance` in the sidebar.
|
||||
|
|
|
|||
|
|
@ -10,29 +10,29 @@ Funkwhale uses GitLab's merge requests to manage changes. The workflow looks lik
|
|||
6. Add a changelog fragment summarizing your changes
|
||||
7. Lint the codebase using the following command:
|
||||
|
||||
::::{tab-set}
|
||||
::::{tab-set}
|
||||
|
||||
:::{tab-item} API code
|
||||
:::{tab-item} API code
|
||||
|
||||
```sh
|
||||
black --check --diff . # Run the black linter in the project root to highlight any new issues
|
||||
```
|
||||
```sh
|
||||
black --check --diff . # Run the black linter in the project root to highlight any new issues
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::{tab-item} Frontend code
|
||||
:::{tab-item} Frontend code
|
||||
|
||||
```sh
|
||||
cd front
|
||||
yarn run eslint # Run eslint in the front directory
|
||||
```
|
||||
```sh
|
||||
cd front
|
||||
yarn run eslint # Run eslint in the front directory
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
8. Push your branch
|
||||
9. Create a merge request in the GitLab frontend
|
||||
9. Create a merge request in the GitLab frontend
|
||||
10. We'll review your request and feed back
|
||||
|
||||
```{mermaid}
|
||||
|
|
|
|||
|
|
@ -4,75 +4,75 @@ Once we're ready to release a new version of the software, we can use the follow
|
|||
|
||||
1. Export the new release version
|
||||
|
||||
```sh
|
||||
export NEXT_RELEASE=1.3.0
|
||||
```
|
||||
```sh
|
||||
export NEXT_RELEASE=1.3.0
|
||||
```
|
||||
|
||||
2. Export the previous release version
|
||||
|
||||
```sh
|
||||
export PREVIOUS_RELEASE=1.2.9
|
||||
```
|
||||
```sh
|
||||
export PREVIOUS_RELEASE=1.2.9
|
||||
```
|
||||
|
||||
3. Pull the latest version of the `develop` branch. Use `stable` if you're releasing a bugfix.
|
||||
|
||||
::::{tab-set}
|
||||
::::{tab-set}
|
||||
|
||||
:::{tab-item} Bugfix release
|
||||
:sync: bugfix
|
||||
:::{tab-item} Bugfix release
|
||||
:sync: bugfix
|
||||
|
||||
```sh
|
||||
git checkout stable
|
||||
git pull
|
||||
```
|
||||
```sh
|
||||
git checkout stable
|
||||
git pull
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
:::{tab-item} Feature release
|
||||
:sync: feature
|
||||
:::{tab-item} Feature release
|
||||
:sync: feature
|
||||
|
||||
```sh
|
||||
git checkout develop
|
||||
git pull
|
||||
```
|
||||
```sh
|
||||
git checkout develop
|
||||
git pull
|
||||
```
|
||||
|
||||
:::
|
||||
:::
|
||||
|
||||
::::
|
||||
::::
|
||||
|
||||
4. Compile the changelog
|
||||
|
||||
```sh
|
||||
towncrier build --version $NEXT_RELEASE
|
||||
```
|
||||
```sh
|
||||
towncrier build --version $NEXT_RELEASE
|
||||
```
|
||||
|
||||
5. Check the output and fix typos and mistakes
|
||||
6. Add a list of contributors
|
||||
|
||||
```sh
|
||||
python3 scripts/get-contributions-stats.py $NEXT_RELEASE # Output a list of contributors
|
||||
git log $PREVIOUS_RELEASE.. --format="- %aN" --reverse | sort | uniq # Get a list of all commit authors
|
||||
nano CHANGELOG # Add these lists to the CHANGELOG
|
||||
```
|
||||
```sh
|
||||
python3 scripts/get-contributions-stats.py $NEXT_RELEASE # Output a list of contributors
|
||||
git log $PREVIOUS_RELEASE.. --format="- %aN" --reverse | sort | uniq # Get a list of all commit authors
|
||||
nano CHANGELOG # Add these lists to the CHANGELOG
|
||||
```
|
||||
|
||||
7. Update the `__version__` variable to the next release version
|
||||
|
||||
```sh
|
||||
nano api/funkwhale_api/__init__.py
|
||||
```
|
||||
```sh
|
||||
nano api/funkwhale_api/__init__.py
|
||||
```
|
||||
|
||||
8. Commit all changes
|
||||
|
||||
```sh
|
||||
git add .
|
||||
git commit -m "Version bump and changelog for $NEXT_RELEASE"
|
||||
```
|
||||
```sh
|
||||
git add .
|
||||
git commit -m "Version bump and changelog for $NEXT_RELEASE"
|
||||
```
|
||||
|
||||
9. Create a tag
|
||||
|
||||
```sh
|
||||
git tag $NEXT_RELEASE
|
||||
```
|
||||
```sh
|
||||
git tag $NEXT_RELEASE
|
||||
```
|
||||
|
||||
10. Publish the new tag to GitLab
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue