mirror of
https://github.com/EvgenyNerush/easy-xray.git
synced 2026-02-04 08:48:16 +03:00
modify default behaviour of "./ex.sh link" command
When executed without a "conf_file" argument, generate the client-link pair from each config file and write it to "conf/client_links.txt".
This commit is contained in:
17
ex.sh
17
ex.sh
@@ -708,9 +708,24 @@ then
|
|||||||
conf_file=$2
|
conf_file=$2
|
||||||
if [ -v $conf_file ]
|
if [ -v $conf_file ]
|
||||||
then
|
then
|
||||||
echo -e "${red}no config is given${normal}"
|
if ! ls -U conf/config_client_*.json 1> /dev/null 2>&1; then
|
||||||
|
echo -e "${red}no config is given, and there are no any client configs${normal}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo -e "${yellow}no config is given, a list of client-link pairs is
|
||||||
|
written to \033[33;3mconf/client_links.txt${yellow} from the following files:${normal}"
|
||||||
|
file="conf/client_links.txt"
|
||||||
|
: > $file
|
||||||
|
for conf_file in conf/config_client_*.json; do
|
||||||
|
echo -e "\033[33;3m - ${conf_file}${normal}"
|
||||||
|
basename=$(basename $conf_file .json)
|
||||||
|
client=${basename#config_client_}
|
||||||
|
link=$(generate_link $conf_file)
|
||||||
|
echo -e "${client}\n$link\n" >> $file
|
||||||
|
done
|
||||||
|
sed -i '$d' $file
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
if [ ! -f $conf_file ]
|
if [ ! -f $conf_file ]
|
||||||
then
|
then
|
||||||
echo -e "${red}file ${conf_file} does not exist${normal}"
|
echo -e "${red}file ${conf_file} does not exist${normal}"
|
||||||
|
|||||||
Reference in New Issue
Block a user