This commit is contained in:
piair 2023-07-01 14:28:04 +02:00
parent 2253506f80
commit 0d9c128a2c
2 changed files with 20 additions and 17 deletions

View File

@ -368,7 +368,6 @@ def config_get():
@app.route("/config/", methods=["POST"]) @app.route("/config/", methods=["POST"])
def config_post(): def config_post():
action = request.form action = request.form
print(action)
with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/proxy.json", "r") as inFile:
proxys = json.load(inFile) proxys = json.load(inFile)
with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/discord.json", "r") as inFile:
@ -376,22 +375,26 @@ def config_post():
with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile: with open("/app/MsRewards-Reborn/user_data/configs.json", "r") as inFile:
configs = json.load(inFile) configs = json.load(inFile)
comptes = { if action["data"] == "delete":
"1":{"mail": action["mail1"], "pwd": action["pwd1"], "2fa": action["2fa1"]}, print(action["config"])
"2":{"mail": action["mail2"], "pwd": action["pwd2"], "2fa": action["2fa2"]}, configs.pop(action["config"])
"3":{"mail": action["mail3"], "pwd": action["pwd3"], "2fa": action["2fa3"]}, else :
"4":{"mail": action["mail4"], "pwd": action["pwd4"], "2fa": action["2fa4"]}, comptes = {
"5":{"mail": action["mail5"], "pwd": action["pwd5"], "2fa": action["2fa5"]} "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"]},
configs[action["config"]] = { "4":{"mail": action["mail4"], "pwd": action["pwd4"], "2fa": action["2fa4"]},
"name" : action["name"] if action["name"] != "" else f"unnamed{action['config']}", "5":{"mail": action["mail5"], "pwd": action["pwd5"], "2fa": action["2fa5"]}
"proxy": action["proxy"],
"discord": action["discord"],
"time":"",
"enabled":"False",
"accounts": comptes
} }
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: with open("/app/MsRewards-Reborn/user_data/configs.json", "w") as outFile:
json.dump(configs, outFile) json.dump(configs, outFile)
return(render_template("config.html", data=configs, discords=discords, proxys=proxys, configs=configs, len=maxi(configs))) return(render_template("config.html", data=configs, discords=discords, proxys=proxys, configs=configs, len=maxi(configs)))

View File

@ -128,7 +128,7 @@
<input type="submit" class="confirm" name="data" id="submit" value="Create !" class="button"/> <input type="submit" class="confirm" name="data" id="submit" value="Create !" class="button"/>
</td> </td>
<td class="left-button"> <td class="left-button">
<input type="submit" name="config" id="submit" value="delete" class="ban"/> <input type="submit" name="data" id="submit" value="delete" class="ban"/>
</td> </td>
</tr> </tr>
</table> </table>