Compare commits
No commits in common. "df9391f5bd21a2546e1d4d0e782728b646c8ce39" and "d7c348e594a2024b8253846b467bd694a37c3375" have entirely different histories.
df9391f5bd
...
d7c348e594
5 changed files with 2 additions and 118 deletions
|
@ -30,15 +30,12 @@ h2 {
|
||||||
height:300px;
|
height:300px;
|
||||||
width:300px;
|
width:300px;
|
||||||
}
|
}
|
||||||
form, .profilecard, #question, #codebox {
|
form, .profilecard {
|
||||||
background-color: #444b5d;
|
background-color: #444b5d;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
padding:50px;
|
padding:50px;
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
font-size:1.4em;
|
font-size:1.4em;
|
||||||
min-width:250px;
|
|
||||||
max-width: 60vw;
|
|
||||||
line-height: 1.4em;
|
|
||||||
}
|
}
|
||||||
.profilecard {
|
.profilecard {
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
|
@ -48,9 +45,6 @@ form, .profilecard, #question, #codebox {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow:ellipsis;
|
text-overflow:ellipsis;
|
||||||
}
|
}
|
||||||
#codebox {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
input {
|
input {
|
||||||
margin:20px;
|
margin:20px;
|
||||||
font-size:1.2em;
|
font-size:1.2em;
|
||||||
|
@ -66,17 +60,11 @@ button, .button {
|
||||||
transition:0.2s all ease-in;
|
transition:0.2s all ease-in;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
display:inline-block;
|
|
||||||
margin: 5px 0;
|
|
||||||
}
|
}
|
||||||
button:hover, .button:hover{
|
button:hover, .button:hover{
|
||||||
background-color:#2b90d9;
|
background-color:#2b90d9;
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
button.fullwidth, .button.fullwidth {
|
|
||||||
width:100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
#form-avi, .pc-avi {
|
#form-avi, .pc-avi {
|
||||||
height: 128px;
|
height: 128px;
|
||||||
width:128px;
|
width:128px;
|
||||||
|
@ -93,17 +81,3 @@ button.fullwidth, .button.fullwidth {
|
||||||
font-size:1.8em;
|
font-size:1.8em;
|
||||||
font-weight:300;
|
font-weight:300;
|
||||||
}
|
}
|
||||||
#ccprompt {
|
|
||||||
font-size: 1.2em;
|
|
||||||
line-height:2.6em;
|
|
||||||
}
|
|
||||||
.code {
|
|
||||||
background-color: white;
|
|
||||||
color: black;
|
|
||||||
font-size: 3em;
|
|
||||||
font-family: monospace;
|
|
||||||
display: inline-block;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin: 15px;
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Curious Greg - Curious Cat Connection</title>
|
|
||||||
{% include 'imports.html' %}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Connect to Curious Cat</h1>
|
|
||||||
<!-- <div id='logo-main'></div> -->
|
|
||||||
<form action='/internal/ccc_a' method='POST'>
|
|
||||||
<div id='form-avi' style="background-image:url('https://lynnesbian.space/res/ceres/cc-smol.png')"></div>
|
|
||||||
<label for='cc'>Curious Cat username</label><br />
|
|
||||||
<input name='cc' required /><br />
|
|
||||||
<button>Connect</button>
|
|
||||||
</form>
|
|
||||||
{% include 'footer.html' %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,19 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Curious Greg - Curious Cat Connection</title>
|
|
||||||
{% include 'imports.html' %}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Connect to Curious Cat</h1>
|
|
||||||
<!-- <div id='logo-main'></div> -->
|
|
||||||
<div id='question'>
|
|
||||||
Continue with this account?<br /><br />
|
|
||||||
<div id='form-avi' style={{ bg }}></div>
|
|
||||||
<div id='form-avi-label'>{{ session['cctemp']['cc'] }}</div><br />
|
|
||||||
<a class='button fullwidth' href='/internal/ccc_b'>Yes</a><br />
|
|
||||||
<a class='button fullwidth' href='/cc_connect'>No</a>
|
|
||||||
</div>
|
|
||||||
{% include 'footer.html' %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -17,12 +17,6 @@
|
||||||
<div class='pc-avi' style={{ ccbg }}></div>
|
<div class='pc-avi' style={{ ccbg }}></div>
|
||||||
<span class='pc-avi-label'>{{ session['cc'] }}</span><br /><br />
|
<span class='pc-avi-label'>{{ session['cc'] }}</span><br /><br />
|
||||||
</div>
|
</div>
|
||||||
{% if session['cc'] == "None" or session['cc'] == None %}
|
|
||||||
<div id='ccprompt'>
|
|
||||||
You haven't connected your Curious Cat account yet.<br>
|
|
||||||
<a href='/cc_connect' class='button'>Connect</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% include 'footer.html' %}
|
{% include 'footer.html' %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
49
web.py
49
web.py
|
@ -4,9 +4,7 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
#TODO: ADD RETROSPRING SUPPORT!
|
import requests, json, hashlib, urllib, time, re
|
||||||
|
|
||||||
import requests, json, hashlib, urllib, time, re, random
|
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from flask import Flask, render_template, request, session, redirect, url_for
|
from flask import Flask, render_template, request, session, redirect, url_for
|
||||||
import mysql.connector
|
import mysql.connector
|
||||||
|
@ -178,48 +176,3 @@ def create_account():
|
||||||
c.execute("INSERT INTO data (username, instance, avi, password, secret, client_id, client_secret) VALUES (%s, %s, %s, %s, %s, %s, %s)", (session['username'], session['instance'], session['avi'], pw, session['secret'], session['client_id'], session['client_secret']))
|
c.execute("INSERT INTO data (username, instance, avi, password, secret, client_id, client_secret) VALUES (%s, %s, %s, %s, %s, %s, %s)", (session['username'], session['instance'], session['avi'], pw, session['secret'], session['client_id'], session['client_secret']))
|
||||||
db.commit()
|
db.commit()
|
||||||
return redirect(url_for('home'))
|
return redirect(url_for('home'))
|
||||||
|
|
||||||
#cc connection
|
|
||||||
|
|
||||||
@app.route('/cc_connect')
|
|
||||||
def cc_connect():
|
|
||||||
return render_template('cc_connect.html')
|
|
||||||
|
|
||||||
@app.route('/internal/ccc_a', methods=['POST'])
|
|
||||||
def ccc_a(): #step one of curiouscat connection: retreive details
|
|
||||||
r = requests.get("https://curiouscat.me/api/v2/profile?username={}".format(request.form['cc']))
|
|
||||||
j = r.json()
|
|
||||||
if 'error' in j:
|
|
||||||
return redirect('/cc_connect?invalid')
|
|
||||||
session['cctemp'] = {
|
|
||||||
"cc":j['userData']['username'],
|
|
||||||
"ccavi":j['userData']['avatar'],
|
|
||||||
"ccid":j['userData']['id']
|
|
||||||
}
|
|
||||||
return redirect('/cc_connect/confirm')
|
|
||||||
|
|
||||||
@app.route('/cc_connect/confirm')
|
|
||||||
def cc_connect_confirm():
|
|
||||||
return render_template('cc_connect_confirm.html', bg="background-image:url('{}')".format(session['cctemp']['ccavi']))
|
|
||||||
|
|
||||||
@app.route('/internal/ccc_b')
|
|
||||||
def ccc_b():
|
|
||||||
session['cctemp']['challenge'] = random.randint(100000, 999999) #provided by CG
|
|
||||||
session['cctemp']['response'] = random.randint(100000, 999999) #user will be asked to answer with this code to prove it's really them
|
|
||||||
session.modified = True
|
|
||||||
form_data = {
|
|
||||||
"addressees": session['cctemp']['ccid'],
|
|
||||||
"anon": "true",
|
|
||||||
"question": "Hi! Please respond to this question with the code given to you by Curious Greg. If you did not request this code, you may safely delete this question. Challenge: {}".format(session['cctemp']['challenge'])
|
|
||||||
}
|
|
||||||
r = requests.post("https://curiouscat.me/api/v2/post/create", data=form_data)
|
|
||||||
j = r.json()
|
|
||||||
if 'success' in j and j['success'] == True:
|
|
||||||
return redirect('/cc_connect/code')
|
|
||||||
else:
|
|
||||||
#todo: handle error properly
|
|
||||||
return False
|
|
||||||
|
|
||||||
@app.route('/cc_connect/code')
|
|
||||||
def cc_connect_code():
|
|
||||||
return render_template('cc_connect_code.html')
|
|
||||||
|
|
Loading…
Reference in a new issue