1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

Compare commits

...

13 commits

Author SHA1 Message Date
743066cb3d fix cancel link 2019-08-31 20:49:50 +10:00
44451b87bf change edit bot page header to say configure bot 2019-08-31 20:45:49 +10:00
e8fed0cd2f add bcrypt dependency 2019-08-31 20:41:07 +10:00
29e935f64f use unsigned ints 2019-08-31 20:38:40 +10:00
5a419376fd format sql 2019-08-31 20:34:45 +10:00
e5ba2258e2 correctly format enums 2019-08-31 20:34:05 +10:00
72e5b56401 quote cw in sql 2019-08-31 20:26:35 +10:00
e0a5cff3a7 oops forgot the semicolons 2019-08-31 20:08:24 +10:00
bb37f226b2 define db structure in sql 2019-08-31 20:06:53 +10:00
12d34a0a8a don't commit my planning document uwu 2019-08-31 20:06:40 +10:00
aea1cc7ccc read secret key from json file 2019-08-31 13:26:20 +10:00
bc0dcfb754 add mysql connector dependency 2019-08-30 23:52:06 +10:00
7f6f18cc14 making a commitment to stay free! 2019-08-30 22:44:13 +10:00
7 changed files with 55 additions and 4 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
__pycache__
config.json
planning.txt

View file

@ -3,3 +3,5 @@ markovify==0.7.1
beautifulsoup4==4.7.1
requests==2.22.0
Flask==1.1.1
mysql-connector-python==8.0.17
bcrypt == 3.1.7

44
setup.sql Normal file
View file

@ -0,0 +1,44 @@
CREATE TABLE IF NOT EXISTS `users` (
`id` BINARY(64) PRIMARY KEY,
`email` VARCHAR(128) UNIQUE NOT NULL,
`password` BINARY(60) NOT NULL
);
CREATE TABLE IF NOT EXISTS `contact_settings` (
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
`fetch` ENUM('always', 'once', 'never') DEFAULT 'once',
`submit` ENUM('always', 'once', 'never') DEFAULT 'once',
`generation` ENUM('always', 'once', 'never') DEFAULT 'once',
`reply` ENUM('always', 'once', 'never') DEFAULT 'once'
);
CREATE TABLE IF NOT EXISTS `bots` (
`id` BINARY(64) PRIMARY KEY,
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
`enabled` BOOLEAN DEFAULT 1,
`replies_enabled` BOOLEAN DEFAULT 1,
`post_frequency` SMALLINT UNSIGNED DEFAULT 30,
`content_warning` VARCHAR(128),
`length` SMALLINT UNSIGNED DEFAULT 500,
`fake_mentions` ENUM('always', 'start', 'never') DEFAULT 'start',
`fake_mentions_full` BOOLEAN DEFAULT 0,
`post_privacy` ENUM('public', 'unlisted', 'followers_only') DEFAULT 'unlisted',
`learn_from_cw` BOOLEAN DEFAULT 0,
`last_post` DATETIME DEFAULT 0,
FOREIGN KEY (`credentials_id`) REFERENCES credentials(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `credentials` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`client_id` VARCHAR(128) NOT NULL,
`client_secret` VARCHAR(128) NOT NULL,
`secret` VARCHAR(128) NOT NULL
);
CREATE TABLE IF NOT EXISTS `fedi_account` (
`outbox` VARCHAR(256) PRIMARY KEY,
`instance` VARCHAR(256) NOT NULL,
FOREIGN KEY (`credentials_id`) REFERENCES credentials(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `posts` (
`id` BIGINT AUTO_INCREMENT PRIMARY KEY,
`post_id` VARCHAR(64) NOT NULL,
`content` VARCHAR(65535) NOT NULL,
`cw` BOOLEAN NOT NULL
);

View file

@ -33,7 +33,7 @@
<h2 class="thin">You used to charge for hosting ebooks bots for people. Why make it free? Aren't you automating yourself out of a job?</h2>
<p>Yup! I'm making this free because I believe all software should be free, not just in cost, but in distributability, accessibility, and so on. mstdn-ebooks is also free software. I used to provide free hosting for mstdn-ebooks bots, but stopped when it became too much for me to handle. In the end, I was running 108 ebooks bots! The worst moment was when I accidentally wiped all the configuration files for them and had to log in to all 108 accounts and re-authorise them all...</p>
<p>FediBooks should (fingers crossed!) require much less maintenance on my part. All I have to do is make sure the server is running, which it is at all times, and make the occasional change or update to reflect new needs. The real concern is my server, not me - let's hope it can handle all these bots!</p>
<p>FediBooks doesn't display ads. It doesn't have any subscription models, donation bonuses, or cryptocurrency mining JavaScript (as useless as that is). What it does have is a donation link at the bottom of the main page. If you have some money to spare and you want to donate, feel free to do so. Paying for the server will be a little tricky since I've just cut off my main source of income, but I should manage. Hopefully.</p>
<p>FediBooks doesn't display ads. It doesn't have any subscription models, donation bonuses, or cryptocurrency mining JavaScript (as useless as that is). It will never have any of these things. What it does have is a donation link at the bottom of the main page. If you have some money to spare and you want to donate, feel free to do so. Paying for the server will be a little tricky since I've just cut off my main source of income, but I should manage. Hopefully.</p>
<h2 class="thin">I'm concerned about my privacy. If FediBooks learns from my posts, doesn't that mean you have access to all my posts?</h2>
<p>By necessity, yes. FediBooks will have access to all of your <em>public</em> posts. Anything you've set to followers only will not be seen by FediBooks. However, if you delete a post, FediBooks will still have it stored in its database. This is because checking if every single post has been deleted is impractically slow, and your instance would soon tell FediBooks to stop making so many API requests.</p>

View file

@ -17,7 +17,7 @@
<div class="container centred">
<p>Are you sure you want to <strong>permanently</strong> delete bot name?</p>
<p>The account on instan.ce will remain open, but your bot will stop posting from it.</p>
<button class="button btn-secondary"><i class="fas fa-times"></i> Cancel</button>
<a class="button btn-secondary" href="/"><i class="fas fa-times"></i> Cancel</a>
<button class="button btn-dangerous"><i class="fas fa-trash"></i> Delete bot</button>
</div>
</form>

View file

@ -8,7 +8,7 @@
<body>
<div class="container">
<h1 class="thin centred">Edit bot</h1>
<h1 class="thin centred">Configure bot</h1>
<p class="large centred">@botname@example.com</p>
</div>

View file

@ -1,7 +1,10 @@
from flask import Flask, render_template, session
import json
cfg = json.load(open("config.json"))
app = Flask(__name__)
app.secret_key = "debug key"
app.secret_key = cfg['secret_key']
@app.route("/")
def hello():