fixed things, like auto adding account to database

This commit is contained in:
piair 2023-08-25 19:40:39 +02:00
parent 820efd8126
commit 6efc77c512
3 changed files with 12 additions and 8 deletions

View File

@ -64,9 +64,7 @@
<li>reorder config</li>
<li>real override</li>
<li>ban button</li>
<li>pourquoi tout ne se lance pas bien ? - </li>
<li>avoir un afficheur de logs</li>
<li>permettre de changer le mot de passe</li>
<li>pourquoi tout ne se lance pas bien ?</li>
<li>synchroniser le mot de passe de grafana et celui du bot</li>
</ul>
<br><br>
@ -79,7 +77,7 @@
<li><a href="/download/settings.json">download settings</a></li>
</ul>
<br>
<br><br>
<h2>Upload your files</h2>
<form method="POST" action="/upload_file/" enctype=multipart/form-data>
<table id="table">

View File

@ -1,10 +1,10 @@
sleep 30
curl -X "POST" "http://192.168.1.32:5555/grafana/api/datasources" \
curl -X "POST" "http://localhost:1234/grafana/api/datasources" \
-H "Content-Type: application/json" \
--user admin:admin \
--data-raw $'{"id":1,"uid":"bed26262-6b98-4dfc-a95d-f8bd39b5d09c","orgId":1,"name":"SQLite","type":"frser-sqlite-datasource","typeName":"SQLite","typeLogoUrl":"public/plugins/frser-sqlite-datasource/img/logo.svg","access":"proxy","url":"","user":"","database":"","basicAuth":false,"isDefault":true,"jsonData":{"attachLimit":0,"path":"/app/MsRewards-Reborn/MsRewards.db","pathPefix":"file:"},"readOnly":false}'
curl 'http://192.168.1.32:5555/grafana/api/dashboards/import' \
curl 'http://localhost:1234/grafana/api/dashboards/import' \
-H 'content-type: application/json' \
-H 'x-grafana-org-id: 1' \
--user admin:admin \

View File

@ -18,8 +18,14 @@ def update_row(compte, points, mycursor, mydb):
# update the value of last_pts for the table comptes
def update_last(compte, points, mycursor, mydb):
sql = f"UPDATE comptes SET last_pts = {points} WHERE compte = '{compte}';"
mycursor.execute(sql)
sql1 = f"UPDATE comptes SET last_pts = {points} WHERE compte = '{compte}';"
sql2 = f"select * from comptes where nom = '{compte}'"
sql3 = "INSERT INTO comptes (compte, last_pts,banned) VALUES ('{compte}', {points}, 0)"
cmd = mycursor.execute(sql2)
if len(list(cmd)) == 0:
mycursor.execute(sql3)
else :
mycursor.execute(sql1)
mydb.commit()
#printf(mycursor.rowcount, "record(s) updated")