Compare commits

...

10 Commits

Author SHA1 Message Date
TriMill 1bae0b679e thingate margins 2023-01-18 23:45:44 -05:00
TriMill 71f7088a10 fix home page 2023-01-17 12:02:16 -05:00
TriMill 64d5aed422 fixed link 2023-01-16 21:01:03 -05:00
TriMill b03b60fa68 fix thing 2023-01-16 20:50:29 -05:00
TriMill b1e112ae3b forgejo blog post 2023-01-16 20:48:04 -05:00
TriMill 6ed79fedc2 persistent cookies 2022-12-31 19:07:52 -05:00
TriMill e28f11e840 no more js, font change 2022-12-31 19:00:52 -05:00
TriMill 753c0c973b blog and css things 2022-12-24 01:37:56 -05:00
TriMill 73544a8aa7 small changes 2022-12-18 14:47:43 -05:00
TriMill 691c13090d fix formatting 2022-11-29 14:46:28 -05:00
8 changed files with 83 additions and 46 deletions

View File

@ -1,3 +1,6 @@
# trimill.xyz
Source code for the Flask server running [trimill.xyz](https://trimill.xyz). Licensed under [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
Source code for the Flask server running [trimill.xyz](https://trimill.xyz). All content licensed under [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html), except the following:
- Symbols from Open Iconic licensed under the [SIL Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ofl).

View File

@ -4,6 +4,7 @@ import markdown2
import datetime
import os
import ast
import datetime
markdown_extras = ["fenced-code-blocks", "footnotes", "strike", "tables", "metadata"]
@ -101,12 +102,21 @@ def create_app():
theme = request.cookies.get("theme") or "dark"
return render_template("404.html", data=data, theme=theme), 404
def get_theme():
return request.args.get("theme") or request.cookies.get("theme") or "dark"
def set_theme(resp):
resp = make_response(resp)
if request.args.get("theme"):
resp.set_cookie("theme", request.args["theme"], expires=datetime.datetime.now() + datetime.timedelta(days=30))
return resp
def load_page(url):
if url.endswith(".html"):
path = os.path.join(app.root_path, app.template_folder, url)
if os.path.exists(path):
theme = request.cookies.get("theme") or "dark"
return render_template(url, data=data, theme=theme)
theme = get_theme()
return set_theme(render_template(url, data=data, theme=theme))
else:
return abort(404)
else:
@ -129,9 +139,8 @@ def create_app():
@app.route("/blog/")
def blog_list():
theme = request.cookies.get("theme") or "dark"
return render_template("blog.html", data=data, theme=theme)
theme = get_theme()
return set_theme(render_template("blog.html", data=data, theme=theme))
@app.route("/blog/<int:y>/<int:m>/<int:d>/")
@app.route("/blog/<int:y>/<int:m>/<int:d>/<int:n>")
@ -144,8 +153,8 @@ def create_app():
contents = f.read()
content = markdown2.markdown(contents, extras=markdown_extras)
meta = content.metadata
theme = request.cookies.get("theme") or "dark"
return render_template("_blog.html", data=data, theme=theme, content=content, date=date, meta=meta)
theme = get_theme()
return set_theme(render_template("_blog.html", data=data, theme=theme, content=content, date=date, meta=meta))
else:
return abort(404)

View File

@ -5,6 +5,7 @@ timestamp: 2022-11-29T14:42:00-05:00
---
This post serves two purposes:
- To announce a new RSS Bundler feature
- To test said RSS Bundler feature

View File

@ -0,0 +1,20 @@
---
title: Pie
desc: the optimal food
timestamp: 2022-12-24T01:36:00-05:00
---
> If you could only eat one food for the rest of your life, which would you choose?
Pie.
I have heard many people answer this question with "pizza". I understand the spirit of this answer; there are nearly endless permutations of pizza toppings, one could easily eat a different pizza for every meal of ones life without repeat.[^1]
What these people forget is that pizza is, in fact, a subset of pie. By broadening the answer to pie, we include all pizzas as well as all other kinds of pies. Much like pizzas, there are many different kinds of pies appropriate for various occasions: dessert pies, meat or vegetable pies, and quiches, to name a few.
If you are not happy with preexisting pies, it is quite simple to innovate an entirely new pie. Simply construct a rigid, breadlike crust and fill it with arbitrary other foodstuffs (including at least one liquidious or saucy food, to bind the others together). Ideally, these ingredients would taste good in combination.
With pie, the possibilities are endless.
[^1]: [this list](https://thepizzacalc.com/pizza-toppings-list-4/) includes 80 standard pizza toppings. this yields $$ 2^{80} $$ possible pizzas. if a human lives for 100 years and eats 3 meals per day, they will eat about 110,000 meals, which is far less than $$ 2^{80} $$.

View File

@ -0,0 +1,11 @@
---
title: Forgejo
desc: Updates regarding g.trimill.xyz
timestamp: 2023-01-16T20:00:00-05:00
---
Recently, [Gitea](https://gitea.io/) (which I had previously been using to self-host [my git server](https://g.trimill.xyz/)) has [found itself](https://blog.gitea.io/2022/10/open-source-sustainment-and-the-future-of-gitea/) under the control of a for-profit organization. As often happens after occurrences like these, it was quickly forked into [Forgejo](https://forgejo.org/) (/forˈd͡ʒe.jo/), which is community-governed rather than being run by a corporation. (sidenote: gitea itself was originally a fork of another project called [gogs](https://gogs.io/) and was created due to disagreements over governance. oh how history repeats itself!)
Switching from Gitea to Forgejo proved to be very easy. Forgejo isn't yet available in any Debian repos, so I had to install it manually and create a new systemd service for it (this can be done trivially by copying and modifying `gitea.service`). After this was done, everything Just Worked™ and through the whole process I only experienced a minute or two of downtime.
So far Forgejo includes some new themes and privacy enhancements, but they plan on adding [ForgeFed](https://forgefed.org/) support soon which will be quite cool.

View File

@ -1,7 +1,7 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@500&family=Source+Sans+Pro:wght@400&family=Fira+Mono&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;700&family=Lato:ital,wght@0,400;0,700;1,400;1,700&family=Roboto+Slab:wght@500&display=swap');
@media (prefers-color-scheme: dark) {
:root[theme="system"] {
:root.theme-system {
--bg: #242328;
--bg-intense: #141316;
--bg-faded: #373338;
@ -19,7 +19,7 @@
}
@media (prefers-color-scheme: light) {
:root[theme="system"] {
:root.theme-system {
--bg: #f6f5f2;
--bg-intense: #ffffff;
--bg-faded: #cbc4c7;
@ -36,7 +36,7 @@
}
}
:root[theme="dark"] {
:root.theme-dark {
--bg: #242328;
--bg-intense: #141316;
--bg-faded: #373338;
@ -49,7 +49,7 @@
--error: #ee6d7d;
}
:root[theme="light"] {
:root.theme-light {
--bg: #f6f5f2;
--bg-intense: #ffffff;
--bg-faded: #cbc4c7;
@ -62,7 +62,7 @@
--error: #a50518;
}
:root[theme="contrast"] {
:root.theme-contrast {
--bg: white;
--bg-intense: white;
--bg-faded: #d0d0d0;
@ -75,7 +75,7 @@
--error: #880000;
}
:root[theme="contrast-dark"] {
:root.theme-contrast-dark {
--bg: black;
--bg-intense: black;
--bg-faded: #333333;
@ -88,7 +88,7 @@
--error: #ff8888;
}
:root[theme="special"] {
:root.theme-special {
--bg: #ffff00;
--bg-intense: #ffffff;
--bg-faded: #00ff00;
@ -104,7 +104,7 @@
:root {
color: var(--fg);
font-family: "Source Sans Pro", sans-serif;
font-family: "Lato", sans-serif;
font-size: 20px;
font-weight: 400;
line-height: 1.5;
@ -205,6 +205,12 @@ p {
margin-bottom: 10px;
}
blockquote {
border-left: 2px solid var(--fg-faded);
margin-left: 2px;
padding-left: 15px;
}
code, pre {
background-color: var(--bg-intense);
padding-left: 3px;
@ -228,7 +234,7 @@ button, input, select, textarea {
background-color: var(--bg-faded);
border: 2px solid var(--fg-faded);
border-radius: 3px;
font-family: "Source Sans Pro", sans-serif;
font-family: "Lato", sans-serif;
font-size: 16px;
}

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en" theme="{{ theme }}">
<html lang="en" class="theme-{{ theme }}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ meta.title }} - TriMill</title>
<title>{{ meta.title }}</title>
<meta name="author" content="TriMill" />
<meta name="author" content="trimill" />
<meta name="description" content="{{ meta.desc }}" />
<meta property="og:description" content="{{ meta.desc }}" />
<meta property="og:title" content="{{ meta.title }}" />
@ -23,7 +23,7 @@
{% if meta.fullscreen == True %}
width: 100%;
{% else %}
width: min({{ meta.pagewidth or "750px"}}, 90vw);
width: min({{ meta.pagewidth or "900px"}}, 90vw);
{% endif %}
}
</style>
@ -31,22 +31,6 @@
<meta itemprop="name" content="{{ meta.title }}" />
<meta itemprop="description" content="{{ meta.desc }}" />
<script>
function updateTheme() {
let theme = "{{ theme }}" || "dark";
let new_theme;
if(event.shiftKey) {
new_theme = "special";
} else {
new_theme = {{ data.next_theme | safe }}[theme] || "dark";
}
let expiry = new Date().getTime() + 1000*60*60*24*90;
document.cookie = "theme=" + new_theme
+ ";expires=" + expiry
+ ";path=/";
location.reload();
}
</script>
{% block head %} {% endblock %}
</head>
<body>
@ -55,7 +39,9 @@
<a href="/">Home</a> ·
<a href="/projects/">Projects</a> ·
<a href="/blog/">Blog™</a> ·
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8" onclick="updateTheme()">
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
<a href="?theme={{ data.next_theme[theme] | safe }}">
<rect width="8" height="8" fill="#00000000" />
{% if theme == "dark" %}
<path d="M2.72 0c-1.58.53-2.72 2.02-2.72 3.78 0 2.21 1.79 4 4 4 1.76 0 3.25-1.14 3.78-2.72-.4.13-.83.22-1.28.22-2.21 0-4-1.79-4-4 0-.45.08-.88.22-1.28z" />
<title>Dark theme</title>
@ -76,6 +62,7 @@
<path d="M3.41 0a.5.5 0 0 0-.13.06l-3 1.5a.5.5 0 1 0 .44.88l3-1.5a.5.5 0 0 0-.31-.94zm1 1.5a.5.5 0 0 0-.13.06l-4 2a.5.5 0 1 0 .44.88l4-2a.5.5 0 0 0-.31-.94zm0 2a.5.5 0 0 0-.13.06l-3 1.5a.5.5 0 0 0 .22.94h2a.5.5 0 0 0 .16-1l1.06-.56a.5.5 0 0 0-.31-.94zm-2.56 3.5a.5.5 0 0 0 .16 1h1a.5.5 0 1 0 0-1h-1a.5.5 0 0 0-.09 0 .5.5 0 0 0-.06 0z" transform="translate(1)" />
<title>System default theme</title>
{% endif %}
</a>
</svg>
</nav>
<hr style="width: 100%"/>

View File

@ -1,4 +1,4 @@
{% set meta = {"title": "Home", "desc": "Home page"} %}
{% set meta = {"title": "trimill", "desc": "Home page"} %}
{% extends "/_base.html" %}
{% block content %}
@ -11,8 +11,8 @@ this page. Enjoy.
<h2>About</h2>
<p>
I am a person (proof of this fact is left to the reader) who has been granted an internet connection and uses
it extensively for assorted purposes. Much of my time not spent sleeping is spent doing mathematics,
programming (preferably in Rust), Minecraft, conlangs, twisty puzzles, and chess.
it extensively for assorted purposes. I enjoy many things, most of which involve manipulating some state
according to various sets of rules.
</p>
<h2>GEORGE</h2>
<p>
@ -38,14 +38,14 @@ below to view the GEORGE homepage or access the previous and next members in the
<p>
Email: trimill012 ("at" sign) gmail (full stop) com <br />
Discord: trimill#6898 <br />
Gitea: <a href="https://g.trimill.xyz/">trimill</a> <br />
GitHub (legacy): <a href="https://github.com/TriMill/">TriMill</a> <br />
Youtube: <a href="https://www.youtube.com/channel/UC2rXSxR9jbihjAE8dAIKCaw">TriMill</a> <br />
Forgejo: <a href="https://g.trimill.xyz/">trimill</a> <br />
GitHub: <a href="https://github.com/TriMill/">trimill</a> <br />
Youtube: <a href="https://www.youtube.com/@trimill012">trimill</a> <br />
</p>
<h2>Source code & attribution</h2>
<p>
The source code for this website is available <a href="https://g.trimill.xyz/trimill/trimill.xyz/">on Gitea</a> and is
The source code for this website is available <a href="https://g.trimill.xyz/trimill/trimill.xyz/">on my Forgejo instance</a> and is
released under the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GNU GPLv3</a> free and open-source license.
It is built using the <a href="https://flask.palletsprojects.com/en/2.1.x/">Flask</a> web framework and incorporates
icons from <a href="https://useiconic.com/open">Open Iconic</a>. The <a href="https://citrons.xyz/a/memetic-apioform-page.html">memetic apioform page</a>