Add matrix icon and missing icon logic files

This commit is contained in:
Kuba Orlik 2026-06-02 13:29:18 +02:00
parent b5ee6ad904
commit f96c70d85e
5 changed files with 84 additions and 0 deletions

28
src/back/icons.ts Normal file
View File

@ -0,0 +1,28 @@
import { promises as fs } from "fs";
import path from "path";
import _locreq from "locreq";
const locreq = _locreq(import.meta.dirname);
const cache = {} as Record<string, Promise<string> | undefined>;
export const svg_icon_path = "src/icons";
async function getIconUncached(icon_name: string): Promise<string> {
return fs.readFile(
locreq.resolve(path.resolve(svg_icon_path, icon_name + ".svg")),
"utf-8"
);
}
export async function icon(icon_name: string) {
if (!cache[icon_name]) {
cache[icon_name] = getIconUncached(icon_name);
}
try {
return cache[icon_name];
} catch (e) {
console.error(e);
return "";
}
}

View File

@ -6,6 +6,7 @@ import { TempstreamJSX } from "tempstream";
const icons = [ const icons = [
{ name: "mastodon", url: "https://mastodon.com.pl" }, { name: "mastodon", url: "https://mastodon.com.pl" },
{ name: "peertube", url: "https://joinpeertube.org/pl" }, { name: "peertube", url: "https://joinpeertube.org/pl" },
{ name: "matrix", url: "https://matrix.org/" },
]; ];
export default async function footer(ctx: Context) { export default async function footer(ctx: Context) {

11
src/icons/mastodon.svg Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="icon" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<defs>
<style>
.cls-1 {
fill: none;
}
</style>
</defs>
<path d="m29.0581,11.1929c0-6.0742-3.9797-7.8545-3.9797-7.8545-2.0066-.9214-5.4522-1.3091-9.0318-1.3384h-.0879c-3.5798.0293-7.023.417-9.0296,1.3384,0,0-3.98,1.7803-3.98,7.8545,0,1.3911-.0271,3.0537.0171,4.8174.1445,5.9404,1.0889,11.7945,6.5811,13.2481,2.5322.6704,4.7063.8105,6.4573.7144,3.1755-.1758,4.958-1.1333,4.958-1.1333l-.1047-2.3037s-2.269.7153-4.8176.6284c-2.5249-.0869-5.1902-.2725-5.5986-3.3726-.0378-.272-.0566-.563-.0566-.8691,0,0,2.4785.606,5.6196.75,1.9207.0879,3.7219-.1128,5.5515-.3311,3.5083-.4189,6.563-2.5806,6.9468-4.5557.605-3.1113.5552-7.5928.5552-7.5928Zm-4.6943,7.8257h-2.9138v-7.1382c0-1.5049-.6331-2.2686-1.8997-2.2686-1.4002,0-2.1018.9058-2.1018,2.6973v3.9077h-2.8967v-3.9077c0-1.7915-.7019-2.6973-2.1021-2.6973-1.2666,0-1.8997.7637-1.8997,2.2686v7.1382h-2.9138v-7.3545c0-1.5029.3828-2.6978,1.1516-3.5811.7927-.8838,1.8308-1.3369,3.1196-1.3369,1.491,0,2.6204.5732,3.367,1.7192l.7256,1.2168.7261-1.2168c.7463-1.146,1.8755-1.7192,3.3667-1.7192,1.2886,0,2.3267.4531,3.1196,1.3369.7686.8833,1.1514,2.0781,1.1514,3.5811v7.3545Z" fill="__color"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

28
src/icons/matrix.svg Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
viewBox="0 0 32 32"
id="svg3"
width="32"
height="32"
>
<defs
id="defs3" />
<title
id="title1">Matrix (protocol) logo</title>
<g
transform="translate(1.982,0.036)"
fill="#040404"
id="g3">
<path
d="M 27.1,31.2 V 0.7 h -2.19 v -0.732 h 3.04 v 32 h -3.04 v -0.732 z"
id="path1" />
<path
d="m 8.23,10.4 v 1.54 h 0.044 c 0.385,-0.564 0.893,-1.03 1.49,-1.37 0.58,-0.323 1.25,-0.485 1.99,-0.485 0.72,0 1.38,0.14 1.97,0.42 0.595,0.279 1.05,0.771 1.36,1.48 0.338,-0.5 0.796,-0.941 1.38,-1.32 0.58,-0.383 1.27,-0.574 2.06,-0.574 0.602,0 1.16,0.074 1.67,0.22 0.514,0.148 0.954,0.383 1.32,0.707 0.366,0.323 0.653,0.746 0.859,1.27 0.205,0.522 0.308,1.15 0.308,1.89 v 7.63 h -3.13 v -6.46 c 0,-0.383 -0.015,-0.743 -0.044,-1.08 -0.0209,-0.307 -0.103,-0.607 -0.242,-0.882 -0.133,-0.251 -0.336,-0.458 -0.584,-0.596 -0.257,-0.146 -0.606,-0.22 -1.05,-0.22 -0.44,0 -0.796,0.085 -1.07,0.253 -0.272,0.17 -0.485,0.39 -0.639,0.662 -0.159,0.287 -0.264,0.602 -0.308,0.927 -0.052,0.347 -0.078,0.697 -0.078,1.05 v 6.35 h -3.13 v -6.4 c 0,-0.338 -0.007,-0.673 -0.021,-1 -0.0114,-0.314 -0.0749,-0.623 -0.188,-0.916 -0.108,-0.277 -0.3,-0.512 -0.55,-0.673 -0.258,-0.168 -0.636,-0.253 -1.14,-0.253 -0.198,0.0083 -0.394,0.042 -0.584,0.1 -0.258,0.0745 -0.498,0.202 -0.705,0.374 -0.228,0.184 -0.422,0.449 -0.584,0.794 -0.161,0.346 -0.242,0.798 -0.242,1.36 v 6.62 h -3.13 v -11.4 z"
id="path2" />
<path
d="m 0.936,0.732 v 30.5 h 2.19 v 0.732 h -3.04 v -32 h 3.03 v 0.732 z"
id="path3" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

16
src/icons/peertube.svg Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg
fill="#000000"
width="32"
height="32"
viewBox="0 0 0.96 0.96"
role="img"
version="1.1"
>
<path
d="M 0.17882848,0.02791469 V 0.48595566 L 0.5223592,0.25693517 Z m 0,0.45804097 V 0.94399661 L 0.5223592,0.71497613 Z M 0.5223592,0.25693517 V 0.71497613 L 0.86588992,0.48595566 Z"
id="path1"
style="stroke-width:0.0381701" />
</svg>

After

Width:  |  Height:  |  Size: 505 B