commit 61488a040a58c2d37520d3a6d6883f6e01a99bca
parent e3b4fbdebec9462f7f468c876f7502c0de2b56b2
Author: Damian Myrda <damian@prime8.dev>
Date: Wed, 18 Feb 2026 14:45:47 -0600
style: apply pre-commit formatting
Diffstat:
18 files changed, 109 insertions(+), 156 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
@@ -0,0 +1,19 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0
+ hooks:
+ - id: end-of-file-fixer
+ - id: trailing-whitespace
+ - id: check-yaml
+ - id: check-json
+ - repo: https://github.com/psf/black
+ rev: 23.12.1
+ hooks:
+ - id: black
+ language_version: python3
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v3.1.0
+ hooks:
+ - id: prettier
+ types_or:
+ [javascript, jsx, ts, tsx, css, scss, json, yaml, markdown, html]
diff --git a/README.md b/README.md
@@ -10,15 +10,15 @@ A website for Computer Science Club made during a mini-hackathon.
The following environment variables are required:
-| Variable | Description | Required |
-|----------|-------------|----------|
-| `DOMAIN` | The URL where this app is hosted | Yes |
-| `SECRET_KEY` | Flask session secret key (auto-generated if not set) | No |
-| `GROUP_ID` | Schoology group ID (found in the URL after `/group/`) | Yes |
-| `SCHOOLOGY_DOMAIN` | Your Schoology instance domain (e.g., `schoology.example.com`) | Yes |
-| `SCHOOLOGY_API_KEY` | Schoology API key | Yes |
-| `SCHOOLOGY_API_SECRET` | Schoology API secret | Yes |
-| `FLASK_ENV` | Set to `development` to allow HTTP OAuth (insecure) | No |
+| Variable | Description | Required |
+| ---------------------- | -------------------------------------------------------------- | -------- |
+| `DOMAIN` | The URL where this app is hosted | Yes |
+| `SECRET_KEY` | Flask session secret key (auto-generated if not set) | No |
+| `GROUP_ID` | Schoology group ID (found in the URL after `/group/`) | Yes |
+| `SCHOOLOGY_DOMAIN` | Your Schoology instance domain (e.g., `schoology.example.com`) | Yes |
+| `SCHOOLOGY_API_KEY` | Schoology API key | Yes |
+| `SCHOOLOGY_API_SECRET` | Schoology API secret | Yes |
+| `FLASK_ENV` | Set to `development` to allow HTTP OAuth (insecure) | No |
### Schoology
diff --git a/database.py b/database.py
@@ -5,9 +5,7 @@ import json
class Database:
def __init__(self):
- self.connection = sqlite3.connect(
- "database.db", check_same_thread=False
- )
+ self.connection = sqlite3.connect("database.db", check_same_thread=False)
self.cursor = self.connection.cursor()
self.cursor.execute(
"""CREATE TABLE IF NOT EXISTS projects (
diff --git a/main.py b/main.py
@@ -20,23 +20,17 @@ app.secret_key = os.environ.get("SECRET_KEY", secrets.token_hex(32))
@app.route("/")
def index():
- return render_template(
- "home.html", group=group, account=session.get("name")
- )
+ return render_template("home.html", group=group, account=session.get("name"))
@app.route("/updates")
def updates():
- return render_template(
- "updates.html", group=group, account=session.get("name")
- )
+ return render_template("updates.html", group=group, account=session.get("name"))
@app.route("/discussions")
def discussions():
- return render_template(
- "discussions.html", group=group, account=session.get("name")
- )
+ return render_template("discussions.html", group=group, account=session.get("name"))
@app.route("/projects", methods=["GET", "POST"])
@@ -69,9 +63,7 @@ def add_project():
@app.route("/members")
def members():
- return render_template(
- "members.html", group=group, account=session.get("name")
- )
+ return render_template("members.html", group=group, account=session.get("name"))
import requests
@@ -113,9 +105,7 @@ def login_callback():
credentials = flow.credentials
request_session = requests.session()
cached_session = CacheControl(request_session)
- token_request = google.auth.transport.requests.Request(
- session=cached_session
- )
+ token_request = google.auth.transport.requests.Request(session=cached_session)
id_info = id_token.verify_oauth2_token(
id_token=credentials._id_token,
request=token_request,
diff --git a/static/intro.css b/static/intro.css
@@ -4,7 +4,8 @@
text-align: center;
}
-html, body {
+html,
+body {
width: 100%;
height: 100%;
margin: 0;
diff --git a/static/main.css b/static/main.css
@@ -5,7 +5,8 @@
font-size: 16px;
}
-html, body {
+html,
+body {
width: 100%;
height: 100%;
margin: 0;
@@ -26,7 +27,7 @@ center {
font-size: 32px;
}
-input, textarea {
+input,
+textarea {
color: black;
}
-
diff --git a/templates/discussions.html b/templates/discussions.html
@@ -1,8 +1,8 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
<head>
- {% import "elements/metadata.html" as metadata %}
- {{ metadata.head(group, "Discussions") }}
+ {% import "elements/metadata.html" as metadata %} {{ metadata.head(group,
+ "Discussions") }}
<link
rel="stylesheet"
href="{{ url_for('static', filename='main.css') }}"
@@ -11,15 +11,14 @@
<body>
<header>
- {% import "elements/navigation.html" as navigation %}
- {{ navigation.bar(account) }}
+ {% import "elements/navigation.html" as navigation %} {{
+ navigation.bar(account) }}
</header>
- {% import "elements/space.html" as space %}
- {{ space.stars(500) }}
+ {% import "elements/space.html" as space %} {{ space.stars(500) }}
<h1>Discussions</h1>
- {% import "elements/discussions.html" as discussions %}
- {{ discussions.list(group.discussions) }}
+ {% import "elements/discussions.html" as discussions %} {{
+ discussions.list(group.discussions) }}
</body>
</html>
diff --git a/templates/elements/authors.html b/templates/elements/authors.html
@@ -1,9 +1,8 @@
{% macro view(author) -%}
<a>{{ author }}</a>
-{%- endmacro %}
-
-{% macro list(authors) -%}
+{%- endmacro %} {% macro list(authors) -%}
<div>
- By: {{ view(authors[0]) }}{% for author in authors[1:] %}, {{ author }}{% endfor %}
+ By: {{ view(authors[0]) }}{% for author in authors[1:] %}, {{ author }}{%
+ endfor %}
</div>
{%- endmacro %}
diff --git a/templates/elements/datetime.html b/templates/elements/datetime.html
@@ -1,7 +1,3 @@
-{% macro time(time) -%}
-{{ "{:02}:{:02}".format(time.hour, time.minute) }}
-{%- endmacro %}
-
-{% macro date(date) -%}
-{{ "{:04}.{:02}.{:02}".format(date.year, date.month, date.day) }}
-{%-endmacro %}
+{% macro time(time) -%} {{ "{:02}:{:02}".format(time.hour, time.minute) }} {%-
+endmacro %} {% macro date(date) -%} {{ "{:04}.{:02}.{:02}".format(date.year,
+date.month, date.day) }} {%-endmacro %}
diff --git a/templates/elements/discussions.html b/templates/elements/discussions.html
@@ -2,10 +2,7 @@
<a target="_blank" href="{{ discussion.link }}">
{{ discussion.name }} {{ discussion.description }}
</a>
-{%- endmacro %}
-
-{% macro list(discussions) -%}
-{% for discussion in discussions %}
+{%- endmacro %} {% macro list(discussions) -%} {% for discussion in discussions
+%}
<div>{{ view(discussion) }}</div>
-{% endfor %}
-{%- endmacro %}
+{% endfor %} {%- endmacro %}
diff --git a/templates/elements/events.html b/templates/elements/events.html
@@ -5,19 +5,13 @@
if event.end %} {% if event.differentDay %} to {{ datetime.date(event.end) }}
{% endif %} {% endif %}
</a>
-{%- endmacro %}
-
-{% macro next(event) -%}
+{%- endmacro %} {% macro next(event) -%}
<a target="_blank" href="{{ event.link }}">
- Upcoming: {{ event.name }} at {{ datetime.time(event.start) }} {% if event.end %} to {{
- datetime.time(event.end) }} {% endif %} on {{ datetime.date(event.start) }} {%
- if event.end %} {% if event.differentDay %} to {{ datetime.date(event.end) }}
- {% endif %} {% endif %}
+ Upcoming: {{ event.name }} at {{ datetime.time(event.start) }} {% if event.end
+ %} to {{ datetime.time(event.end) }} {% endif %} on {{
+ datetime.date(event.start) }} {% if event.end %} {% if event.differentDay %}
+ to {{ datetime.date(event.end) }} {% endif %} {% endif %}
</a>
-{%- endmacro %}
-
-{% macro upcoming(events) -%}
-{% for event in events %}
+{%- endmacro %} {% macro upcoming(events) -%} {% for event in events %}
<div>{{ view(event) }}</div>
-{% endfor %}
-{%- endmacro %}
+{% endfor %} {%- endmacro %}
diff --git a/templates/elements/metadata.html b/templates/elements/metadata.html
@@ -1,5 +1,3 @@
{% macro head(group, subsection) -%}
-<title>
- CSC {% if subsection %} - {{ subsection }} {% endif %}
-</title>
+<title>CSC {% if subsection %} - {{ subsection }} {% endif %}</title>
{%- endmacro %}
diff --git a/templates/elements/projects.html b/templates/elements/projects.html
@@ -1,32 +1,20 @@
-{% import "elements/authors.html" as authors %}
-
-{% macro view(project) -%}
+{% import "elements/authors.html" as authors %} {% macro view(project) -%}
<h2>{{ project.name }}</h2>
{% if project.description %}
<p>{{ project.description }}</p>
-{% endif %}
-{% if project.source %}
+{% endif %} {% if project.source %}
<a target="_blank" href="{{ project.source }}">Source Code</a>
<br />
-{% endif %}
-{{ authors.list(project.authors) }}
-{% if project.images %}
-{% for image in project.images %}
+{% endif %} {{ authors.list(project.authors) }} {% if project.images %} {% for
+image in project.images %}
<img src="{{ image }}" />
-{% endfor %}
-{% endif %}
-{%- endmacro %}
-
-{% macro list(projects) -%}
-{% for project in projects %}
+{% endfor %} {% endif %} {%- endmacro %} {% macro list(projects) -%} {% for
+project in projects %}
<div>
{{ view(project) }}
<br />
</div>
-{% endfor %}
-{%- endmacro %}
-
-{% macro new() -%}
+{% endfor %} {%- endmacro %} {% macro new() -%}
<center>
<h1>Add New Project</h1>
<form method="post" enctype="multipart/form-data">
diff --git a/templates/elements/updates.html b/templates/elements/updates.html
@@ -1,20 +1,10 @@
-{% import "elements/datetime.html" as datetime %}
-
-{% macro recent(update) -%}
-<p>
- Annoucement from {{ update.member.name }}: {{ update.content }}
-</p>
-{%- endmacro %}
-
-{% macro view(update) -%}
+{% import "elements/datetime.html" as datetime %} {% macro recent(update) -%}
+<p>Annoucement from {{ update.member.name }}: {{ update.content }}</p>
+{%- endmacro %} {% macro view(update) -%}
<p>
{{ update.member.name }} on {{ datetime.date(update.created) }} at {{
datetime.time(update.created) }}: {{ update.content }}
</p>
-{%- endmacro %}
-
-{% macro list(updates) -%}
-{% for update in updates %}
+{%- endmacro %} {% macro list(updates) -%} {% for update in updates %}
<div>{{ view(update) }}</div>
-{% endfor %}
-{%- endmacro %}
+{% endfor %} {%- endmacro %}
diff --git a/templates/home.html b/templates/home.html
@@ -1,8 +1,7 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
<head>
- {% import "elements/metadata.html" as metadata %}
- {{ metadata.head(group)}}
+ {% import "elements/metadata.html" as metadata %} {{ metadata.head(group)}}
<link
rel="stylesheet"
href="{{ url_for('static', filename='main.css') }}"
@@ -15,24 +14,18 @@
navigation.bar(account) }}
</header>
- {% import "elements/space.html" as space %}
- {{ space.stars(500) }}
+ {% import "elements/space.html" as space %} {{ space.stars(500) }}
<center>
<h1 id="title">{{ group.name }}</h1>
<p>{{ group.description }}</p>
- {% import "elements/events.html" as events %}
- {% if group.events | length > 0 %}
- {{ events.next(group.events[0]) }}
- {% else %}
- <p>No upcoming events.</p>
- {% endif %}
-
- {% import "elements/updates.html" as updates %}
- {% if group.updates | length > 0 %}
- {{ updates.recent(group.updates[0]) }}
- {% else %}
- <p>No recent updates.</p>
+ {% import "elements/events.html" as events %} {% if group.events | length
+ > 0 %} {{ events.next(group.events[0]) }} {% else %}
+ <p>No upcoming events.</p>
+ {% endif %} {% import "elements/updates.html" as updates %} {% if
+ group.updates | length > 0 %} {{ updates.recent(group.updates[0]) }} {%
+ else %}
+ <p>No recent updates.</p>
{% endif %}
</center>
</body>
diff --git a/templates/members.html b/templates/members.html
@@ -1,8 +1,8 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
<head>
- {% import "elements/metadata.html" as metadata %}
- {{ metadata.head(group, "Members") }}
+ {% import "elements/metadata.html" as metadata %} {{ metadata.head(group,
+ "Members") }}
<link
rel="stylesheet"
href="{{ url_for('static', filename='intro.css') }}"
@@ -10,8 +10,7 @@
</head>
<body>
- {% import "elements/space.html" as space %}
- {{ space.stars(200) }}
+ {% import "elements/space.html" as space %} {{ space.stars(200) }}
<div id="board">
<div id="content">
<center>
diff --git a/templates/projects.html b/templates/projects.html
@@ -1,12 +1,9 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
<head>
- {% import "elements/metadata.html" as metadata %}
- {% if create %}
- {{ metadata.head(group, "New Project") }}
- {% else %}
- {{ metadata.head(group, "Projects") }}
- {% endif %}
+ {% import "elements/metadata.html" as metadata %} {% if create %} {{
+ metadata.head(group, "New Project") }} {% else %} {{ metadata.head(group,
+ "Projects") }} {% endif %}
<link
rel="stylesheet"
href="{{ url_for('static', filename='main.css') }}"
@@ -15,21 +12,16 @@
<body>
<header>
- {% import "elements/navigation.html" as navigation %}
- {{ navigation.bar(account) }}
+ {% import "elements/navigation.html" as navigation %} {{
+ navigation.bar(account) }}
</header>
- {% import "elements/space.html" as space %}
- {{ space.stars(500) }}
- {% import "elements/projects.html" as projects %}
- {% if create %}
- {{ projects.new() }}
+ {% import "elements/space.html" as space %} {{ space.stars(500) }} {% import
+ "elements/projects.html" as projects %} {% if create %} {{ projects.new() }}
{% else %}
<h1>Projects</h1>
- {{ projects.list(group.projects) }}
- {% if account %}
+ {{ projects.list(group.projects) }} {% if account %}
<a href="/projects/add">Add a Project</a>
- {% endif %}
- {% endif %}
+ {% endif %} {% endif %}
</body>
</html>
diff --git a/templates/updates.html b/templates/updates.html
@@ -1,8 +1,8 @@
-<!DOCTYPE html>
+<!doctype html>
<html>
<head>
- {% import "elements/metadata.html" as metadata %}
- {{ metadata.head(group, "Updates") }}
+ {% import "elements/metadata.html" as metadata %} {{ metadata.head(group,
+ "Updates") }}
<link
rel="stylesheet"
href="{{ url_for('static', filename='main.css') }}"
@@ -11,15 +11,14 @@
<body>
<header>
- {% import "elements/navigation.html" as navigation %}
- {{ navigation.bar(account) }}
+ {% import "elements/navigation.html" as navigation %} {{
+ navigation.bar(account) }}
</header>
- {% import "elements/space.html" as space %}
- {{ space.stars(500) }}
+ {% import "elements/space.html" as space %} {{ space.stars(500) }}
<h1>Updates</h1>
- {% import "elements/updates.html" as updates %}
- {{ updates.list(group.updates) }}
+ {% import "elements/updates.html" as updates %} {{
+ updates.list(group.updates) }}
</body>
</html>