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

Add Apple Pay verification for Stripe

This commit is contained in:
tituspijean 2024-04-09 19:12:02 +02:00
parent 6c9c9ce11f
commit 99ee6e8d88
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
3 changed files with 56 additions and 0 deletions

4
conf/apple_pay.conf Normal file
View file

@ -0,0 +1,4 @@
location = /.well-known/apple-developer-merchantid-domain-association {
alias __INSTALL_DIR__;
index apple-developer-merchantid-domain-association =404;
}

13
config_panel.toml Normal file
View file

@ -0,0 +1,13 @@
version = "1.0"
[main]
name = "Ghost configuration"
[main.stripe]
name = "Stripe integration"
[main.stripe.apple_pay]
ask = "Upload the apple-developer-merchantid-domain-association file"
type = "file"
help = "It is provided by Stripe"
bind = "__INSTALL_DIR__/apple_pay.__APP__.conf"

39
scripts/config Normal file
View file

@ -0,0 +1,39 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# OVERWRITING VALIDATE STEP
#=================================================
ynh_app_config_apply() {
if [ -f $install_dir/apple-developer-merchantid-domain-association ]
then
ynh_add_config --template="apple_pay.conf" --destination="/etc/nginx/conf.d/$domain.d/apple_pay.$app.conf"
if [ ! ynh_permission_exists --permission="$app.apple_pay" ]; then
ynh_permission_create --permission="$app.apple_pay" --url="$domain/.well-known/apple-developer-merchantid-domain-association" --allowed=visitors --protected --auth_header=false
fi
else
ynh_secure_remove --file="/etc/nginx/conf.d/$domain.d/apple_pay.$app.conf"
if [ ynh_permission_exists --permission="$app.apple_pay" ]; then
ynh_permission_delete --permission="$app.apple_pay"
fi
fi
ynh_systemd_action --service_name=nginx --action=reload
_ynh_app_config_apply
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_run $1