Skip to content

Commit

Permalink
feat: add esoteric files
Browse files Browse the repository at this point in the history
  • Loading branch information
rayhanadev committed Jan 10, 2025
1 parent ff88acf commit 553c6a0
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pages/humans.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { APIRoute } from "astro";
import dayjs from "dayjs";

const robotsTxt = `
/* TEAM */
Owner: Rayhan Noufal Arayilakath
Contact: [email protected]
Twitter: @rayhanadev
From: Dallas, Texas, United States of America
/* SITE */
Last update: ${dayjs().format("YYYY/MM/DD")}
Language: English
Doctype: HTML5
IDE: Zed
`.trim();

export const GET: APIRoute = () => {
return new Response(robotsTxt, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
};
14 changes: 14 additions & 0 deletions src/pages/version.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { execSync } from "child_process";
import type { APIRoute } from "astro";

const versionTxt = execSync("git log -1 --pretty=reference", {
encoding: "utf-8",
});

export const GET: APIRoute = () => {
return new Response(versionTxt, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
};
20 changes: 20 additions & 0 deletions src/pages/whois.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { promisify } from "node:util";
import type { APIRoute } from "astro";
// @ts-ignore: no types for this package
import whois from "whois";

const lookup = promisify(whois.lookup);

const sld = import.meta.env.DEV
? "example.com"
: new URL(import.meta.env.SITE).hostname.split(".").slice(-2).join(".");

const whoisTxt = await lookup(sld);

export const GET: APIRoute = () => {
return new Response(whoisTxt, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
};

0 comments on commit 553c6a0

Please sign in to comment.