feat: add bridge data and display page for Matrix bots
All checks were successful
Build and Deploy Static Site / build (push) Successful in 58s

Integrated a new "bridges.json" file to list various Matrix bot bridges, including Telegram, WhatsApp, Discord, and more. Updated the main script to load this data and render it on a new "bridges" template. The new "bridges.html" template provides users with a clear and intuitive interface to view available bridges and their respective Matrix IDs.

Improves user experience by providing a dedicated page for bridge information.
This commit is contained in:
Kumi 2024-07-19 09:49:32 +02:00
parent 5cbe4bacaf
commit 440ef9828a
Signed by: kumi
GPG key ID: ECBCC9082395383F
3 changed files with 67 additions and 0 deletions

40
data/bridges.json Normal file
View file

@ -0,0 +1,40 @@
{
"bridges": [
{
"name": "Telegram",
"mxid": "@telegrambot:private.coffee"
},
{
"name": "WhatsApp",
"mxid": "@whatsappbot:private.coffee"
},
{
"name": "Discord",
"mxid": "@discordbot:private.coffee"
},
{
"name": "Slack",
"mxid": "@slackbot:private.coffee"
},
{
"name": "LinkedIn",
"mxid": "@linkedinbot:private.coffee"
},
{
"name": "GPT-4o",
"mxid": "@gptbot:private.coffee"
},
{
"name": "RSS/Atom feeds",
"mxid": "@rssbot:private.coffee"
},
{
"name": "Instagram",
"mxid": "@instagrambot:private.coffee"
},
{
"name": "Facebook",
"mxid": "@facebookbot:private.coffee"
}
]
}

View file

@ -80,6 +80,11 @@ def generate_static_site(development_mode=False):
(pathlib.Path(__file__).parent / "data" / "finances.json").read_text()
)
# Load bridges data
bridges = json.loads(
(pathlib.Path(__file__).parent / "data" / "bridges.json").read_text()
)
# Iterate over all templates in the templates directory
templates_path = pathlib.Path("templates")
for template_file in templates_path.glob("*.html"):
@ -89,6 +94,9 @@ def generate_static_site(development_mode=False):
if template_name in ["index", "simple"]:
context.update({"services": services})
if template_name == "bridges":
context.update({"bridges": bridges})
if template_name == "membership":
allow_current = development_mode
finances_month, finances_year = get_latest_month(finances, allow_current)

19
templates/bridges.html Normal file
View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bridges and bots</title>
</head>
<body>
<div style="font-family: Arial, sans-serif; background-color: #f2f2f2; color: #333; line-height: 1.6; padding: 20px; max-width: 600px; margin: auto;">
<h2 style="color: #333;">Bridges and bots</h2>
<p>These are the bridges and bots available to Private.coffee Matrix users:</p>
<ul style="list-style: none; padding: 0;">
{% for bridge in bridges.bridges %}
<li style="padding: 8px 0;"><a style="color: #1a5dab; text-decoration: none;" href="https://matrix.pcof.fi/#/{{ bridge.mxid }}">{{ bridge.name }}</a> - {{ bridge.mxid }}</li>
{% endfor %}
</ul>
</div>
</body>
</html>