From 3eaf8b61a8f3ea42b55b84f8a584fa6776bf3dcc Mon Sep 17 00:00:00 2001 From: anmol26s <5068843+anmol26s@users.noreply.github.com> Date: Tue, 9 Oct 2018 09:51:40 +0530 Subject: [PATCH] Fix: Android app work and updated to version 2.8.1 (#27) * Genrate key for android app * misnamed file name * Replace and wrong variable * Replace and wrong variable * start php7.1 start * start php7.1 before reload * wrong commenting syntex in php.conf * Updated to version 2.8.1 * Run php artisan passport:install for the app config * Added domain .env --- README.md | 2 +- conf/.env | 6 +++--- conf/app.src | 4 ++-- conf/php-fpm.conf | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/install | 15 +++++++++++++-- scripts/upgrade | 20 ++++++++++++++++++-- 8 files changed, 41 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bab7a94..f87a756 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Installer Monica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=monica) -Shipped version: **2.8.0** +Shipped version: **2.8.1**

Personal Relationship Manager

diff --git a/conf/.env b/conf/.env index b42f2a4..94f9605 100644 --- a/conf/.env +++ b/conf/.env @@ -18,7 +18,7 @@ HASH_SALT=ChangeMeBy20+KeyLength HASH_LENGTH=18 # The URL of your application. -APP_URL=http://localhost +APP_URL=https://__DOMAIN__ # Database information # To keep this information secure, we urge you to change the default password @@ -114,8 +114,8 @@ MFA_ENABLED=false # CLIENT ID and SECRET used for the official mobile application # This is to make sure that only the mobile application that you approve can # access the route to let your users sign in with their credentials -MOBILE_CLIENT_ID= -MOBILE_CLIENT_SECRET= +MOBILE_CLIENT_ID=__IDENTITY__ +MOBILE_CLIENT_SECRET=__KEY__ # Allow to access general statistics about your instance through a public API # call diff --git a/conf/app.src b/conf/app.src index 3a4a9ff..5a35fbb 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/monicahq/monica/archive/v2.8.0.zip -SOURCE_SUM=72670426bf3ffd64827d0d0fce32469fc895b800580d1c81f0213e52b468e1c6 +SOURCE_URL=https://github.com/monicahq/monica/archive/v2.8.1.zip +SOURCE_SUM=130d886412483e2a80703fde42b09181d572ca355ce1144c5bf7db8fa9010cb0 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index d50ba2e..2da7a2f 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -249,12 +249,12 @@ catch_workers_output = yes ;php_value[memory_limit] = 256M ;php_value[short_open_tag] = On -# Common values to change to increase file upload limit +; Common values to change to increase file upload limit ; upload_max_filesize = 50M ; post_max_size = 50M ; mail.add_x_header = Off -# Other common parameters +; Other common parameters ; max_execution_time = 600 ; max_input_time = 300 ; memory_limit = 256M diff --git a/manifest.json b/manifest.json index 423333b..33fdbc9 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ }, "url": "https://monica.com", "license": "GPL-3.0", - "version": "2.8.0", + "version": "2.8.1", "maintainer": { "name": "Sebastian Gumprich", "email": "yunohost@gumpri.ch", diff --git a/scripts/_common.sh b/scripts/_common.sh index 2b61c4d..9b942c6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -109,7 +109,7 @@ ynh_install_php7 () { echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list ynh_package_update - ynh_install_app_dependencies php7.1 php7.1-zip php7.1-fpm php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-bcmath + ynh_install_app_dependencies php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm php7.1-bcmath php7.1-intl php7.1-simplexml php7.1-dom php7.1-curl php7.1-gd sudo update-alternatives --install /usr/bin/php php /usr/bin/php5 70 } diff --git a/scripts/install b/scripts/install index 797c351..a3f5b05 100755 --- a/scripts/install +++ b/scripts/install @@ -123,7 +123,7 @@ email=$(ynh_user_get_info $admin 'mail') sudo cp ../conf/.env $final_path/.env db_name=$(ynh_sanitize_dbid $app) - +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env" ynh_replace_string "random_key" "$random_key" "$final_path/.env" ynh_replace_string "yunouser" "$db_name" "$final_path/.env" ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env" @@ -134,7 +134,17 @@ ynh_replace_string "language" "$language" "$final_path/.env" # setup application config -cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force +( cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force ) +( cd $final_path && sudo /usr/bin/php7.1 artisan passport:install ) +( cd $final_path && sudo /usr/bin/php7.1 artisan passport:client --password -n > key.txt ) +mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) +mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) +ynh_replace_string "__IDENTITY__" "$mobile_id" "$final_path/.env" +ynh_replace_string "__KEY__" "$mobile_key" "$final_path/.env" +ynh_app_setting_set $app mobile_id $mobile_id +ynh_app_setting_set $app mobile_key $mobile_key +(cd $final_path && rm -f key.txt) + # create a cronjob to run the scheduler echo "* * * * * -u $app /usr/bin/php7.1 $final_path/artisan schedule:run" > /tmp/cron$app @@ -174,6 +184,7 @@ fi #================================================= # RELOAD NGINX #================================================= +service php7.1-fpm start systemctl reload php7.1-fpm systemctl reload nginx # Set default php to php5 or php7.0 diff --git a/scripts/upgrade b/scripts/upgrade index bcdfd7a..e5d33ec 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,6 @@ db_name=$(ynh_app_setting_get $app db_name) db_pwd=$(ynh_app_setting_get $app mysqlpwd) language=$(ynh_app_setting_get $app language) random_key=$(ynh_app_setting_get $app random_key) - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -95,7 +94,7 @@ ynh_system_user_create $app #================================================= # install new dependencies -ynh_install_app_dependencies php7.1 php7.1-zip php7.1-fpm php7.1-mysql php7.1-xml php7.1-intl php7.1-mbstring php7.1-gd php7.1-curl php7.1-bcmath +ynh_install_app_dependencies php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm php7.1-bcmath php7.1-intl php7.1-simplexml php7.1-dom php7.1-curl php7.1-gd #================================================= # PHP-FPM 7.1 CONFIGURATION @@ -118,11 +117,28 @@ ynh_replace_string "yunobase" "$db_name" "$final_path/.env" ynh_replace_string "yunomail" "$email" "$final_path/.env" ynh_replace_string "yunodomain" "$domain" "$final_path/.env" ynh_replace_string "language" "$language" "$final_path/.env" +ynh_replace_string "__DOMAIN__" "$domain" "$final_path/.env" # Run monica update cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force +if [ -f $final_path/storage/oauth-private.key ]; then + mobile_id=$(ynh_app_setting_get $app mobile_id) + mobile_key=$(ynh_app_setting_get $app mobile_key) + ynh_replace_string "__IDENTITY__" "$mobile_id" "$final_path/.env" + ynh_replace_string "__KEY__" "$mobile_key" "$final_path/.env" +else + ( cd $final_path && sudo /usr/bin/php7.1 artisan passport:install ) + ( cd $final_path && sudo /usr/bin/php7.1 artisan passport:client --password -n > key.txt ) + mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) + mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) + ynh_replace_string "__IDENTITY__" "$mobile_id" "$final_path/.env" + ynh_replace_string "__KEY__" "$mobile_key" "$final_path/.env" + ynh_app_setting_set $app mobile_id $mobile_id + ynh_app_setting_set $app mobile_key $mobile_key + (cd $final_path && rm -f key.txt) +fi #================================================= # GENERIC FINALIZATION #=================================================