From 79fd506d30eef3d113f4a8e3ab9ebd9004f1e8cc Mon Sep 17 00:00:00 2001 From: João Augusto Costa Branco Marado Torres Date: Sat, 28 Jun 2025 18:14:22 -0300 Subject: feat: index page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Augusto Costa Branco Marado Torres --- src/components/BaseHead.astro | 54 ++++++----- src/components/Commit.astro | 49 ---------- src/components/CopyrightNotice.astro | 5 +- src/components/Footer.astro | 125 ++++++++++++++++-------- src/components/Header.astro | 69 +++++++++---- src/components/HeaderLink.astro | 18 ---- src/components/Search.astro | 32 ------- src/components/organisms/ActiveLink.astro | 18 ++++ src/components/organisms/Date.astro | 14 +++ src/components/organisms/KeywordsList.astro | 31 ++++++ src/components/signature/Authors.astro | 8 +- src/components/templates/MicroBlog.astro | 114 ++++++++++++++++++++++ src/components/templates/Search.astro | 67 +++++++++++++ src/components/templates/SimplePostList.astro | 81 ++++++++++++++++ src/consts.ts | 29 ------ src/content.config.ts | 103 +------------------- src/custom-attributes.d.ts | 8 ++ src/layouts/Base.astro | 12 +-- src/lib/collection/helpers.ts | 107 +++++++++++++++++++++ src/lib/collection/schemas.ts | 133 ++++++++++++++++++++++++++ src/lib/env.ts | 68 +++++++++++++ src/lib/git/log.ts | 3 + src/lib/pgp/sign.ts | 1 + src/lib/pgp/trust.ts | 5 +- src/lib/pgp/user.ts | 33 +++++++ src/lib/pgp/verify.ts | 39 +------- src/pages/blog/[...year].astro | 30 +++--- src/pages/blog/micro/[page].astro | 32 +++++++ src/pages/blog/read/[...slug].astro | 74 +++++++------- src/pages/index.astro | 104 ++++++++++++++++++-- src/pages/robots.txt.ts | 4 +- src/pages/rss.xml.js | 16 ---- src/pages/rss.xml.ts | 32 +++++++ src/styles/global.css | 101 +++++++++++++++---- src/utils/datetime.test.ts | 1 - 35 files changed, 1162 insertions(+), 458 deletions(-) delete mode 100644 src/components/Commit.astro delete mode 100644 src/components/HeaderLink.astro delete mode 100644 src/components/Search.astro create mode 100644 src/components/organisms/ActiveLink.astro create mode 100644 src/components/organisms/Date.astro create mode 100644 src/components/organisms/KeywordsList.astro create mode 100644 src/components/templates/MicroBlog.astro create mode 100644 src/components/templates/Search.astro create mode 100644 src/components/templates/SimplePostList.astro create mode 100644 src/custom-attributes.d.ts create mode 100644 src/lib/collection/helpers.ts create mode 100644 src/lib/collection/schemas.ts create mode 100644 src/lib/env.ts create mode 100644 src/lib/pgp/user.ts create mode 100644 src/pages/blog/micro/[page].astro delete mode 100644 src/pages/rss.xml.js create mode 100644 src/pages/rss.xml.ts (limited to 'src') diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 5ac0410..b4dbb74 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,8 +1,6 @@ --- -// Import the global.css file here so that it is included on -// all pages through the use of the component. +import { env } from "@lib/env"; import "../styles/global.css"; -import { SITE_AUTHOR, SITE_DESCRIPTION, SITE_TITLE } from "../consts"; import { ClientRouter } from "astro:transitions"; export interface Props { @@ -12,11 +10,24 @@ export interface Props { keywords?: string[]; } +const { + PUBLIC_SITE_TITLE, + PUBLIC_SITE_DESCRIPTION, + PUBLIC_SITE_AUTHOR, + PUBLIC_TOR_URL, +} = env; + +const isOnion = Astro.url.origin.endsWith(".onion"); +const alternate = !isOnion ? PUBLIC_TOR_URL : Astro.site; + const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { title, description = SITE_DESCRIPTION, image, keywords = [] } = - Astro.props; -// const socialImage = image ?? Astro.site.href + 'assets/social.png' +const { + title, + description = PUBLIC_SITE_DESCRIPTION, + image = new URL("favicon.svg", Astro.site), + keywords = [], +} = Astro.props; --- @@ -28,24 +39,30 @@ const { title, description = SITE_DESCRIPTION, image, keywords = [] } = + {title} - + {keywords.length > 0 && } - + @@ -54,26 +71,13 @@ const { title, description = SITE_DESCRIPTION, image, keywords = [] } = -{image && } + -{image && } + - - diff --git a/src/components/Commit.astro b/src/components/Commit.astro deleted file mode 100644 index 3ee284a..0000000 --- a/src/components/Commit.astro +++ /dev/null @@ -1,49 +0,0 @@ ---- -import type { Commit } from "@lib/git/types"; -import { gitDir } from "@lib/git"; - -type Props = Commit; - -const { hash, files, author, signature } = Astro.props; - -const git = await gitDir; ---- -

Git commit info:

-
-
Hash
-
{hash}
-
Files
- {files.map((file) =>
{file.pathname.replace(git, "")}
)} -
Author
-
{author.name} <{author.email}>
- { - signature && ( -
Commit Signature
-
-
-
Type
-
{signature.type}
-
Signer
-
{signature.signerName}
-
Key fingerprint
-
{signature.keyFingerPrint}
-
-
- ) - } -
- - diff --git a/src/components/CopyrightNotice.astro b/src/components/CopyrightNotice.astro index 2aa72ad..6b3bd48 100644 --- a/src/components/CopyrightNotice.astro +++ b/src/components/CopyrightNotice.astro @@ -1,7 +1,10 @@ --- +import { + CREATIVE_COMMONS_LICENSES, + type LICENSES, +} from "@lib/collection/schemas"; import CC from "./licenses/CC.astro"; import WTFPL from "./licenses/WTFPL.astro"; -import { CREATIVE_COMMONS_LICENSES, LICENSES } from "../consts.ts"; export interface Props { title: string; diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 11c62c4..c3dffca 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,62 +1,107 @@ --- +import { env } from "@lib/env"; +const { + PUBLIC_GIT_URL, + PUBLIC_TOR_URL, + PUBLIC_GIT_TOR_URL, + PUBLIC_SIMPLE_X_ADDRESS, +} = env; +const isOnion = Astro.url.origin.endsWith(".onion"); +const site = isOnion ? PUBLIC_TOR_URL : Astro.site; +const git = isOnion ? PUBLIC_GIT_TOR_URL ?? PUBLIC_GIT_URL : PUBLIC_GIT_URL; --- -