ouo
This commit is contained in:
parent
54d728364e
commit
ed828e4ea0
|
@ -7,7 +7,7 @@ screenshot.png
|
||||||
login.csv
|
login.csv
|
||||||
data
|
data
|
||||||
**/__pycache__
|
**/__pycache__
|
||||||
|
/user_data
|
||||||
install.sh
|
install.sh
|
||||||
nohup.out
|
nohup.out
|
||||||
points.csv
|
points.csv
|
||||||
|
|
10
Dockerfile
10
Dockerfile
|
@ -2,11 +2,13 @@ FROM python:3.10
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
RUN curl -sSLO https://piair.xyz/download/chrome.deb \
|
RUN curl -sSLO https://piair.xyz/download/chrome.deb \
|
||||||
|
&& ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime \
|
||||||
&& git clone https://gitea.augustin64.fr/piair/MsRewards-Reborn \
|
&& git clone https://gitea.augustin64.fr/piair/MsRewards-Reborn \
|
||||||
|
&& python3 -m pip install -r MsRewards-Reborn/requirements.txt \
|
||||||
&& apt update \
|
&& apt update \
|
||||||
&& apt install xvfb wfrench tigervnc-standalone-server libasound2 libatk-bridge2.0-0 libnss3 libnspr4 xvfb libgbm1 libatk1.0-0 libu2f-udev libatspi2.0-0 libcups2 libxkbcommon0 libxrandr2 libdbus-1-3 xdg-utils fonts-liberation libdrm2 -y \
|
&& apt install xvfb nano tzdata wfrench tigervnc-standalone-server libasound2 libatk-bridge2.0-0 libnss3 libnspr4 xvfb libgbm1 libatk1.0-0 libu2f-udev libatspi2.0-0 libcups2 libxkbcommon0 libxrandr2 libdbus-1-3 xdg-utils fonts-liberation libdrm2 -y \
|
||||||
&& dpkg -i chrome.deb \
|
&& dpkg -i chrome.deb
|
||||||
&& python3 -m pip install -r MsRewards-Reborn/requirements.txt
|
ENV TZ="Europe/Paris"
|
||||||
WORKDIR /app/MsRewards-Reborn/
|
WORKDIR /app/MsRewards-Reborn/
|
||||||
CMD python3 Flask/app.py
|
CMD python3 -u Flask/app.py
|
||||||
|
|
||||||
|
|
19
Flask/app.py
19
Flask/app.py
|
@ -8,7 +8,7 @@ import json
|
||||||
|
|
||||||
global password
|
global password
|
||||||
with open("./user_data/flask.json", "r") as inFile:
|
with open("./user_data/flask.json", "r") as inFile:
|
||||||
data = json.load(inFile)
|
data = json.load(inFile)
|
||||||
|
|
||||||
password = data["password"]
|
password = data["password"]
|
||||||
secret = data["secret"]
|
secret = data["secret"]
|
||||||
|
@ -17,10 +17,10 @@ if secret == "":
|
||||||
secret = secrets.token_hex()
|
secret = secrets.token_hex()
|
||||||
with open("./user_data/flask.json", "w") as inFile:
|
with open("./user_data/flask.json", "w") as inFile:
|
||||||
data = {
|
data = {
|
||||||
"password": password,
|
"password": password,
|
||||||
"secret": secret
|
"secret": secret
|
||||||
}
|
}
|
||||||
json.dump(data, inFile)
|
json.dump(data, inFile)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#Automatic start of MsRewards
|
#Automatic start of MsRewards
|
||||||
|
@ -31,14 +31,13 @@ scheduler.start()
|
||||||
|
|
||||||
def start_ms(i):
|
def start_ms(i):
|
||||||
print("\033[32m" + f"Starting config {i}" + "\033[0m")
|
print("\033[32m" + f"Starting config {i}" + "\033[0m")
|
||||||
subprocess.Popen(["python3", "./V6.py", "-c", i])
|
subprocess.Popen(["python3",'-u' ,"./V6.py", "-c", i])
|
||||||
|
|
||||||
|
|
||||||
TriggerDict = {}
|
TriggerDict = {}
|
||||||
def update_jobs():
|
def update_jobs():
|
||||||
with open("./user_data/configs.json", "r") as inFile:
|
with open("./user_data/configs.json", "r") as inFile:
|
||||||
configs = json.load(inFile)
|
configs = json.load(inFile)
|
||||||
|
|
||||||
for i in configs:
|
for i in configs:
|
||||||
h, m = configs[i]["time"].split(":")
|
h, m = configs[i]["time"].split(":")
|
||||||
print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m")
|
print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m")
|
||||||
|
@ -46,12 +45,12 @@ def update_jobs():
|
||||||
year="*", month="*", day="*", hour=h, minute=m, second="0"
|
year="*", month="*", day="*", hour=h, minute=m, second="0"
|
||||||
)
|
)
|
||||||
if configs[i]["enabled"]:
|
if configs[i]["enabled"]:
|
||||||
try :
|
try :
|
||||||
scheduler.remove_job(i) # on reset le job
|
scheduler.remove_job(i) # on reset le job
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"\033[33merror with deleting config {i} : {e}\033[0m")
|
print(f"\033[33merror with deleting config {i} : {e}\033[0m")
|
||||||
|
|
||||||
try :
|
try :
|
||||||
scheduler.add_job( # on relance le job
|
scheduler.add_job( # on relance le job
|
||||||
start_ms, # ---
|
start_ms, # ---
|
||||||
trigger=TriggerDict[i], # ---
|
trigger=TriggerDict[i], # ---
|
||||||
|
@ -93,7 +92,7 @@ class User(UserMixin):
|
||||||
self.id = id
|
self.id = id
|
||||||
self.name = "user" + str(id)
|
self.name = "user" + str(id)
|
||||||
self.password = password
|
self.password = password
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "%d/%s/%s" % (self.id, self.name, self.password)
|
return "%d/%s/%s" % (self.id, self.name, self.password)
|
||||||
|
|
||||||
|
@ -134,8 +133,8 @@ def change_password():
|
||||||
def page_not_found(e):
|
def page_not_found(e):
|
||||||
return(render_template("login.html"))
|
return(render_template("login.html"))
|
||||||
|
|
||||||
|
|
||||||
# callback to reload the user object
|
# callback to reload the user object
|
||||||
@login_manager.user_loader
|
@login_manager.user_loader
|
||||||
def load_user(userid):
|
def load_user(userid):
|
||||||
return User(userid)
|
return User(userid)
|
||||||
|
|
3
build.sh
3
build.sh
|
@ -3,5 +3,4 @@
|
||||||
echo "Enter the name of the instance"
|
echo "Enter the name of the instance"
|
||||||
read name
|
read name
|
||||||
|
|
||||||
sudo docker build -t msrewards .
|
sudo docker build -t msrewards . && sudo docker run -p 1234:1234 --shm-size=2gb --name $name msrewards
|
||||||
sudo docker run -p 1234:1234 --shm-size=2gb --name $name msrewards
|
|
||||||
|
|
Loading…
Reference in New Issue