From 5e368d6e344a6936d4e3bf15c3dfc69ad7dd344b Mon Sep 17 00:00:00 2001 From: Bad Manners Date: Wed, 4 Sep 2024 18:07:00 -0300 Subject: [PATCH] Add Resetera and pubkey fingerprint, and block bots --- .vscode/settings.json | 4 +- astro.config.mjs | 14 ++ public/robots.txt | 2 - public/ssh.pub | 2 +- public/ssh.pub.fingerprint | 1 + .../icons/brands/IconResetera.astro | 15 ++ src/components/icons/brands/index.ts | 1 + src/data/ai_bots.ts | 38 +++ src/pages/index.astro | 229 ++++-------------- src/pages/robots.txt.ts | 10 + src/styles/base.css | 4 + 11 files changed, 136 insertions(+), 184 deletions(-) delete mode 100644 public/robots.txt create mode 100644 public/ssh.pub.fingerprint create mode 100644 src/components/icons/brands/IconResetera.astro create mode 100644 src/data/ai_bots.ts create mode 100644 src/pages/robots.txt.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 43f71ef..9ef8ff4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,8 @@ "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "prettier.requireConfig": true, "prettier.configPath": ".prettierrc.mjs", - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true } diff --git a/astro.config.mjs b/astro.config.mjs index 3b45241..611b2db 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,6 +1,7 @@ import { defineConfig, envField } from "astro/config"; import tailwindIntegration from "@astrojs/tailwind"; import htaccessIntegration from "astro-htaccess"; +import { AI_BOTS } from "./src/data/ai_bots"; // https://astro.build/config export default defineConfig({ @@ -11,6 +12,15 @@ export default defineConfig({ }), htaccessIntegration({ generateHtaccessFile: import.meta.env.APACHE_CONFIG === "true", + customRules: [ + // Block AI bots + "", + " RewriteEngine on", + " RewriteBase /", + ` RewriteCond %{HTTP_USER_AGENT} ${AI_BOTS.map((bot) => `^${bot}$`).join("|")} [NC]`, + " RewriteRule ^ – [F]", + "", + ], redirects: [ { match: /^\/@\/(aryion|ekas?(portal)?)\b/, @@ -124,6 +134,10 @@ export default defineConfig({ match: /^\/@\/redd\.?it\b/, url: "https://www.reddit.com/user/BadManners_", }, + { + match: /^\/@\/resetera\b/, + url: "https://www.resetera.com/members/bad-manners.181209/", + }, { match: /^\/@\/signal\b/, url: "https://signal.me/#eu/ytt_rk0fFmAB2JAW-x2PbUiJyc_H3kYmfL_Pq4QNh5QIDsiFtjdFHaqFRs1D36tB", diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index 9624d10..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: .htaccess diff --git a/public/ssh.pub b/public/ssh.pub index 984a3a2..dd4aa87 100644 --- a/public/ssh.pub +++ b/public/ssh.pub @@ -1 +1 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ3QAZd3E95gxef2kiXppWa/xhcwBtnKMZJaW6s4d7Tm Bad Manners +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ3QAZd3E95gxef2kiXppWa/xhcwBtnKMZJaW6s4d7Tm Bad Manners \ No newline at end of file diff --git a/public/ssh.pub.fingerprint b/public/ssh.pub.fingerprint new file mode 100644 index 0000000..a345c89 --- /dev/null +++ b/public/ssh.pub.fingerprint @@ -0,0 +1 @@ +SHA256:KdH6YixZQlyFZvTw0M60qVqei4ds4sfomVikMbw0n6E \ No newline at end of file diff --git a/src/components/icons/brands/IconResetera.astro b/src/components/icons/brands/IconResetera.astro new file mode 100644 index 0000000..86d7742 --- /dev/null +++ b/src/components/icons/brands/IconResetera.astro @@ -0,0 +1,15 @@ +--- +import SVGIcon from "../SVGIcon.astro"; + +type Props = { + width: string; + height: string; + class?: string; +}; +--- + + + + diff --git a/src/components/icons/brands/index.ts b/src/components/icons/brands/index.ts index 83d5a0e..45df522 100644 --- a/src/components/icons/brands/index.ts +++ b/src/components/icons/brands/index.ts @@ -18,6 +18,7 @@ export { default as IconMastodon } from "./IconMastodon.astro"; export { default as IconNeocities } from "./IconNeocities.astro"; export { default as IconPicarto } from "./IconPicarto.astro"; export { default as IconReddit } from "./IconReddit.astro"; +export { default as IconResetera } from "./IconResetera.astro"; export { default as IconSignal } from "./IconSignal.astro"; export { default as IconSoFurry } from "./IconSoFurry.astro"; export { default as IconSteam } from "./IconSteam.astro"; diff --git a/src/data/ai_bots.ts b/src/data/ai_bots.ts new file mode 100644 index 0000000..e504b3d --- /dev/null +++ b/src/data/ai_bots.ts @@ -0,0 +1,38 @@ +export const AI_BOTS = [ + "AI2Bot", + "Ai2Bot-Dolma", + "Amazonbot", + "Applebot", + "Applebot-Extended", + "Bytespider", + "CCBot", + "ChatGPT-User", + "Claude-Web", + "ClaudeBot", + "Diffbot", + "FacebookBot", + "FriendlyCrawler", + "GPTBot", + "Google-Extended", + "GoogleOther", + "GoogleOther-Image", + "GoogleOther-Video", + "ICC-Crawler", + "ImagesiftBot", + "Meta-ExternalAgent", + "Meta-ExternalFetcher", + "OAI-SearchBot", + "PerplexityBot", + "PetalBot", + "Scrapy", + "Timpibot", + "VelenPublicWebCrawler", + "Webzio-Extended", + "YouBot", + "anthropic-ai", + "cohere-ai", + "facebookexternalhit", + "img2dataset", + "omgili", + "omgilibot", +] as const; diff --git a/src/pages/index.astro b/src/pages/index.astro index fa23179..8da547e 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -23,6 +23,7 @@ import { IconNeocities, IconPicarto, IconReddit, + IconResetera, IconSignal, IconSoFurry, IconSteam, @@ -79,11 +80,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-clipboard={Astro.site} data-noun="URL" > - +

https://badmanners.xyz

@@ -98,11 +95,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); aria-label="Main gallery" data-age-restricted > - +

Gallery on https://gallery.badmanners.xyz

@@ -114,11 +107,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Pronouns (he/they)" > - +

@BadManners on pronouns.cc

@@ -134,11 +123,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-clipboard="me@badmanners.xyz" data-noun="E-mail address" > - +

me@badmanners.xyz

@@ -150,11 +135,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Bluesky" > - +

@badmanners.xyz on Bluesky

@@ -166,11 +147,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Codeberg" > - +

BadManners on Codeberg

@@ -182,11 +159,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Cohost" > - +

BadManners on Cohost

@@ -199,11 +172,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-noun="Discord username" aria-disabled="true" > - +

badmanners on Discord

@@ -215,11 +184,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Eka's Portal" > - +

BadManners on Eka's Portal

@@ -231,11 +196,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Fur Affinity" > - +

BadManners on Fur Affinity

@@ -247,11 +208,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="GitGud" > - +

BadMannersXYZ on GitGud

@@ -263,11 +220,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="GitHub" > - +

BadMannersXYZ on GitHub

@@ -279,11 +232,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="GitLab" > - +

Bad_Manners on GitLab

@@ -297,11 +246,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-clipboard="badmanners.vore@gmail.com" data-noun="Gmail address" > - +

badmanners.vore@gmail.com

@@ -314,11 +259,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-clipboard={gpgKey} data-noun="GPG key" > - +

GPG public key

@@ -330,11 +271,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Inkbunny" > - +

BadManners on Inkbunny

@@ -346,11 +283,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Itaku" > - +

badmanners on Itaku

@@ -362,11 +295,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Itch.io" > - +

Bad Manners on Itch.io

@@ -378,11 +307,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Keybase" > - +

badmanners on Keybase

@@ -394,11 +319,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Keyoxide" > - +

aspe:keyoxide.org:UWYBVFCBFXTVUF2U6FS6AYJHLU on Keyoxide

@@ -412,11 +333,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Ko-fi" > - +

badmanners on Ko-fi

@@ -428,11 +345,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Mastodon" > - +

@BadManners@meow.social on Mastodon

@@ -444,11 +357,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Neocities" > - +

badmanners.neocities.org on Neocities

@@ -460,11 +369,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Picarto" > - +

BadManners on Picarto

@@ -476,14 +381,22 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Reddit" > - +

/u/BadManners_ on Reddit

+
  • + + +

    Bad Manners on Resetera

    +
    +
  • - +

    badmanners.10 on Signal

  • @@ -508,11 +417,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="SoFurry" > - +

    Bad Manners on SoFurry

    @@ -525,11 +430,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); data-clipboard={sshKey} data-noun="SSH key" > - +

    SSH public key

    @@ -541,11 +442,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Steam" > - +

    badmanners_ on Steam

    @@ -557,11 +454,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="SubscribeStar" > - +

    Bad Manners on SubscribeStar

    @@ -573,11 +466,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Telegram" > - +

    @bad_manners on Telegram

    @@ -589,11 +478,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Tumblr" > - +

    badmannersxyz on Tumblr

    @@ -605,11 +490,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Twitch" > - +

    bad__manners on Twitch

    @@ -621,11 +502,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="Weasyl" > - +

    BadManners on Weasyl

    @@ -637,11 +514,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="X" > - +

    @BadManners__ on X

    @@ -653,11 +526,7 @@ const sshKey = await readFile("./public/ssh.pub", { encoding: "utf-8" }); rel="me" aria-label="YouTube" > - +

    @BadMannersXYZ on YouTube

    diff --git a/src/pages/robots.txt.ts b/src/pages/robots.txt.ts new file mode 100644 index 0000000..0fad9e7 --- /dev/null +++ b/src/pages/robots.txt.ts @@ -0,0 +1,10 @@ +import type { APIRoute } from "astro"; +import { AI_BOTS } from "../data/ai_bots"; + +export const GET: APIRoute = async () => { + const robots = [AI_BOTS.map((bot) => `User-agent: ${bot}`), "Disallow: /", "", "User-agent: *", "Disallow: .htaccess"] + .flat() + .join("\n"); + + return new Response(robots, { headers: { "Content-Type": "text/plain; charset=utf-8" } }); +}; diff --git a/src/styles/base.css b/src/styles/base.css index cbaeb16..615191f 100644 --- a/src/styles/base.css +++ b/src/styles/base.css @@ -27,4 +27,8 @@ .button-close { @apply rounded-full p-[6px] text-stone-800 hover:bg-stone-300 hover:text-stone-800 focus:bg-stone-300 focus:text-stone-800 sm:p-2 dark:text-zinc-300 dark:hover:bg-zinc-500 dark:hover:text-zinc-800 dark:focus:bg-zinc-500 dark:focus:text-zinc-800; } + + .contact-icon { + @apply inline transition-transform group-hover:scale-150 group-focus:scale-150 motion-reduce:transition-none motion-reduce:group-hover:scale-100 motion-reduce:group-focus:scale-100; + } }