more, understandable text

This commit is contained in:
Daniel Langbein 2022-12-14 18:07:22 +01:00
parent d29b642caf
commit 4793464be0
5 changed files with 42 additions and 17 deletions

View File

@ -15,20 +15,25 @@ SHELL := bash
all: prod
.PHONY: prod
prod: requirements.txt
prod: requirements.txt ## Starts a production webserver.
source venv/bin/activate
export PYTHONPATH="${PYTHONPATH}:src"
python3 src/mastodon_toot_follower/server/waitress_server.py
.PHONY: dev
dev: requirements.txt
dev: requirements.txt ## Starts a development webserver.
source venv/bin/activate
export PYTHONPATH="${PYTHONPATH}:src"
python3 src/mastodon_toot_follower/server/flask_server.py
.PHONY: cli
cli: requirements.txt ## Runs the commandline version.
source venv/bin/activate
export PYTHONPATH="${PYTHONPATH}:src"
python3 src/mastodon_toot_follower/cli.py $(MASTODON_TOOT_URL)
.PHONY: requirements.txt
requirements.txt:
requirements.txt: ## Creates a virtual environment including the python dependencies.
if ! [ -d venv ]; then
python3 -m venv venv
source venv/bin/activate
@ -36,5 +41,10 @@ requirements.txt:
fi
.PHONY: clean
clean:
rm -rf venv
clean: ## Removes all created files.
rm -rf venv ~/.MastodonTootFollower
sudo rm -rf data
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@ -30,9 +30,9 @@ def main():
print(f'Conversation length: {conversation.conversation_length()}')
new_updates = conversation.updates(reading_position=reading_position)
if len(new_updates) == 0:
print('No new updates.')
print('There is no news from the conversation.')
else:
print(f'New updates:\n')
print(f'News from the conversation:\n')
print('\n'.join([str(update) for update in new_updates]))

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from enum import Enum
from secrets import token_urlsafe
from flask import Flask, Response, render_template
from flask import request
@ -27,7 +28,7 @@ class Templates(Enum):
@app.route('/', methods=['GET'])
def hello_world():
return render_template(Templates.index.value)
return render_template(Templates.index.value, seed=token_urlsafe(16))
@app.route('/rss/')

View File

@ -13,25 +13,39 @@
<main>
<h1>MastodonTootFollower</h1>
<p>
<label for="input1">URL of toot to follow: </label>
In the following you can generate a link to follow a conversation on Mastodon.
</p>
<p>
You can either follow a conversation with a feed reader (Atom/RSS) of your choice
or view new replies and edits each time you open the link in your webbrowser (HTML page or JSON file).
</p>
<p>
To get started, fill in the URL of the Toot that has started the conversation
and click one of the three buttons. Then open your generated link (either with a feed reader or in your webbrowser).
</p>
<p>
The random seed is used to store your reading position.
</p>
<p>
<label for="input1">URL of Toot: </label>
<input name="html_url" type="url" maxlength="256" id="input1"/>
</p>
<p>
<label for="input2">Private seed; required for consecutive updates: </label>
<input name="html_url" type="text" maxlength="256" id="input2"/>
<label for="input2">Seed: </label>
<input name="html_url" type="text" value="{{ seed }}" maxlength="256" id="input2"/>
</p>
<ul>
<li>
<button onclick="rss_button()">All updates as RSS feed</button>
<button onclick="rss_button()">Atom/RSS feed</button>
</li>
<li>
<button onclick="json_button()">Consecutive updates as JSON file</button>
<button onclick="json_button()">News as JSON file</button>
</li>
<li>
<button onclick="html_button()">Consecutive updates as HTML page</button>
<button onclick="html_button()">News as HTML page</button>
</li>
</ul>
<p>Resulting link: <a href="https://localhost:443" id="href1"></a></p>
<p>Generated link: <a href="https://localhost:443" id="href1"></a></p>
</main>
<script src="{{ url_for('static', filename='index.js') }}"></script>

View File

@ -11,8 +11,8 @@
</head>
<body>
<h1>Consecutive Toot Updates</h1>
<h1>News from the conversation</h1>
<p>List of changes from the conversation since your last visit.</p>
<table class="styled-table">
<thead>
<tr>