diff --git a/README.md b/README.md index 42547e5..0d8358c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # autonomous.contact -Bringing the BBS back. +A hub for communities as a single service with no required external dependencies. ## TODO diff --git a/deno.json b/deno.json index a69554d..a4b793c 100644 --- a/deno.json +++ b/deno.json @@ -11,11 +11,15 @@ "test": "DENO_ENV=test FSDB_ROOT=$PWD/tests/data/$(date --iso-8601=seconds) SERVERUS_ROOT=$PWD/public SERVERUS_PUT_PATHS_ALLOWED=./files SERVERUS_DELETE_PATHS_ALLOWED=./files deno test --allow-env --allow-read --allow-write --allow-net --allow-import --trace-leaks --fail-fast tests/" }, "test": { - "exclude": ["tests/data/"] + "exclude": [ + "tests/data/" + ] }, "compilerOptions": {}, "fmt": { - "include": ["**/*.ts"], + "include": [ + "**/*.ts" + ], "options": { "useTabs": true, "lineWidth": 180, @@ -25,22 +29,28 @@ } }, "lint": { - "include": ["**/*.ts"], + "include": [ + "**/*.ts" + ], "rules": { - "tags": ["recommended"], - "exclude": ["no-explicit-any"] + "tags": [ + "recommended" + ], + "exclude": [ + "no-explicit-any" + ] } }, "imports": { "@andyburke/fsdb": "jsr:@andyburke/fsdb@^1.2.4", "@andyburke/lurid": "jsr:@andyburke/lurid@^0.2.0", - "@andyburke/serverus": "jsr:@andyburke/serverus@^0.13.0", + "@andyburke/serverus": "jsr:@andyburke/serverus@^0.16.0", "@da/bcrypt": "jsr:@da/bcrypt@^1.0.1", - "@std/assert": "jsr:@std/assert@^1.0.15", + "@std/assert": "jsr:@std/assert@^1.0.17", "@std/encoding": "jsr:@std/encoding@^1.0.10", - "@std/fs": "jsr:@std/fs@^1.0.19", - "@std/http": "jsr:@std/http@^1.0.21", + "@std/fs": "jsr:@std/fs@^1.0.22", + "@std/http": "jsr:@std/http@^1.0.23", "@std/media-types": "jsr:@std/media-types@^1.1.0", - "@std/path": "jsr:@std/path@^1.1.2" + "@std/path": "jsr:@std/path@^1.1.4" } } diff --git a/deno.lock b/deno.lock index e96cc4d..0e06569 100644 --- a/deno.lock +++ b/deno.lock @@ -3,31 +3,31 @@ "specifiers": { "jsr:@andyburke/fsdb@^1.2.4": "1.2.4", "jsr:@andyburke/lurid@0.2": "0.2.0", - "jsr:@andyburke/serverus@0.13": "0.13.0", + "jsr:@andyburke/serverus@0.16": "0.16.0", "jsr:@da/bcrypt@*": "1.0.1", "jsr:@da/bcrypt@^1.0.1": "1.0.1", - "jsr:@std/assert@^1.0.15": "1.0.15", - "jsr:@std/cli@^1.0.19": "1.0.23", - "jsr:@std/cli@^1.0.20": "1.0.23", - "jsr:@std/cli@^1.0.21": "1.0.23", - "jsr:@std/cli@^1.0.23": "1.0.23", + "jsr:@std/assert@^1.0.17": "1.0.17", + "jsr:@std/cli@^1.0.19": "1.0.25", + "jsr:@std/cli@^1.0.20": "1.0.25", + "jsr:@std/cli@^1.0.21": "1.0.25", + "jsr:@std/cli@^1.0.25": "1.0.25", "jsr:@std/encoding@^1.0.10": "1.0.10", "jsr:@std/fmt@^1.0.6": "1.0.8", "jsr:@std/fmt@^1.0.8": "1.0.8", - "jsr:@std/fs@^1.0.18": "1.0.19", - "jsr:@std/fs@^1.0.19": "1.0.19", + "jsr:@std/fs@^1.0.18": "1.0.22", + "jsr:@std/fs@^1.0.19": "1.0.22", + "jsr:@std/fs@^1.0.21": "1.0.22", + "jsr:@std/fs@^1.0.22": "1.0.22", "jsr:@std/html@^1.0.5": "1.0.5", - "jsr:@std/http@^1.0.20": "1.0.21", - "jsr:@std/http@^1.0.21": "1.0.21", - "jsr:@std/internal@^1.0.10": "1.0.12", + "jsr:@std/http@^1.0.20": "1.0.23", + "jsr:@std/http@^1.0.23": "1.0.23", "jsr:@std/internal@^1.0.12": "1.0.12", - "jsr:@std/internal@^1.0.9": "1.0.12", "jsr:@std/media-types@^1.1.0": "1.1.0", "jsr:@std/net@^1.0.6": "1.0.6", - "jsr:@std/path@^1.1.0": "1.1.2", - "jsr:@std/path@^1.1.1": "1.1.2", - "jsr:@std/path@^1.1.2": "1.1.2", - "jsr:@std/streams@^1.0.13": "1.0.13", + "jsr:@std/path@^1.1.0": "1.1.4", + "jsr:@std/path@^1.1.1": "1.1.4", + "jsr:@std/path@^1.1.4": "1.1.4", + "jsr:@std/streams@^1.0.16": "1.0.16", "npm:@types/node@*": "22.15.15" }, "jsr": { @@ -45,8 +45,8 @@ "jsr:@std/cli@^1.0.19" ] }, - "@andyburke/serverus@0.13.0": { - "integrity": "73f451e1b68cd9be3938333b06290bfeab275361453559f40dfeab19dc4ad6d7", + "@andyburke/serverus@0.16.0": { + "integrity": "625fc3f08ddc377beb86b282d603ca6154cf38e136d916ec19a87ae4c4ed86d5", "dependencies": [ "jsr:@std/cli@^1.0.21", "jsr:@std/fmt@^1.0.6", @@ -59,14 +59,14 @@ "@da/bcrypt@1.0.1": { "integrity": "d2172d3acbcff52e0465557a1a48b1ff1c92df08c90712dae5372255a8c45eb3" }, - "@std/assert@1.0.15": { - "integrity": "d64018e951dbdfab9777335ecdb000c0b4e3df036984083be219ce5941e4703b", + "@std/assert@1.0.17": { + "integrity": "df5ebfffe77c03b3fa1401e11c762cc8f603d51021c56c4d15a8c7ab45e90dbe", "dependencies": [ - "jsr:@std/internal@^1.0.12" + "jsr:@std/internal" ] }, - "@std/cli@1.0.23": { - "integrity": "bf95b7a9425ba2af1ae5a6359daf58c508f2decf711a76ed2993cd352498ccca" + "@std/cli@1.0.25": { + "integrity": "1f85051b370c97a7a9dfc6ba626e7ed57a91bea8c081597276d1e78d929d8c91" }, "@std/encoding@1.0.10": { "integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1" @@ -74,27 +74,27 @@ "@std/fmt@1.0.8": { "integrity": "71e1fc498787e4434d213647a6e43e794af4fd393ef8f52062246e06f7e372b7" }, - "@std/fs@1.0.19": { - "integrity": "051968c2b1eae4d2ea9f79a08a3845740ef6af10356aff43d3e2ef11ed09fb06", + "@std/fs@1.0.22": { + "integrity": "de0f277a58a867147a8a01bc1b181d0dfa80bfddba8c9cf2bacd6747bcec9308", "dependencies": [ - "jsr:@std/internal@^1.0.9", - "jsr:@std/path@^1.1.1" + "jsr:@std/internal", + "jsr:@std/path@^1.1.4" ] }, "@std/html@1.0.5": { "integrity": "4e2d693f474cae8c16a920fa5e15a3b72267b94b84667f11a50c6dd1cb18d35e" }, - "@std/http@1.0.21": { - "integrity": "abb5c747651ee6e3ea6139858fd9b1810d2c97f53a5e6722f3b6d27a6d263edc", + "@std/http@1.0.23": { + "integrity": "6634e9e034c589bf35101c1b5ee5bbf052a5987abca20f903e58bdba85c80dee", "dependencies": [ - "jsr:@std/cli@^1.0.23", + "jsr:@std/cli@^1.0.25", "jsr:@std/encoding", "jsr:@std/fmt@^1.0.8", - "jsr:@std/fs@^1.0.19", + "jsr:@std/fs@^1.0.21", "jsr:@std/html", "jsr:@std/media-types", "jsr:@std/net", - "jsr:@std/path@^1.1.2", + "jsr:@std/path@^1.1.4", "jsr:@std/streams" ] }, @@ -107,14 +107,14 @@ "@std/net@1.0.6": { "integrity": "110735f93e95bb9feb95790a8b1d1bf69ec0dc74f3f97a00a76ea5efea25500c" }, - "@std/path@1.1.2": { - "integrity": "c0b13b97dfe06546d5e16bf3966b1cadf92e1cc83e56ba5476ad8b498d9e3038", + "@std/path@1.1.4": { + "integrity": "1d2d43f39efb1b42f0b1882a25486647cb851481862dc7313390b2bb044314b5", "dependencies": [ - "jsr:@std/internal@^1.0.10" + "jsr:@std/internal" ] }, - "@std/streams@1.0.13": { - "integrity": "772d208cd0d3e5dac7c1d9e6cdb25842846d136eea4a41a62e44ed4ab0c8dd9e" + "@std/streams@1.0.16": { + "integrity": "85030627befb1767c60d4f65cb30fa2f94af1d6ee6e5b2515b76157a542e89c4" } }, "npm": { @@ -135,14 +135,14 @@ "dependencies": [ "jsr:@andyburke/fsdb@^1.2.4", "jsr:@andyburke/lurid@0.2", - "jsr:@andyburke/serverus@0.13", + "jsr:@andyburke/serverus@0.16", "jsr:@da/bcrypt@^1.0.1", - "jsr:@std/assert@^1.0.15", + "jsr:@std/assert@^1.0.17", "jsr:@std/encoding@^1.0.10", - "jsr:@std/fs@^1.0.19", - "jsr:@std/http@^1.0.21", + "jsr:@std/fs@^1.0.22", + "jsr:@std/http@^1.0.23", "jsr:@std/media-types@^1.1.0", - "jsr:@std/path@^1.1.2" + "jsr:@std/path@^1.1.4" ] } } diff --git a/public/.spa b/public/.spa new file mode 100644 index 0000000..e69de29 diff --git a/public/api/auth/index.ts b/public/api/auth/index.ts index c69d8cf..7d47e32 100644 --- a/public/api/auth/index.ts +++ b/public/api/auth/index.ts @@ -6,10 +6,11 @@ import { SESSION, SESSIONS } from '../../../models/session.ts'; import { TOTP_ENTRIES } from '../../../models/totp_entry.ts'; import { encodeBase64 } from '@std/encoding/base64'; import parse_body from '../../../utils/bodyparser.ts'; -import { get_session, get_user, PRECHECK_TABLE, require_user, SESSION_ID_TOKEN, SESSION_SECRET_TOKEN } from '../../../utils/prechecks.ts'; +import { AUTHED_BEFORE_COOKIE_ID, get_session, get_user, PRECHECK_TABLE, require_user, SESSION_ID_TOKEN, SESSION_SECRET_TOKEN } from '../../../utils/prechecks.ts'; import * as bcrypt from '@da/bcrypt'; import { verifyTotp } from '../../../utils/totp.ts'; +const AUTHED_BEFORE_EXPIRATION: number = 399 * (24 * (60 * (60 * 1_000))); // 399 days const DEFAULT_SESSION_TIME: number = 365 * (24 * (60 * (60 * 1_000))); // 365 days export const PRECHECKS: PRECHECK_TABLE = {}; @@ -206,6 +207,7 @@ export async function create_new_session(session_settings: SESSION_INFO): Promis const headers = new Headers(); const expires_in_utc = new Date(session.timestamps.expires).toUTCString(); + headers.append('Set-Cookie', `${AUTHED_BEFORE_COOKIE_ID}=1; Path=/; Secure; Expires=${new Date(new Date(now).valueOf() + AUTHED_BEFORE_EXPIRATION).toUTCString()}`); headers.append('Set-Cookie', `${SESSION_ID_TOKEN}=${session.id}; Path=/; Secure; Expires=${expires_in_utc}`); headers.append(`x-${SESSION_ID_TOKEN}`, session.id); diff --git a/public/base.css b/public/base.css index 4035c12..cab56f7 100644 --- a/public/base.css +++ b/public/base.css @@ -169,6 +169,15 @@ body { /* fixed height? */ } +#background-container { + position: fixed; + top: 0; + right: 0; + left: 0; + bottom: 0; + z-index: -1; +} + main { position: relative; width: 100%; @@ -1682,6 +1691,32 @@ body[data-perms*="files.write.own"] [data-requires-permission="files.write.own"] left: 11px; } +.icon.map-pin { + box-sizing: border-box; + position: relative; + display: block; + transform: rotate(45deg) scale(var(--icon-scale, 1)); + width: 18px; + height: 18px; + border-radius: 100% 100% 0 100%; + border: 2px solid; + margin-top: -4px; +} + +.icon.map-pin::before { + content: ""; + display: block; + box-sizing: border-box; + position: absolute; + width: 8px; + height: 8px; + border: 2px solid; + top: 3px; + left: 3px; + border-radius: 40px; +} + + /* AUDIO PLAYER ICONS */ .icon.skip-back { box-sizing: border-box; diff --git a/public/foo/index.html b/public/foo/index.html new file mode 100644 index 0000000..42d2802 --- /dev/null +++ b/public/foo/index.html @@ -0,0 +1,6 @@ + + +
+