diff --git a/config.txt.sample b/config.txt.sample index 456737b..6cf4b6e 100644 --- a/config.txt.sample +++ b/config.txt.sample @@ -2,4 +2,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='' -log_all=0 \ No newline at end of file +print_log_to_webhook=0 \ No newline at end of file diff --git a/setup-linux.sh b/setup-linux.sh index e7e6967..9e57bd0 100644 --- a/setup-linux.sh +++ b/setup-linux.sh @@ -42,7 +42,7 @@ update_package_manager install_requirements git clone https://git.justw.tf/Lightemerald/mcr-bot && cd mcr-bot && git checkout legacy -git clone https://github.com/farshadz1997/Microsoft-Rewards-bot && cd Microsoft-Rewards-bot && git checkout 03476776e9c58029dedaeee431958b5d04364bcf && pip install -r requirements.txt +git clone https://git.justw.tf/Lightemerald/Microsoft-Rewards-bot && cd Microsoft-Rewards-bot && pip install -r requirements.txt cd .. && mkdir vpn cp ./config.txt.sample config.txt chmod +x ./*.sh diff --git a/setup-vpn.sh b/setup-vpn.sh index 8f7681e..1de7958 100644 --- a/setup-vpn.sh +++ b/setup-vpn.sh @@ -1,9 +1,14 @@ #!/bin/bash -folder_path="vpn" +vpn_connections=$(nmcli connection show | grep vpn | awk '{print $1}') +for vpn in $vpn_connections; do + nmcli connection delete "$vpn" +done + +folder_path="vpn" for file in "$folder_path"/*; do if [[ -f "$file" ]]; then - nmcli con import type openvpn file ./$file + nmcli con import type openvpn file ./"$file" fi done \ No newline at end of file diff --git a/start.sh b/start.sh index abeb971..a9fc359 100644 --- a/start.sh +++ b/start.sh @@ -128,16 +128,16 @@ do if [ -z "$webhook" ]; then command_suffix="--accounts-file $vpn.json" else - if [[ "$log_all" == 1 ]]; then + if [[ "$print_log_to_webhook" == 1 ]]; then command_suffix="--accounts-file $vpn.json --discord $webhook --print-to-webhook" else command_suffix="--accounts-file $vpn.json --discord $webhook" fi fi if grep -q "container=lxc" /proc/1/environ || grep -q "container=lxc-libvirt" /proc/1/environ; then - command_prefix="cd Microsoft-Rewards-bot && python ms_rewards_farmer.py --dont-check-for-updates --shuffle --session --superfast --on-finish exit --no-webdriver-manager --skip-unusual --virtual-display" + command_prefix="cd Microsoft-Rewards-bot && python ms_rewards_farmer.py --dont-check-for-updates --shuffle --session --superfast --on-finish exit --no-webdriver-manager --browser uc --skip-unusual --virtual-display" else - command_prefix="cd Microsoft-Rewards-bot && python ms_rewards_farmer.py --dont-check-for-updates --shuffle --session --superfast --on-finish exit --no-webdriver-manager --skip-unusual" + command_prefix="cd Microsoft-Rewards-bot && python ms_rewards_farmer.py --dont-check-for-updates --shuffle --session --superfast --on-finish exit --no-webdriver-manager --browser uc --skip-unusual" fi gnome-terminal -- sh -c "$command_prefix $command_suffix; exit; exec bash" & read -t 2 diff --git a/update.sh b/update.sh index 3c36493..7cf2f51 100644 --- a/update.sh +++ b/update.sh @@ -1,6 +1,31 @@ +#!/bin/bash + +git fetch +if [ "$(git rev-parse HEAD)" != "$(git rev-parse "@{u}")" ]; then + git stash && git pull + cd .. && chmod +x ./*.sh + exec "$0" +fi + +if [ ! -d "accounts" ]; then + mkdir "accounts" +fi + +if [ ! -d "vpn" ]; then + mkdir "vpn" +fi + +if [ ! -d "Microsoft-Rewards-bot" ]; then + git clone https://git.justw.tf/Lightemerald/Microsoft-Rewards-bot +fi + sudo dnf up -y -git stash && git pull -cd Microsoft-Rewards-bot && git stash && git pull && git checkout 03476776e9c58029dedaeee431958b5d04364bcf && pip install -r requirements.txt -clear +cd Microsoft-Rewards-bot || exit +git fetch +if [ "$(git rev-parse HEAD)" != "$(git rev-parse "@{u}")" ]; then + git stash && git pull && pip install -r requirements.txt +fi + cd .. && chmod +x ./*.sh +clear echo "Update done!" \ No newline at end of file