Compare commits

...

3 commits

Author SHA1 Message Date
c451be78df
Added default settings to DB 2018-11-13 12:55:18 +10:00
042acb6b1a
added beta warning 2018-11-13 12:51:42 +10:00
c3d98034f7
Added proper imports to run.py 2018-11-13 12:49:23 +10:00
3 changed files with 23 additions and 20 deletions

4
run.py
View file

@ -4,7 +4,9 @@
# 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/.
import requests, sqlite3, json
import json, time
from mastodon import Mastodon
import requests
import mysql.connector
cfg = json.load(open('meta.json'))

View file

@ -1,4 +1,5 @@
<div id='footer'>
Note that Curious Greg uses a cookie to store your login state. Deleting the cookie used by Curious Greg will log you out of your account. Posting will still function as normal.<br />
Created by <a target="_blank" href='https://fedi.lynnesbian.space/@lynnesbian'>@lynnesbian@fedi.lynnesbian.space</a> (message her about any bugs you find). Source code is available <a target="_blank" href='https://git.lynnesbian.space/curious-greg'>here</a>, under the <a target="_blank" href='https://www.mozilla.org/en-US/MPL/2.0/'>Mozilla Public License Version 2.0</a>.
Created by <a target="_blank" href='https://fedi.lynnesbian.space/@lynnesbian'>@lynnesbian@fedi.lynnesbian.space</a> (message her about any bugs you find). Source code is available <a target="_blank" href='https://git.lynnesbian.space/curious-greg'>here</a>, under the <a target="_blank" href='https://www.mozilla.org/en-US/MPL/2.0/'>Mozilla Public License Version 2.0</a>.<br />
Curious Greg is currently in beta. Bugs may be present. There is <strong>no risk</strong> of Curious Greg deleting any of your posts.
</div>

10
web.py
View file

@ -24,9 +24,9 @@ db = mysql.connector.connect(user=cfg['dbuser'], password=cfg['dbpass'], databas
c = db.cursor()
dc = db.cursor(dictionary=True)
# MariaDB [curiousgreg]> DESCRIBE data;
# +---------------------+--------------+------+-----+------------------------------------------------+-------+
# +---------------------+---------------+------+-----+------------------------------------------------+-------+
# | Field | Type | Null | Key | Default | Extra |
# +---------------------+--------------+------+-----+------------------------------------------------+-------+
# +---------------------+---------------+------+-----+------------------------------------------------+-------+
# | username | varchar(64) | NO | PRI | NULL | |
# | instance | varchar(128) | NO | PRI | NULL | |
# | password | tinytext | NO | | NULL | |
@ -39,9 +39,9 @@ dc = db.cursor(dictionary=True)
# | latest_post | tinytext | YES | | NULL | |
# | last_check | tinytext | YES | | NULL | |
# | time_between_checks | int(11) | YES | | NULL | |
# | settings | longtext | YES | | NULL | |
# +---------------------+--------------+------+-----+------------------------------------------------+-------+
c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR(64) NOT NULL, instance VARCHAR(128) NOT NULL, password TINYTEXT NOT NULL, avi TEXT NOT NULL, secret TINYTEXT NOT NULL, client_id VARCHAR(128) NOT NULL, client_secret TINYTEXT NOT NULL, cc TINYTEXT, ccavi VARCHAR(128) DEFAULT 'https://lynnesbian.space/res/ceres/cc-smol.png', latest_post TINYTEXT, last_check TINYTEXT, time_between_checks INT, settings LONGTEXT, PRIMARY KEY(username, instance))")
# | settings | varchar(4096) | YES | | {'cw': False} | |
# +---------------------+---------------+------+-----+------------------------------------------------+-------+
c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR(64) NOT NULL, instance VARCHAR(128) NOT NULL, password TINYTEXT NOT NULL, avi TEXT NOT NULL, secret TINYTEXT NOT NULL, client_id VARCHAR(128) NOT NULL, client_secret TINYTEXT NOT NULL, cc TINYTEXT, ccavi VARCHAR(128) DEFAULT 'https://lynnesbian.space/res/ceres/cc-smol.png', latest_post TINYTEXT, last_check TINYTEXT, time_between_checks INT, settings VARCHAR(4096) DEFAULT \"{}\", PRIMARY KEY(username, instance))".format(settings))
app = Flask(cfg['name'])
app.secret_key = cfg['flask_key']