basic web stuff

This commit is contained in:
Jill 2023-11-17 23:11:50 +03:00
parent 77dbd8ee3f
commit eb1dd27d6b
Signed by: oat
GPG Key ID: 33489AA58A955108
11 changed files with 2450 additions and 28 deletions

View File

@ -15,6 +15,7 @@
"chalk": "^4.1.2",
"d3-array": "^2.12.1",
"discord.js": "^14.14.1",
"express": "^4.18.2",
"got": "^11.8.6",
"knex": "^3.0.1",
"outdent": "^0.8.0",
@ -25,6 +26,7 @@
},
"devDependencies": {
"@types/d3-array": "^3.2.1",
"@types/express": "^4.17.21",
"@types/parse-color": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ export default {
if (sub === 'create') {
interaction.reply({
ephemeral: true,
content: `To create a recipe, go here: ${interaction.client.config.siteURL}/create-recipe\nOnce done, click the button below and paste the resulting string in.`
content: `To create a recipe, go here: ${interaction.client.config.siteURL}/create-recipe/\nOnce done, click the button below and paste the resulting string in.`
});
}
}

View File

@ -7,6 +7,7 @@ import * as log from './lib/log';
import chalk from 'chalk';
import prettyBytes from 'pretty-bytes';
import { Command } from './types/index';
import { startServer } from './web';
const bot = new Client({
intents: [
@ -27,6 +28,9 @@ bot.config = {
async function init() {
log.nonsense('booting chip...');
log.nonsense('starting up web interface...');
await startServer(sitePort);
log.nonsense('setting up connection...');
try {
@ -48,7 +52,7 @@ bot.on(Events.ClientReady, async () => {
bot.commands = new Collection();
const cmdFiles = fs.readdirSync(path.join(__dirname, './commands')).filter((file) => file.endsWith('.js'));
for (const file of cmdFiles) {
const cmd = (await import(`./commands/${file}`)) as Command;
const cmd = (await import(`./commands/${file}`)).default as Command;
bot.commands.set(cmd.data.name, cmd);
if (cmd.onClientReady) cmd.onClientReady(bot);
}

10
src/web.ts Normal file
View File

@ -0,0 +1,10 @@
import express from 'express';
import * as log from './lib/log';
export async function startServer(port: number) {
const app = express();
app.use(express.static('static/'));
app.listen(port, () => log.info(`web interface listening on ${port}`));
}

BIN
static/assets/jillo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1 @@
hi

27
static/index.html Normal file
View File

@ -0,0 +1,27 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>jillo</title>
<meta name="theme-color" content="light dark">
<link href="/style.css" rel="stylesheet">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Balsamiq+Sans&display=swap" rel="stylesheet">
</head>
<body>
<div id="main">
<img src="/assets/jillo.png" width="150" height="200">
<h1>jillo!</h1>
<div>
<a href="https://discord.com/oauth2/authorize?client_id=898850107892596776&scope=bot" target="_blank" rel="noopener">invite</a>
&middot;
<a href="https://git.oat.zone/dark-firepit/jillo-bot" target="_blank" rel="noopener">repo</a>
</div>
</div>
</body>
</html>

80
static/style.css Normal file
View File

@ -0,0 +1,80 @@
:root {
--accent-color: #f17d10;
}
body {
padding: 0px;
margin: 0px;
overflow-x: hidden;
color: var(--text-color);
background-color: var(--background-color);
font-family: 'Balsamiq Sans', sans-serif;
font-weight: 300;
width: 100%;
min-height: 100vh;
text-underline-offset: 3px;
font-size: 16px;
color-scheme: dark;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}
:root {
--text-color: #111;
--background-color: #fefefd;
}
@media (prefers-color-scheme: dark) {
:root {
--text-color: #eee;
--background-color: #111110;
}
}
a {
text-decoration: none;
color: var(--accent-color);
}
a:hover {
text-decoration: underline;
}
#main {
display: flex;
text-align: center;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
}
#main img {
display: block;
height: 18rem;
width: auto;
animation: 1s popup;
animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
transition: transform 0.15s, opacity 0.1s;
}
#main img:active {
transform: scale(0.97);
opacity: 0.9;
}
#main :not(img) {
animation: 0.8s fadein;
}
#main h1 {
font-size: 4rem;
margin-top: 0.5rem;
margin-bottom: 1rem;
}
@keyframes fadein {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes popup {
0% { transform: scale(0) rotate(40deg) }
100% { transform: scale(1) rotate(0deg) }
}

7
svelte.config.mjs Normal file
View File

@ -0,0 +1,7 @@
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
export default {
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
// for more information about preprocessors
preprocess: vitePreprocess(),
};

7
vite.config.mjs Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
});