mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-11-25 16:48:58 +00:00
Compare commits
17 commits
e19abc6a18
...
7a1658c3c9
Author | SHA1 | Date | |
---|---|---|---|
7a1658c3c9 | |||
316f7291dd | |||
7c2c8a01f5 | |||
da3084f76e | |||
3a2cbdc267 | |||
a7bde87a45 | |||
5336013a95 | |||
f2a124aff5 | |||
07430c4d64 | |||
fdacc204bf | |||
1d2095015c | |||
226654bf2d | |||
043f85a9b3 | |||
e0f3a232bc | |||
ba81cbbef5 | |||
feabb82386 | |||
21781f4e01 |
11 changed files with 182 additions and 8 deletions
30
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
30
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Report a bug with FediBooks
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: Lynnesbian
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What happened?**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**How did it happen?**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Where did it happen?**
|
||||||
|
Please copy and paste the URL here.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Error message**
|
||||||
|
Did FediBooks give you an error message? If so, paste the message here.
|
||||||
|
|
||||||
|
**Further comments**
|
||||||
|
You can add more info here if you'd like.
|
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: Lynnesbian
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**What would you like FediBooks to do?**
|
||||||
|
Type in your feature idea here. Please do not suggest any of the following features:
|
||||||
|
- Different bot types (for example, bots that post images)
|
||||||
|
- Donation bonuses
|
||||||
|
|
||||||
|
Please ensure that your idea is:
|
||||||
|
- Easy to understand for the end user - Don't overwhelm the user with too many options or settings, or complex terminology.
|
||||||
|
- Relatively achievable - FediBooks is a passion project developed by one person. Something like a mobile app for accessing FediBooks is beyond my skillset and would take too much time.
|
||||||
|
- Not too heavy on the server - The main FediBooks instance (https://fedibooks.com) is running on a moderately powerful server capable of relatively complex tasks, but some things such as machine learning or automated video generation are beyond its capabilities.
|
13
setup.sql
13
setup.sql
|
@ -42,3 +42,16 @@ CREATE TABLE IF NOT EXISTS `posts` (
|
||||||
`content` VARCHAR(65535) NOT NULL,
|
`content` VARCHAR(65535) NOT NULL,
|
||||||
`cw` BOOLEAN NOT NULL
|
`cw` BOOLEAN NOT NULL
|
||||||
);
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS `word_blacklist` (
|
||||||
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE,
|
||||||
|
`phrase` VARCHAR(128) NOT NULL,
|
||||||
|
`whole_word` BOOLEAN NOT NULL
|
||||||
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS `contact_history` (
|
||||||
|
FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
`fetch` BOOLEAN DEFAULT 0,
|
||||||
|
`submit` BOOLEAN DEFAULT 0,
|
||||||
|
`generation` BOOLEAN DEFAULT 0,
|
||||||
|
`reply` BOOLEAN DEFAULT 0
|
||||||
|
);
|
||||||
|
|
|
@ -33,7 +33,7 @@ body {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
.subtle {
|
.subtle {
|
||||||
color: #dddddd;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -47,6 +47,15 @@ body {
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background: center/contain url("https://cloud.lynnesbian.space/s/JZCPTs3DzMLAspC/preview");
|
background: center/contain url("https://cloud.lynnesbian.space/s/JZCPTs3DzMLAspC/preview");
|
||||||
}
|
}
|
||||||
|
.panel-icon.online, .panel-icon.offline {
|
||||||
|
width: 105px;
|
||||||
|
}
|
||||||
|
.panel-icon.online {
|
||||||
|
border-left: 5px #5c5 solid;
|
||||||
|
}
|
||||||
|
.panel-icon.offline {
|
||||||
|
border-left: 5px #c33 solid;
|
||||||
|
}
|
||||||
.panel-icon, .panel-text, .panel-actions {
|
.panel-icon, .panel-text, .panel-actions {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
|
34
templates/bot_accounts.html
Normal file
34
templates/bot_accounts.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>FediBooks</title>
|
||||||
|
{% include 'imports.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container centred">
|
||||||
|
<h1 class="thin centred">Set accounts to learn from</h1>
|
||||||
|
<p class="large centred">@botname@example.com</p>
|
||||||
|
<p class="centred" style="margin: 50px 0;">
|
||||||
|
<a class="button btn-primary btn-large" href="/bot/accounts/add" role="button"><i class="fas fa-plus"></i> Add account</a>
|
||||||
|
<a class="button btn-secondary btn-large" href="/" role="button"><i class="fas fa-arrow-left"></i> Back</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container" style="min-height: 300px;">
|
||||||
|
<div class="row light">
|
||||||
|
<div class="panel-icon"></div>
|
||||||
|
<div class="panel-text">
|
||||||
|
<div class="panel-name">@user<span class="subtle">@instan.ce</span></div>
|
||||||
|
<div class="panel-status">12345 posts stored</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-actions">
|
||||||
|
<a class="button btn-secondary" href="/bot/accounts/toggle/insert id here" title="Turn on/off"><i class="fas fa-power-off"></i></a><a class="button btn-dangerous" href="/bot/accounts/delete/insert id here" title="Delete"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include 'footer.html' %}
|
||||||
|
</body>
|
||||||
|
</html>
|
50
templates/bot_accounts_add.html
Normal file
50
templates/bot_accounts_add.html
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>FediBooks</title>
|
||||||
|
{% include 'imports.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="thin centred">Add account</h1>
|
||||||
|
<p class="large thin centred">Step {{ session['step'] }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container centred">
|
||||||
|
<form action="/bot/accounts/add" method="POST">
|
||||||
|
{% if session['step'] == 1 %}
|
||||||
|
<label for="account" class="important">Account handle</label>
|
||||||
|
<input type="text" name="account" class="full-width" placeholder="@user@example.com">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
{% elif session['step'] == 2 %}
|
||||||
|
<h2 class="thin centred">Authentication required</h2>
|
||||||
|
<p>{{ session['instance'] }} requires authentication to view public posts. Ensure you're signed in as {{ session['account'] }}, and click Next. You will be prompted to give FediBooks access to read your posts, which is required for your bot.</p>
|
||||||
|
|
||||||
|
{% elif session['step'] == 3 %}
|
||||||
|
|
||||||
|
<h2 class="thin centred">Authentication failure</h2>
|
||||||
|
<p>FediBooks was unable to authenticate with {{ session['instance'] }}.</p>
|
||||||
|
<p>Click back to try again. If you believe this is in error, you may <a href="https://github.com/Lynnesbian/FediBooks/issues/new/choose">file a bug report</a>.</p>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<h2 class="thin centred">Error</h2>
|
||||||
|
<p>An unknown error has occurred.</p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="container centred">
|
||||||
|
<a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a>
|
||||||
|
{% if session['step'] != 1 %}
|
||||||
|
<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button>
|
||||||
|
{% endif %}
|
||||||
|
<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% include 'footer.html' %}
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -32,10 +32,17 @@
|
||||||
<p>FediBooks has successfully authenticated with {{ session['instance'] }}, and your bot is ready to be configured. Click finish to return to the bot management screen.</p>
|
<p>FediBooks has successfully authenticated with {{ session['instance'] }}, and your bot is ready to be configured. Click finish to return to the bot management screen.</p>
|
||||||
<p>To get your bot working, you need to add at least one account for it to learn from. You can do so by clicking the <i class="fas fa-users"></i> button. To configure settings such as posting frequency and content warnings, click the <i class="fas fa-cog"></i> button.</p>
|
<p>To get your bot working, you need to add at least one account for it to learn from. You can do so by clicking the <i class="fas fa-users"></i> button. To configure settings such as posting frequency and content warnings, click the <i class="fas fa-cog"></i> button.</p>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<h2 class="thin centred">Error</h2>
|
||||||
|
<p>An unknown error has occurred.</p>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="container centred">
|
<div class="container centred">
|
||||||
|
<a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a>
|
||||||
|
{% if session['step'] != 1 %}
|
||||||
<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button>
|
<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button>
|
||||||
|
{% endif %}
|
||||||
<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>
|
<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container centred">
|
<div class="container centred">
|
||||||
<h1 class="thin centred">Delete bot</h1>
|
<h1 class="thin centred">Delete bot</h1>
|
||||||
<div class="bot-icon"></div>
|
<div class="panel-icon"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container centred">
|
<div class="container centred">
|
||||||
|
|
|
@ -20,15 +20,15 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="freq" class="large">Post frequency (minutes)</label>
|
<label for="freq" class="large">Post frequency (minutes)</label>
|
||||||
<input type="number" min="15" max="240" step="5" value="30">
|
<input type="number" min="15" max="240" step="5" value="30" name="freq">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="cw" class="large">Content warning (subject)</label>
|
<label for="cw" class="large">Content warning (subject)</label>
|
||||||
<input type="text" placeholder="None">
|
<input type="text" placeholder="None" name="cw">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="length" class="large">Maximum post length (characters)</label>
|
<label for="length" class="large">Maximum post length (characters)</label>
|
||||||
<input type="number" min="100" max="5000" value="500">
|
<input type="number" min="100" max="5000" value="500" name="length">
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="fake-mentions" class="large">Fake mentions</label>
|
<label for="fake-mentions" class="large">Fake mentions</label>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="privacy" class="large">Post privacy</label>
|
<label for="privacy" class="large">Post privacy</label>
|
||||||
<select>
|
<select name="privacy">
|
||||||
<option value="public">Public</option>
|
<option value="public">Public</option>
|
||||||
<option value="unlisted">Unlisted</option>
|
<option value="unlisted">Unlisted</option>
|
||||||
<option value="followers">Followers only</option>
|
<option value="followers">Followers only</option>
|
||||||
|
@ -55,7 +55,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label for="cw-learning" class="large">Learn from posts with content warnings (subjects)</label>
|
<label for="cw-learning" class="large">Learn from posts with content warnings (subjects)</label>
|
||||||
<input type="checkbox">
|
<input type="checkbox" name="cw-learning">
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<label for="replies" class="large">Enable replies</label>
|
||||||
|
<input type="checkbox" name="replies">
|
||||||
</div>
|
</div>
|
||||||
<div class="container centred">
|
<div class="container centred">
|
||||||
<button class="button btn-primary"><i class="fas fa-save"></i> Save</button>
|
<button class="button btn-primary"><i class="fas fa-save"></i> Save</button>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div class="container" style="min-height: 300px;">
|
<div class="container" style="min-height: 300px;">
|
||||||
<div class="row light">
|
<div class="row light">
|
||||||
<div class="panel-icon"></div>
|
<div class="panel-icon online"></div>
|
||||||
<div class="panel-text">
|
<div class="panel-text">
|
||||||
<div class="panel-name">My bot!!</div>
|
<div class="panel-name">My bot!!</div>
|
||||||
<div class="panel-status">Online, learning from 3 accounts, 12345 posts in database</div>
|
<div class="panel-status">Online, learning from 3 accounts, 12345 posts in database</div>
|
||||||
|
|
9
webui.py
9
webui.py
|
@ -11,6 +11,7 @@ def hello():
|
||||||
session['userid'] = 1
|
session['userid'] = 1
|
||||||
# session.clear()
|
# session.clear()
|
||||||
if 'userid' in session:
|
if 'userid' in session:
|
||||||
|
session['step'] = 1
|
||||||
return render_template("home.html")
|
return render_template("home.html")
|
||||||
else:
|
else:
|
||||||
return render_template("front_page.html")
|
return render_template("front_page.html")
|
||||||
|
@ -43,6 +44,14 @@ def bot_edit(id):
|
||||||
def bot_delete(id):
|
def bot_delete(id):
|
||||||
return render_template("bot_delete.html")
|
return render_template("bot_delete.html")
|
||||||
|
|
||||||
|
@app.route("/bot/accounts/<id>")
|
||||||
|
def bot_accounts(id):
|
||||||
|
return render_template("bot_accounts.html")
|
||||||
|
|
||||||
|
@app.route("/bot/accounts/add")
|
||||||
|
def bot_accounts_add():
|
||||||
|
return render_template("bot_accounts_add.html")
|
||||||
|
|
||||||
@app.route("/bot/create/")
|
@app.route("/bot/create/")
|
||||||
def bot_create():
|
def bot_create():
|
||||||
session['step'] = 4
|
session['step'] = 4
|
||||||
|
|
Loading…
Reference in a new issue