js reminder, fetch auth stuff
This commit is contained in:
parent
802efbe286
commit
85fc4ca5ca
4 changed files with 15 additions and 8 deletions
1
main.py
1
main.py
|
@ -7,3 +7,4 @@
|
|||
import requests, sqlite3, json
|
||||
from mastodon import Mastodon
|
||||
|
||||
cfg = json.load(open('meta.json'))
|
||||
|
|
|
@ -35,8 +35,6 @@ async function ajax(url) { //must be called from an async function! use 'await',
|
|||
|
||||
async function cont() {
|
||||
url = dgel('instance-input').value;
|
||||
if (url.substr(0,8) != "https://") {
|
||||
url = "https://" + url
|
||||
}
|
||||
|
||||
j = await ajax('/internal/auth_a?url=' + url)
|
||||
console.log(j)
|
||||
}
|
|
@ -9,6 +9,9 @@
|
|||
<body>
|
||||
<h1>Curious Greg</h1>
|
||||
<h2>Connect your Curious Cat and Mastodon accounts for automated crossposting.</h2>
|
||||
<noscript>
|
||||
Curious Greg will not function without JavaScript. Please ensure you have JavaScript enabled.
|
||||
</noscript>
|
||||
<!-- <div id='logo-main'></div> -->
|
||||
<form onsubmit='cont(); return false'>
|
||||
<label for='instance'>Instance URL</label><br />
|
||||
|
@ -17,6 +20,7 @@
|
|||
</form>
|
||||
<div id='footer'>
|
||||
Note that Curious Greg requires first-party cookies to be enabled. You may safely delete the cookie upon completing the connection process.
|
||||
Curious Greg will not function without JavaScript. Please ensure you have JavaScript enabled.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
12
web.py
12
web.py
|
@ -6,7 +6,7 @@
|
|||
|
||||
import requests, sqlite3, json
|
||||
from mastodon import Mastodon
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, render_template, request
|
||||
|
||||
cfg = json.load(open("meta.json"))
|
||||
|
||||
|
@ -24,14 +24,18 @@ def main():
|
|||
|
||||
@app.route('/internal/auth_a')
|
||||
def internal_auth_a():
|
||||
|
||||
client_id = "abc"
|
||||
client_secret = "123"
|
||||
instance_url = request.args.get('url', default='mastodon.social', type=str)
|
||||
if not instance_url.startswith("https://"):
|
||||
instance_url = "https://{}".format(instance_url)
|
||||
|
||||
# client_id, client_secret = Mastodon.create_app(cfg['name'],
|
||||
# api_base_url=instance_url,
|
||||
# scopes="write:statuses",
|
||||
# website=cfg['website'])
|
||||
|
||||
client_id = "abc"
|
||||
client_secret = "123"
|
||||
|
||||
client_info = {
|
||||
"client_id": client_id,
|
||||
"client_secret":client_secret,
|
||||
|
|
Loading…
Reference in a new issue