mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-11-16 11:21:47 +00:00
Merge pull request #375 from Neilpang/dev
Add shfmt to format source code
This commit is contained in:
commit
5daefc0194
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@ -0,0 +1,11 @@
|
||||
language: bash
|
||||
|
||||
env:
|
||||
global:
|
||||
- SHFMT_URL=https://github.com/mvdan/sh/releases/download/v0.4.0/shfmt_v0.4.0_linux_amd64
|
||||
|
||||
script:
|
||||
- curl -sSL $SHFMT_URL -o ~/shfmt
|
||||
- chmod +x ~/shfmt
|
||||
- ~/shfmt -l -w -i 2 .
|
||||
- git diff --exit-code || (echo "Run shfmt to fix the formatting issues" && false)
|
@ -6,8 +6,6 @@
|
||||
#Which will be called by acme.sh to deploy the cert
|
||||
#returns 0 means success, otherwise error.
|
||||
|
||||
|
||||
|
||||
######## Public functions #####################
|
||||
|
||||
#domain keyfile certfile cafile fullchain
|
||||
@ -24,10 +22,7 @@ myapi_deploy() {
|
||||
_debug _cca "$_cca"
|
||||
_debug _cfullchain "$_cfullchain"
|
||||
|
||||
|
||||
_err "Not implemented yet"
|
||||
return 1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
|
||||
#
|
||||
#CF_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
|
||||
#
|
||||
#CF_Email="xxxx@sss.com"
|
||||
|
||||
|
||||
CF_Api="https://api.cloudflare.com/client/v4"
|
||||
|
||||
######## Public functions #####################
|
||||
@ -69,7 +67,7 @@ dns_cf_add(){
|
||||
_info "Updated, sleeping 10 seconds"
|
||||
sleep 10
|
||||
#todo: check if the record takes effect
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
_err "Update error"
|
||||
return 1
|
||||
@ -77,14 +75,12 @@ dns_cf_add(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_cf_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
@ -99,7 +95,7 @@ _get_root() {
|
||||
h=$(printf $domain | cut -d . -f $i-100)
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! _cf_rest GET "zones?name=$h"; then
|
||||
@ -145,5 +141,3 @@ _cf_rest() {
|
||||
_debug2 response "$response"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,10 +6,8 @@
|
||||
#
|
||||
#CX_Secret="sADDsdasdgdsf"
|
||||
|
||||
|
||||
CX_Api="https://www.cloudxns.net/api2"
|
||||
|
||||
|
||||
#REST_API
|
||||
######## Public functions #####################
|
||||
|
||||
@ -30,7 +28,6 @@ dns_cx_add() {
|
||||
_saveaccountconf CX_Key "$CX_Key"
|
||||
_saveaccountconf CX_Secret "$CX_Secret"
|
||||
|
||||
|
||||
_debug "First detect the root zone"
|
||||
if ! _get_root $fulldomain; then
|
||||
_err "invalid domain"
|
||||
@ -56,15 +53,12 @@ dns_cx_add() {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_cx_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#usage: root sub
|
||||
#return if the sub record already exists.
|
||||
#echos the existing records count.
|
||||
@ -127,9 +121,6 @@ update_record() {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
@ -150,7 +141,7 @@ _get_root() {
|
||||
_debug h "$h"
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if printf "$response" | grep "$h." >/dev/null; then
|
||||
@ -173,7 +164,6 @@ _get_root() {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#Usage: method URI data
|
||||
_rest() {
|
||||
m=$1
|
||||
@ -214,5 +204,3 @@ _rest() {
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,10 +6,8 @@
|
||||
#
|
||||
#DP_Key="sADDsdasdgdsf"
|
||||
|
||||
|
||||
DP_Api="https://dnsapi.cn"
|
||||
|
||||
|
||||
#REST_API
|
||||
######## Public functions #####################
|
||||
|
||||
@ -30,7 +28,6 @@ dns_dp_add() {
|
||||
_saveaccountconf DP_Id "$DP_Id"
|
||||
_saveaccountconf DP_Key "$DP_Key"
|
||||
|
||||
|
||||
_debug "First detect the root zone"
|
||||
if ! _get_root $fulldomain; then
|
||||
_err "invalid domain"
|
||||
@ -51,15 +48,12 @@ dns_dp_add() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_dp_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#usage: root sub
|
||||
#return if the sub record already exists.
|
||||
#echos the existing records count.
|
||||
@ -74,7 +68,7 @@ existing_records() {
|
||||
fi
|
||||
|
||||
if printf "$response" | grep 'No records'; then
|
||||
count=0;
|
||||
count=0
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -87,7 +81,6 @@ existing_records() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
count=0
|
||||
}
|
||||
|
||||
@ -110,7 +103,6 @@ add_record() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
return 1 #error
|
||||
}
|
||||
|
||||
@ -136,9 +128,6 @@ update_record() {
|
||||
return 1 #error
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
@ -153,7 +142,7 @@ _get_root() {
|
||||
h=$(printf $domain | cut -d . -f $i-100)
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! _rest POST "Domain.Info" "login_token=$DP_Id,$DP_Key&format=json&domain=$h"; then
|
||||
@ -178,7 +167,6 @@ _get_root() {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#Usage: method URI data
|
||||
_rest() {
|
||||
m=$1
|
||||
@ -203,5 +191,3 @@ _rest() {
|
||||
_debug2 response "$response"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#
|
||||
#GD_Secret="asdfsdfsfsdfsdfdfsdf"
|
||||
|
||||
|
||||
GD_Api="https://api.godaddy.com/v1"
|
||||
|
||||
######## Public functions #####################
|
||||
@ -35,7 +34,6 @@ dns_gd_add(){
|
||||
_debug _sub_domain "$_sub_domain"
|
||||
_debug _domain "$_domain"
|
||||
|
||||
|
||||
_info "Adding record"
|
||||
if _gd_rest PUT "domains/$_domain/records/TXT/$_sub_domain" "[{\"data\":\"$txtvalue\"}]"; then
|
||||
if [ "$response" = "{}" ]; then
|
||||
@ -53,17 +51,12 @@ dns_gd_add(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_gd_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
@ -78,7 +71,7 @@ _get_root() {
|
||||
h=$(printf $domain | cut -d . -f $i-100)
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! _gd_rest GET "domains/$h"; then
|
||||
@ -121,5 +114,3 @@ _gd_rest() {
|
||||
_debug2 response "$response"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,14 +65,8 @@ dns_lexicon_add() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_lexicon_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
8
dnsapi/dns_lua.sh
Normal file → Executable file
8
dnsapi/dns_lua.sh
Normal file → Executable file
@ -68,7 +68,7 @@ dns_lua_add() {
|
||||
if [ "$?" = "0" ]; then
|
||||
_info "Updated!"
|
||||
#todo: check if the record takes effect
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
_err "Update error"
|
||||
return 1
|
||||
@ -76,14 +76,12 @@ dns_lua_add() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_lua_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
@ -101,7 +99,7 @@ _get_root() {
|
||||
h=$(printf $domain | cut -d . -f $i-100)
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if printf $response | grep \"name\":\"$h\" >/dev/null; then
|
||||
@ -141,5 +139,3 @@ _LUA_rest() {
|
||||
_debug2 response "$response"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
#Which will be called by acme.sh to add the txt record to your api system.
|
||||
#returns 0 means success, otherwise error.
|
||||
|
||||
|
||||
|
||||
######## Public functions #####################
|
||||
|
||||
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||
@ -15,18 +13,15 @@ dns_myapi_add() {
|
||||
fulldomain=$1
|
||||
txtvalue=$2
|
||||
_err "Not implemented!"
|
||||
return 1;
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_myapi_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
_info() {
|
||||
if [ -z "$2" ]; then
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
|
||||
#Applcation Key
|
||||
#OVH_AK="sdfsdfsdfljlbjkljlkjsdfoiwje"
|
||||
#
|
||||
@ -10,10 +9,8 @@
|
||||
#Consumer Key
|
||||
#OVH_CK="sdfsdfsdfsdfsdfdsf"
|
||||
|
||||
|
||||
#OVH_END_POINT=ovh-eu
|
||||
|
||||
|
||||
#'ovh-eu'
|
||||
OVH_EU='https://eu.api.ovh.com/1.0'
|
||||
|
||||
@ -35,13 +32,10 @@ SYS_CA='https://ca.api.soyoustart.com/1.0'
|
||||
#'runabove-ca'
|
||||
RAV_CA='https://api.runabove.com/1.0'
|
||||
|
||||
|
||||
wiki="https://github.com/Neilpang/acme.sh/wiki/How-to-use-OVH-domain-api"
|
||||
|
||||
ovh_success="https://github.com/Neilpang/acme.sh/wiki/OVH-Success"
|
||||
|
||||
|
||||
|
||||
_ovh_get_api() {
|
||||
_ogaep="$1"
|
||||
|
||||
@ -76,8 +70,8 @@ _ovh_get_api() {
|
||||
return
|
||||
;;
|
||||
|
||||
|
||||
*)
|
||||
|
||||
_err "Unknown parameter : $1"
|
||||
return 1
|
||||
;;
|
||||
@ -101,7 +95,6 @@ dns_ovh_add(){
|
||||
_saveaccountconf OVH_AK "$OVH_AK"
|
||||
_saveaccountconf OVH_AS "$OVH_AS"
|
||||
|
||||
|
||||
if [ -z "$OVH_END_POINT" ]; then
|
||||
OVH_END_POINT="ovh-eu"
|
||||
fi
|
||||
@ -119,10 +112,9 @@ dns_ovh_add(){
|
||||
_err "Can not get consumer key."
|
||||
fi
|
||||
#return and wait for retry.
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
_info "Checking authentication"
|
||||
|
||||
response="$(_ovh_rest GET "domain/")"
|
||||
@ -173,7 +165,7 @@ dns_ovh_add(){
|
||||
_debug "Refresh:$response"
|
||||
_info "Updated, sleeping 10 seconds"
|
||||
sleep 10
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
_err "Update error"
|
||||
@ -182,14 +174,12 @@ dns_ovh_add(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_ovh_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
#################### Private functions bellow ##################################
|
||||
|
||||
_ovh_authentication() {
|
||||
@ -227,7 +217,6 @@ _ovh_authentication() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
#_acme-challenge.www.domain.com
|
||||
#returns
|
||||
# _sub_domain=_acme-challenge.www
|
||||
@ -241,7 +230,7 @@ _get_root() {
|
||||
h=$(printf $domain | cut -d . -f $i-100)
|
||||
if [ -z "$h" ]; then
|
||||
#not valid
|
||||
return 1;
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! _ovh_rest GET "domain/zone/$h"; then
|
||||
@ -274,7 +263,6 @@ _ovh_rest() {
|
||||
data="$3"
|
||||
_debug $ep
|
||||
|
||||
|
||||
_ovh_url="$OVH_API/$ep"
|
||||
_debug2 _ovh_url "$_ovh_url"
|
||||
_ovh_t="$(_ovh_timestamp)"
|
||||
@ -284,7 +272,6 @@ _ovh_rest() {
|
||||
_ovh_hex="$(printf "%s" "$_ovh_p" | _digest sha1 hex)"
|
||||
_debug2 _ovh_hex "$_ovh_hex"
|
||||
|
||||
|
||||
_H1="X-Ovh-Application: $OVH_AK"
|
||||
_H2="X-Ovh-Signature: \$1\$$_ovh_hex"
|
||||
_debug2 _H2 "$_H2"
|
||||
@ -305,5 +292,3 @@ _ovh_rest() {
|
||||
_debug2 response "$response"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,14 +61,12 @@ dns_pdns_add() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#fulldomain
|
||||
dns_pdns_rm() {
|
||||
fulldomain=$1
|
||||
|
||||
}
|
||||
|
||||
|
||||
set_record() {
|
||||
_info "Adding record"
|
||||
root=$1
|
||||
|
Loading…
Reference in New Issue
Block a user