aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/shared.ts
diff options
context:
space:
mode:
authorLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-02-27 16:51:14 +0100
committerLibravatarLarge Libravatar memdmp <memdmpestrogenzone>2025-02-27 16:51:14 +0100
commit291e5b0cc2d5f1c510775e8e17d6b78659e56f24 (patch)
tree08934a545f8b4a2aa554f48db33f1e7d74848809 /src/routes/shared.ts
parent08c8330012f57d5de28bc63a2be60b62ea1078c6 (diff)
downloadmem-estrogen-zone-291e5b0cc2d5f1c510775e8e17d6b78659e56f24.tar.gz
mem-estrogen-zone-291e5b0cc2d5f1c510775e8e17d6b78659e56f24.tar.bz2
mem-estrogen-zone-291e5b0cc2d5f1c510775e8e17d6b78659e56f24.tar.lz
mem-estrogen-zone-291e5b0cc2d5f1c510775e8e17d6b78659e56f24.zip

feat: new canary, move to /~mem/ on estrogen.zone

Diffstat (limited to 'src/routes/shared.ts')
-rw-r--r--src/routes/shared.ts289
1 files changed, 145 insertions, 144 deletions
diff --git a/src/routes/shared.ts b/src/routes/shared.ts
index 56467a1..b40792a 100644
--- a/src/routes/shared.ts
+++ b/src/routes/shared.ts
@@ -7,6 +7,7 @@
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
export const biosSteps = 3;
export const biosStepInterval = 1000;
@@ -23,7 +24,7 @@ export const getDelay = (typingInfo: TypingSpeed) =>
(Math.random() * 2 - 1) * typingInfo.typingDeviation +
typingInfo.typingSpeedAvg;
export const login = {
- username: "lain",
+ username: 'lain',
passwordLength: 12,
...typingInfo(100), // one usually has muscle memory for well-known frequently-typed credentials, hence higher wpm
};
@@ -38,34 +39,34 @@ export type RenderBlock = {
url?:
| `newtab:${string}`
| `currenttab:${string}`
- | ((textObj: TTYText & { kind: "text" }) => void);
+ | ((textObj: TTYText & { kind: 'text' }) => void);
bg?: string;
raw?: boolean;
dl?: string;
};
export type TTYText =
| {
- kind: "text";
- renderrestriction?: "everywhere" | "js-only" | "noscript";
+ kind: 'text';
+ renderrestriction?: 'everywhere' | 'js-only' | 'noscript';
value: RenderBlock[];
id: string;
classes: string[];
}
| {
- kind: "removeNode";
+ kind: 'removeNode';
removedId: string;
removedItemClassList: string[];
}
| {
- kind: "time";
+ kind: 'time';
delay: number;
}
| {
- kind: "cursorVisibility";
+ kind: 'cursorVisibility';
visible: boolean;
}
| {
- kind: "clear";
+ kind: 'clear';
};
export type Only<Obj, Keys extends keyof Obj> = {
[k in Keys]: Obj[k];
@@ -90,15 +91,15 @@ export const ttyLines: TTYText[] = (() => {
const byId = new Map<string, TTYText>();
let i = 69420;
let defaultRenderRestriction: Only<
- TTYText & { kind: "text" },
- "renderrestriction"
- >["renderrestriction"] = "everywhere";
- type LimitedRenderBlock = Omit<RenderBlock, "value">;
+ TTYText & { kind: 'text' },
+ 'renderrestriction'
+ >['renderrestriction'] = 'everywhere';
+ type LimitedRenderBlock = Omit<RenderBlock, 'value'>;
type RenderBlockArg = [text: string, options?: LimitedRenderBlock];
/** due to hellish css constraints, each text() call creates its own line - however, each block in a text() is joined on the same line. */
const text = (
globalOptions:
- | Only<TTYText & { kind: "text" }, "renderrestriction">
+ | Only<TTYText & { kind: 'text' }, 'renderrestriction'>
| RenderBlockArg,
...blocks: RenderBlockArg[]
) => {
@@ -109,12 +110,12 @@ export const ttyLines: TTYText[] = (() => {
globalOptions = {};
}
const txt = {
- kind: "text",
+ kind: 'text',
renderrestriction:
globalOptions.renderrestriction ?? defaultRenderRestriction,
value: blocks.map(([t, o]) => ({
value: t,
- colour: "#b9b9b9",
+ colour: '#b9b9b9',
...o,
})),
id,
@@ -126,34 +127,34 @@ export const ttyLines: TTYText[] = (() => {
};
const wait = (time: number) =>
lines.push({
- kind: "time",
+ kind: 'time',
delay: time,
});
const del = (id: string | number) => {
const removedId =
- typeof id === "string" ? id : id >= 0 ? ids[id] : ids[ids.length + id];
+ typeof id === 'string' ? id : id >= 0 ? ids[id] : ids[ids.length + id];
const r = byId.get(removedId);
- if (r?.kind === "text") {
+ if (r?.kind === 'text') {
lines.push({
- kind: "removeNode",
+ kind: 'removeNode',
removedId,
removedItemClassList: r.classes,
});
- r.classes.push("ttytext-removed-after-done");
+ r.classes.push('ttytext-removed-after-done');
}
ids = ids.filter((v) => v !== removedId);
};
const delSince = (id: string | number) => {
const removedId =
- typeof id === "string" ? id : id >= 0 ? ids[id] : ids[ids.length + id];
+ typeof id === 'string' ? id : id >= 0 ? ids[id] : ids[ids.length + id];
const idIndex = ids.indexOf(removedId);
for (let i = idIndex; i < ids.length; i++) {
const removedId = ids[i];
const r = byId.get(removedId);
- if (r?.kind === "text") {
- r.classes.push("ttytext-removed-after-done");
+ if (r?.kind === 'text') {
+ r.classes.push('ttytext-removed-after-done');
lines.push({
- kind: "removeNode",
+ kind: 'removeNode',
removedId,
removedItemClassList: r.classes,
});
@@ -163,13 +164,13 @@ export const ttyLines: TTYText[] = (() => {
};
const getLast = () => {
const v = byId.get(ids[ids.length - 1]);
- if (v?.kind == "text") {
+ if (v?.kind == 'text') {
return v.value;
} else return null;
};
const overwriteLast = (...newValue: RenderBlockArg[]) => {
const v = byId.get(ids[ids.length - 1]);
- const l = v?.kind == "text" ? v.renderrestriction : "everywhere";
+ const l = v?.kind == 'text' ? v.renderrestriction : 'everywhere';
del(-1);
return text(
{
@@ -188,7 +189,7 @@ export const ttyLines: TTYText[] = (() => {
[
v.value,
Object.fromEntries(
- Object.entries(v).filter(([k]) => k !== "value"),
+ Object.entries(v).filter(([k]) => k !== 'value'),
),
] as const,
),
@@ -196,26 +197,26 @@ export const ttyLines: TTYText[] = (() => {
);
const everyTTYClear: (() => void)[] = [];
const clear = () => {
- if (lines.find((v) => v.kind === "clear")) {
- delSince(lines.findLastIndex((v) => v.kind === "clear"));
+ if (lines.find((v) => v.kind === 'clear')) {
+ delSince(lines.findLastIndex((v) => v.kind === 'clear'));
}
- lines.push({ kind: "clear" });
+ lines.push({ kind: 'clear' });
everyTTYClear.forEach((v) => v());
};
everyTTYClear.push(() => {
text(
{
- renderrestriction: "noscript",
+ renderrestriction: 'noscript',
},
[
- "This browser does not support JS. Your experience may be degraded.",
+ 'This browser does not support JS. Your experience may be degraded.',
{
- bg: "#ff0000",
- colour: "#dedede",
+ bg: '#ff0000',
+ colour: '#dedede',
},
],
- ["\n", {}],
+ ['\n', {}],
);
});
everyTTYClear.forEach((v) => v());
@@ -223,88 +224,88 @@ export const ttyLines: TTYText[] = (() => {
//
wait(300);
- text({ renderrestriction: "js-only" }, [
+ text({ renderrestriction: 'js-only' }, [
((v) => v[Math.floor(Math.random() * v.length)])([
- "cool beats are stored in the balls",
- "found xml documents in the firmware",
+ 'cool beats are stored in the balls',
+ 'found xml documents in the firmware',
'overhead: "I don\'t consent" "hey thats my line"',
- "uwu",
- "i regret making this hellhole of a codebase",
+ 'uwu',
+ 'i regret making this hellhole of a codebase',
]),
{
- colour: "#777777",
+ colour: '#777777',
},
]);
wait(1000);
clear();
text(
[
- "lain",
+ 'lain',
{
- colour: "#FFFF53",
+ colour: '#FFFF53',
weight: 700,
},
],
- [" in "],
+ [' in '],
[
- "mem.estrogen.zone",
+ 'mem.estrogen.zone',
{
- colour: "#17B117",
+ colour: '#17B117',
weight: 700,
},
],
- [" in "],
+ [' in '],
[
- "~",
+ '~',
{
- colour: "#53FFFF",
+ colour: '#53FFFF',
weight: 700,
},
],
);
text(
- ["❯ ", { colour: "#53FF53", weight: 600 }],
- [""],
- ["", { colour: "#777777" }],
+ ['❯ ', { colour: '#53FF53', weight: 600 }],
+ [''],
+ ['', { colour: '#777777' }],
);
{
- const targetstr = "/usr/bin/env wel";
+ const targetstr = '/usr/bin/env wel';
const completions = [
'/bin/sh -c "$(/usr/bin/env curl -fsSL https://blahaj.estrogen.zone/)"',
- "/usr/local/bin/become-estradiol",
- "/usr/bin/shellutil ansi cheatsheet 24bit",
- "/usr/bin/env sh",
- "/usr/bin/env wc -l src/routes/anim.css",
- "/usr/bin/env welcome -c ~/.local/share/welcome.toml",
+ '/usr/local/bin/become-estradiol',
+ '/usr/bin/shellutil ansi cheatsheet 24bit',
+ '/usr/bin/env sh',
+ '/usr/bin/env wc -l src/routes/anim.css',
+ '/usr/bin/env welcome -c ~/.local/share/welcome.toml',
];
- for (const c of [...targetstr.split(""), "COMPLETE"]) {
+ for (const c of [...targetstr.split(''), 'COMPLETE']) {
replaceLast((l) => {
const prompt = l[l.length - 2];
const suggestions = l[l.length - 1];
- if (c === "COMPLETE") {
+ if (c === 'COMPLETE') {
prompt[0] += suggestions[0];
- suggestions[0] = "";
+ suggestions[0] = '';
} else {
prompt[0] += c;
const completion = completions.find((v) => v.startsWith(prompt[0]));
if (completion) {
suggestions[0] = completion.substring(prompt[0].length);
- } else suggestions[0] = "";
+ } else suggestions[0] = '';
}
return l;
});
- if (c === "COMPLETE") {
+ if (c === 'COMPLETE') {
wait(100);
} else wait(50 + Math.random() * 100);
}
- text(["Preparing..."]);
+ text(['Preparing...']);
wait(200);
}
wait(1000);
clear();
- text(["Welcome to"], [""], [" the Estrogen Zone!\n\n"]);
+ text(['Welcome to'], [''], [' the Estrogen Zone!\n\n']);
wait(300);
- for (const c of " my corner of".split("")) {
+ for (const c of ' my corner of'.split('')) {
replaceLast((l) => {
l[1][0] += c;
return l;
@@ -312,95 +313,95 @@ export const ttyLines: TTYText[] = (() => {
wait(70);
}
text([
- "Places you can find me:",
+ 'Places you can find me:',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(300);
text(
[
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
],
- ["estrogen.zone git: ", { colour: "#cdcdcd" }],
+ ['estrogen.zone git: ', { colour: '#cdcdcd' }],
);
wait(100);
replaceLast((v) => [
...v,
[
- "git.estrogen.zone",
+ 'git.estrogen.zone',
{
- colour: "#99aaff",
+ colour: '#99aaff',
underlined: true,
weight: 700,
- url: "newtab:https://git.estrogen.zone",
+ url: 'newtab:https://git.estrogen.zone',
},
],
]);
wait(100);
text(
[
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
],
- ["On jsr: ", { colour: "#cdcdcd" }],
+ ['On jsr: ', { colour: '#cdcdcd' }],
);
wait(600);
replaceLast((v) => [
...v,
[
- "jsr.io/@memdmp",
+ 'jsr.io/@memdmp',
{
- colour: "#f7df23",
+ colour: '#f7df23',
underlined: true,
weight: 700,
- url: "newtab:https://jsr.io/@memdmp",
+ url: 'newtab:https://jsr.io/@memdmp',
},
],
]);
wait(200);
text(
[
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
],
- ["In random hackerspaces", { colour: "#aaaaaa" }],
+ ['In random hackerspaces', { colour: '#aaaaaa' }],
);
wait(600);
text([
- "\nYou may find these useful:",
+ '\nYou may find these useful:',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(400);
text(
[
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
],
- ["GPG Root Key: ", { colour: "#cdcdcd" }],
+ ['GPG Root Key: ', { colour: '#cdcdcd' }],
);
wait(1000);
replaceLast((v) => [
...v,
[
- "B546778F06BBCC8EC167DB3CD919706487B8B6DE",
+ 'B546778F06BBCC8EC167DB3CD919706487B8B6DE',
{
- colour: "#58C7F3",
+ colour: '#58C7F3',
underlined: true,
weight: 700,
- url: "currenttab:/keys/memdmp/primary.pgp",
- dl: "memdmp-primary.pgp",
+ url: `currenttab:/keys/memdmp/primary.pgp`,
+ dl: 'memdmp-primary.pgp',
},
],
]);
@@ -408,35 +409,35 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- " (root key)",
+ ' (root key)',
{
- colour: "#999999",
+ colour: '#999999',
},
],
]);
wait(400);
text([
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(70);
replaceLast((v) => [
...v,
- ["GPG Git Key: ", { colour: "#cdcdcd" }],
+ ['GPG Git Key: ', { colour: '#cdcdcd' }],
]);
wait(100);
replaceLast((v) => [
...v,
[
- "5134F05BD8D9DB8C6C0E1515A9439D346AB6DF4E",
+ '5134F05BD8D9DB8C6C0E1515A9439D346AB6DF4E',
{
- colour: "#F0A3B3",
+ colour: '#F0A3B3',
underlined: true,
weight: 700,
- url: "currenttab:/keys/memdmp/git.pgp",
- dl: "memdmp-git.pgp",
+ url: `currenttab:/keys/memdmp/git.pgp`,
+ dl: 'memdmp-git.pgp',
},
],
]);
@@ -444,37 +445,37 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- " (",
+ ' (',
{
- colour: "#999999",
+ colour: '#999999',
},
],
[
- "signed",
+ 'signed',
{
- colour: "#F0A3B3",
+ colour: '#F0A3B3',
underlined: true,
weight: 500,
- url: "currenttab:/keys/memdmp/git.pgp.sig",
- dl: "memdmp-git.pgp.sig",
+ url: `currenttab:/keys/memdmp/git.pgp.sig`,
+ dl: 'memdmp-git.pgp.sig',
},
],
- [")", { colour: "#999999" }],
+ [')', { colour: '#999999' }],
]);
wait(45);
text([
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(70);
replaceLast((v) => [
...v,
[
- "GPG Release Signing Key: ",
+ 'GPG Release Signing Key: ',
{
- colour: "#cdcdcd",
+ colour: '#cdcdcd',
},
],
]);
@@ -482,13 +483,13 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- "0D93102265071798C7B65A4C9F0739B9E0C8FD60",
+ '0D93102265071798C7B65A4C9F0739B9E0C8FD60',
{
- colour: "#ffffff",
+ colour: '#ffffff',
underlined: true,
weight: 700,
- url: "currenttab:/keys/memdmp/release.pgp",
- dl: "memdmp-release.pgp",
+ url: `currenttab:/keys/memdmp/release.pgp`,
+ dl: 'memdmp-release.pgp',
},
],
]);
@@ -496,37 +497,37 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- " (",
+ ' (',
{
- colour: "#999999",
+ colour: '#999999',
},
],
[
- "signed",
+ 'signed',
{
- colour: "#ffffff",
+ colour: '#ffffff',
underlined: true,
weight: 500,
- url: "currenttab:/keys/memdmp/release.pgp.sig",
- dl: "memdmp-release.pgp.sig",
+ url: `currenttab:/keys/memdmp/release.pgp.sig`,
+ dl: 'memdmp-release.pgp.sig',
},
],
- [")", { colour: "#999999" }],
+ [')', { colour: '#999999' }],
]);
wait(100);
text([
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(35);
replaceLast((v) => [
...v,
[
- "Source Code: ",
+ 'Source Code: ',
{
- colour: "#cdcdcd",
+ colour: '#cdcdcd',
},
],
]);
@@ -534,29 +535,29 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- "git.estrogen.zone/mem-estrogen-zone",
+ 'git.estrogen.zone/mem-estrogen-zone',
{
- colour: "#F0A3B3",
+ colour: '#F0A3B3',
underlined: true,
weight: 700,
- url: "newtab:/upstream/",
+ url: 'newtab:/upstream/',
},
],
]);
wait(100);
text([
- " - ",
+ ' - ',
{
- colour: "#7a7a7a",
+ colour: '#7a7a7a',
},
]);
wait(35);
replaceLast((v) => [
...v,
[
- "Canaries: ",
+ 'Canaries: ',
{
- colour: "#cdcdcd",
+ colour: '#cdcdcd',
},
],
]);
@@ -564,12 +565,12 @@ export const ttyLines: TTYText[] = (() => {
replaceLast((v) => [
...v,
[
- "/canaries/",
+ './canaries/',
{
- colour: "#58C7F3",
+ colour: '#58C7F3',
underlined: true,
weight: 700,
- url: "currenttab:/canaries/",
+ url: `currenttab:/canaries/`,
},
],
]);
@@ -578,23 +579,23 @@ export const ttyLines: TTYText[] = (() => {
`<button style="padding: 12px 12px;background: #fff2;margin-top: 0.4rem;border-radius: 0.7rem;opacity:0.1;margin-top:3rem;" data-el="le funny button">have a button :3</button>`,
{
raw: true,
- url: () => alert("i abused too much css for this i wanna cry now"),
+ url: () => alert('i abused too much css for this i wanna cry now'),
},
]);
wait(200);
text(
- { renderrestriction: "js-only" },
+ { renderrestriction: 'js-only' },
[
- "next time, you may want to ",
+ 'next time, you may want to ',
{
- colour: "#fff2",
+ colour: '#fff2',
},
],
[
- `skip the animation<img style="opacity:0;position:fixed;top:0;left:0;width:0px;height:0px;pointer-events:none;" src='about:blank' onerror='setTimeout(()=>{if(location.pathname==="/skip-animation")document.querySelector(${JSON.stringify(`a[href=${JSON.stringify("/skip-animation")}]`)})?.parentElement?.remove();else document.querySelector(${JSON.stringify(`a[href=${JSON.stringify("about:blank")}]`)})?.remove();},1)' />`,
+ `skip the animation<img style="opacity:0;position:fixed;top:0;left:0;width:0px;height:0px;pointer-events:none;" src='about:blank' onerror='setTimeout(()=>{if(location.pathname===${JSON.stringify('/~mem/skip-animation')})document.querySelector(${JSON.stringify(`a[href=${JSON.stringify('/~mem/skip-animation')}]`)})?.parentElement?.remove();else document.querySelector(${JSON.stringify(`a[href=${JSON.stringify('about:blank')}]`)})?.remove();},1)' />`,
{
- url: "currenttab:/skip-animation",
- colour: "#fff2",
+ url: `currenttab:/skip-animation`,
+ colour: '#fff2',
underlined: true,
raw: true,
},