From 6efc77c512e75c4bb12a1891bb2ac02d1e3ecede Mon Sep 17 00:00:00 2001 From: piair Date: Fri, 25 Aug 2023 19:40:39 +0200 Subject: [PATCH] fixed things, like auto adding account to database --- Flask/templates/settings.html | 6 ++---- config/request.sh | 4 ++-- modules/db.py | 10 ++++++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Flask/templates/settings.html b/Flask/templates/settings.html index 8989d96..576151d 100644 --- a/Flask/templates/settings.html +++ b/Flask/templates/settings.html @@ -64,9 +64,7 @@
  • reorder config
  • real override
  • ban button
  • -
  • pourquoi tout ne se lance pas bien ? -
  • -
  • avoir un afficheur de logs
  • -
  • permettre de changer le mot de passe
  • +
  • pourquoi tout ne se lance pas bien ?
  • synchroniser le mot de passe de grafana et celui du bot


  • @@ -79,7 +77,7 @@
  • download settings
  • -
    +

    Upload your files

    diff --git a/config/request.sh b/config/request.sh index 949efda..ed70b22 100644 --- a/config/request.sh +++ b/config/request.sh @@ -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 \ diff --git a/modules/db.py b/modules/db.py index 063f8c0..2d7fdf1 100644 --- a/modules/db.py +++ b/modules/db.py @@ -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")