migrate to astro #1

Merged
nin0 merged 18 commits from astro into main 2024-07-29 17:07:16 -04:00
17 changed files with 0 additions and 2288 deletions
Showing only changes of commit bfc0c43b12 - Show all commits

130
.gitignore vendored
View file

@ -1,130 +0,0 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

View file

@ -1,4 +0,0 @@
FROM lipanski/docker-static-website:latest
# Copy your static files
COPY . .

View file

@ -1,3 +0,0 @@
Copyright (c) 2024 nin0dev (https://github.com/nin0-dev, https://codeberg.org/nin0dev, https://git.nin0.dev/nin0, https://nin0.dev)
Usage and reproduction is prohibited.
All rights reserved.

View file

@ -1,60 +0,0 @@
import pluginJs from "@eslint/js";
import stylisticJs from "@stylistic/eslint-plugin-js";
import globals from "globals";
export default [
{files: ["**/*.{js,mjs,cjs,ts}"],},
{languageOptions: { globals: globals.node }},
pluginJs.configs.recommended,
{
ignores: ["dist/*", "**/jquery.js"]
},
{
plugins: {
"@stylistic/js": stylisticJs,
},
rules: {
"yoda": "error",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"prefer-destructuring": ["error", {
"VariableDeclarator": { "array": false, "object": true },
"AssignmentExpression": { "array": false, "object": false }
}],
"operator-assignment": ["error", "always"],
"no-useless-computed-key": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
"no-invalid-regexp": "error",
"no-constant-condition": ["error", { "checkLoops": false }],
"no-duplicate-imports": "error",
"dot-notation": "error",
"no-fallthrough": "error",
"for-direction": "error",
"no-async-promise-executor": "error",
"no-cond-assign": "error",
"no-dupe-else-if": "error",
"no-duplicate-case": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-prototype-builtins": "error",
"no-regex-spaces": "error",
"no-shadow-restricted-names": "error",
"no-unexpected-multiline": "error",
"no-unsafe-optional-chaining": "error",
"no-useless-backreference": "error",
"use-isnan": "error",
"prefer-const": "error",
"prefer-spread": "error",
"semi": [2, "always"],
"@stylistic/js/indent": ["error", 4],
"@stylistic/js/quotes": [2, "double", { "avoidEscape": true }]
}
},
{
files: ["public/**/*.js"],
rules: {
"no-undef": "off", // due to being separate files eslint goes insane
"@typescript-eslint/no-unused-vars": ["off"] // noone cares lol
}
}
];

View file

@ -1,23 +0,0 @@
{
"name": "website",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "echo \"Error: no test specified\" && exit 1"
},
"author": "nin0dev",
"license": "All Rights Reserved",
"dependencies": {
"@stylistic/eslint-plugin-js": "^2.4.0",
"ejs": "^3.1.10",
"eslint-plugin-simple-import-sort": "^12.1.1",
"express": "^4.19.2",
"nodemon": "^3.1.4"
},
"devDependencies": {
"@eslint/js": "^9.8.0",
"eslint": "9.x",
"globals": "^15.8.0"
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,81 +0,0 @@
:root {
--online-color: #23a55a;
--idle-color: #f0b232;
--dnd-color: #f23f43;
--offline-color: #80848e;
}
body {
padding: 30px;
font-family: "Segoe UI", "Roboto", sans-serif !important;
background-color: #56a0d1;
}
#main-window {
max-width: 600px;
}
@media (pointer:coarse) {
body {
overflow: scroll !important;
}
#main-window {
margin-right: 10px;
margin-bottom: 10px;
}
}
.window-body {
padding: 10px;
}
#header {
display: flex;
}
#header h3 {
font-weight: 400;
margin-left: 20px;
margin-top: auto;
margin-bottom: auto;
}
#pfp {
width: 90px;
height: 90px;
border-radius: 6px;
box-shadow: 10px black;
border-color: var(--offline-color);
border-style: solid;
border-width: 2px;
}
a {
color: blue;
}
li {
padding: 2px;
}
#presence img {
width: 30px;
height: 30px;
}
#presence-content {
margin-top: auto;
margin-bottom: auto;
margin-left: 10px;
}
#presence {
display: flex;
}
#bottom-actions {
display: flex;
align-items: end;
justify-content: right;
}
body {
overflow: hidden;
}
* {
/* no this is not to protect my content or whatever. this is just to make draggable windows work in a non deranged way */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,56 +0,0 @@
// wow i love being fake programmer
// source: https://jams.hackclub.com/batch/webOS/part-3
function dragElement(element) {
// Step 2: Set up variables to keep track of the element's position.
var initialX = 0;
var initialY = 0;
var currentX = 0;
var currentY = 0;
// Step 3: Check if there is a special header element associated with the draggable element.
if (document.getElementById("title-bar")) {
// Step 4: If present, assign the `dragMouseDown` function to the header's `onmousedown` event.
// This allows you to drag the window around by its header.
document.getElementById("title-bar").onmousedown = startDragging;
} else {
// Step 5: If not present, assign the function directly to the draggable element's `onmousedown` event.
// This allows you to drag the window by holding down anywhere on the window.
element.onmousedown = startDragging;
}
// Step 6: Define the `startDragging` function to capture the initial mouse position and set up event listeners.
function startDragging(e) {
e = e || window.event;
e.preventDefault();
// Step 7: Get the mouse cursor position at startup.
initialX = e.clientX;
initialY = e.clientY;
// Step 8: Set up event listeners for mouse movement (`elementDrag`) and mouse button release (`closeDragElement`).
document.onmouseup = stopDragging;
document.onmousemove = dragElement;
}
// Step 9: Define the `elementDrag` function to calculate the new position of the element based on mouse movement.
function dragElement(e) {
e = e || window.event;
e.preventDefault();
// Step 10: Calculate the new cursor position.
currentX = initialX - e.clientX;
currentY = initialY - e.clientY;
initialX = e.clientX;
initialY = e.clientY;
// Step 11: Update the element's new position by modifying its `top` and `left` CSS properties.
console.log(element.offsetTop);
console.log(currentX);
element.style.top = (element.offsetTop - currentY) + "px";
element.style.left = (element.offsetLeft - currentX) + "px";
}
// Step 12: Define the `stopDragging` function to stop tracking mouse movement by removing the event listeners.
function stopDragging() {
document.onmouseup = null;
document.onmousemove = null;
console.log(element.offsetTop - currentY);
console.log(element.offsetLeft - currentX);
}
}

View file

@ -1,69 +0,0 @@
const shouldLog = false;
function log(content) {
if (shouldLog) console.log(content);
}
function onUpdate(data) {
// set status
log(data);
const pfp = document.getElementById("pfp");
switch(data.discord_status) {
case "online":
pfp.style.borderColor = "var(--online-color)";
break;
case "idle":
pfp.style.borderColor = "var(--idle-color)";
break;
case "dnd":
pfp.style.borderColor = "var(--dnd-color)";
break;
case "offline":
pfp.style.borderColor = "var(--offline-color)";
break;
}
// set presence
log(data.activities);
let listening = false;
let content = "";
data.activities.forEach(presence => {
if(presence.application_id === "463151177836658699" && presence.assets.small_text !== "Paused") { // premid
listening = true;
artist = presence.state.substring(0, presence.state.indexOf(" -"));
if (artist === "") {
artist = presence.state;
}
content = `Listening to ${presence.details} - ${artist}`;
}
if(presence.application_id === "1108588077900898414") { // vencord lastfm
listening = true;
content = `Listening to ${presence.details} - ${presence.state}`;
}
if(presence.application_id === "1054951789318909972") { // vendetta lastfm
listening = true;
content = `Listening to ${presence.details} - ${presence.state}`;
}
if(presence.id === "spotify:1") { // built in spotify hooluy shit normal presence)
listening = true;
content = `Listening to ${presence.details} - ${presence.state}`;
}
if(presence.type === 0 && presence.application_id !== "463151177836658699" && presence.application_id !== "1108588077900898414") { // generic playing status that isn't vencord lastfm or premid
listening = false;
content = `Playing ${presence.name}`;
}
});
document.getElementById("presence").style.display = content === "" ? "none": "flex";
document.getElementById("presence-content").innerText = content;
document.getElementById("presence-icon").src = listening ? "img/music.ico" : "img/game.ico";
}
LanyardWrapper.connectWebSocket("886685857560539176", onUpdate)
.catch(err => {
console.error(err);
});
// eslint-disable-next-line no-unused-vars
function showCredits() {
document.getElementById("credits").style.display = "block";
document.getElementById("credits-button").style.display = "none";
}
document.addEventListener("DOMContentLoaded", () => {
dragElement(document.getElementById("main-window"));
});

View file

@ -1,239 +0,0 @@
// oneko.js: https://github.com/adryd325/oneko.js
(function oneko() {
const isReducedMotion =
window.matchMedia("(prefers-reduced-motion: reduce)") === true ||
window.matchMedia("(prefers-reduced-motion: reduce)").matches === true;
if (isReducedMotion) return;
const nekoEl = document.createElement("div");
let nekoPosX = 32;
let nekoPosY = 32;
let mousePosX = 0;
let mousePosY = 0;
let frameCount = 0;
let idleTime = 0;
let idleAnimation = null;
let idleAnimationFrame = 0;
const nekoSpeed = 10;
const spriteSets = {
idle: [[-3, -3]],
alert: [[-7, -3]],
scratchSelf: [
[-5, 0],
[-6, 0],
[-7, 0],
],
scratchWallN: [
[0, 0],
[0, -1],
],
scratchWallS: [
[-7, -1],
[-6, -2],
],
scratchWallE: [
[-2, -2],
[-2, -3],
],
scratchWallW: [
[-4, 0],
[-4, -1],
],
tired: [[-3, -2]],
sleeping: [
[-2, 0],
[-2, -1],
],
N: [
[-1, -2],
[-1, -3],
],
NE: [
[0, -2],
[0, -3],
],
E: [
[-3, 0],
[-3, -1],
],
SE: [
[-5, -1],
[-5, -2],
],
S: [
[-6, -3],
[-7, -2],
],
SW: [
[-5, -3],
[-6, -1],
],
W: [
[-4, -2],
[-4, -3],
],
NW: [
[-1, 0],
[-1, -1],
],
};
function init() {
nekoEl.id = "oneko";
nekoEl.ariaHidden = true;
nekoEl.style.width = "32px";
nekoEl.style.height = "32px";
nekoEl.style.position = "fixed";
nekoEl.style.pointerEvents = "none";
nekoEl.style.imageRendering = "pixelated";
nekoEl.style.left = `${nekoPosX - 16}px`;
nekoEl.style.top = `${nekoPosY - 16}px`;
nekoEl.style.zIndex = Number.MAX_VALUE;
let nekoFile = "./oneko.gif";
const curScript = document.currentScript;
if (curScript && curScript.dataset.cat) {
nekoFile = curScript.dataset.cat;
}
nekoEl.style.backgroundImage = `url(${nekoFile})`;
document.body.appendChild(nekoEl);
document.addEventListener("mousemove", function (event) {
mousePosX = event.clientX;
mousePosY = event.clientY;
});
window.requestAnimationFrame(onAnimationFrame);
}
let lastFrameTimestamp;
function onAnimationFrame(timestamp) {
// Stops execution if the neko element is removed from DOM
if (!nekoEl.isConnected) {
return;
}
if (!lastFrameTimestamp) {
lastFrameTimestamp = timestamp;
}
if (timestamp - lastFrameTimestamp > 100) {
lastFrameTimestamp = timestamp;
frame();
}
window.requestAnimationFrame(onAnimationFrame);
}
function setSprite(name, frame) {
const sprite = spriteSets[name][frame % spriteSets[name].length];
nekoEl.style.backgroundPosition = `${sprite[0] * 32}px ${sprite[1] * 32}px`;
}
function resetIdleAnimation() {
idleAnimation = null;
idleAnimationFrame = 0;
}
function idle() {
idleTime += 1;
// every ~ 20 seconds
if (
idleTime > 10 &&
Math.floor(Math.random() * 200) === 0 &&
idleAnimation == null
) {
const avalibleIdleAnimations = ["sleeping", "scratchSelf"];
if (nekoPosX < 32) {
avalibleIdleAnimations.push("scratchWallW");
}
if (nekoPosY < 32) {
avalibleIdleAnimations.push("scratchWallN");
}
if (nekoPosX > window.innerWidth - 32) {
avalibleIdleAnimations.push("scratchWallE");
}
if (nekoPosY > window.innerHeight - 32) {
avalibleIdleAnimations.push("scratchWallS");
}
idleAnimation =
avalibleIdleAnimations[
Math.floor(Math.random() * avalibleIdleAnimations.length)
];
}
switch (idleAnimation) {
case "sleeping":
if (idleAnimationFrame < 8) {
setSprite("tired", 0);
break;
}
setSprite("sleeping", Math.floor(idleAnimationFrame / 4));
if (idleAnimationFrame > 192) {
resetIdleAnimation();
}
break;
case "scratchWallN":
case "scratchWallS":
case "scratchWallE":
case "scratchWallW":
case "scratchSelf":
setSprite(idleAnimation, idleAnimationFrame);
if (idleAnimationFrame > 9) {
resetIdleAnimation();
}
break;
default:
setSprite("idle", 0);
return;
}
idleAnimationFrame += 1;
}
function frame() {
frameCount += 1;
const diffX = nekoPosX - mousePosX;
const diffY = nekoPosY - mousePosY;
const distance = Math.sqrt(diffX ** 2 + diffY ** 2);
if (distance < nekoSpeed || distance < 48) {
idle();
return;
}
idleAnimation = null;
idleAnimationFrame = 0;
if (idleTime > 1) {
setSprite("alert", 0);
// count down after being alerted before moving
idleTime = Math.min(idleTime, 7);
idleTime -= 1;
return;
}
let direction;
direction = diffY / distance > 0.5 ? "N" : "";
direction += diffY / distance < -0.5 ? "S" : "";
direction += diffX / distance > 0.5 ? "W" : "";
direction += diffX / distance < -0.5 ? "E" : "";
setSprite(direction, frameCount);
nekoPosX -= (diffX / distance) * nekoSpeed;
nekoPosY -= (diffY / distance) * nekoSpeed;
nekoPosX = Math.min(Math.max(16, nekoPosX), window.innerWidth - 16);
nekoPosY = Math.min(Math.max(16, nekoPosY), window.innerHeight - 16);
nekoEl.style.left = `${nekoPosX - 16}px`;
nekoEl.style.top = `${nekoPosY - 16}px`;
}
init();
})();

View file

@ -1,12 +0,0 @@
var express = require("express");
var app = express();
app.set("view engine", "ejs");
app.use(express.static("public"))
app.get("/", function(req, res) {
res.render("index");
});
app.listen(8080);
console.log("Server is listening on port 8080");

View file

@ -1,105 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
* {
font-family: sans-serif !important;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nin0dev</title>
<link rel="stylesheet" href="https://unpkg.com/7.css">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/x-icon" href="logo-but-round.png">
<meta name="theme-color" content="#00D0D0">
<meta property="og:url" content="https://nin0.dev" />
<meta property="og:title" content="nin0dev" />
<meta property="og:description" content="Hey, I'm nin0dev, a Canadian software developer." />
<meta property="og:image" content="https://nin0.dev/logo.png" />
<script src="js/drag.js"></script>
</head>
<body>
<div class="window" id="main-window" style="position: absolute;">
<div class="title-bar">
<div class="title-bar-text">Home</div>
</div>
<div class="window-body">
<div id="header">
<img src="img/logo.png" alt="the nin0dev logo" id="pfp">
<h3>nin0dev <span style="font-size: 0.4em;">(he/him)</span></h3>
</div>
<br/>
<div id="presence" style="display: none; margin-bottom: 12px;">
<img src="img/game.ico" id="presence-icon">
<p id="presence-content"></p>
</div>
<fieldset>
<legend>About me</legend>
I'm a Canadian self-taught software developer that makes useless things in Python, HTML, JavaScript, and Kotlin.
<br/>
yeah that's it
</fieldset>
<br/>
<fieldset>
<legend>My projects</legend>
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
<li>
VendroidEnhanced: A Discord client for Android that loads the mobile website and injects Vencord.
<ul>
<li><a href="https://github.com/VendroidEnhanced/Vendroid">GitHub repo</a></li>
<li>Actively maintained</li>
<li>Fork of <a href="https://github.com/Vencord/Vendroid">Vencord/Vendroid</a></li>
</ul>
</li>
<li>
website: The website you're currently viewing
<ul>
<li><a href="https://github.com/nin0-dev/website">GitHub repo</a></li>
</ul>
</li>
<li>
nin0-bot: An in-development kitchen-sink Discord Bot with moderation, fun and utility
<ul>
<li><a href="https://github.com/nin0-dev/Sink">GitHub repo</a></li>
<li>In development</li>
</ul>
</li>
</ul>
</fieldset>
</br>
<fieldset>
<legend>Reach out!</legend>
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
<li>Discord: @nin0.dev</li>
<li>
Email: <a href="mailto:support@nin0.dev">support@nin0.dev</a>
</li>
<li>Telegram: <a href="https://t.me/nin0dev">@nin0dev</a></li>
<li>GitHub: <a href="https://github.com/nin0-dev">nin0-dev</a></li>
</ul>
</fieldset>
<span id="credits" style="display: none;">
<br/>
<fieldset>
<legend>Credits</legend>
<ul style="margin-top: 5px; margin-bottom: 5px; padding-left: 20px;">
<li>UI library: <a href="https://jdan.github.io/98.css/">98.css by jdan</a></li>
<li>Presence/status API: <a href="https://discord.gg/lanyard">Lanyard</a></li>
<li>Icons: <a href="https://win98icons.alexmeub.com/">official Windows 98 icons</a></li>
</ul>
</fieldset>
</span>
<div id="bottom-actions" style="margin-top: 13px;">
<button onclick="showCredits()" id="credits-button">Credits</button>
</div>
</div>
</div>
<script src="js/oneko.js"></script>
<script src="https://cdn.jsdelivr.net/npm/lanyard-wrapper/dist/index.browser.js"></script>
<script src="js/index.js"></script>
</body>
</html>