Compare commits

..

No commits in common. "802efbe286ac065e817a1968ce2e81cb98200841" and "54fdba72078b6bb7b6c2b05ad03c613462e1b342" have entirely different histories.

4 changed files with 9 additions and 134 deletions

View file

@ -1,42 +0,0 @@
Node.prototype.gel = function (id) {
return this.getElementById(id);
}
Node.prototype.gcn = function (classname) {
return this.getElementsByClassName(classname);
}
function dgel(id) {
return document.getElementById(id);
}
function dgcn(classname) {
return document.getElementsByClassName(classname);
}
/**
* Asynchronous function. Promises the text content of url. Automatically adds/removes from the loading counter.
* @param {string} url URL to request. Note that unless cross-domain is specifically permitted, this URL must come from the same domain as this file.
*/
async function ajax(url) { //must be called from an async function! use 'await', e.g. "var result = await ajax('https://google.com');"
return new Promise(resolve => {
var pageGetter = new XMLHttpRequest;
pageGetter.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
resolve(this.responseText);
} else if (this.readyState == 4) {
resolve('Error: Expecting HTTP 200, got HTTP ' + this.status)
}
}
pageGetter.open('GET', url, true)
pageGetter.send();
});
}
async function cont() {
url = dgel('instance-input').value;
if (url.substr(0,8) != "https://") {
url = "https://" + url
}
}

View file

@ -1,53 +0,0 @@
body {
font-family: sans-serif;
margin: 5%;
text-align: center;
background-color: #282c37;
color: white;
}
h1, h2 {
font-weight: 300;
}
h1 {
font-size: 4em;
margin:0;
font-family:"Open Sans", sans-serif;
}
h2 {
font-size: 2.5em;
font-family:"Open Sans", sans-serif;
}
#footer {
position:absolute;
bottom:5%;
width:90%;
}
#logo-main {
height:300px;
width:300px;
}
form {
background-color: #444b5d;
display:inline-block;
padding:50px;
border-radius:5px;
font-size:1.4em;
}
input {
margin:20px;
font-size:1.2em;
}
button {
font-size:1em;
text-transform: uppercase;
color:#2b90d9;
border: 2px #2b90d9 solid;
background-color:transparent;
border-radius:2px;
padding:10px 25px;
transition:0.2s all ease-in;
}
button:hover{
background-color:#2b90d9;
color:white;
}

View file

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Curious Greg</title>
<link rel='stylesheet' type='text/css' href="{{ url_for('static', filename='style.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
</head>
<body>
<h1>Curious Greg</h1>
<h2>Connect your Curious Cat and Mastodon accounts for automated crossposting.</h2>
<!-- <div id='logo-main'></div> -->
<form onsubmit='cont(); return false'>
<label for='instance'>Instance URL</label><br />
<input name='instance' placeholder='mastodon.social' id='instance-input' /><br />
<button class='loading'>Continue</button>
</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.
</div>
</body>
</html>

26
web.py
View file

@ -6,7 +6,7 @@
import requests, sqlite3, json
from mastodon import Mastodon
from flask import Flask, render_template
from flask import Flask
cfg = json.load(open("meta.json"))
@ -20,23 +20,15 @@ app.secret_key = cfg['flask_key']
@app.route('/')
def main():
return render_template("landing_page.html")
return "test"
@app.route('/internal/auth_a')
def internal_auth_a():
# client_id, client_secret = Mastodon.create_app(cfg['name'],
# api_base_url=instance_url,
# scopes="write:statuses",
# website=cfg['website'])
client_id, client_secret = Mastodon.create_app(cfg['name'],
api_base_url=instance_url,
scopes="write:statuses",
website="https://git.lynnesbian.space/lynnesbian/curious-greg")
client_id = "abc"
client_secret = "123"
client_info = {
"client_id": client_id,
"client_secret":client_secret,
"scopes":"write:statuses",
"website": cfg['website']
}
return(json.dumps(client_info))
client = Mastodon(client_id = client_id,
client_secret = client_secret,
api_base_url=instance_url)