From 7672ba34c27788c4b7aad5bb40b10ce68224eb87 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 09:39:41 +0200 Subject: [PATCH] Remove ynh_local_curl --- scripts/_ynh_local_curl | 45 ----------------------------------------- scripts/install | 1 - scripts/upgrade | 1 - 3 files changed, 47 deletions(-) delete mode 100644 scripts/_ynh_local_curl diff --git a/scripts/_ynh_local_curl b/scripts/_ynh_local_curl deleted file mode 100644 index ad0d1f7..0000000 --- a/scripts/_ynh_local_curl +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash -# Curl abstraction to help with POST requests to local pages (such as installation forms) -# For multiple calls, cookies are persisted between each call for the same app -# -# $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?)) -# -# example: ynh_local_curl "/install.php?installButton" "foo=$var1" "bar=$var2" -# -# usage: ynh_local_curl "page_uri" "key1=value1" "key2=value2" ... -# | arg: page_uri - Path (relative to $path_url) of the page where POST data will be sent -# | arg: key1=value1 - (Optionnal) POST key and corresponding value -# | arg: key2=value2 - (Optionnal) Another POST key and corresponding value -# | arg: ... - (Optionnal) More POST keys and values -# -# Requires YunoHost version 2.6.4 or higher. -ynh_local_curl () { - # Define url of page to curl - local local_page=$(ynh_normalize_url_path $1) - local full_path=$path_url$local_page - - if [ "${path_url}" == "/" ]; then - full_path=$local_page - fi - - local full_page_url=https://localhost$full_path - - # Concatenate all other arguments with '&' to prepare POST data - local POST_data="" - local arg="" - for arg in "${@:2}" - do - POST_data="${POST_data}${arg}&" - done - if [ -n "$POST_data" ] - then - # Add --data arg and remove the last character, which is an unecessary '&' - POST_data="--data ${POST_data::-1}" - fi - - # Wait untils nginx has fully reloaded (avoid curl fail with http2) - sleep 2 - - # Curl the URL - curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar /tmp/ynh-$app-cookie.txt --cookie /tmp/ynh-$app-cookie.txt -} diff --git a/scripts/install b/scripts/install index d5d14e8..c191ca6 100644 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -source _ynh_local_curl #================================================= # MANAGE SCRIPT FAILURE diff --git a/scripts/upgrade b/scripts/upgrade index 27b5115..25d4da6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -source _ynh_local_curl #================================================= # LOAD SETTINGS