Compare commits
No commits in common. "1edc72061ec1a7507da5d25c117f4dd7a92a3400" and "c451be78df08f4f481383ad60989b99e5ae994b7" have entirely different histories.
1edc72061e
...
c451be78df
3 changed files with 1 additions and 19 deletions
9
run.py
Executable file → Normal file
9
run.py
Executable file → Normal file
|
@ -10,12 +10,3 @@ import requests
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
|
|
||||||
cfg = json.load(open('meta.json'))
|
cfg = json.load(open('meta.json'))
|
||||||
|
|
||||||
db = mysql.connector.connect(user=cfg['dbuser'], password=cfg['dbpass'], database=cfg['dbname'])
|
|
||||||
c = db.cursor()
|
|
||||||
dc = db.cursor(dictionary=True)
|
|
||||||
|
|
||||||
dc.execute("SELECT * FROM data")
|
|
||||||
for row in dc.fetchall():
|
|
||||||
print(row)
|
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
You haven't connected your Curious Cat account yet.<br>
|
You haven't connected your Curious Cat account yet.<br>
|
||||||
<a href='/cc_connect' class='button'>Connect</a>
|
<a href='/cc_connect' class='button'>Connect</a>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
<br />
|
|
||||||
<a class='button' href='/settings'>Settings</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
</body>
|
</body>
|
||||||
|
|
8
web.py
8
web.py
|
@ -56,12 +56,6 @@ def main():
|
||||||
@app.route('/home')
|
@app.route('/home')
|
||||||
def home():
|
def home():
|
||||||
if 'acct' in session:
|
if 'acct' in session:
|
||||||
dc.execute("SELECT * FROM data WHERE username LIKE %s AND instance LIKE %s", (session['username'], session['instance']))
|
|
||||||
#TODO: if this fails, redirect to /logout
|
|
||||||
data = dc.fetchone()
|
|
||||||
for item in ['username', 'instance', 'avi', 'secret', 'client_id', 'client_secret', 'cc', 'ccavi']:
|
|
||||||
session[item] = data[item]
|
|
||||||
|
|
||||||
if 'cc' not in session:
|
if 'cc' not in session:
|
||||||
session['cc'] = "None"
|
session['cc'] = "None"
|
||||||
if session['cc'] == "None" or 'ccavi' not in session:
|
if session['cc'] == "None" or 'ccavi' not in session:
|
||||||
|
@ -72,6 +66,7 @@ def home():
|
||||||
session['cc'] = cc[0]
|
session['cc'] = cc[0]
|
||||||
session['ccavi'] = cc[1]
|
session['ccavi'] = cc[1]
|
||||||
|
|
||||||
|
|
||||||
if 'last_avi_update' not in session or session['last_avi_update'] + (24 * 60 * 60) < time.time():
|
if 'last_avi_update' not in session or session['last_avi_update'] + (24 * 60 * 60) < time.time():
|
||||||
#avatars haven't been updated for over 24 hours, update them now
|
#avatars haven't been updated for over 24 hours, update them now
|
||||||
client = Mastodon(client_id=session['client_id'], client_secret=session['client_secret'], access_token=session['secret'], api_base_url=session['instance'])
|
client = Mastodon(client_id=session['client_id'], client_secret=session['client_secret'], access_token=session['secret'], api_base_url=session['instance'])
|
||||||
|
@ -238,7 +233,6 @@ def ccc_c():
|
||||||
for item in ['cc', 'ccavi']:
|
for item in ['cc', 'ccavi']:
|
||||||
session[item] = session['cctemp'][item]
|
session[item] = session['cctemp'][item]
|
||||||
c.execute("UPDATE data SET cc = %s, ccavi = %s, latest_post = %s, time_between_checks = %s, last_check = %s WHERE username = %s AND instance = %s", (session['cc'], session['ccavi'], session['cctemp']['latest_post'], 1, 0, session['username'], session['instance']))
|
c.execute("UPDATE data SET cc = %s, ccavi = %s, latest_post = %s, time_between_checks = %s, last_check = %s WHERE username = %s AND instance = %s", (session['cc'], session['ccavi'], session['cctemp']['latest_post'], 1, 0, session['username'], session['instance']))
|
||||||
db.commit()
|
|
||||||
del session['cctemp']
|
del session['cctemp']
|
||||||
return redirect('/cc_connect/complete')
|
return redirect('/cc_connect/complete')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue