From 63ab03ab79cc088a52b8a36fb4fdf5918bf0e14b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89ric=20Gaspar?=
<46165813+ericgaspar@users.noreply.github.com>
Date: Fri, 12 Mar 2021 07:20:04 +0100
Subject: [PATCH] Testing (#59)
---
README.md | 12 ++++---
README_fr.md | 71 ++++++++++++++++++++++++++++++++++++++++
check_process | 4 +--
conf/LDAP-Auth.xml | 16 +++++++++
conf/ldap.src | 8 +++++
issue_template.md | 55 +++++++++++++++++++++++++++++++
manifest.json | 11 ++++++-
pull_request_template.md | 16 +++++++++
scripts/_common.sh | 2 +-
scripts/change_url | 6 ++--
scripts/install | 30 +++++++++++++----
scripts/upgrade | 54 +++++++++++++++++++++++++++++-
12 files changed, 266 insertions(+), 19 deletions(-)
create mode 100644 README_fr.md
create mode 100644 conf/LDAP-Auth.xml
create mode 100644 conf/ldap.src
create mode 100644 issue_template.md
create mode 100644 pull_request_template.md
diff --git a/README.md b/README.md
index f002652..6a0507f 100644
--- a/README.md
+++ b/README.md
@@ -3,13 +3,15 @@
[](https://dash.yunohost.org/appci/app/jellyfin)  
[](https://install-app.yunohost.org/?app=jellyfin)
+*[Lire ce readme en français.](./README_fr.md)*
+
> *This package allows you to install Jellyfin quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin server on your system and gain access to the leading free-software entertainment system, bells and whistles included.
-**Shipped version:** 10.6.4
+**Shipped version:** 10.7.0
## Screenshots
@@ -17,22 +19,22 @@ Jellyfin enables you to collect, manage, and stream your media. Run the Jellyfin
## Demo
-* [Official demo](Link to a demo site for this app.)
+* [Official demo](https://demo.jellyfin.org/)
## Configuration
-How to configure this app: From an admin panel, a plain file with SSH, or any other way.
+ * How to configure this app: From an admin panel.
## Documentation
- * Official documentation: Link to the official documentation of this app
+ * Official documentation: https://jellyfin.org/docs/
* YunoHost documentation: If specific documentation is needed, feel free to contribute.
## YunoHost specific features
#### Multi-user support
- * Are LDAP and HTTP auth supported? **No**
+ * Are LDAP and HTTP auth supported? **Yes**
* Can the app be used by multiple users? **Yes**
#### Supported architectures
diff --git a/README_fr.md b/README_fr.md
new file mode 100644
index 0000000..ad701cb
--- /dev/null
+++ b/README_fr.md
@@ -0,0 +1,71 @@
+# Jellyfin pour YunoHost
+
+[](https://dash.yunohost.org/appci/app/jellyfin)  
+[](https://install-app.yunohost.org/?app=jellyfin)
+
+*[Read this readme in english.](./README.md)*
+
+> *Ce package vous permet d'installer Jellyfin rapidement et simplement sur un serveur YunoHost.
+Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
+
+## Vue d'ensemble
+Jellyfin vous permet de collecter, gérer et diffuser vos médias. Exécutez le serveur Jellyfin sur votre système et accédez au principal système de divertissement à logiciel libre.
+
+**Version incluse :** 10.7.0
+
+## Captures d'écran
+
+
+
+## Démo
+
+* [Démo officielle](https://demo.jellyfin.org/)
+
+## Configuration
+
+Comment configurer cette application : via le panneau d'administration.
+
+## Documentation
+
+ * Documentation officielle : https://jellyfin.org/docs/
+ * Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer.
+
+## Caractéristiques spécifiques YunoHost
+
+#### Support multi-utilisateur
+
+* L'authentification LDAP et HTTP est-elle prise en charge ? **Oui**
+* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
+
+#### Architectures supportées
+
+* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/jellyfin/)
+* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/jellyfin/)
+
+## Limitations
+
+* Limitations connues.
+
+## Informations additionnelles
+
+* Autres informations que vous souhaitez ajouter sur cette application.
+
+## Liens
+
+ * Signaler un bug : https://github.com/YunoHost-Apps/jellyfin_ynh/issues
+ * Site de l'application : https://jellyfin.org/
+ * Dépôt de l'application principale : https://github.com/jellyfin/jellyfin
+ * Site web YunoHost : https://yunohost.org/
+
+---
+
+## Informations pour les développeurs
+
+Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing).
+
+Pour essayer la branche testing, procédez comme suit.
+```
+sudo yunohost app install https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug
+ou
+sudo yunohost app upgrade jellyfin -u https://github.com/YunoHost-Apps/jellyfin_ynh/tree/testing --debug
+```
diff --git a/check_process b/check_process
index 19f6216..fcdf735 100644
--- a/check_process
+++ b/check_process
@@ -20,7 +20,8 @@
setup_private=1
setup_public=1
upgrade=1
- upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966
+# Disabled because Jellyfin's team decided to remove old package...
+# upgrade=1 from_commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966
backup_restore=1
multi_instance=0
port_already_use=0
@@ -31,5 +32,4 @@ Notification=none
;;; Upgrade options
; commit=3e38d2ec954f6b333c3c2ed95e0e75c0df2fe966
name=2020-09-07 commit
-# manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&port=666&
diff --git a/conf/LDAP-Auth.xml b/conf/LDAP-Auth.xml
new file mode 100644
index 0000000..713a063
--- /dev/null
+++ b/conf/LDAP-Auth.xml
@@ -0,0 +1,16 @@
+
+
+ 127.0.0.1
+ ou=users,dc=yunohost,dc=org
+ 389
+ uid, mail
+ uid
+ (permission=cn=jellyfin.main,ou=permission,dc=yunohost,dc=org)
+ (permission=cn=jellyfin.admin,ou=permission,dc=yunohost,dc=org)
+
+
+ true
+ false
+ false
+ false
+
diff --git a/conf/ldap.src b/conf/ldap.src
new file mode 100644
index 0000000..7ddae3c
--- /dev/null
+++ b/conf/ldap.src
@@ -0,0 +1,8 @@
+SOURCE_URL=https://repo.jellyfin.org/releases/plugin/ldap-authentication/ldap-authentication_10.0.0.0.zip
+SOURCE_SUM=A261DD2F9F448839BC24D4DDC0996007F72517E04EEA8C78C45AEF217DD82D22
+SOURCE_SUM_PRG=sha256sum
+SOURCE_FORMAT=zip
+SOURCE_IN_SUBDIR=false
+SOURCE_FILENAME=
+SOURCE_EXTRACT=true
+
diff --git a/issue_template.md b/issue_template.md
new file mode 100644
index 0000000..869d5e4
--- /dev/null
+++ b/issue_template.md
@@ -0,0 +1,55 @@
+---
+name: Bug report
+about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
+
+---
+
+**How to post a meaningful bug report**
+1. *Read this whole template first.*
+2. *Determine if you are on the right place:*
+ - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
+ - *Otherwise, the issue may be due to Jellyfin itself. Refer to its documentation or repository for help.*
+ - *When in doubt, post here and we will figure it out together.*
+3. *Delete the italic comments as you write over them below, and remove this guide.*
+---
+
+### Describe the bug
+
+*A clear and concise description of what the bug is.*
+
+### Context
+
+- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
+- YunoHost version: x.x.x
+- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
+- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
+ - If yes, please explain:
+- Using, or trying to install package version/branch:
+- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
+
+### Steps to reproduce
+
+- *If you performed a command from the CLI, the command itself is enough. For example:*
+ ```sh
+ sudo yunohost app install jellyfin
+ ```
+- *If you used the webadmin, please perform the equivalent command from the CLI first.*
+- *If the error occurs in your browser, explain what you did:*
+ 1. *Go to '...'*
+ 2. *Click on '...'*
+ 3. *Scroll down to '...'*
+ 4. *See error*
+
+### Expected behavior
+
+*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
+
+### Logs
+
+*When an operation fails, YunoHost provides a simple way to share the logs.*
+- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
+- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
+
+*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
+
+*If applicable and useful, add screenshots to help explain your problem.*
diff --git a/manifest.json b/manifest.json
index 53a5b7f..f12a6dd 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Media System that manage and stream your media.",
"fr": "Système multimédia qui gère et diffuse vos médias."
},
- "version": "10.6.4~ynh3",
+ "version": "10.7.0~ynh1",
"url": "https://github.com/jellyfin/jellyfin",
"license": "GPL-2.0-only",
"maintainer": {
@@ -40,6 +40,15 @@
"example": "/jellyfin",
"default": "/jellyfin"
},
+ {
+ "name": "admin",
+ "type": "user",
+ "ask": {
+ "en": "Choose an admin user",
+ "fr": "Choisissez l'administrateur"
+ },
+ "example": "johndoe"
+ },
{
"name": "is_public",
"type": "boolean",
diff --git a/pull_request_template.md b/pull_request_template.md
new file mode 100644
index 0000000..6c28fc5
--- /dev/null
+++ b/pull_request_template.md
@@ -0,0 +1,16 @@
+## Problem
+- *Description of why you made this PR*
+
+## Solution
+- *And how do you fix that problem*
+
+## PR Status
+- [ ] Code finished.
+- [ ] Tested with Package_check.
+- [ ] Fix or enhancement tested.
+- [ ] Upgrade from last version tested.
+- [ ] Can be reviewed and tested.
+
+## Package_check results
+---
+* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 0e17ea6..c0e6516 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,7 +4,7 @@
# COMMON VARIABLES
#=================================================
-pkg_version="10.6.4-1"
+pkg_version="10.7.0-1"
#=================================================
# PERSONAL HELPERS
diff --git a/scripts/change_url b/scripts/change_url
index 03e8e62..e660a15 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -112,10 +112,10 @@ fi
if [ $change_path -eq 1 ]
then
# If somehow was not replaced during install
- if grep -q "" "/etc/jellyfin/system.xml"; then
- ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml"
+ if grep -q "" "/etc/jellyfin/network.xml"; then
+ ynh_replace_string --match_string="" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml"
else
- ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/system.xml"
+ ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="/etc/jellyfin/network.xml"
fi
fi
diff --git a/scripts/install b/scripts/install
index 95c39f8..944b386 100644
--- a/scripts/install
+++ b/scripts/install
@@ -26,6 +26,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
+admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
@@ -49,8 +50,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
+ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
-ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# STANDARD MODIFICATIONS
@@ -89,6 +90,7 @@ ynh_system_user_create --username=$app
#=================================================
# MODIFY A CONFIG FILE
#=================================================
+ynh_script_progression --message="Configuring the settings..." --weight=1
# Load services once to generate system.xml
systemctl enable jellyfin --quiet
@@ -97,10 +99,23 @@ sleep 5
systemctl stop jellyfin
# Port config
-ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/system.xml"
+ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml"
+ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml"
# BaseUrl config
-ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/system.xml"
+ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml"
+
+# Disable Setup Wizard
+ynh_replace_string --match_string="false" --replace_string="true" --target_file="/etc/jellyfin/system.xml"
+
+#=================================================
+# INSTALL LDAP PLUGIN
+#=================================================
+ynh_script_progression --message="Installing LDAP plugin..." --weight=2
+
+ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=ldap
+mkdir -p /var/lib/jellyfin/plugins/configurations/
+cp ../conf/LDAP-Auth.xml /var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml
#=================================================
# GENERIC FINALIZATION
@@ -138,16 +153,19 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
#=================================================
# SETUP SSOWAT
#=================================================
-ynh_script_progression --message="Configuring SSOwat..." --weight=2
+ynh_script_progression --message="Configuring permissions..." --weight=1
-# Make app public if necessary or protect it
+# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
- ynh_permission_update --permission "main" --add "visitors"
+ ynh_permission_update --permission="main" --add="visitors"
fi
+# Only the admin can access the admin panel of the app (if the app has an admin panel)
+ynh_permission_create --permission="admin" --allowed=$admin
+
#=================================================
# RELOAD NGINX
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 2664d0e..5fb1c2f 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -17,7 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
-is_public=$(ynh_app_setting_get --app=$app --key=is_public)
+admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
@@ -27,6 +27,23 @@ port=$(ynh_app_setting_get --app=$app --key=port)
upgrade_type=$(ynh_check_app_version_changed)
+#=================================================
+# ENSURE DOWNWARD COMPATIBILITY
+#=================================================
+ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
+
+# Cleaning legacy permissions
+if ynh_legacy_permissions_exists; then
+ ynh_legacy_permissions_delete_all
+
+ ynh_app_setting_delete --app=$app --key=is_public
+fi
+
+if ! ynh_permission_exists --permission="admin"; then
+ # Create the required permissions
+ ynh_permission_create --permission="admin" --allowed=$admin
+fi
+
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@@ -73,6 +90,41 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
+#=================================================
+# MODIFY A CONFIG FILE
+#=================================================
+
+# Check if network.xml exists (introduced in v10.7)
+if [ -z "/etc/jellyfin/network.xml" ]; then
+ ynh_script_progression --message="Configuring the settings..." --weight=1
+
+ # Load services once to generate network.xml
+ systemctl enable jellyfin --quiet
+ systemctl start jellyfin
+ sleep 5
+ systemctl stop jellyfin
+
+ # Port config
+ ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml"
+ ynh_replace_string --match_string="8096" --replace_string="$port" --target_file="/etc/jellyfin/network.xml"
+
+ # BaseUrl config
+ ynh_replace_string --match_string="" --replace_string="$path_url" --target_file="/etc/jellyfin/network.xml"
+fi
+
+#=================================================
+# INSTALL LDAP PLUGIN
+#=================================================
+
+# Install it only if the plugin directory does not exist
+if [ ! -e "/var/lib/jellyfin/plugins/LDAP Authentication" ]; then
+ ynh_script_progression --message="Installing LDAP plugin..." --weight=2
+
+ ynh_setup_source --dest_dir="/var/lib/jellyfin/plugins/LDAP Authentication" --source_id=ldap
+ mkdir -p /var/lib/jellyfin/plugins/configurations/
+ cp ../conf/LDAP-Auth.xml /var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml
+fi
+
#=================================================
# GENERIC FINALIZATION
#=================================================