1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Genrate key for android app

This commit is contained in:
anmol26s 2018-10-06 18:25:30 +05:30
parent 990cf764d2
commit 8d454cbf61
4 changed files with 30 additions and 8 deletions

View file

@ -18,7 +18,7 @@ HASH_SALT=ChangeMeBy20+KeyLength
HASH_LENGTH=18 HASH_LENGTH=18
# The URL of your application. # The URL of your application.
APP_URL=http://localhost APP_URL=https://__DOMAIN__
# Database information # Database information
# To keep this information secure, we urge you to change the default password # 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 # CLIENT ID and SECRET used for the official mobile application
# This is to make sure that only the mobile application that you approve can # 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 # access the route to let your users sign in with their credentials
MOBILE_CLIENT_ID= MOBILE_CLIENT_ID=__IDENTITY__
MOBILE_CLIENT_SECRET= MOBILE_CLIENT_SECRET=__KEY__
# Allow to access general statistics about your instance through a public API # Allow to access general statistics about your instance through a public API
# call # call

View file

@ -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 echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.list
ynh_package_update 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 sudo update-alternatives --install /usr/bin/php php /usr/bin/php5 70
} }

View file

@ -123,7 +123,7 @@ email=$(ynh_user_get_info $admin 'mail')
sudo cp ../conf/.env $final_path/.env sudo cp ../conf/.env $final_path/.env
db_name=$(ynh_sanitize_dbid $app) 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 "random_key" "$random_key" "$final_path/.env"
ynh_replace_string "yunouser" "$db_name" "$final_path/.env" ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env" ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
@ -134,7 +134,16 @@ ynh_replace_string "language" "$language" "$final_path/.env"
# setup application config # 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:client --password -n > key.txt )
mobile_id=$( cd $final_path && tail -2 test.txt | head -1 | cut -c 12- )
mobile_keykey=$( cd $final_path && tail -1 key.txt | cut -c 16- )
ynh_replace_string "__IDENTITY__" "$id" "$final_path/.env"
ynh_replace_string "__KEY__" "$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)
(cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force)
# create a cronjob to run the scheduler # create a cronjob to run the scheduler
echo "* * * * * -u $app /usr/bin/php7.1 $final_path/artisan schedule:run" > /tmp/cron$app echo "* * * * * -u $app /usr/bin/php7.1 $final_path/artisan schedule:run" > /tmp/cron$app

View file

@ -24,7 +24,6 @@ db_name=$(ynh_app_setting_get $app db_name)
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get $app mysqlpwd)
language=$(ynh_app_setting_get $app language) language=$(ynh_app_setting_get $app language)
random_key=$(ynh_app_setting_get $app random_key) random_key=$(ynh_app_setting_get $app random_key)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -95,7 +94,7 @@ ynh_system_user_create $app
#================================================= #=================================================
# install new dependencies # 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 # PHP-FPM 7.1 CONFIGURATION
@ -123,6 +122,20 @@ ynh_replace_string "language" "$language" "$final_path/.env"
# Run monica update # Run monica update
cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force 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)
else
( cd $final_path && sudo /usr/bin/php7.1 artisan passport:client --password -n > key.txt )
mobile_id=$( cd $final_path && tail -2 test.txt | head -1 | cut -c 12- )
mobile_keykey=$( cd $final_path && tail -1 key.txt | cut -c 16- )
ynh_replace_string "__IDENTITY__" "$id" "$final_path/.env"
ynh_replace_string "__KEY__" "$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)
(cd $final_path && sudo /usr/bin/php7.1 artisan monica:update --force)
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================