feat: page portfolio de style terminal Linux présentant Riric (DotRiric)
- public/portfolio/ (FR + EN) : terminal Debian interactif (prompt dotriric@zektyc:~$, historique, commandes help/whoami/cat/neofetch/contact/sudo/exit/clear...) - Corrige un bug CSP-critique : String.prototype.link faisait traiter toutes les lignes texte comme des liens (A undefined) ; makeRich exige désormais typeof item.link === 'string' - Nav : lien Portfolio ajouté (components.js v=8, i18n nav.portfolio) - Sitemaps FR/EN : /fr/portfolio et /en/portfolio
This commit is contained in:
parent
a2952080fd
commit
f16e6ddde1
34 changed files with 693 additions and 25 deletions
351
public/js/portfolio.js
Normal file
351
public/js/portfolio.js
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
(function () {
|
||||
"use strict";
|
||||
|
||||
var FR = /^\/en(\/|$)/.test(location.pathname) ? false : true;
|
||||
|
||||
var T = {
|
||||
title: FR ? "dotriric@zektyc: ~ — bash" : "dotriric@zektyc: ~ — bash",
|
||||
boot: FR
|
||||
? ["Debian GNU/Linux 12 (bookworm) tty1", "zektyc login: dotriric", "Password: ********", "Last login: a l'instant depuis votre navigateur", "Bienvenue sur le terminal de presentation de Riric.", "Tapez 'help' pour la liste des commandes."]
|
||||
: ["Debian GNU/Linux 12 (bookworm) tty1", "zektyc login: dotriric", "Password: ********", "Last login: right now from your browser", "Welcome to Riric's presentation terminal.", "Type 'help' for the list of commands."],
|
||||
promptUser: "dotriric",
|
||||
promptHost: "zektyc",
|
||||
unknown: function (c) { return FR ? ("bash: " + c + " : commande introuvable") : ("bash: " + c + ": command not found"); },
|
||||
pwEmpty: FR ? "bash: passage en racine impossible : ne peut pas se connecter en tant que root" : "bash: cannot become root: cannot login as root",
|
||||
helpLines: FR
|
||||
? [
|
||||
"Commandes disponibles :",
|
||||
"",
|
||||
" help affiche cette aide",
|
||||
" whoami qui suis-je",
|
||||
" cat about.txt mon profil",
|
||||
" cat projects.txt mes projets",
|
||||
" neofetch infos systeme + profil",
|
||||
" ls, pwd, date, hostname, uname -a",
|
||||
" contact le meilleur moyen de me joindre",
|
||||
" clear efface l'ecran",
|
||||
" exit quitter le terminal",
|
||||
"",
|
||||
"Astuce : essayez aussi 'sudo' ou 'apt update'.",
|
||||
]
|
||||
: [
|
||||
"Available commands:",
|
||||
"",
|
||||
" help show this help",
|
||||
" whoami who am I",
|
||||
" cat about.txt my profile",
|
||||
" cat projects.txt my projects",
|
||||
" neofetch system info + profile",
|
||||
" ls, pwd, date, hostname, uname -a",
|
||||
" contact best way to reach me",
|
||||
" clear clear the screen",
|
||||
" exit quit the terminal",
|
||||
"",
|
||||
"Tip: try 'sudo' or 'apt update' too.",
|
||||
],
|
||||
neofetch: FR
|
||||
? [
|
||||
" .---. dotriric@zektyc",
|
||||
" / \\ ----------------",
|
||||
" \\ / OS: Debian GNU/Linux 12 (bookworm)",
|
||||
" '---' Host: Zektyc, sheberge en France",
|
||||
" Shell: zeke 1.0",
|
||||
" Roles: CEO · Fondateur · Architecte",
|
||||
" Le site web tourne derriere nginx + Caddy + Bun.",
|
||||
]
|
||||
: [
|
||||
" .---. dotriric@zektyc",
|
||||
" / \\ ----------------",
|
||||
" \\ / OS: Debian GNU/Linux 12 (bookworm)",
|
||||
" '---' Host: Zektyc, hosted in France",
|
||||
" Shell: zeke 1.0",
|
||||
" Roles: CEO · Founder · Architect",
|
||||
" The website runs behind nginx + Caddy + Bun.",
|
||||
],
|
||||
about: FR
|
||||
? [
|
||||
"Riric (alias DotRiric) — fondateur de Zektyc.",
|
||||
"",
|
||||
"CEO · Fondateur · Architecte",
|
||||
"",
|
||||
"Vision, direction technique, architecture, design, securite.",
|
||||
"Riric construit Zektyc de A a Z — du serveur au premier pixel.",
|
||||
"",
|
||||
"Une personne reelle derriere chaque service : pas de promesses vagues,",
|
||||
"du concret, de la transparence, et un vrai travail d'infrastructure.",
|
||||
"",
|
||||
"Avec OpenCode, programmeur, il ecrit et maintient le code source",
|
||||
"de Zektyc — du serveur Bun aux pages statiques.",
|
||||
]
|
||||
: [
|
||||
"Riric (a.k.a. DotRiric) — founder of Zektyc.",
|
||||
"",
|
||||
"CEO · Founder · Architect",
|
||||
"",
|
||||
"Vision, technical direction, architecture, design, security.",
|
||||
"Riric builds Zektyc from A to Z — from the server to the first pixel.",
|
||||
"",
|
||||
"A real person behind every service: no vague promises, concrete work,",
|
||||
"transparency, and real infrastructure engineering.",
|
||||
"",
|
||||
"With OpenCode, programmer, he writes and maintains Zektyc's",
|
||||
"source code — from the Bun server to static pages.",
|
||||
],
|
||||
projects: FR
|
||||
? [
|
||||
"Projets actuels :",
|
||||
"",
|
||||
" /fingerprint-test Test de fingerprinting navigateur (local, rien n'est envoye).",
|
||||
" /zmap/ ZMap — calculateur de vitesses maximales (donnees Europe).",
|
||||
" /zenyth/ Zenyth — navigateur de confiance.",
|
||||
" /projets/ Tous les projets et contributions.",
|
||||
"",
|
||||
"Vous pouvez ouvrir ces liens en cliquant dessus.",
|
||||
]
|
||||
: [
|
||||
"Current projects:",
|
||||
"",
|
||||
" /fingerprint-test Browser fingerprinting test (local, nothing is sent).",
|
||||
" /zmap/ ZMap — max speed calculator (Europe data).",
|
||||
" /zenyth/ Zenyth — a browser you can trust.",
|
||||
" /projets/ All projects and contributions.",
|
||||
"",
|
||||
"You can open these links by clicking on them.",
|
||||
],
|
||||
contact: FR
|
||||
? ["Email: riric65@protonmail.com", "Mastodon: @zektyc@piaille.fr", "Repond generalement en francais ou en anglais."]
|
||||
: ["Email: riric65@protonmail.com", "Mastodon: @zektyc@piaille.fr", "Usually replies in French or English."],
|
||||
files: ["about.txt", "projects.txt", "contact.txt", ".bashrc", ".profile"],
|
||||
contactFile: FR ? ["ouvrez contact.txt, ou tapez 'contact'"] : ["open contact.txt, or type 'contact'"],
|
||||
bashrc: FR ? ["# Config bash de dotriric", 'export PS1="dotriric@zektyc:~$ "', "alias ll='ls -alF'", "# Je n'aime pas le sucre."] : ["# dotriric's bash config", 'export PS1="dotriric@zektyc:~$ "', "alias ll='ls -alF'", "# I don't like sugar."],
|
||||
profile: FR ? ["# .profile — charge le bashrc", "source ~/.bashrc", "# Bienvenue."] : ["# .profile — loads bashrc", "source ~/.bashrc", "# Welcome."],
|
||||
sudo: FR ? ["dotriric n'est pas dans le fichier sudoers. Cet incident sera signale."] : ["dotriric is not in the sudoers file. This incident will be reported."],
|
||||
apt: FR ? ["Lecture des listes de paquets... Termine.", "Construction de l'arbre des dependances... Termine.", "0 paquet(s) mis a niveau."] : ["Reading package lists... Done.", "Building dependency tree... Done.", "0 packages can be upgraded."],
|
||||
contactCmd: FR ? "Me contacter : taper 'contact'" : "To contact me: type 'contact'",
|
||||
shutdown: FR ? ["connexion fermee.", "terminal de presentation quitte — la page reste, evidemment. :)"] : ["connection closed.", "presentation terminal exited — the page stays, of course. :)"],
|
||||
};
|
||||
|
||||
var root = document.getElementById("terminal");
|
||||
|
||||
if (!root) return;
|
||||
|
||||
var body = root.querySelector(".terminal-body");
|
||||
var input = root.querySelector(".term-input");
|
||||
var history = [];
|
||||
var histIdx = -1;
|
||||
|
||||
function makeLine(text, cls) {
|
||||
var div = document.createElement("div");
|
||||
div.className = "terminal-line";
|
||||
if (cls) div.classList.add(cls);
|
||||
if (typeof text === "string") {
|
||||
div.textContent = text;
|
||||
} else {
|
||||
div.appendChild(text);
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
function makeLink(text, href) {
|
||||
var a = document.createElement("a");
|
||||
a.href = href;
|
||||
a.textContent = text;
|
||||
return a;
|
||||
}
|
||||
|
||||
function makeRich(lines) {
|
||||
var frag = document.createDocumentFragment();
|
||||
var i;
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
var item = lines[i];
|
||||
var div = document.createElement("div");
|
||||
div.className = "terminal-line";
|
||||
if (item && item.color) div.classList.add(item.color);
|
||||
if (item && typeof item.link === "string") {
|
||||
div.appendChild(makeLink(item.text, item.link));
|
||||
} else if (item && typeof item === "object") {
|
||||
div.textContent = item.text || "";
|
||||
} else {
|
||||
div.textContent = item;
|
||||
}
|
||||
frag.appendChild(div);
|
||||
}
|
||||
return frag;
|
||||
}
|
||||
|
||||
function print(lines) {
|
||||
if (typeof lines === "string") lines = [lines];
|
||||
body.appendChild(makeRich(lines));
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
function printAscii(lines) {
|
||||
var div = document.createElement("div");
|
||||
div.className = "term-ascii";
|
||||
div.textContent = (typeof lines === "string" ? lines : lines.join("\n"));
|
||||
body.appendChild(div);
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
function scrollDown() {
|
||||
body.scrollTop = body.scrollHeight;
|
||||
}
|
||||
|
||||
function promptLine() {
|
||||
var p = document.createElement("div");
|
||||
p.className = "term-prompt";
|
||||
var sp = document.createElement("span");
|
||||
sp.className = "t-user";
|
||||
sp.textContent = T.promptUser + "@" + T.promptHost;
|
||||
var ct = document.createElement("span");
|
||||
ct.className = "t-path";
|
||||
ct.textContent = ":" + "\u007e" + "$ ";
|
||||
p.appendChild(sp);
|
||||
p.appendChild(ct);
|
||||
return p;
|
||||
}
|
||||
|
||||
function runCommand(raw) {
|
||||
var cmd = raw.trim();
|
||||
var line = document.createElement("div");
|
||||
line.className = "terminal-line";
|
||||
line.appendChild(promptLine());
|
||||
line.appendChild(document.createTextNode(raw));
|
||||
body.appendChild(line);
|
||||
|
||||
if (!cmd) { scrollDown(); return; }
|
||||
|
||||
var parts = cmd.split(/[ \t]+/);
|
||||
var c = parts[0].toLowerCase();
|
||||
var arg = parts.slice(1).join(" ");
|
||||
|
||||
switch (true) {
|
||||
case c === "help" || c === "h" || c === "?":
|
||||
print(T.helpLines);
|
||||
break;
|
||||
case c === "clear" || c === "cls":
|
||||
body.innerHTML = "";
|
||||
break;
|
||||
case c === "whoami":
|
||||
print("dotriric");
|
||||
break;
|
||||
case c === "id":
|
||||
print("uid=1000(dotriric) gid=1000(dotriric) groupes=1000(dotriric)");
|
||||
break;
|
||||
case c === "pwd":
|
||||
print("/home/dotriric");
|
||||
break;
|
||||
case c === "hostname":
|
||||
print(T.promptHost);
|
||||
break;
|
||||
case c === "ls" || c === "ll" || c === "dir":
|
||||
if (arg === "-la" || arg === "-al" || c === "ll") {
|
||||
print(["total 24", "drwxr-xr-x dotriric dotriric dots .", "drwxr-xr-x root root dots ..", "-rw-r--r-- dotriric dotriric dots .bashrc", "-rw-r--r-- dotriric dotriric dots .profile", "-rw-r--r-- dotriric dotriric dots about.txt", "-rw-r--r-- dotriric dotriric dots projects.txt", "-rw-r--r-- dotriric dotriric dots contact.txt"]);
|
||||
} else {
|
||||
print(["about.txt projects.txt contact.txt .bashrc .profile"]);
|
||||
}
|
||||
break;
|
||||
case c === "uname":
|
||||
print("Linux zektyc 6.1.0 localhost x86_64 GNU/Linux");
|
||||
break;
|
||||
case c === "date":
|
||||
print(new Date().toUTCString().replace("GMT", "UTC"));
|
||||
break;
|
||||
case c === "neofetch" || c === "fetch":
|
||||
printAscii(T.neofetch);
|
||||
break;
|
||||
case c === "cat":
|
||||
switch (true) {
|
||||
case arg.indexOf("about") !== -1:
|
||||
print(T.about);
|
||||
break;
|
||||
case arg.indexOf("project") !== -1:
|
||||
print(T.projects.map(function (l) {
|
||||
var m = l.match(/^\s*(\/[a-z-]+\/?\s*)\s(.*)$/);
|
||||
if (m) return { text: m[1] + " " + m[2], link: m[1].trim() };
|
||||
return l;
|
||||
}));
|
||||
break;
|
||||
case arg.indexOf("contact") !== -1:
|
||||
print(T.contact);
|
||||
break;
|
||||
case arg.indexOf("bashrc") !== -1:
|
||||
print(T.bashrc);
|
||||
break;
|
||||
case arg.indexOf("profile") !== -1:
|
||||
print(T.profile);
|
||||
break;
|
||||
default:
|
||||
print(FR ? "cat: " + (arg || "?") + ": fichier introuvable" : "cat: " + (arg || "?") + ": No such file or directory");
|
||||
}
|
||||
break;
|
||||
case c === "contact" || c === "email" || c === "mail":
|
||||
print(T.contact.map(function (l) {
|
||||
var m = l.match(/^([A-Za-z]+:)\s*(\S+)$/);
|
||||
if (m && m[1] === "Email:") return { text: l, link: "mailto:" + m[2] };
|
||||
if (m && m[1] === "Mastodon:") return { text: l, link: "https://piaille.fr/@zektyc" };
|
||||
return l;
|
||||
}));
|
||||
break;
|
||||
case c === "sudo" || c === "su":
|
||||
print(T.sudo);
|
||||
break;
|
||||
case c === "apt":
|
||||
print(T.apt);
|
||||
break;
|
||||
case c === "exit" || c === "logout" || c === "quit":
|
||||
print(T.shutdown);
|
||||
input.disabled = true;
|
||||
input.setAttribute("placeholder", "");
|
||||
break;
|
||||
case c === "echo":
|
||||
print(arg || "");
|
||||
break;
|
||||
case c === "history":
|
||||
print(history.length ? history : [FR ? "(aucune commande)" : "(no commands)"]);
|
||||
break;
|
||||
default:
|
||||
print(T.unknown(c));
|
||||
}
|
||||
scrollDown();
|
||||
}
|
||||
|
||||
function submit() {
|
||||
var v = input.value;
|
||||
if (v.trim()) history.push(v);
|
||||
histIdx = history.length;
|
||||
runCommand(v);
|
||||
input.value = "";
|
||||
}
|
||||
|
||||
input.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Enter") {
|
||||
e.preventDefault();
|
||||
submit();
|
||||
} else if (e.key === "ArrowUp") {
|
||||
e.preventDefault();
|
||||
if (history.length) {
|
||||
histIdx = Math.max(0, histIdx - 1);
|
||||
input.value = history[histIdx] || "";
|
||||
}
|
||||
} else if (e.key === "ArrowDown") {
|
||||
e.preventDefault();
|
||||
if (history.length) {
|
||||
histIdx = Math.min(history.length, histIdx + 1);
|
||||
input.value = histIdx >= history.length ? "" : history[histIdx];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
root.addEventListener("click", function () {
|
||||
if (!input.disabled) input.focus();
|
||||
});
|
||||
|
||||
(function boot() {
|
||||
printAscii(["", T.boot.join("\n"), ""]);
|
||||
})();
|
||||
|
||||
setTimeout(function () {
|
||||
input.focus();
|
||||
}, 50);
|
||||
})();
|
||||
Loading…
Reference in a new issue