1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00

Fix linter warnings

This commit is contained in:
ericgaspar 2020-11-29 12:34:49 +01:00
parent a4e365451e
commit 92c82325f5
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 31 additions and 88 deletions

View file

@ -1,10 +1,11 @@
# Funkwhale for YunoHost
[![Integration level](https://dash.yunohost.org/integration/funkwhale.svg)](https://dash.yunohost.org/appci/app/funkwhale) ![](https://ci-apps.yunohost.org/ci/badges/funkwhale.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/funkwhale.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/funkwhale.svg)](https://dash.yunohost.org/appci/app/funkwhale) ![](https://ci-apps.yunohost.org/ci/badges/funkwhale.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/funkwhale.maintain.svg)
[![Install Funkwhale with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=funkwhale)
> *This package allows you to install Funkwhale quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview
A modern, convivial and free music server on YunoHost
@ -21,21 +22,17 @@ Installation requires a dedicated domain or subdomain. Installing in a subpath i
The admin uses the login you provided at installation. The password is the same you use for YunoHost.
The admin interface is accessible at the address: your.domain.fr/api/admin
The admin interface is accessible at the address: `your.domain.fr/api/admin`
# State of this package
* The following have been tested with this package and work fine:
* [x] install/remove/backup/remove/upgrade with x86_64
* [x] import file with web interface, imports from youtube, interraction with MusicBrainz
* [x] install/remove/backup/remove/upgrade with x86_64 and ARM
* [x] import file with web interface, imports from YouTube, interraction with MusicBrainz
* [x] [Subsonic API](https://docs.funkwhale.audio/users/apps.html)
* [x] [Federation](https://docs.funkwhale.audio/federation.html) tests
* [x] [CLI Import](https://docs.funkwhale.audio/importing-music.html#from-music-directory-on-the-server) Remember to `source $final_path/venv/bin/activate`, then `source $final_path/load_env` before typinh using manage.py.
* [x] ARM support
* end-user configuration required:
* [x] LDAP integration
* [x] [CLI Import](https://docs.funkwhale.audio/importing-music.html#from-music-directory-on-the-server) Remember to `source $final_path/venv/bin/activate`, then `source $final_path/load_env` before typinh using manage.py.
* to be added:
* [ ] Store files in HOME, see https://github.com/YunoHost-Apps/funkwhale_ynh/issues/15
@ -46,6 +43,9 @@ The admin interface is accessible at the address: your.domain.fr/api/admin
## YunoHost specific features
* Are LDAP and HTTP auth supported? **Yes**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/funkwhale%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/funkwhale/)
@ -61,8 +61,7 @@ The admin interface is accessible at the address: your.domain.fr/api/admin
---
Developers info
----------------
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/funkwhale_ynh/tree/testing).

View file

@ -3,7 +3,8 @@
"id": "funkwhale",
"packaging_format": 1,
"description": {
"en": "A modern, convivial and free music server"
"en": "Modern, convivial and free music server",
"fr": "Serveur de musique moderne, convivial et gratuit"
},
"version": "1.0.1~ynh1",
"url": "https://funkwhale.audio",
@ -17,7 +18,7 @@
"email": "jean-baptiste@holcroft.fr"
}],
"requirements": {
"yunohost": ">= 4.0"
"yunohost": ">= 4.0.0"
},
"multi_instance": true,
"services": [
@ -28,7 +29,8 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for funkwhale"
"en": "Choose a domain for Funkwhale",
"fr": "Choisissez un nom de domaine pour Funkwhale"
},
"example": "example.com"
},
@ -36,7 +38,8 @@
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user"
"en": "Choose an admin user",
"fr": "Choisissez l'administrateur"
},
"example": "sporiff"
},
@ -44,10 +47,12 @@
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?"
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"help": {
"en": "Allows unauthenticated users to access the user interface (mandatory for federation)"
"en": "Allows unauthenticated users to access the user interface (mandatory for federation).",
"fr": "Permet aux utilisateurs non authentifiés d'accéder à l'interface utilisateur (obligatoire pour la fédération)."
},
"default": true
}

View file

@ -125,72 +125,3 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Send the email to the recipients
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
}
#=================================================
# fail2ban helpers
# taken from https://github.com/YunoHost-Apps/shaarli_ynh
#=================================================
# Create a dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
# | arg: log_file - Log file to be checked by fail2ban
# | arg: failregex - Failregex to be looked for by fail2ban
# | arg: max_retry - Maximum number of retries allowed before banning IP address - default: 3
# | arg: ports - Ports blocked for a banned IP address - default: http,https
ynh_add_fail2ban_config () {
local logpath
local failregex
local max_retry
local ports
logpath=$1
failregex=$2
max_retry=${3:-3}
ports=${4:-http,https}
test -n "$logpath" || ynh_die --message="ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
test -n "$failregex" || ynh_die --message="ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
sudo tee "$finalfail2banjailconf" <<EOF
[$app]
enabled = true
port = $ports
filter = $app
logpath = $logpath
maxretry = $max_retry
EOF
sudo tee "$finalfail2banfilterconf" <<EOF
[INCLUDES]
before = common.conf
[Definition]
failregex = $failregex
ignoreregex =
EOF
ynh_store_file_checksum "$finalfail2banjailconf"
ynh_store_file_checksum "$finalfail2banfilterconf"
systemctl restart fail2ban
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
if [ -n "$fail2ban_error" ]
then
echo "[ERR] Fail2ban failed to load the jail for $app" >&2
echo "WARNING${fail2ban_error#*WARNING}" >&2
fi
}
# Remove the dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_remove_fail2ban_config
ynh_remove_fail2ban_config () {
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
systemctl reload fail2ban
}

View file

@ -220,7 +220,7 @@ ynh_replace_string --match_string="__KEY__" --replace_string="$key"
# Delete the original thumbnails and generate new ones for
# higher quality images
# https://docs.funkwhale.audio/changelog.html#increased-quality-of-jpeg-thumbnails-manual-action-required
rm -rf "$final_path/media/__sized__"
ynh_secure_remove "$final_path/media/__sized__"
python api/manage.py fw media generate-thumbnails
)
@ -263,6 +263,14 @@ chmod -R 755 "$final_path/code/front/dist/"
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add "$app-server" --log "/var/log/$app/server.log"
yunohost service add "$app-worker" --log "/var/log/$app/worker.log"
yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#=================================================
# SETUP SSOWAT
#=================================================