From 001fc710d8b662080098d8d7dcba2c668bcb0587 Mon Sep 17 00:00:00 2001 From: memdmp Date: Wed, 20 Aug 2025 20:55:34 +0000 Subject: feat: do things --- src/routes/+layout.svelte | 54 ++++++++++++++++++---------- src/routes/api/v1/fs.ts | 20 +++++++++++ src/routes/aup/+page.svelte | 83 ++++++++++++++++++++++++++++++++++++++++++++ src/routes/home/+page.svelte | 2 +- src/routes/login/+server.ts | 4 ++- 5 files changed, 143 insertions(+), 20 deletions(-) create mode 100644 src/routes/api/v1/fs.ts create mode 100644 src/routes/aup/+page.svelte (limited to 'src/routes') diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index dc81706..61bd14e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,22 +10,40 @@ - -{@render children?.()} + diff --git a/src/routes/api/v1/fs.ts b/src/routes/api/v1/fs.ts new file mode 100644 index 0000000..92714f3 --- /dev/null +++ b/src/routes/api/v1/fs.ts @@ -0,0 +1,20 @@ +import { LockSet } from '$lib/vendor/lock'; +import fs from 'node:fs/promises'; +import process from 'node:process'; +import path from 'node:path'; + +const lockSet = new LockSet(); +const baseDataPath = + process.env.BASE_DATA_PATH ?? path.join(process.cwd(), 'data'); +const usersDir = path.join(baseDataPath, 'users'); +const disksDir = path.join(baseDataPath, 'disks'); + +export const userExists = async (username: string) => { + const unlock = await lockSet.get(username).acquireRead(); + try { + fs.open(path.join(baseDataPath, '')); + } catch (error) { + unlock(); + throw error; + } +}; diff --git a/src/routes/aup/+page.svelte b/src/routes/aup/+page.svelte new file mode 100644 index 0000000..767ee2d --- /dev/null +++ b/src/routes/aup/+page.svelte @@ -0,0 +1,83 @@ + + Crunched - Acceptable Use Policy + + +
+

Crunched - Acceptable Use Policy

+

+ The Neobot Verein does our best to provide rules limited to preserving our + morality, integrity, reliability and legality of our services.
+ We kindly request you follow the following rules: +

+
    +
  1. No pornography involving minors - real or fictional.
  2. +
  3. No crypto mining, please.
  4. +
  5. + No training LLMs. Only run them if their resource usage over time is + similar to any other server we'd see. +
  6. +
  7. + No hosting black-hat phishing sites or command and control (C&C) servers. + No launching (D)DoS attacks from our infrastructure. No outgoing spam. +
  8. +
  9. + No Tor Exit Nodes/Open Proxies/i2p Outproxies. Sorry, we don't want the + feds knocking on our door. +
  10. +
  11. Make an attempt to not have the server wide open for any attacker.
  12. +
  13. + Be reasonable with resource usage. We don't want to start needing to limit + network interfaces. +
  14. +
  15. + Try not to get init7 + to contact us about your use of our services. + (Link goes to their ToS) +
  16. +
  17. + Follow regional laws in Zurich, Switzerland - atleast in regards to the + contents hosted here.
    + We dislike the feds knocking on our door just as much as anyone else. +
  18. +
+

+ Tl;dr: Abide by the same general rules any other provider provides. Try not + to violate regional laws in Zurich, Switzerland. +

+

Excessive Resource Use Policy

+

+ In case of excessive resource use, we will try to inform you prior to taking + action. However, if the resource use severely affects other users, or the + server's operations as a whole, we may take actions without prior notice. +

+

UGC

+

+ If you allow user-generated content, you should really try to make sure you + moderate it so illegal material is removed before any complaints reach us. +

+

+ If you clearly state that your site hosts user-generated content, law + enforcement and child-protection agencies will typically contact you first + rather than contacting us, so ensure you put easily-accessible contact + information. +

+

Contact

+

+ As a user, due to the invite-only nature of this service, if you have + questions regarding the AUP, please just contact the creature that sent you + here. Only admins can generate invites, as of now. +

+

+ Are you a law enforcement agency and need contact with us? Contact us at
law-enforcement[at]neobot[dot]systems
+ Note that if you are requesting user data, unless you have a legally valid Durchsuchungsbefehl + (or similar) from the Staatsanwaltschaft, we are very likely to deny any requests + for data belonging to our users. +

+
diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index 8fa9ddd..2fc52e6 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -23,7 +23,7 @@ diff --git a/src/routes/login/+server.ts b/src/routes/login/+server.ts index 7313f13..d206e7e 100644 --- a/src/routes/login/+server.ts +++ b/src/routes/login/+server.ts @@ -6,14 +6,16 @@ export const GET = async (event) => { let desiredScopes = event.url.searchParams.get('scope') ?? 'default'; desiredScopes = desiredScopes .split(' ') - .flatMap((v) => (v === 'default' ? 'vm-own-read vm-own-write' : '')) + .flatMap((v) => (v === 'default' ? 'vm-own-read vm-own-write' : v)) .join(' '); if (new URL(target, event.url.href).host !== event.url.host) target = '/'; const existingScopes = (event.cookies.get('oid__scopes') ?? '').split(' '); const authed = await event.locals.auth(); const missingScopes = !!desiredScopes .split(' ') + .filter((v) => v) .find((v) => !existingScopes.includes(v)); + if ( // if we're not authenticated !authed || -- cgit v1.2.3