Compare commits
4 commits
719843e2b8
...
6616a748c0
| Author | SHA1 | Date | |
|---|---|---|---|
| 6616a748c0 | |||
| f5ef6d3b5e | |||
| 57f4ebb231 | |||
| 0b375cdfe9 |
7 changed files with 118 additions and 20 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
__pycache__
|
||||||
|
env/
|
||||||
1
password
Normal file
1
password
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
25uXB9R29rW9GK9mXPNU
|
||||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
fastcgi==0.0.3
|
||||||
BIN
services/mentions.pickle
Normal file
BIN
services/mentions.pickle
Normal file
Binary file not shown.
63
services/webmention.py
Normal file
63
services/webmention.py
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from fastcgi import fastcgi
|
||||||
|
from urllib.parse import parse_qs
|
||||||
|
from pathlib import Path
|
||||||
|
import pickle
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
CACHE_PATH = Path(__file__).parent / "mentions.pickle"
|
||||||
|
|
||||||
|
print("FastCGI server starting... unix socket to be located at")
|
||||||
|
print(Path.cwd()/"fcgi.sock")
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Mention:
|
||||||
|
source: str
|
||||||
|
target: str
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def load_past_mentions() -> list["Mention"]:
|
||||||
|
if CACHE_PATH.exists():
|
||||||
|
with open(CACHE_PATH, "rb") as fo:
|
||||||
|
return pickle.load(fo)
|
||||||
|
return []
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def save_past_mentions(mentions: list["Mention"]):
|
||||||
|
with open(CACHE_PATH, "wb") as fo:
|
||||||
|
return pickle.dump(mentions, fo)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_mention(cls, mention: "Mention"):
|
||||||
|
cache = cls.load_past_mentions()
|
||||||
|
if mention not in cache:
|
||||||
|
cache.append(mention)
|
||||||
|
cls.save_past_mentions(cache)
|
||||||
|
|
||||||
|
@fastcgi()
|
||||||
|
def handler():
|
||||||
|
try:
|
||||||
|
url = os.environ["REQUEST_URL"]
|
||||||
|
method = os.environ["REQUEST_METHOD"]
|
||||||
|
if method == "POST":
|
||||||
|
payload = sys.stdin.read()
|
||||||
|
data = parse_qs(payload)
|
||||||
|
source = data["source"][-1]
|
||||||
|
target = data["target"][-1]
|
||||||
|
Mention.add_mention(Mention(source, target))
|
||||||
|
if source == target:
|
||||||
|
raise Exception()
|
||||||
|
print("Status: 202 Accepted\r")
|
||||||
|
print("Content-Type: text/plain; charset=utf-8\r\n\r")
|
||||||
|
print("Thanks for mentioning us!")
|
||||||
|
print(source)
|
||||||
|
elif method == "GET":
|
||||||
|
print("Status: 200 OK\r")
|
||||||
|
print("Content-Type: text/plain; charset=utf-8\r\n\r")
|
||||||
|
for mention in Mention.load_past_mentions():
|
||||||
|
print(f"<{mention.source}> mentioned <{mention.target}>")
|
||||||
|
else:
|
||||||
|
raise Exception()
|
||||||
|
except Exception as e:
|
||||||
|
print("Status: 400 Bad Request\r\n\r")
|
||||||
14
services/webmention_nginx.conf
Normal file
14
services/webmention_nginx.conf
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# A basic nginx configuration to test webmention.py
|
||||||
|
# Update unix: path to be the correct file
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
add_header Link "<https://webmention.libreinternet.club>; rel=\"webmention\"" always;
|
||||||
|
fastcgi_pass unix:/home/gopher/libreinternet.club/services/fcgi.sock;
|
||||||
|
fastcgi_param REQUEST_METHOD $request_method;
|
||||||
|
fastcgi_param REQUEST_URL $request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,33 +1,50 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en-ca" typeof="Organization">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8">
|
||||||
<html lang="en-ca" />
|
<title property="http://schema.org/name">Libre Internet Club</title>
|
||||||
<title>Libre Internet Club</title>
|
<link rel="stylesheet" href="style.css">
|
||||||
<link rel="stylesheet" href="style.css" />
|
|
||||||
<script type="module" src="editor.js" defer></script>
|
<script type="module" src="editor.js" defer></script>
|
||||||
<script type="module" src="tictactoe.js" defer></script>
|
<script type="module" src="tictactoe.js" defer></script>
|
||||||
<script type="module" src="crawler.js" defer></script>
|
<script type="module" src="crawler.js" defer></script>
|
||||||
<link rel="stylesheet" href="tictactoe.css" />
|
<link rel="stylesheet" href="tictactoe.css">
|
||||||
|
<link vocab="https://www.w3.org/ns/webmention#" rel="webmention" href="https://webmention.libreinternet.club">
|
||||||
</head>
|
</head>
|
||||||
|
<body vocab="https://schema.org/">
|
||||||
<div id="banner">
|
<div id="banner">
|
||||||
<img src="banner.gif" />
|
<img property="logo" src="banner.gif" alt="Libre Internet Club" />
|
||||||
</div>
|
</div>
|
||||||
@ University of Alberta
|
<span property="location">@ <span typeof="CollegeOrUniversity" property="name">University of Alberta</span></span>
|
||||||
|
<div><a href="https://www.w3.org/TR/webmention">Webmention</a> us at <a vocab="https://www.w3.org/ns/webmention#" rel="webmention" href="https://webmention.libreinternet.club">https://webmention.libreinternet.club</a></div>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://discord.gg/U9MQTv952">Join Discord</a></li>
|
<li><a href="https://discord.gg/U9MQTv952">Join Discord</a></li>
|
||||||
<li><a href="https://matrix.to/#/#Libre_Internet:matrix.org">Matrix</a></li>
|
<li><a href="https://matrix.to/#/#Libre_Internet:matrix.org">Matrix</a></li>
|
||||||
<li><a rel="me" href="https://mstdn.ca/@LibreInternetClubUofA">Federate with us on Mastodon</a></li>
|
<li vocab="https://joinmastodon.org/verification#"><a rel="me" href="https://mstdn.ca/@LibreInternetClubUofA">Federate with us on Mastodon</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Resources:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="./pages/linux.html">Linux</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h2><marquee>Upcoming Events</marquee></h2>
|
<h2><marquee>Upcoming Events</marquee></h2>
|
||||||
<div class="infoblock">
|
|
||||||
<h1>Meetup 2!</h1>
|
<i>To be updated here....</i>
|
||||||
<p>To enter your availability: <a href="https://crab.fit/meetup-2-336168" target="_blank">https://crab.fit/meetup-2-336168</a></p>
|
|
||||||
|
<div class="infoblock" property="event">
|
||||||
|
<h2><i>Most Recent Event:</i></h2>
|
||||||
|
<h1>Meetup 2! (Linux Install Session)</h1>
|
||||||
|
<p>Saturday, June 13, 2026. 1pm. Meet up at <a href="https://www.openstreetmap.org/search?lat=53.525347&lon=-113.524075&zoom=19#map=19/53.525348/-113.524075">The Daily Grind in University Commons</a>. <s>Where we go after that is TBA, but we will update it on here.</s> (Forgot to do that, oops. Can confirm the event happened, though, and some new people showed up!)</p>
|
||||||
|
<p>Bring your laptop, and we can test or install Linux on it! It is recommended to bring the following:</p>
|
||||||
|
<ul>
|
||||||
|
<li>A USB, to boot Linux from (at least 4MB)</li>
|
||||||
|
<li>An SSD or USB (or something similar) to back up your laptop's data, if needed. It's better to have your laptop files backed up before the meetup.</li>
|
||||||
|
<li>Your ONEcard (if you're a UofA student). Might be convenient in case some places are ONEcard access-only during the weekend. Regardless, do feel free to send a message to the club Mastodon account to let us know if you get lost.</li>
|
||||||
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
<div class="infoblock">
|
<div class="infoblock" property="event">
|
||||||
<h1>Libre Local Event</h1>
|
<h1>Libre Local Event</h1>
|
||||||
<h2><i>Most Recent Event:</i></h2>
|
|
||||||
<img src="events/libre_local_1.png" style="text-align: center; display: block;" />
|
<img src="events/libre_local_1.png" style="text-align: center; display: block;" />
|
||||||
<p>Thursday, May 21, 2026 from 12-4pm @ UoA North Campus ED 262 (Education South)</p>
|
<p>Thursday, May 21, 2026 from 12-4pm @ UoA North Campus ED 262 (Education South)</p>
|
||||||
<p>This event will involve discussions, presentations, and the potential for software demos. However, we also aim for the comfort of attendees. Introverted or shy attendees may feel more comfortable simply listening in or reading some of the provided event materials, and that's OK! Attendees may move in and out of the room at any time.
|
<p>This event will involve discussions, presentations, and the potential for software demos. However, we also aim for the comfort of attendees. Introverted or shy attendees may feel more comfortable simply listening in or reading some of the provided event materials, and that's OK! Attendees may move in and out of the room at any time.
|
||||||
|
|
@ -38,11 +55,11 @@
|
||||||
<h2>
|
<h2>
|
||||||
Members
|
Members
|
||||||
</h2>
|
</h2>
|
||||||
<ul>
|
<ul rel="member">
|
||||||
<li><a href="https://sjkillen.ca">Spencer</a></li>
|
<li typeof="Person" about="https://sjkillen.ca"><a href="https://sjkillen.ca">Spencer</a></li>
|
||||||
<li>Mimi</li>
|
<li about="Mimi" typeof="Person"><span property="name">Mimi</span></li>
|
||||||
<li>PT118's Site (Outdated, as of 2024) <a href="https://periodictable118.wixsite.com/mycv"> PT118 </a> </li>
|
<li typeof="Person" >PT118's Site (Outdated, as of 2024) <a href="https://periodictable118.wixsite.com/mycv"> PT118 </a> </li>
|
||||||
<li>You! (Add yourself here using the site editor below!</li>
|
<li typeof="Person" >You! (Add yourself here using the site editor below!)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="infoblock">
|
<div class="infoblock">
|
||||||
<h2>Edit Site!</h2>
|
<h2>Edit Site!</h2>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue