diff --git a/README.md b/README.md index cbff268..dea2e55 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.1 ## 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..05c02c7 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.1.tar.gz +SOURCE_SUM=223469e4c276d21e8d85cc24df2b71896580c516201ec5a238676c8cdfa19ed0b18c6475fdaedc8117265002f38aee81b93d39fd5b77e27dc5e467126e5304a1 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..acaecda 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 @@ -176,6 +176,7 @@ DOMAIN=https://__DOMAIN__ ROCKET_ADDRESS=127.0.0.1 ROCKET_PORT=__ROCKET_PORT__ # ROCKET_TLS={certs="/path/to/certs.pem",key="/path/to/key.pem"} +# Workaround for YunoHost CI ROCKET_WORKERS=1 ## Mail specific settings, set SMTP_HOST and SMTP_FROM to enable the mail service. 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..af1b30b 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.2/bw_web_v2.13.2.tar.gz +SOURCE_SUM=2cdfbb91a9c084bb606cdaf17480b8eb25ced4ede768f127695c68c73af90bb874032173574d6a835098d04151d9ce41115a7e089e5fc6decdad3a1f7753d642 +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 4c6aca3..86ce3c5 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.1~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 0c1e105..786e00a 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 @@ -88,10 +88,10 @@ ynh_print_info --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress the source of bitwarden_rs from app.src to his build directory -ynh_setup_source --dest_dir="$final_path/build/" --source_id=app +ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" # Download, check integrity, uncompress and patch the source from web.src -ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id=web +ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" #================================================= # NGINX CONFIGURATION @@ -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 aad1a3c..dcf1e6b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,10 +86,10 @@ then ynh_print_info --message="Upgrading source files..." # Download, check integrity, uncompress the source of bitwarden_rs from app.src to his build directory - ynh_setup_source --dest_dir="$final_path/build/" --source_id=app + ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" # Download, check integrity, uncompress and patch the source from web.src - ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id=web + ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" fi #================================================= @@ -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"