Compare commits

..

No commits in common. "6f13b2532d23dabfb8078adc9db3fc4c684b15d1" and "49dc53ed324f60424d7b6ed3491d37d874e92b8b" have entirely different histories.

4 changed files with 33 additions and 47 deletions

6
V6.py
View File

@ -9,6 +9,7 @@ from modules.db import add_to_database
from modules.driver_tools import * from modules.driver_tools import *
from modules.error import * from modules.error import *
import os
from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoSuchElementException
# create a webdriver # create a webdriver
@ -24,7 +25,9 @@ def create_driver(mobile=False):
"Chrome/22 Mobile Safari/537.36" "Chrome/22 Mobile Safari/537.36"
) )
chrome_profile_dir = init_profile(config.UserCredentials.get_mail()) # Profile dir
chrome_profile_dir = "/app/MsRewards-Reborn/user_data/profile/"+config.UserCredentials.get_mail()
os.makedirs(chrome_profile_dir, exist_ok=True)
# Full list on https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md # Full list on https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
arguments = [ arguments = [
@ -50,6 +53,7 @@ def create_driver(mobile=False):
chrome_options.add_argument(arg) chrome_options.add_argument(arg)
driver = uc.Chrome(options=chrome_options) driver = uc.Chrome(options=chrome_options)
set_language(driver)
return driver return driver

View File

@ -1,13 +0,0 @@
#!/bin/bash
docker-do () { # Check if sudo needs to be used
if id -nG "$(whoami)" | grep -qw "docker"; then
docker $@
else
sudo docker $@
fi
}
docker-do stop MsRewards
docker-do rm MsRewards
docker-do image rm msrewards

View File

@ -1,5 +1,3 @@
import os
import json
from random import uniform from random import uniform
from selenium.common import TimeoutException from selenium.common import TimeoutException
@ -12,36 +10,33 @@ from modules.Tools.logger import debug
from modules.Tools.tools import * from modules.Tools.tools import *
def init_profile(mail): def set_language(ldriver):
chrome_profile_dir = "/app/MsRewards-Reborn/user_data/profile/"+mail ldriver.get("chrome://settings/languages")
os.makedirs(chrome_profile_dir, exist_ok=True) action = ActionChains(ldriver)
action.reset_actions()
preferences_file = os.path.join(chrome_profile_dir, "Default", "Preferences") # select language
if not os.path.exists(preferences_file): x_coord = 1200
os.makedirs(os.path.join(chrome_profile_dir, "Default"), exist_ok=True) y_coord = 150
with open(preferences_file, "w") as f: action.move_by_offset(x_coord, y_coord).click().perform()
json.dump( sleep(0.5)
{ # scroll down
"intl": { action.reset_actions()
"accept_languages": "fr-FR,en-US,en", elm = ldriver.find_element(By.XPATH, "/html/body")
"selected_languages": "fr-FR,en-US,en" ActionChains(ldriver) \
} .send_keys("french") \
}, f .pause(0.5) \
) .send_keys(Keys.TAB + Keys.TAB + Keys.ENTER + Keys.TAB + Keys.TAB + Keys.ENTER) \
else: .perform()
with open(preferences_file, "r") as f: x_coord = 1163
settings = json.load(f) y_coord = 717
action.move_by_offset(x_coord, y_coord).click().perform()
if "intl" not in settings: # put to the top
settings["intl"] = {} sleep(0.5)
action.reset_actions()
settings["intl"]["accept_languages"] = "fr-FR,en-US,en" x_coord = 1257
settings["intl"]["selected_languages"] = "fr-FR,en-US,en" y_coord = 328
action.move_by_offset(x_coord, y_coord).click().perform()
with open(preferences_file, "w") as f: action.click().perform()
json.dump(settings, f)
return chrome_profile_dir
# Deal with RGPD popup as well as some random popup like 'are you satisfied' one # Deal with RGPD popup as well as some random popup like 'are you satisfied' one

View File

@ -1 +1 @@
v6.8.44 v6.8.43