Deal with ports/tls, don't commit index.css
This commit is contained in:
parent
cf51f82a0d
commit
ca6d1785f5
6 changed files with 27 additions and 1868 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
.env
|
.env
|
||||||
|
index.css
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<script defer src="https://visitors.taevas.xyz/script.js" data-website-id="f196d626-e609-4841-9a80-0dc60f523ed5"></script>
|
<script defer src="https://visitors.taevas.xyz/script.js" data-website-id="f196d626-e609-4841-9a80-0dc60f523ed5"></script>
|
||||||
<title>Site - taevas.xyz</title>
|
<title>Site - taevas.xyz</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-gradient-to-tl from-indigo-100 via-sky-300 to-indigo-100 bg-fixed">
|
<body class="bg-gradient-to-tl from-amber-100 via-sky-300 to-amber-100 bg-fixed">
|
||||||
<span id="links" style="display: none;">
|
<span id="links" style="display: none;">
|
||||||
<a rel="me" href="https://taevas.xyz/">Taevas</a>
|
<a rel="me" href="https://taevas.xyz/">Taevas</a>
|
||||||
<a rel="me" href="https://www.youtube.com/@TTTaevas">YouTube</a>
|
<a rel="me" href="https://www.youtube.com/@TTTaevas">YouTube</a>
|
||||||
|
|
23
index.ts
23
index.ts
|
@ -1,3 +1,4 @@
|
||||||
|
import { parseArgs } from "util";
|
||||||
import { coding_github } from "./api/coding_github";
|
import { coding_github } from "./api/coding_github";
|
||||||
import { coding_gitlab } from "./api/coding_gitlab";
|
import { coding_gitlab } from "./api/coding_gitlab";
|
||||||
import { coding_kitsudev } from "./api/coding_kitsudev";
|
import { coding_kitsudev } from "./api/coding_kitsudev";
|
||||||
|
@ -11,7 +12,24 @@ import { media_lastfm } from "./api/media_lastfm";
|
||||||
import { token } from "./api/token";
|
import { token } from "./api/token";
|
||||||
import { website_umami } from "./api/website_umami";
|
import { website_umami } from "./api/website_umami";
|
||||||
|
|
||||||
|
// PORT AND SSL STUFF
|
||||||
|
|
||||||
|
const certificate = Bun.file("./cert.pem");
|
||||||
|
const key = Bun.file("./key.pem");
|
||||||
|
const ssl_available = await certificate.exists() && await key.exists();
|
||||||
|
console.log("Are we able to use SSL?", ssl_available);
|
||||||
|
|
||||||
|
const { values } = parseArgs({args: Bun.argv, allowPositionals: true, options: {dev: {type: "boolean"}}});
|
||||||
|
const dev = values.dev ?? false;
|
||||||
|
console.log("Are we in development mode?", dev);
|
||||||
|
|
||||||
|
const port = dev ? 8000 : ssl_available ? 443 : 80;
|
||||||
|
const tls = ssl_available ? {certificate, key} : undefined;
|
||||||
|
|
||||||
|
// ACTUAL CODE
|
||||||
|
|
||||||
export type Handler = (req: URLSearchParams) => Promise<Response>;
|
export type Handler = (req: URLSearchParams) => Promise<Response>;
|
||||||
|
|
||||||
const api_endpoints: Handler[] = [
|
const api_endpoints: Handler[] = [
|
||||||
coding_github,
|
coding_github,
|
||||||
coding_gitlab,
|
coding_gitlab,
|
||||||
|
@ -39,6 +57,9 @@ const builds = await Bun.build({
|
||||||
|
|
||||||
const server = Bun.serve({
|
const server = Bun.serve({
|
||||||
idleTimeout: 30,
|
idleTimeout: 30,
|
||||||
|
// @ts-expect-error https://github.com/oven-sh/bun/issues/17772
|
||||||
|
tls,
|
||||||
|
port,
|
||||||
fetch: async (req) => {
|
fetch: async (req) => {
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
const parameters = url.searchParams;
|
const parameters = url.searchParams;
|
||||||
|
@ -100,4 +121,4 @@ const server = Bun.serve({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`Listening on ${server.hostname}:${server.port}`);
|
console.log(`Listening on ${server.hostname}:${server.port}\n\n--------\n\n`);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bunx bun css && bun --hot index.ts",
|
"dev": "bunx bun css && bun --hot index.ts --dev",
|
||||||
"css": "bun tailwindcss -i ./src/App.css -o index.css",
|
"css": "bun tailwindcss -i ./src/App.css -o index.css",
|
||||||
"lint": "bunx eslint .",
|
"lint": "bunx eslint .",
|
||||||
"start": "bun run index.ts"
|
"start": "bun install && bunx bun css && bun run index.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bachmacintosh/wanikani-api-types": "^1.7.0",
|
"@bachmacintosh/wanikani-api-types": "^1.7.0",
|
||||||
|
|
|
@ -8,7 +8,7 @@ import Infos from "./Infos/index.tsx";
|
||||||
const root = createRoot(document.getElementById("root")!);
|
const root = createRoot(document.getElementById("root")!);
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<div className="App flex text-center bg-gradient-to-tl from-indigo-100 via-sky-300 to-indigo-100 bg-fixed">
|
<div className="App flex text-center bg-gradient-to-tl from-amber-100 via-sky-300 to-amber-100 bg-fixed">
|
||||||
<MainContent/>
|
<MainContent/>
|
||||||
<Infos/>
|
<Infos/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue