mirror of
https://gitea.augustin64.fr/piair/MsRewards-Reborn.git
synced 2025-06-17 17:14:46 +02:00
updated webUI according to param changes
This commit is contained in:
442
Flask/app.py
Normal file
442
Flask/app.py
Normal file
@ -0,0 +1,442 @@
|
||||
import gevent.monkey
|
||||
gevent.monkey.patch_all()
|
||||
from time import sleep
|
||||
import subprocess
|
||||
import os
|
||||
from flask import Flask, Response, redirect, url_for, request, session, abort, render_template, send_from_directory
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from apscheduler.triggers.cron import CronTrigger
|
||||
from flask_login import LoginManager, UserMixin, login_required, login_user, logout_user
|
||||
from werkzeug.utils import secure_filename
|
||||
import json
|
||||
import re
|
||||
from requests import get
|
||||
import redis
|
||||
|
||||
|
||||
# redis part for live update
|
||||
pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
|
||||
r = redis.Redis(connection_pool=pool)
|
||||
|
||||
def generate_output():
|
||||
pubsub = r.pubsub()
|
||||
pubsub.subscribe('console')
|
||||
try :
|
||||
for message in pubsub.listen():
|
||||
if message['type'] == 'message':
|
||||
print(message)
|
||||
yield f"data: {message['data'].decode()}\n\n"
|
||||
except Exception as e:
|
||||
print(f"ya eu une erreur sad {e}")
|
||||
|
||||
# the end
|
||||
|
||||
global password
|
||||
with open("/app/MsRewards-Reborn/user_data/flask.json", "r") as inFile:
|
||||
data = json.load(inFile)
|
||||
|
||||
password = data["password"]
|
||||
secret = data["secret"]
|
||||
if secret == "":
|
||||
import secrets
|
||||
secret = secrets.token_hex()
|
||||
with open("/app/MsRewards-Reborn/user_data/flask.json", "w") as inFile:
|
||||
data = {
|
||||
"password": password,
|
||||
"secret": secret
|
||||
}
|
||||
json.dump(data, inFile)
|
||||
|
||||
"""
|
||||
#Automatic start of MsRewards
|
||||
"""
|
||||
def daily_command():
|
||||
subprocess.Popen(["git",'pull'])
|
||||
subprocess.Popen(["pkill","-9","chrome"])
|
||||
subprocess.Popen(["pkill","-9","Xvfb"])
|
||||
subprocess.Popen(["pkill","-9","Xvnc"])
|
||||
subprocess.Popen(["pkill","-9", "undetected_chromedriver"])
|
||||
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.start()
|
||||
scheduler.add_job( # on relance le job
|
||||
daily_command, # ---
|
||||
trigger=CronTrigger(
|
||||
year="*", month="*", day="*", hour="0", minute="0", second="0"
|
||||
), # ---
|
||||
name="Daily refresh", # ---
|
||||
id="99" # ---
|
||||
)
|
||||
|
||||
def start_ms(i):
|
||||
print("\033[32m" + f"Starting config {i}" + "\033[0m")
|
||||
log = open(f"/app/MsRewards-Reborn/Flask/static/logs/{i}.txt", 'a') # so that data written to it will be appended
|
||||
subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {i}"], stdout=log, stderr=log, shell=True)
|
||||
log.close()
|
||||
|
||||
|
||||
TriggerDict = {}
|
||||
def update_jobs():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
for i in configs:
|
||||
try :
|
||||
h, m = configs[i]["time"].split(":")
|
||||
print("\033[36m" + f"config {i} : {h}:{m}" + "\033[0m")
|
||||
TriggerDict[i] = CronTrigger(
|
||||
year="*", month="*", day="*", hour=h, minute=m, second="0"
|
||||
)
|
||||
if configs[i]["enabled"]:
|
||||
try :
|
||||
scheduler.remove_job(i) # on reset le job
|
||||
except Exception as e:
|
||||
print(f"\033[33merror with deleting config {i} : {e}\033[0m")
|
||||
|
||||
try :
|
||||
scheduler.add_job( # on relance le job
|
||||
start_ms, # ---
|
||||
trigger=TriggerDict[i], # ---
|
||||
args=[i], # ---
|
||||
name="Daily start", # ---
|
||||
id=i # ---
|
||||
)
|
||||
print("\033[36m" + f"successfully created config {i}" + "\033[0m")
|
||||
except Exception as e:
|
||||
print(f"\033[33merror with creating config {i} : {e}\033[0m")
|
||||
else :
|
||||
try :
|
||||
scheduler.remove_job(i)
|
||||
except Exception as e :
|
||||
print(f"\033[33merror with deleting config {i} : {e}\033[0m")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
"""
|
||||
#Flask app
|
||||
"""
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.context_processor
|
||||
def inject_default_variables():
|
||||
with open("/app/MsRewards-Reborn/version", "r") as f:
|
||||
version = f.readline().replace("\n", '')
|
||||
return dict(version=version)
|
||||
"""
|
||||
#Login stuff
|
||||
"""
|
||||
# config
|
||||
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||
app.config.update(
|
||||
SECRET_KEY = secret
|
||||
)
|
||||
|
||||
login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
login_manager.login_view = "login"
|
||||
|
||||
# silly user model
|
||||
class User(UserMixin):
|
||||
def __init__(self, id):
|
||||
self.id = id
|
||||
self.name = "user" + str(id)
|
||||
self.password = password
|
||||
|
||||
def __repr__(self):
|
||||
return "%d/%s/%s" % (self.id, self.name, self.password)
|
||||
|
||||
users = [User(1)]
|
||||
|
||||
@app.route('/stream')
|
||||
def stream():
|
||||
return Response(generate_output(), content_type='text/event-stream')
|
||||
|
||||
|
||||
@app.route("/login/", methods=["GET", "POST"])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
if request.form['password'] == password:
|
||||
user = User(id)
|
||||
login_user(user)
|
||||
if password == "ChangeMe":
|
||||
return(redirect('/change_password'))
|
||||
return(redirect('/schedule'))
|
||||
else:
|
||||
return abort(401)
|
||||
else:
|
||||
return(render_template("login.html"))
|
||||
|
||||
|
||||
@app.route("/change_password/", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def change_password():
|
||||
global password
|
||||
if request.method == 'POST':
|
||||
password = request.form["password"]
|
||||
subprocess.Popen(["grafana-cli", "admin", "reset-admin-password", password])
|
||||
with open("/app/MsRewards-Reborn/user_data/flask.json", "w") as inFile:
|
||||
data = {
|
||||
"password": password,
|
||||
"secret": secret
|
||||
}
|
||||
json.dump(data, inFile)
|
||||
return(render_template("change_password.html"))
|
||||
|
||||
|
||||
# handle login failed
|
||||
@app.errorhandler(401)
|
||||
def unauthorized(e):
|
||||
return(redirect("/login"))
|
||||
|
||||
|
||||
# callback to reload the user object
|
||||
@login_manager.user_loader
|
||||
def load_user(userid):
|
||||
return User(userid)
|
||||
|
||||
"""
|
||||
#end of login stuff
|
||||
"""
|
||||
|
||||
@app.route("/")
|
||||
def main():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
return(render_template("schedule.html", data=configs))
|
||||
|
||||
|
||||
@app.route("/discord/")
|
||||
def discord_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
|
||||
data = json.load(inFile)
|
||||
return(render_template("discord.html", data=data, len=maxi(data)))
|
||||
|
||||
|
||||
@app.route("/discord/", methods=["post"])
|
||||
def discord_post():
|
||||
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
|
||||
data = json.load(inFile)
|
||||
action = request.form
|
||||
if action['DISCORD'] == "delete" :
|
||||
data.pop(action["select"], None)
|
||||
else :
|
||||
config = action["select"]
|
||||
successL = action["successL"]
|
||||
try :
|
||||
a = action["successT"]
|
||||
successT = "True"
|
||||
except:
|
||||
successT = "False"
|
||||
try :
|
||||
a = action["errorsT"]
|
||||
errorsT = "True"
|
||||
except:
|
||||
errorsT = "False"
|
||||
errorsL = action["errorsL"]
|
||||
name = action["name"] if action["name"] else f"unnamed{action['select']}"
|
||||
data[config] = {"errorsL" : errorsL, "errorsT": errorsT, "successT": successT, "successL": successL, "name": name}
|
||||
|
||||
with open("/app/MsRewards-Reborn/user_data/discord.json", "w") as outFile:
|
||||
json.dump(data, outFile)
|
||||
return(render_template("discord.html", data=data, len=maxi(data)))
|
||||
|
||||
|
||||
@app.route("/dev/")
|
||||
def dev2():
|
||||
return(render_template("dev.html"))
|
||||
|
||||
|
||||
@app.route("/settings/")
|
||||
def settings_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/settings.json", "r") as inFile:
|
||||
settings = json.load(inFile)
|
||||
return(render_template("settings.html", data=settings))
|
||||
|
||||
|
||||
@app.route("/settings/", methods=["post"])
|
||||
def settings_post():
|
||||
settings = {}
|
||||
action = request.form
|
||||
settings['avatarlink'] = action["avatarlink"]
|
||||
with open("/app/MsRewards-Reborn/user_data/settings.json", "w") as inFile:
|
||||
json.dump(settings, inFile)
|
||||
return(render_template("settings.html", data=settings))
|
||||
|
||||
|
||||
@app.route("/proxy/")
|
||||
def proxy_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
|
||||
j = json.load(inFile)
|
||||
return(render_template("proxy.html", data=j, len=maxi(j)))
|
||||
|
||||
|
||||
@app.route("/proxy/", methods=["post"])
|
||||
def proxy_post():
|
||||
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
|
||||
data = json.load(inFile)
|
||||
action = request.form
|
||||
print(action)
|
||||
if action['PROXY'] == "delete" :
|
||||
print(action)
|
||||
data.pop(action["select"], None)
|
||||
else :
|
||||
try :
|
||||
config = action["select"]
|
||||
address = action["address"]
|
||||
port = action["port"]
|
||||
name = action["name"] if action["name"] else f"@unnamed{action['select']}"
|
||||
data[config] = {"address" : address, "port": port, "name": name}
|
||||
except :
|
||||
print("error : probably bad config")
|
||||
|
||||
with open("/app/MsRewards-Reborn/user_data/proxy.json", "w") as outFile:
|
||||
json.dump(data, outFile)
|
||||
return(render_template("proxy.html", data=data, len=maxi(data)))
|
||||
|
||||
|
||||
@app.route("/schedule/")
|
||||
def schedule_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
return(render_template("schedule.html", data=configs))
|
||||
|
||||
|
||||
@app.route("/schedule/", methods=["post"])
|
||||
def schedule_post():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
|
||||
data = dict(request.form)
|
||||
for i in configs:
|
||||
try :
|
||||
data[f'switch{i}']
|
||||
except :
|
||||
data[f'switch{i}'] = "off"
|
||||
|
||||
for i in configs:
|
||||
configs[i]["time"] = data[f"time{i}"]
|
||||
configs[i]["enabled"] = data[f"switch{i}"] == "on"
|
||||
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "w") as inFile:
|
||||
json.dump(configs, inFile)
|
||||
update_jobs()
|
||||
return(render_template("schedule.html", data=configs))
|
||||
|
||||
|
||||
@app.route("/config/")
|
||||
def config_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
|
||||
proxys = json.load(inFile)
|
||||
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
|
||||
discords = json.load(inFile)
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
return(render_template("config.html", data=configs, discords=discords, proxys=proxys, configs=configs, len=maxi(configs)))
|
||||
|
||||
|
||||
@app.route("/config/", methods=["POST"])
|
||||
def config_post():
|
||||
action = request.form
|
||||
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
|
||||
proxys = json.load(inFile)
|
||||
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
|
||||
discords = json.load(inFile)
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
|
||||
if action["data"] == "delete":
|
||||
print(action["config"])
|
||||
configs.pop(action["config"])
|
||||
else :
|
||||
comptes = {
|
||||
"1":{"mail": action["mail1"], "pwd": action["pwd1"], "2fa": action["2fa1"]},
|
||||
"2":{"mail": action["mail2"], "pwd": action["pwd2"], "2fa": action["2fa2"]},
|
||||
"3":{"mail": action["mail3"], "pwd": action["pwd3"], "2fa": action["2fa3"]},
|
||||
"4":{"mail": action["mail4"], "pwd": action["pwd4"], "2fa": action["2fa4"]},
|
||||
"5":{"mail": action["mail5"], "pwd": action["pwd5"], "2fa": action["2fa5"]}
|
||||
}
|
||||
|
||||
configs[action["config"]] = {
|
||||
"name" : action["name"] if action["name"] != "" else f"unnamed{action['config']}",
|
||||
"proxy": action["proxy"],
|
||||
"discord": action["discord"],
|
||||
"time":"",
|
||||
"enabled":"False",
|
||||
"accounts": comptes
|
||||
}
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "w") as outFile:
|
||||
json.dump(configs, outFile)
|
||||
return(render_template("config.html", data=configs, discords=discords, proxys=proxys, configs=configs, len=maxi(configs)))
|
||||
|
||||
@app.route("/logs/", methods=["GET", "POST"])
|
||||
def logs():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
print(configs)
|
||||
return(render_template("logs.html", data=configs))
|
||||
|
||||
|
||||
@app.route("/stats/", methods=["GET", "POST"])
|
||||
def stats():
|
||||
return(render_template("stats.html"))
|
||||
|
||||
|
||||
@app.route("/override/", methods=["POST"])
|
||||
def override_post():
|
||||
json = request.form.to_dict(flat=False)
|
||||
log = open(f"/app/MsRewards-Reborn/Flask/static/logs/custom.txt", 'w') # so that data written to it will be appended
|
||||
subprocess.Popen([f"python3 -u /app/MsRewards-Reborn/V6.py -c {json['config'][0]} --json \"{json}\""], stdout=log, stderr=log, shell=True)
|
||||
log.close()
|
||||
return(render_template("vnc_post.html"))
|
||||
|
||||
@app.route("/override/", methods=["GET"])
|
||||
def override_get():
|
||||
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
|
||||
configs = json.load(inFile)
|
||||
return(render_template("vnc_get.html", configs=configs))
|
||||
|
||||
@app.route('/download/<path:filename>', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def download(filename):
|
||||
return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True)
|
||||
|
||||
|
||||
def allowed_file(filename):
|
||||
ALLOWED_EXTENSIONS = ["json"]
|
||||
return '.' in filename and \
|
||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||
|
||||
@app.route('/upload_file/', methods=['POST'])
|
||||
@login_required
|
||||
def upload_file():
|
||||
print(request.files)
|
||||
i = 1
|
||||
while f'file{i}' in request.files :
|
||||
file = request.files[f'file{i}']
|
||||
if file.filename == '':
|
||||
print('end of files')
|
||||
return redirect(url_for('settings_get'))
|
||||
|
||||
elif file and allowed_file(file.filename):
|
||||
filename = secure_filename(file.filename)
|
||||
print(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
|
||||
file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
|
||||
|
||||
i += 1
|
||||
print(i)
|
||||
print(f'file{i}' in request.files)
|
||||
print("requete bizarre")
|
||||
return redirect(url_for('settings_get'))
|
||||
|
||||
|
||||
def maxi(dict):
|
||||
m = 0
|
||||
for i in dict :
|
||||
if int(i) >= m:
|
||||
m = int(i)
|
||||
return(m+1)
|
||||
|
||||
|
||||
update_jobs()
|
||||
subprocess.Popen(["bash",'/app/MsRewards-Reborn/config/request.sh'])
|
5
Flask/start.sh
Normal file
5
Flask/start.sh
Normal file
@ -0,0 +1,5 @@
|
||||
nohup bash /app/MsRewards-Reborn/sse.sh &
|
||||
service grafana-server start
|
||||
service nginx start
|
||||
nohup redis-server &
|
||||
gunicorn --reload --worker-class gevent -b 0.0.0.0:6666 'app:app'
|
405
Flask/static/css/flask.css
Normal file
405
Flask/static/css/flask.css
Normal file
@ -0,0 +1,405 @@
|
||||
@import url('https://fonts.googleapis.com/css?family=Montserrat');
|
||||
|
||||
/* Colors */
|
||||
:root {
|
||||
--color-background0: #212121;
|
||||
--color-background1: #212121;
|
||||
--color-background2: dimgray;
|
||||
--color-border0: #FFFFFF;
|
||||
--color-border1: grey;
|
||||
--color-text: #FFFFFF;
|
||||
--color-green: green;
|
||||
--color-lime: #BADA55;
|
||||
--color-red: red;
|
||||
--color-switch-button: #FFFFFF;
|
||||
--color-switch-background: grey;
|
||||
--color-transparent: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* Sidebar size is the left panel size when opened */
|
||||
:root {
|
||||
--sidebar-size: max(20vw, 160px);
|
||||
--sidebar-sz-plus10: calc(var(--sidebar-size) + 10px);
|
||||
--sidebar-sz-plus30: calc(var(--sidebar-size) + 30px);
|
||||
}
|
||||
|
||||
html {
|
||||
text-align: center;
|
||||
font-family: Montserrat;
|
||||
height: 95%;
|
||||
}
|
||||
|
||||
form {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
iframe{
|
||||
border: none;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
|
||||
width: 90%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
background-color: var(--color-background1);
|
||||
border: 2px solid var(--color-border1);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
color: var(--color-text);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input[type=password] {
|
||||
|
||||
width: 90%;
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
text-align: center;
|
||||
border: 2px solid var(--color-border1);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-background1);
|
||||
}
|
||||
|
||||
.button{
|
||||
border-radius: 4px;
|
||||
border: 2px solid var(--color-border1);
|
||||
background-color: var(--color-background1);
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.left-button{
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.ban{
|
||||
border-radius: 4px;
|
||||
border: 2px solid var(--color-red);
|
||||
background-size: 200% 100%;
|
||||
background-image: linear-gradient(to right, var(--color-background1) 50%, var(--color-red) 50%);
|
||||
-webkit-transition: background-position 0.5s;
|
||||
-moz-transition: background-position 0.5s;
|
||||
transition: background-position 0.5s;
|
||||
color: var(--color-text);
|
||||
padding: 12px 0px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
}
|
||||
.ban:hover{
|
||||
background-position: -100% 0;
|
||||
}
|
||||
|
||||
.confirm{
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
background-size: 200% 100%;
|
||||
background-image: linear-gradient(to right, var(--color-background1) 50%, var(--color-green) 50%);
|
||||
-webkit-transition: background-position 0.5s;
|
||||
-moz-transition: background-position 0.5s;
|
||||
transition: background-position 0.5s;
|
||||
border: 2px solid var(--color-border1);
|
||||
}
|
||||
|
||||
.confirm:hover{
|
||||
background-position: -100% 0;
|
||||
}
|
||||
|
||||
.confirm{
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
background-size: 200% 100%;
|
||||
background-image: linear-gradient(to right, var(--color-background1) 50%, var(--color-green) 50%);
|
||||
-webkit-transition: background-position 0.5s;
|
||||
-moz-transition: background-position 0.5s;
|
||||
transition: background-position 0.5s;
|
||||
border: 2px solid var(--color-border1);
|
||||
}
|
||||
|
||||
.confirm:hover{
|
||||
background-position: -100% 0;
|
||||
}
|
||||
.unselected{
|
||||
border-radius: 4px;
|
||||
border: 2px solid var(--color-border1);
|
||||
background-color: var(--color-background1);
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
}
|
||||
.selected{
|
||||
border-radius: 4px;
|
||||
border: 2px solid var(--color-border1);
|
||||
background-color: var(--color-background2);
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 70%;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
|
||||
button:hover{
|
||||
border: 2px solid var(--color-border0);
|
||||
cursor: pointer;
|
||||
}
|
||||
input:hover{
|
||||
border: 2px solid var(--color-border0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.submit{
|
||||
border-radius: 4px;
|
||||
border: 2px solid var(--color-border1);
|
||||
background-color: var(--color-background1);
|
||||
color: var(--color-text);
|
||||
padding: 12px 20px;
|
||||
width: 100%;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--color-background0);
|
||||
color: var(--color-text);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.left-pannel{
|
||||
flex: 1;
|
||||
margin: 20px;
|
||||
border: 1px solid var(--color-border0);
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
width: 80%;
|
||||
height: 90%;
|
||||
|
||||
}
|
||||
|
||||
.content{
|
||||
flex: 3;
|
||||
margin: 20px;
|
||||
border: 1px solid var(--color-border0);
|
||||
border-radius: 5px;
|
||||
padding: 20px;
|
||||
height: 90%;
|
||||
|
||||
}
|
||||
|
||||
.content > ul {
|
||||
display: inline-block;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.row-item {
|
||||
margin: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#image img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
width: 20%;
|
||||
}
|
||||
.comlumn-name{
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
For toggle switch
|
||||
*/
|
||||
|
||||
|
||||
input.toogle[type=checkbox]{
|
||||
height: 0;
|
||||
width: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
label {
|
||||
padding: 8px;
|
||||
margin: auto;
|
||||
cursor: pointer;
|
||||
text-indent: -9999px;
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
background: var(--color-switch-background);
|
||||
display: block;
|
||||
border-radius: 100px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/*
|
||||
width: height of label /2 ;
|
||||
height: height of label /2px;
|
||||
*/
|
||||
label:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: var(--color-switch-button);
|
||||
border-radius: 90px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
input:checked + label {
|
||||
background: var(--color-lime);
|
||||
}
|
||||
|
||||
input:checked + label:after {
|
||||
left: calc(100% - 5px);
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
/*changer l'épaisseur du click */
|
||||
label:active:after {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 90%;
|
||||
/*height: 100%;*/
|
||||
padding: 12px 20px;
|
||||
margin: 8px 0;
|
||||
background-color: var(--color-background1);
|
||||
border: 2px solid var(--color-border1);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
color: var(--color-text);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
select:hover {
|
||||
border: 2px solid var(--color-border0);
|
||||
}
|
||||
|
||||
|
||||
input[type="time"] {
|
||||
width: 70%;
|
||||
padding: 8px 12px;
|
||||
margin: 8px 0;
|
||||
background-color: var(--color-background1);
|
||||
border: 2px solid var(--color-border1);
|
||||
border-radius: 4px;
|
||||
outline: none;
|
||||
color: var(--color-text);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input[type="time"]::-webkit-calendar-picker-indicator {
|
||||
filter: invert(1);
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input[type="time"]::-webkit-calendar-picker-indicator:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
|
||||
/** Sidebar stuff */
|
||||
#slide-sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
label[for="slide-sidebar"] {
|
||||
all: initial;
|
||||
z-index: 1; /* Always on top */
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: var(--sidebar-sz-plus30);
|
||||
|
||||
-moz-transition: left 0.5s ease;
|
||||
transition: left 0.5s ease;
|
||||
background: var(--color-transparent);
|
||||
}
|
||||
|
||||
label[for="slide-sidebar"]:after {
|
||||
all:unset;
|
||||
}
|
||||
|
||||
input:checked + label[for="slide-sidebar"] {
|
||||
background: var(--color-transparent);
|
||||
}
|
||||
|
||||
#slide {
|
||||
border-style: solid;
|
||||
border-radius: 4px;
|
||||
border-width: 1px;
|
||||
border-color: var(--color-border0);
|
||||
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-background0);
|
||||
padding: 8px 8px 2px 8px;
|
||||
}
|
||||
|
||||
/* When opened behaviour */
|
||||
.left-pannel {
|
||||
width: var(--sidebar-size);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: var(--sidebar-sz-plus10);
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
-moz-transition: left 0.5s ease;
|
||||
transition: left 0.5s ease;
|
||||
|
||||
padding: 0 25px;
|
||||
background-color: var(--color-background0); /* we need no transparency when switching */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* When closed behaviour */
|
||||
input:checked#slide-sidebar~label {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
input:checked#slide-sidebar~.left-pannel {
|
||||
display: none;
|
||||
transition: display 0s 0.5s;
|
||||
}
|
||||
|
||||
input:checked#slide-sidebar~.content {
|
||||
left: 0;
|
||||
}
|
BIN
Flask/static/favicon.ico
Normal file
BIN
Flask/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
1
Flask/static/images/trash.svg
Normal file
1
Flask/static/images/trash.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 21 0 C 19.355469 0 18 1.355469 18 3 L 18 5 L 10.1875 5 C 10.0625 4.976563 9.9375 4.976563 9.8125 5 L 8 5 C 7.96875 5 7.9375 5 7.90625 5 C 7.355469 5.027344 6.925781 5.496094 6.953125 6.046875 C 6.980469 6.597656 7.449219 7.027344 8 7 L 9.09375 7 L 12.6875 47.5 C 12.8125 48.898438 14.003906 50 15.40625 50 L 34.59375 50 C 35.996094 50 37.1875 48.898438 37.3125 47.5 L 40.90625 7 L 42 7 C 42.359375 7.003906 42.695313 6.816406 42.878906 6.503906 C 43.058594 6.191406 43.058594 5.808594 42.878906 5.496094 C 42.695313 5.183594 42.359375 4.996094 42 5 L 32 5 L 32 3 C 32 1.355469 30.644531 0 29 0 Z M 21 2 L 29 2 C 29.5625 2 30 2.4375 30 3 L 30 5 L 20 5 L 20 3 C 20 2.4375 20.4375 2 21 2 Z M 11.09375 7 L 38.90625 7 L 35.3125 47.34375 C 35.28125 47.691406 34.910156 48 34.59375 48 L 15.40625 48 C 15.089844 48 14.71875 47.691406 14.6875 47.34375 Z M 18.90625 9.96875 C 18.863281 9.976563 18.820313 9.988281 18.78125 10 C 18.316406 10.105469 17.988281 10.523438 18 11 L 18 44 C 17.996094 44.359375 18.183594 44.695313 18.496094 44.878906 C 18.808594 45.058594 19.191406 45.058594 19.503906 44.878906 C 19.816406 44.695313 20.003906 44.359375 20 44 L 20 11 C 20.011719 10.710938 19.894531 10.433594 19.6875 10.238281 C 19.476563 10.039063 19.191406 9.941406 18.90625 9.96875 Z M 24.90625 9.96875 C 24.863281 9.976563 24.820313 9.988281 24.78125 10 C 24.316406 10.105469 23.988281 10.523438 24 11 L 24 44 C 23.996094 44.359375 24.183594 44.695313 24.496094 44.878906 C 24.808594 45.058594 25.191406 45.058594 25.503906 44.878906 C 25.816406 44.695313 26.003906 44.359375 26 44 L 26 11 C 26.011719 10.710938 25.894531 10.433594 25.6875 10.238281 C 25.476563 10.039063 25.191406 9.941406 24.90625 9.96875 Z M 30.90625 9.96875 C 30.863281 9.976563 30.820313 9.988281 30.78125 10 C 30.316406 10.105469 29.988281 10.523438 30 11 L 30 44 C 29.996094 44.359375 30.183594 44.695313 30.496094 44.878906 C 30.808594 45.058594 31.191406 45.058594 31.503906 44.878906 C 31.816406 44.695313 32.003906 44.359375 32 44 L 32 11 C 32.011719 10.710938 31.894531 10.433594 31.6875 10.238281 C 31.476563 10.039063 31.191406 9.941406 30.90625 9.96875 Z"/></svg>
|
After Width: | Height: | Size: 2.2 KiB |
102
Flask/static/js/main.js
Normal file
102
Flask/static/js/main.js
Normal file
@ -0,0 +1,102 @@
|
||||
function addline(ligne){
|
||||
var lplus = parseInt(ligne) + 1;
|
||||
document.getElementById("table").insertRow(lplus).insertCell(0).innerHTML = '<input type="file" id="file' + lplus + '" name="file' + lplus + '" onchange="addline(' + lplus + ')">'
|
||||
}
|
||||
|
||||
function change_discord(value, data, len) {
|
||||
if (value == len){
|
||||
document.getElementById("name").value = "";
|
||||
document.getElementById("submit").value = "Create !";
|
||||
document.getElementById("successT").checked = false;
|
||||
document.getElementById("errorsT").checked = false;
|
||||
document.getElementById("successL").value = "";
|
||||
document.getElementById("errorsL").value = "";
|
||||
}
|
||||
else {
|
||||
console.log(data[parseInt(value)]["successL"]);
|
||||
document.getElementById("submit").value = "Update";
|
||||
document.getElementById("successT").checked = data[parseInt(value)]["successT"] == "True";
|
||||
document.getElementById("errorsT").checked = data[parseInt(value)]["errorsT"] == "True";
|
||||
document.getElementById("successL").value = data[parseInt(value)]["successL"];
|
||||
document.getElementById("errorsL").value = data[parseInt(value)]["errorsL"];
|
||||
document.getElementById("name").value = data[parseInt(value)]["name"];
|
||||
}
|
||||
}
|
||||
|
||||
function delay(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
function change_config(value, data, len) {
|
||||
console.log(data[2]);
|
||||
document.getElementById("delete").style.visibility = "hidden";
|
||||
if (value == len){
|
||||
document.getElementById("submit").value = "Create !";
|
||||
document.getElementById("discord").value = "-1";
|
||||
document.getElementById("proxy").value = "-1";
|
||||
document.getElementById("name").value = "";
|
||||
for (let i = 1; i < 6; i++) {
|
||||
document.getElementById("mail"+ i).value = "";
|
||||
document.getElementById("pwd"+ i).value = "" ;
|
||||
document.getElementById("2fa"+ i).value = "" ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
document.getElementById("delete").style.visibility = "visible";
|
||||
document.getElementById("submit").value = "Update !";
|
||||
document.getElementById("discord").value = data[parseInt(value)]["discord"];
|
||||
document.getElementById("proxy").value = data[parseInt(value)]["proxy"];
|
||||
document.getElementById("name").value = data[parseInt(value)]["name"];
|
||||
for (let i = 1; i < 6; i++) {
|
||||
document.getElementById("mail"+ i).value = data[parseInt(value)]['accounts'][i]["mail"] ;
|
||||
document.getElementById("pwd"+ i).value = data[parseInt(value)]['accounts'][i]["pwd"] ;
|
||||
document.getElementById("2fa"+ i).value = data[parseInt(value)]['accounts'][i]["2fa"] ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function change_proxy(value, data, len) {
|
||||
if (value == len){
|
||||
document.getElementById("submit").value = "Create";
|
||||
document.getElementById("address").value = "";
|
||||
document.getElementById("port").value = "";
|
||||
document.getElementById("name").value = "";
|
||||
}
|
||||
else {
|
||||
document.getElementById("submit").value = "Update";
|
||||
document.getElementById("address").value = data[parseInt(value)]["address"];
|
||||
document.getElementById("port").value = data[parseInt(value)]["port"];
|
||||
document.getElementById("name").value = data[parseInt(value)]["name"];
|
||||
}
|
||||
}
|
||||
|
||||
function change_override(value, data) {
|
||||
for (let i = 1; i < 6; i++) {
|
||||
document.getElementById("compte_"+ i).innerHTML = data[parseInt(value)]['accounts'][i]["mail"];
|
||||
if (!(data[parseInt(value)]['accounts'][i]["mail"])){
|
||||
console.log("hiding" + i);
|
||||
for (let j = 1; j <= 5; j++) {
|
||||
|
||||
document.getElementById(i.toString() +j.toString()).style.visibility = "hidden";
|
||||
}
|
||||
} else {
|
||||
console.log("showing" + i);
|
||||
for (let j = 1; j <= 5; j++) {
|
||||
console.log("element " + i.toString()+j.toString());
|
||||
document.getElementById(i.toString()+j.toString()).style.visibility = "visible";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function change_logs(value) {
|
||||
var myIframe = document.getElementById('embed');
|
||||
myIframe.addEventListener("load", function() {
|
||||
let doc = myIframe.contentDocument;
|
||||
doc.body.innerHTML = doc.body.innerHTML + '<style>html{color:white;}</style>';
|
||||
myIframe.contentWindow.scrollTo(0, myIframe.contentDocument.body.scrollHeight);
|
||||
});
|
||||
myIframe.src = "/static/logs/" + value + ".txt";
|
||||
}
|
1
Flask/static/logs/.gitignore
vendored
Normal file
1
Flask/static/logs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.txt
|
79
Flask/templates/base.html
Normal file
79
Flask/templates/base.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<meta charset="utf-8">
|
||||
<link rel="icon" type="image/png" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>MS Rewards</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/flask.css')}}"/>
|
||||
<script src="{{ url_for('static', filename='js/main.js')}}"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<input id="slide-sidebar" type="checkbox" role="button"/>
|
||||
<label for="slide-sidebar">
|
||||
<div id="slide">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-menu-2" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M4 6l16 0"></path>
|
||||
<path d="M4 12l16 0"></path>
|
||||
<path d="M4 18l16 0"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</label>
|
||||
<div class="left-pannel">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_schedule" onclick="location.href = '/schedule';">schedule</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_config" onclick="location.href = '/config';">config</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_discord" onclick="location.href = '/discord';">discord</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_proxy" onclick="location.href = '/proxy';">proxy</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_logs" onclick="location.href = '/logs';">logs</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_stats" onclick="location.href = '/stats';">stats</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_override" onclick="location.href = '/override';">Override</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="unselected" id="sidebar_settings" onclick="location.href = '/settings';">settings</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>document.getElementById("sidebar_{% block left_pannel %}{% endblock %}").className = "selected"</script>
|
||||
</div>
|
||||
<div class="content">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">{{version}}</div>
|
||||
</body>
|
||||
|
||||
</html>
|
22
Flask/templates/change_password.html
Normal file
22
Flask/templates/change_password.html
Normal file
@ -0,0 +1,22 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<h1>Already logged in</h1>
|
||||
{% else %}
|
||||
<form method="post" action="/change_password/">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name">Change password</td>
|
||||
<td><input type="text" name="password"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" name="NewPassword" value="send" class="button"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endblock %}
|
106
Flask/templates/config.html
Normal file
106
Flask/templates/config.html
Normal file
@ -0,0 +1,106 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}config{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
<script>data2 = JSON.parse('{{configs|tojson}}'); </script>
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<form method="post" action="/config/">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width: 10%;">config : </td>
|
||||
<td style="width: 40%;">
|
||||
<select onchange="change_config(this.value, data2, '{{len}}')" name="config">
|
||||
<option id="config" value="{{len}}">New config</option>
|
||||
{% for i in configs %}
|
||||
<option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 10%;">name : </td>
|
||||
<td>
|
||||
<input type="text" id="name" name="name" value = "">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 10%;">Proxy : </td>
|
||||
<td style="width: 40%;">
|
||||
<select id="proxy" name="proxy">
|
||||
<option id="" value="-1">No proxy</option>
|
||||
{% for i in proxys %}
|
||||
<option id="{{proxys[i]['name']}}" value="{{i}}">{{proxys[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 10%;">Discord : </td>
|
||||
<td>
|
||||
<select id="discord" name="discord">
|
||||
<option id="no discord" value="-1">No discord (not sure about the support)</option>
|
||||
{% for i in discords %}
|
||||
<option id="{{discords[i]['name']}}" value="{{i}}">{{discords[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Mail</td>
|
||||
<td>Password</td>
|
||||
<td>2FA</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" id="mail1" name="mail1" value=""></td>
|
||||
<td><input type="text" id="pwd1" name="pwd1" value=""></td>
|
||||
<td><input type="text" id="2fa1" name="2fa1" value=""></td>
|
||||
<td class="left-button"><button class="ban" name="ban" value="">ban</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" id="mail2" name="mail2" value=""></td>
|
||||
<td><input type="text" id="pwd2" name="pwd2" value=""></td>
|
||||
<td><input type="text" id="2fa2" name="2fa2" value=""></td>
|
||||
<td class="left-button"><button class="ban" name="ban" value="">ban</button></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" id="mail3" name="mail3" value=""></td>
|
||||
<td><input type="text" id="pwd3" name="pwd3" value="" ></td>
|
||||
<td><input type="text" id="2fa3" name="2fa3" value=""></td>
|
||||
<td class="left-button"><button class="ban" name="ban" value="">ban</button></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" id="mail4" name="mail4" value=""></td>
|
||||
<td><input type="text" id="pwd4" name="pwd4" value="" ></td>
|
||||
<td><input type="text" id="2fa4" name="2fa4" value=""></td>
|
||||
<td class="left-button"><button class="ban" name="ban" value="">ban</button></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="text" id="mail5" name="mail5" value=""></td>
|
||||
<td><input type="text" id="pwd5" name="pwd5" value=""></td>
|
||||
<td><input type="text" id="2fa5" name="2fa5" value=""></td>
|
||||
<td class="left-button"><button class="ban" name="ban" value="">ban</button></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="submit" class="confirm" name="data" id="submit" value="Create !" class="button" style="width:97%;"/>
|
||||
</td>
|
||||
<td class="left-button">
|
||||
<input type="submit" name="data" id="delete" value="delete" class="ban" style="visibility: hidden;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
31
Flask/templates/dev.html
Normal file
31
Flask/templates/dev.html
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block left_pannel %}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<table>
|
||||
<tr>
|
||||
<td width="20%" height="90%">
|
||||
<div id="console"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
const consoleElement = document.getElementById('console');
|
||||
const eventSource = new EventSource('/stream');
|
||||
|
||||
eventSource.onmessage = (event) => {
|
||||
console.log("je ne comprend vraiment plus rien, meme git me casse les couilles");
|
||||
const newOutput = document.createElement('div');
|
||||
newOutput.textContent = event.data;
|
||||
consoleElement.appendChild(newOutput);
|
||||
};
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
56
Flask/templates/discord.html
Normal file
56
Flask/templates/discord.html
Normal file
@ -0,0 +1,56 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}discord{% endblock %}
|
||||
{% block content %}
|
||||
<script>data = JSON.parse('{{data|tojson}}'); </script>
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<form method="post" action="/discord/">
|
||||
<table>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<select name="select" onchange="change_discord(this.value, data, '{{len}}')">
|
||||
<option selected id="new" value="{{ len }}">Create new Discord config</option>
|
||||
{% for i in data %}
|
||||
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">name</td>
|
||||
<td><input type="text" id="name" name="name" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">Send errors</td>
|
||||
<td><input type="checkbox" id="errorsT" name="errorsT" class="toogle"/><label for="errorsT">Toggle</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">Send success</td>
|
||||
<td><input type="checkbox" id="successT" name="successT" class="toogle"/><label for="successT">Toggle</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">Success link</td>
|
||||
<td><input type="text" id="successL" name="successL" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">Failure Link</td>
|
||||
<td><input type="text" id="errorsL" name="errorsL" value=""></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name"></td>
|
||||
<td style="width:60%;"><input type="submit" name="DISCORD" id="submit" value="Create !" class="confirm" style="width:86%;"/></td>
|
||||
<td style="padding-right: 20px;">
|
||||
<input type="submit" name="DISCORD" id="submit" value="delete" class="ban" style="width:60%;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
23
Flask/templates/login.html
Normal file
23
Flask/templates/login.html
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}login{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<form method="post" action="/login/">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name">password</td>
|
||||
<td><input type="password" name="password"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" name="DISCORD" value="send" class="button"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<h1>Already logged in</h1>
|
||||
{% endif %}
|
||||
{% endblock %}
|
21
Flask/templates/logs.html
Normal file
21
Flask/templates/logs.html
Normal file
@ -0,0 +1,21 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}logs{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<h1>Already logged in</h1>
|
||||
{% else %}
|
||||
|
||||
<select name="select" onchange="change_logs(this.value)">
|
||||
<option id="null" value="0">Choisir une config</option>
|
||||
{% for i in data %}
|
||||
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<br><br>
|
||||
<iframe type="text/html" src="{{url_for('static', filename='logs/1.txt')}}" width="100%" height="85%" id="embed">
|
||||
|
||||
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
53
Flask/templates/proxy.html
Normal file
53
Flask/templates/proxy.html
Normal file
@ -0,0 +1,53 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}proxy{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<form method="post" action="/proxy/">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name"></td>
|
||||
<td>
|
||||
<script>data = JSON.parse('{{data|tojson}}');</script>
|
||||
<select name="select" onchange="change_proxy(this.value, data, '{{len}}')">
|
||||
<option selected id="new" value="{{ len }}">Create new proxy</option>
|
||||
{% for i in data %}
|
||||
<option id="{{data[i]['name']}}" value="{{i}}">{{data[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">name : </td>
|
||||
<td><input type="text" name="name" value="" id="name"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">address : </td>
|
||||
<td><input type="text" name="address" value="" id="address"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="comlumn-name">port : </td>
|
||||
<td><input type="text" name="port" value="" id="port"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name"></td>
|
||||
<td style="width:60%;"><input type="submit" name="PROXY" id="submit" value="Create !" class="confirm" style="width:86%;"/></td>
|
||||
<td style="padding-right: 20px;"><input type="submit" name="PROXY" id="submit" value="delete" class="ban" style="width:60%;"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
35
Flask/templates/schedule.html
Normal file
35
Flask/templates/schedule.html
Normal file
@ -0,0 +1,35 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}schedule{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
|
||||
<form method="post" action="/schedule/">
|
||||
<table>
|
||||
{% for i in data %}
|
||||
<tr>
|
||||
<td>{{data[i]['name']}}</td>
|
||||
<td>
|
||||
<input type="time" id="{{i}}" name="time{{i}}" value="{{data[i]['time']}}" required>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" class="toogle" id="switch{{i}}" name="switch{{i}}" {{ "checked" if data[i]['enabled'] == True else "" }} />
|
||||
<label for="switch{{i}}">
|
||||
Toggle
|
||||
</label>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<input type="submit" name="data" value="Update" class="button"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{%endblock %}
|
49
Flask/templates/settings.html
Normal file
49
Flask/templates/settings.html
Normal file
@ -0,0 +1,49 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}settings{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<form method="post" action="/settings/">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="comlumn-name">avatar url :</td>
|
||||
<td><input type="text" name="avatarlink" value="{{data['avatarlink']}}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="submit" name="settings" id="submit" value="update" class="button"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<h2>TODO</h2>
|
||||
<ul>
|
||||
<li>ban button</li>
|
||||
</ul>
|
||||
<br><br>
|
||||
<h2>Backup config files</h2>
|
||||
<ul>
|
||||
<li><a href="/download/configs.json">download account config</a></li>
|
||||
<li><a href="/download/discord.json">download discord config</a></li>
|
||||
<li><a href="/download/flask.json">download flask config</a></li>
|
||||
<li><a href="/download/proxy.json">download proxy config</a></li>
|
||||
<li><a href="/download/settings.json">download settings</a></li>
|
||||
</ul>
|
||||
|
||||
<br><br>
|
||||
<h2>Upload your files</h2>
|
||||
<form method="POST" action="/upload_file/" enctype=multipart/form-data>
|
||||
<table id="table">
|
||||
<tr><td><input type="file" id="file1" name="file1" onchange='addline(0)'></td></tr>
|
||||
<tr><td><input type="submit" name="settings" id="submit" value="send file" class="button"/></td></tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
{%endblock %}
|
||||
|
12
Flask/templates/stats.html
Normal file
12
Flask/templates/stats.html
Normal file
@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}stats{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<iframe src="/grafana?orgId=1&kiosk" width="100%" height="100%" frameborder="0"></iframe>
|
||||
{% endif %}
|
||||
|
||||
{%endblock %}
|
45
Flask/templates/vnc_get.html
Normal file
45
Flask/templates/vnc_get.html
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}override{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<script>data = JSON.parse('{{configs|tojson}}'); </script>
|
||||
|
||||
|
||||
<form method="post" action="/override/" height="90%">
|
||||
<select onchange="change_override(this.value, data)" name="config">
|
||||
<option id="-1" value="-1" selected>Select a config</option>
|
||||
{% for i in configs %}
|
||||
<option id="{{configs[i]['name']}}" value="{{i}}">{{configs[i]['name']}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<table height="90%" class="lines">
|
||||
<tr>
|
||||
<td width="30%">name</td>
|
||||
<td width="14%">Unban</td>
|
||||
<td width="14%">tout</td>
|
||||
<td width="14%">daily</td>
|
||||
<td width="14%">pc</td>
|
||||
<td width="14%">mobile</td>
|
||||
</tr>
|
||||
{% for i in range(0,5) %}
|
||||
<tr heigh="15%">
|
||||
<td id="compte_{{i+1}}"></td>
|
||||
<td id="{{i+1}}1" style="visibility: hidden;"><input type="checkbox" id="compte_{{i+1}}" value="{{i}}" name="unban"></td>
|
||||
<td id="{{i+1}}2" style="visibility: hidden;"><input type="checkbox" id="compte_{{i+1}}" value="{{i}}" name="tout"></td>
|
||||
<td id="{{i+1}}3" style="visibility: hidden;"><input type="checkbox" id="compte_{{i+1}}" value="{{i}}" name="daily"></td>
|
||||
<td id="{{i+1}}4" style="visibility: hidden;"><input type="checkbox" id="compte_{{i+1}}" value="{{i}}" name="pc"></td>
|
||||
<td id="{{i+1}}5" style="visibility: hidden;"><input type="checkbox" id="compte_{{i+1}}" value="{{i}}" name="mobile"></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
|
||||
<input type="submit" name="VNC" id="submit" value="Start" class="confirm" style="width:60%;"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
{%endblock %}
|
35
Flask/templates/vnc_post.html
Normal file
35
Flask/templates/vnc_post.html
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
{% extends "base.html" %}
|
||||
{% block left_pannel %}override{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{%if not current_user.is_authenticated %}
|
||||
<button class="unselected" onclick="location.href = '/login';">login</button>
|
||||
{% else %}
|
||||
<table>
|
||||
<tr>
|
||||
<td width="20%" height="90%">
|
||||
<div id="console"></div>
|
||||
</td>
|
||||
<td width="80%">
|
||||
<iframe src="/novnc/vnc.html?resize=scale&path=novnc/websockify&autoconnect=true&view_only" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const consoleElement = document.getElementById('console');
|
||||
const eventSource = new EventSource('/stream');
|
||||
|
||||
eventSource.onmessage = (event) => {
|
||||
document.getElementById("console").innerHTML = event.data + document.getElementById("console").innerHTML
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{%endblock %}
|
Reference in New Issue
Block a user