diff --git a/README.md b/README.md index cbff268..bfaeae1 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,11 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview Open source password management solutions. -**Shipped version:** 1.13.1 +**Shipped version:** 1.14 ## Important points to read before installing -1. **Bitwarden** require a dedicated **root domain**, eg. bitwarden.domain.tld -1. At the end of the installation, the admin user will receive a mail with the admin_token used to access https://bitwarden.domain.tld/admin. +1. At the end of the installation, the admin user will receive a mail with the admin_token used to access https://your.domain.tld/bitwarden/admin. ## Screenshots diff --git a/check_process b/check_process index e511988..3782bf0 100644 --- a/check_process +++ b/check_process @@ -6,6 +6,7 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) + path="/path" (PATH) admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) ; Checks @@ -22,7 +23,7 @@ # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto diff --git a/conf/app.src b/conf/app.src index 5bfe565..79ad7ed 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.13.1.tar.gz -SOURCE_SUM=f032749606745ab1fd78cc0429fff3e9711522a94098f57d0134fa0f8dbfc07814d5b2a71e53028f8f911fd9c233fdedb8f68822096229a00cef189b41b6e717 +SOURCE_URL=https://github.com/dani-garcia/bitwarden_rs/archive/1.14.tar.gz +SOURCE_SUM=f9aa250f1dacc4a8d5b582ced57b11db3bd9f0880309fe7ea33065eb5d4f42baf1d0d704a810741bb8a7ad34e66b400f034e655076cdadb00f82c1c89630061a SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/bitwarden_rs.env b/conf/bitwarden_rs.env index 6d90dae..9c74ffa 100644 --- a/conf/bitwarden_rs.env +++ b/conf/bitwarden_rs.env @@ -138,7 +138,7 @@ ADMIN_TOKEN=__ADMIN_TOKEN__ ## It's recommended to configure this value, otherwise certain functionality might not work, ## like attachment downloads, email links and U2F. ## For U2F to work, the server must use HTTPS, you can use Let's Encrypt for free certs -DOMAIN=https://__DOMAIN__ +DOMAIN=https://__DOMAIN____PATH_URL__ ## Yubico (Yubikey) Settings ## Set your Client ID and Secret Key for Yubikey OTP diff --git a/conf/nginx.conf b/conf/nginx.conf index 89d793b..ae95ddf 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,7 +19,7 @@ location __PATH__/ { include conf.d/yunohost_panel.conf.inc; } -location /notifications/hub { +location __FINALPATH__/notifications/hub { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -28,6 +28,6 @@ location /notifications/hub { proxy_pass http://127.0.0.1:__WEBSOCKET_PORT__; } -location /notifications/hub/negotiate { +location __FINALPATH__/notifications/hub/negotiate { proxy_pass http://127.0.0.1:__ROCKET_PORT__; } \ No newline at end of file diff --git a/conf/web.src b/conf/web.src index 71b00d6..8a19388 100644 --- a/conf/web.src +++ b/conf/web.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.12.0b/bw_web_v2.12.0b.tar.gz -SOURCE_SUM=e511e061f9a064048f42a7d5b7a4b13a593bf2e1ff3fd72f4570a6aa18f45c06 -SOURCE_SUM_PRG=sha256sum +SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.13.1/bw_web_v2.13.1.tar.gz +SOURCE_SUM=4b73b01b009282ae520ca9dd695bac48ebf9f9ad72e20b417d80fbed4eecca9f738efd7e6038e546a6aa865d537f83910b796156ae70605efdfceac7b00ae51f +SOURCE_SUM_PRG=sha512sum SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index 8c77293..7eef607 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage passwords and other sensitive informations", "fr": "GĂ©res les mots de passe et autres informations sensibles" }, - "version": "1.13.1~ynh1", + "version": "1.14~ynh1", "url": "https://github.com/dani-garcia/bitwarden_rs", "license": "GPL-3.0-or-later", "maintainer": { @@ -30,6 +30,16 @@ }, "example": "example.com" }, + { + "name": "path", + "type": "path", + "ask": { + "en": "Choose a path for Bitwarden", + "fr": "Choisissez un chemin pour Bitwarden" + }, + "example": "/bitwarden", + "default": "/bitwarden" + }, { "name": "admin", "type": "user", diff --git a/scripts/change_url b/scripts/change_url index afdc363..2705f2f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= +ynh_print_info --message="Retrieve arguments from the manifest" old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH @@ -33,6 +34,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +rocket_port=$(ynh_app_setting_get --app=$app --key=rocket_port) +websocket_port=$(ynh_app_setting_get --app=$app --key=websocket_port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -92,7 +95,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config + ynh_add_nginx_config "websocket_port rocket_port" fi # Change the domain for nginx @@ -108,8 +111,18 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= -# ... +# MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." + +config="$final_path/live/bitwarden_rs.env" + +ynh_backup_if_checksum_is_different --file="$config" + +ynh_replace_string --match_string="DOMAIN=https://$old_domain$old_path" --replace_string="DOMAIN=https://$new_domain$new_path" --target_file="$config" + +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 348549f..189bcb8 100644 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,7 @@ ynh_abort_if_errors ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN -path_url="/" +path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC @@ -158,6 +158,7 @@ cp -f ../conf/bitwarden_rs.env "$config" ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --target_file="$config" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$config" ynh_replace_string --match_string="__WEBSOCKET_PORT__" --replace_string="$websocket_port" --target_file="$config" ynh_replace_string --match_string="__ROCKET_PORT__" --replace_string="$rocket_port" --target_file="$config" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config" diff --git a/scripts/upgrade b/scripts/upgrade index fb45c31..3f3b6fa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -161,6 +161,7 @@ cp -f ../conf/bitwarden_rs.env "$config" ynh_replace_string --match_string="__ADMIN_TOKEN__" --replace_string="$admin_token" --target_file="$config" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$config" ynh_replace_string --match_string="__WEBSOCKET_PORT__" --replace_string="$websocket_port" --target_file="$config" ynh_replace_string --match_string="__ROCKET_PORT__" --replace_string="$rocket_port" --target_file="$config" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"