From 530fff24eaa43aa3776a4bc2bb52002177f110cf Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Thu, 18 May 2023 16:56:49 +0200 Subject: [PATCH] Added config file, improved setup and updater scripts. --- .gitignore | 3 ++- README.md | 4 ++-- config.txt.sample | 4 ++++ setup-fedora.sh | 7 ++++++- start-lxc.sh | 12 ++++++++---- start.sh | 12 ++++++++---- update.sh | 6 +++++- 7 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 config.txt.sample diff --git a/.gitignore b/.gitignore index a604902..1c5d309 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vpn/ -Microsoft-Rewards-bot/ \ No newline at end of file +Microsoft-Rewards-bot/ +config.txt \ No newline at end of file diff --git a/README.md b/README.md index d6b509c..0174d72 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,13 @@ Clone the project curl -sSL https://git.justw.tf/Lightemerald/mcr-bot/raw/branch/main/setup-fedora.sh | bash ``` -Add your VPN files to `./vpn` then run +Add your VPN files (.ovpn) to `./vpn` then run ```bash sh setup-vpn.sh ``` -Copy your accounts file named as [vpnname].json in the Bot then run +Copy your accounts file named as [vpnname].json in the Bot folder then run ```bash sh start.sh diff --git a/config.txt.sample b/config.txt.sample new file mode 100644 index 0000000..0a0f54a --- /dev/null +++ b/config.txt.sample @@ -0,0 +1,4 @@ +interval=300 +schedule=("01:00" "03:15" "05:30" "07:45" "10:00" "12:15" "14:30" "16:45" "19:00" "21:15") +retries=3 +webhook='' \ No newline at end of file diff --git a/setup-fedora.sh b/setup-fedora.sh index 09088e5..a7e474b 100644 --- a/setup-fedora.sh +++ b/setup-fedora.sh @@ -6,5 +6,10 @@ git clone https://git.justw.tf/Lightemerald/mcr-bot && cd mcr-bot git clone https://github.com/farshadz1997/Microsoft-Rewards-bot pip install -r Microsoft-Rewards-bot/requirements.txt mkdir vpn +cp ./config.txt.sample config.txt +chmod +x ./*.sh clear -echo "Add your VPN files in ./vpn and your accounts files with the same name as the vpn in ./Microsoft-Rewards-bot then run setup-vpn.sh" \ No newline at end of file +echo "edit config.txt" +echo "Add your VPN files (.ovpn) in ./vpn" +echo "Add your accounts files (.json) with the same name as the vpn in ./Microsoft-Rewards-bot" +echo "finally run setup-vpn.sh" \ No newline at end of file diff --git a/start-lxc.sh b/start-lxc.sh index 065b8a1..086dc99 100644 --- a/start-lxc.sh +++ b/start-lxc.sh @@ -16,11 +16,15 @@ then exit fi -interval=300 -schedule=("06:00" "08:00" "10:00" "12:00" "14:00" "16:00" "18:00" "20:00") vpns=$(nmcli connection show | grep vpn | awk '{print $1}') -retries=3 -webhook='' + +config_file="config.txt" +if [ -f "$config_file" ]; then + source "$config_file" +else + echo "Config file not found." + exit 1 +fi while true do diff --git a/start.sh b/start.sh index 67623bb..ea4bc05 100644 --- a/start.sh +++ b/start.sh @@ -16,11 +16,15 @@ then exit fi -interval=300 -schedule=("06:00" "08:00" "10:00" "12:00" "14:00" "16:00" "18:00" "20:00") vpns=$(nmcli connection show | grep vpn | awk '{print $1}') -retries=3 -webhook='' + +config_file="config.txt" +if [ -f "$config_file" ]; then + source "$config_file" +else + echo "Config file not found." + exit 1 +fi while true do diff --git a/update.sh b/update.sh index bddc158..13114b5 100644 --- a/update.sh +++ b/update.sh @@ -1 +1,5 @@ -git pull \ No newline at end of file +dnf up -y +git pull +cd Microsoft-Rewards-bot && git pull +clear +echo "Update done!" \ No newline at end of file