bug fixes and performance enhancements
This commit is contained in:
parent
0279b09690
commit
4bbc6ab393
1 changed files with 5 additions and 4 deletions
9
web.py
9
web.py
|
@ -6,7 +6,8 @@
|
|||
|
||||
#TODO: ADD RETROSPRING SUPPORT!
|
||||
|
||||
import requests, json, hashlib, urllib, time, re, random
|
||||
import json, hashlib, urllib, time, re, random
|
||||
import requests
|
||||
from mastodon import Mastodon
|
||||
from flask import Flask, render_template, request, session, redirect, url_for
|
||||
import mysql.connector
|
||||
|
@ -195,7 +196,7 @@ def ccc_a(): #step one of curiouscat connection: retreive details
|
|||
"cc":j['userData']['username'],
|
||||
"ccavi":j['userData']['avatar'],
|
||||
"ccid":j['userData']['id'],
|
||||
"latest_post":j['posts'][0]['timestamp']
|
||||
"latest_post":j['posts'][0]['timestamp'] #only post new answers from this point onwards, rather than posting all the old ones
|
||||
}
|
||||
return redirect('/cc_connect/confirm')
|
||||
|
||||
|
@ -203,7 +204,7 @@ def ccc_a(): #step one of curiouscat connection: retreive details
|
|||
def cc_connect_confirm():
|
||||
return render_template('cc_connect_confirm.html', bg="background-image:url('{}')".format(session['cctemp']['ccavi']))
|
||||
|
||||
@app.route('/internal/ccc_b')
|
||||
@app.route('/internal/ccc_b') #TODO: don't allow people to spam this
|
||||
def ccc_b():
|
||||
session['cctemp']['challenge'] = random.randint(100000, 999999)
|
||||
session.modified = True
|
||||
|
@ -230,7 +231,7 @@ def ccc_c():
|
|||
return redirect('/cc_connect/code?invalid')
|
||||
for item in ['cc', 'ccavi']:
|
||||
session[item] = session['cctemp'][item]
|
||||
c.execute("UPDATE data SET cc = %s, ccavi = %s, latest_post = %s, time_between_checks = %s WHERE username = %s AND instance = %s", (session['cc'], session['ccavi'], session['cctemp']['latest_post'], 1, 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']))
|
||||
return redirect('/cc_connect/complete')
|
||||
|
||||
@app.route('/cc_connect/complete')
|
||||
|
|
Loading…
Reference in a new issue