From db5efd8ed9c8b054d2de81c3bdf3bfe7ff7000ad Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 17 Apr 2026 00:12:47 +0200 Subject: [PATCH] clean initial commit --- .gitignore | 4 + index.js | 23 + package-lock.json | 1533 ++++++++++++++++++++++++++++++ package.json | 21 + public/admin.html | 601 ++++++++++++ public/datenschutz.html | 149 +++ public/favicon.svg | 7 + public/index.html | 1967 +++++++++++++++++++++++++++++++++++++++ public/login.html | 341 +++++++ src/auth.js | 25 + src/db.js | 146 +++ src/files.js | 181 ++++ src/routes.js | 394 ++++++++ 13 files changed, 5392 insertions(+) create mode 100644 .gitignore create mode 100644 index.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 public/admin.html create mode 100644 public/datenschutz.html create mode 100644 public/favicon.svg create mode 100644 public/index.html create mode 100644 public/login.html create mode 100644 src/auth.js create mode 100644 src/db.js create mode 100644 src/files.js create mode 100644 src/routes.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3bb9b42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +data.db +storage/ +CLAUDE.md diff --git a/index.js b/index.js new file mode 100644 index 0000000..9cd64cd --- /dev/null +++ b/index.js @@ -0,0 +1,23 @@ +const express = require('express'); +const cookieParser = require('cookie-parser'); +const path = require('path'); +const routes = require('./src/routes'); +const { router: filesRouter } = require('./src/files'); + +const app = express(); +const PORT = 3010; + +app.use(express.json()); +app.use(cookieParser()); +app.use(express.static(path.join(__dirname, 'public'))); +app.use('/api', routes); +app.use('/api/files', filesRouter); + +const html = f => (req, res) => res.sendFile(path.join(__dirname, 'public', f)); + +app.get('/login', html('login.html')); +app.get('/admin', html('admin.html')); +app.get('/datenschutz', html('datenschutz.html')); +app.get('/{*path}', html('index.html')); + +app.listen(PORT, '127.0.0.1', () => console.log(`info1 lΓ€uft auf :${PORT}`)); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..7f68bf2 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1533 @@ +{ + "name": "info1", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "info1", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "bcryptjs": "^3.0.3", + "better-sqlite3": "^12.9.0", + "cookie-parser": "^1.4.7", + "express": "^5.2.1", + "express-rate-limit": "^8.3.2", + "jsonwebtoken": "^9.0.3", + "multer": "^2.1.1" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/append-field": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz", + "integrity": "sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==", + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bcryptjs": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.3.tgz", + "integrity": "sha512-GlF5wPWnSa/X5LKM1o0wz0suXIINz1iHRLvTS+sLyi7XPbe5ycmYI3DlZqVGZZtDgl4DmasFg7gOB3JYbphV5g==", + "license": "BSD-3-Clause", + "bin": { + "bcrypt": "bin/bcrypt" + } + }, + "node_modules/better-sqlite3": { + "version": "12.9.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.9.0.tgz", + "integrity": "sha512-wqUv4Gm3toFpHDQmaKD4QhZm3g1DjUBI0yzS4UBl6lElUmXFYdTQmmEDpAFa5o8FiFiymURypEnfVHzILKaxqQ==", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "bindings": "^1.5.0", + "prebuild-install": "^7.1.1" + }, + "engines": { + "node": "20.x || 22.x || 23.x || 24.x || 25.x" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "license": "MIT", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "license": "MIT" + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC" + }, + "node_modules/concat-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-2.0.0.tgz", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/content-disposition": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz", + "integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", + "license": "MIT", + "dependencies": { + "cookie": "0.7.2", + "cookie-signature": "1.0.6" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.3.2.tgz", + "integrity": "sha512-77VmFeJkO0/rvimEDuUC5H30oqUC4EyOhyGccfqoLebB0oiEYfM7nwPrsDsBL1gsTpwfzX8SFy2MT3TDyRq+bg==", + "license": "MIT", + "dependencies": { + "ip-address": "10.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/express/node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "license": "MIT" + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", + "license": "MIT" + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/multer": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/multer/-/multer-2.1.1.tgz", + "integrity": "sha512-mo+QTzKlx8R7E5ylSXxWzGoXoZbOsRMpyitcht8By2KHvMbf3tjwosZ/Mu/XYU6UuJ3VZnODIrak5ZrPiPyB6A==", + "license": "MIT", + "dependencies": { + "append-field": "^1.0.0", + "busboy": "^1.6.0", + "concat-stream": "^2.0.0", + "type-is": "^1.6.18" + }, + "engines": { + "node": ">= 10.16.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/multer/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/multer/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-abi": { + "version": "3.89.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.89.0.tgz", + "integrity": "sha512-6u9UwL0HlAl21+agMN3YAMXcKByMqwGx+pq+P76vii5f7hTPtKDp08/H9py6DY+cfDw7kQNTGEj/rly3IgbNQA==", + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz", + "integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", + "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/qs": { + "version": "6.15.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.1.tgz", + "integrity": "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..6de29c9 --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "name": "info1", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "bcryptjs": "^3.0.3", + "better-sqlite3": "^12.9.0", + "cookie-parser": "^1.4.7", + "express": "^5.2.1", + "express-rate-limit": "^8.3.2", + "jsonwebtoken": "^9.0.3", + "multer": "^2.1.1" + } +} diff --git a/public/admin.html b/public/admin.html new file mode 100644 index 0000000..3f14492 --- /dev/null +++ b/public/admin.html @@ -0,0 +1,601 @@ + + + + + +IFB Β· Admin + + + + + + + + +
+
+
IFB-Berufsfachschule Rosenheim
+
INFO1
+
+
+ Admin-Panel + ← Dashboard +
+ +
+

Admin-Dashboard

+

Eingeloggt als …

+
+ +
+ + + + + +
+ +
+ + +
+
+
+ + + + +
+
+ + + + + +
IDBenutzernameE-MailRolleStatusRegistriertAktionen
+
+
+ + +
+

Lehrerkkonten warten auf Genehmigung.

+
+ + + + + +
IDBenutzernameE-MailRegistriertAktionen
+
+
+ + +
+
+ + +
+
+ + + + + +
IDVonBetreffStatusErstelltAktionen
+
+
+ + +
+
+ + + + + +
BenutzernameRolleStundenplanHausaufgabenNotenFehlzeitenTodosCountdownsLinksTickets
+
+
+ + +
+
+ + + + + +
ZeitAdminAktionZiel-IDDetails
+
+
+ +
+ + + + + + + +
+ + + + diff --git a/public/datenschutz.html b/public/datenschutz.html new file mode 100644 index 0000000..5e6a8d9 --- /dev/null +++ b/public/datenschutz.html @@ -0,0 +1,149 @@ + + + + + +DatenschutzerklΓ€rung Β· INFO1 Dashboard + + + + + +
+ INFO1 Dashboard + ← ZurΓΌck +
+
+

DatenschutzerklΓ€rung

+

Zuletzt aktualisiert: April 2026 Β· Gilt fΓΌr info1.simon0x.xyz

+ +
+

1. Verantwortlicher

+
+

Dieses Dashboard wird privat betrieben von einem Schüler der IFB-Berufsfachschule Rosenheim ausschließlich für interne Klassenzwecke der Klasse INFO1. Es handelt sich um kein kommerzielles Angebot.

+

Kontakt: kontakt@simon0x.xyz

+
+
+ +
+

2. Welche Daten werden gespeichert?

+ + + + + + + + + + + + + + + +
DatenkategorieInhaltZweck
AccountBenutzername (Klartext), Passwort als bcrypt-Hash (nicht lesbar, nicht umkehrbar)Authentifizierung
StundenplanFach, Raum, Lehrkraft, Uhrzeit, WochentagPersΓΆnliche Stundenplanverwaltung
HausaufgabenTitel, Fach, FΓ€lligkeitsdatum, ErledigungsstatusAufgabenverwaltung
NotenFach, Note, Notentyp, optionale AnmerkungNotenΓΌbersicht und Durchschnittsberechnung
FehlzeitenDatum, Fach, GrundFehlzeitentracking
To-DoAufgabentitel, ErledigungsstatusPersΓΆnliche Aufgabenliste
CountdownsBezeichnung, ZieldatumEreignis-Countdowns
LinksBezeichnung, URLPersΓΆnliche Schnellzugriffe
KlassenkalenderPrΓΌfungen und FerieneintrΓ€ge (klassenΓΆffentlich)Gemeinsame TerminΓΌbersicht der Klasse
+

Es werden keine Echtname, E-Mail-Adressen, IP-Adressen (dauerhaft), GerΓ€tedaten oder Verhaltensprofile gespeichert. Es gibt kein Tracking, keine Analytics und keine Werbung.

+
+ +
+

3. Wo werden die Daten gespeichert?

+

Alle Daten werden in einer SQLite-Datenbank auf einem virtuellen Server der Hetzner Online GmbH (Industriestr. 25, 91710 Gunzenhausen, Deutschland) gespeichert. Der Server befindet sich physisch im Rechenzentrum NΓΌrnberg (Deutschland) und unterliegt damit deutschem und europΓ€ischem Datenschutzrecht.

+

Es findet keine Übertragung in DrittlÀnder (außerhalb der EU/EWR) statt.

+

Hetzner ist als Auftragsverarbeiter gem. Art. 28 DSGVO tΓ€tig. DatenschutzerklΓ€rung Hetzner: hetzner.com/legal/privacy-policy

+
+ +
+

4. Rechtsgrundlage

+

Die Verarbeitung erfolgt auf Grundlage von Art. 6 Abs. 1 lit. a DSGVO (Einwilligung). Du gibst deine Einwilligung durch die freiwillige Registrierung. Du kannst sie jederzeit widerrufen, indem du deinen Account lΓΆschst (siehe Abschnitt 7).

+
+ +
+

5. Zugriff auf deine Daten

+

Alle persânlichen EintrÀge (Stundenplan, Noten, Hausaufgaben usw.) sind ausschließlich für den jeweiligen Account sichtbar. Kein anderer Nutzer kann deine persânlichen Daten sehen.

+

Klassenkalender-EintrΓ€ge (PrΓΌfungen, Ferien) sind fΓΌr alle Besucher der Seite sichtbar, da sie Klasseninformationen darstellen und keine persΓΆnlichen Daten enthalten.

+

Der Serverbetreiber hat technischen Zugriff auf die Datenbankdatei. PasswΓΆrter sind jedoch als bcrypt-Hash gespeichert und nicht lesbar.

+
+ +
+

6. Speicherdauer

+

Daten werden gespeichert bis:

+
    +
  • du deinen Account lΓΆschst (alle deine Daten werden sofort und vollstΓ€ndig gelΓΆscht), oder
  • +
  • du eine LΓΆschung per E-Mail anforderst, oder
  • +
  • das Dashboard eingestellt wird (Nutzer werden vorab informiert soweit mΓΆglich)
  • +
+
+ +
+

7. Deine Rechte (DSGVO Art. 15–21)

+
    +
  • Auskunft (Art. 15): Du kannst jederzeit Auskunft ΓΌber deine gespeicherten Daten anfordern.
  • +
  • Berichtigung (Art. 16): Du kannst alle EintrΓ€ge direkt im Dashboard bearbeiten oder lΓΆschen.
  • +
  • LΓΆschung (Art. 17): Du kannst deinen Account in den Einstellungen vollstΓ€ndig lΓΆschen. Alle deine Daten werden dabei sofort gelΓΆscht.
  • +
  • EinschrΓ€nkung (Art. 18): Auf Anfrage per E-Mail mΓΆglich.
  • +
  • Widerspruch (Art. 21): Da die Verarbeitung auf Einwilligung basiert, entfΓ€llt sie mit Widerruf der Einwilligung (= Account-LΓΆschung).
  • +
  • Beschwerde: Du hast das Recht, bei der zustΓ€ndigen DatenschutzaufsichtsbehΓΆrde Beschwerde einzulegen (Bayern: Bayerisches Landesamt fΓΌr Datenschutzaufsicht, lda.bayern.de).
  • +
+
+ +
+

8. Drittanbieter-Dienste

+ + + + + + + + + + + + + + + + + + + +
DienstZweckDatenΓΌbertragung
CloudflareCDN, DDoS-Schutz, HTTPS-ZertifikatIP-Adressen werden von Cloudflare temporΓ€r verarbeitet (EU-Server mΓΆglich). Cloudflare speichert keine Inhalte dauerhaft. DatenschutzerklΓ€rung
Open-Meteo APIWetterdaten fΓΌr RosenheimAnfragen gehen direkt vom Browser an api.open-meteo.com. Es werden nur Koordinaten ΓΌbertragen, keine personenbezogenen Daten. Nutzungsbedingungen
Google FontsSchriftart InterBeim ersten Laden wird die Schriftart von Google-Servern geladen. Dabei wird deine IP-Adresse an Google ΓΌbertragen. DatenschutzerklΓ€rung. Falls unerwΓΌnscht: Seite funktioniert auch mit System-Schriftart.
+
+ +
+

9. Sicherheit

+
    +
  • PasswΓΆrter werden ausschließlich als bcrypt-Hash (Cost-Factor 12) gespeichert – niemals im Klartext
  • +
  • Alle Verbindungen laufen ΓΌber HTTPS (TLS via Cloudflare)
  • +
  • Anmeldeversuch-Begrenzung: max. 10 Versuche pro 15 Minuten pro IP-Adresse
  • +
  • Session-Cookies sind als HttpOnly gesetzt (kein JavaScript-Zugriff)
  • +
  • Jeder Nutzer sieht nur seine eigenen Daten (serverseitige Filterung)
  • +
+
+
+ + diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..05d501a --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..3260fb4 --- /dev/null +++ b/public/index.html @@ -0,0 +1,1967 @@ + + + + + +IFB Β· INFO1 Dashboard + + + + + + + + +
+
+
i1
+
+ IFB-Berufsfachschule Rosenheim + INFO1 +
+
+ +
+
+ +
+
–
+
+ + + +
+
+ + + +
+
+ + +
+ + +
+
+
Stundenplan
+
+
+
+
Mo
+
Di
+
Mi
+
Do
+
Fr
+
+
Wird noch eingetragen
+
+
+ + + + + + + +
+ + +
+ + +
+
+
PrΓΌfungen & Klausuren
+ +
+
+
+ + +
+
+
Ferien & Feiertage
+ +
+
+
+ + + + + +
+
+
Schnelllinks
+ +
+ +
+ +
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/public/login.html b/public/login.html new file mode 100644 index 0000000..9010b9d --- /dev/null +++ b/public/login.html @@ -0,0 +1,341 @@ + + + + + +IFB Β· INFO1 – Anmelden + + + + + + + + +
+
+ + + +
+
Anmelden
+
Registrieren
+
+ +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ +
+
SchΓΌler/in
+
Lehrer/in
+
+
+
+ Lehrerkonten werden nach der Registrierung von einem Administrator geprΓΌft und freigeschaltet. +
+
+ + +
+
+ + +
+
+
Passwort eingeben
+
+
+
+
Registrierung erfolgreich! Dein Lehrerkonto wird von einem Administrator geprΓΌft und freigeschaltet.
+ +
+ +
+
+ + + + + + diff --git a/src/auth.js b/src/auth.js new file mode 100644 index 0000000..55eda8e --- /dev/null +++ b/src/auth.js @@ -0,0 +1,25 @@ +const jwt = require('jsonwebtoken'); +const SECRET = process.env.JWT_SECRET || 'info1-ifb-secret-change-in-prod'; + +function signToken(user) { + return jwt.sign({ id: user.id, username: user.username, role: user.role }, SECRET, { expiresIn: '30d' }); +} + +function verifyToken(token) { + try { + return jwt.verify(token, SECRET); + } catch { + return null; + } +} + +function requireAuth(req, res, next) { + const token = req.cookies?.token; + if (!token) return res.status(401).json({ error: 'Nicht eingeloggt' }); + const user = verifyToken(token); + if (!user) return res.status(401).json({ error: 'UngΓΌltige Sitzung' }); + req.user = user; + next(); +} + +module.exports = { signToken, verifyToken, requireAuth }; diff --git a/src/db.js b/src/db.js new file mode 100644 index 0000000..be40a67 --- /dev/null +++ b/src/db.js @@ -0,0 +1,146 @@ +const Database = require('better-sqlite3'); +const path = require('path'); + +const db = new Database(path.join(__dirname, '../data.db')); + +db.exec(` + CREATE TABLE IF NOT EXISTS users ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + username TEXT UNIQUE NOT NULL, + email TEXT UNIQUE NOT NULL, + password_hash TEXT NOT NULL, + created_at TEXT DEFAULT (datetime('now')) + ); + + CREATE TABLE IF NOT EXISTS timetable ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + day TEXT NOT NULL, + time_start TEXT, + time_end TEXT, + subject TEXT, + room TEXT, + teacher TEXT, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS homework ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + subject TEXT, + title TEXT NOT NULL, + due_date TEXT, + done INTEGER DEFAULT 0, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS grades ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + subject TEXT NOT NULL, + grade REAL, + type TEXT DEFAULT 'sonstiges', + note TEXT, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS absences ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + date TEXT, + subject TEXT, + reason TEXT, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS todos ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + title TEXT NOT NULL, + done INTEGER DEFAULT 0, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS countdowns ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + title TEXT NOT NULL, + target_date TEXT NOT NULL, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS quicklinks ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + label TEXT NOT NULL, + url TEXT NOT NULL, + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS class_events ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + type TEXT NOT NULL, + title TEXT NOT NULL, + date TEXT, + date_end TEXT, + description TEXT, + created_by INTEGER, + created_at TEXT DEFAULT (datetime('now')) + ); + + CREATE TABLE IF NOT EXISTS support_tickets ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + subject TEXT NOT NULL, + message TEXT NOT NULL, + status TEXT NOT NULL DEFAULT 'open', + created_at TEXT DEFAULT (datetime('now')), + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS ticket_messages ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + ticket_id INTEGER NOT NULL, + sender_id INTEGER NOT NULL, + message TEXT NOT NULL, + created_at TEXT DEFAULT (datetime('now')), + FOREIGN KEY (ticket_id) REFERENCES support_tickets(id), + FOREIGN KEY (sender_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS admin_logs ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + admin_id INTEGER NOT NULL, + action TEXT NOT NULL, + target_id INTEGER, + details TEXT, + created_at TEXT DEFAULT (datetime('now')) + ); + + CREATE TABLE IF NOT EXISTS chat_messages ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + class_id TEXT NOT NULL DEFAULT 'info1', + content TEXT NOT NULL, + created_at TEXT DEFAULT (datetime('now')), + FOREIGN KEY (user_id) REFERENCES users(id) + ); + + CREATE TABLE IF NOT EXISTS user_files ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + user_id INTEGER NOT NULL, + original_name TEXT NOT NULL, + stored_name TEXT NOT NULL UNIQUE, + mime_type TEXT NOT NULL, + size INTEGER NOT NULL, + created_at TEXT DEFAULT (datetime('now')), + FOREIGN KEY (user_id) REFERENCES users(id) + ); +`); + +// Safe migrations +try { db.exec(`ALTER TABLE grades ADD COLUMN type TEXT DEFAULT 'sonstiges'`); } catch {} +try { db.exec(`ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'student'`); } catch {} +try { db.exec(`ALTER TABLE users ADD COLUMN status TEXT NOT NULL DEFAULT 'pending'`); } catch {} + +module.exports = db; diff --git a/src/files.js b/src/files.js new file mode 100644 index 0000000..6f4f1a5 --- /dev/null +++ b/src/files.js @@ -0,0 +1,181 @@ +const express = require('express'); +const multer = require('multer'); +const path = require('path'); +const fs = require('fs'); +const crypto = require('crypto'); +const db = require('./db'); +const { requireAuth } = require('./auth'); + +const router = express.Router(); + +const STORAGE_DIR = path.resolve(__dirname, '../storage'); +fs.mkdirSync(STORAGE_DIR, { recursive: true }); + +const MAX_FILE_BYTES = 50 * 1024 * 1024; +const MAX_USER_BYTES = 2 * 1024 * 1024 * 1024; + +const ALLOWED_EXT = new Set([ + 'pdf','doc','docx','xls','xlsx','ppt','pptx','odt','ods','odp','rtf','txt','md', + 'jpg','jpeg','png','gif','webp','bmp','tiff','svg', + 'zip','rar','7z','tar','gz', + 'csv','json','xml', +]); + +const EXT_MIME = { + pdf: 'application/pdf', + doc: 'application/msword', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + xls: 'application/vnd.ms-excel', + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + ppt: 'application/vnd.ms-powerpoint', + pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + odt: 'application/vnd.oasis.opendocument.text', + ods: 'application/vnd.oasis.opendocument.spreadsheet', + odp: 'application/vnd.oasis.opendocument.presentation', + rtf: 'application/rtf', + txt: 'text/plain', + md: 'text/plain', + jpg: 'image/jpeg', + jpeg: 'image/jpeg', + png: 'image/png', + gif: 'image/gif', + webp: 'image/webp', + bmp: 'image/bmp', + tiff: 'image/tiff', + svg: 'image/svg+xml', + zip: 'application/zip', + rar: 'application/vnd.rar', + '7z': 'application/x-7z-compressed', + tar: 'application/x-tar', + gz: 'application/gzip', + csv: 'text/csv', + json: 'application/json', + xml: 'application/xml', +}; + +const ALLOWED_MIME = new Set([ + 'application/pdf', + 'application/msword', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.ms-excel', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.ms-powerpoint', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.presentation', + 'application/rtf', 'text/rtf', + 'text/plain', 'text/markdown', + 'image/jpeg', 'image/png', 'image/gif', 'image/webp', + 'image/bmp', 'image/tiff', 'image/svg+xml', + 'application/zip', 'application/x-zip-compressed', + 'application/vnd.rar', 'application/x-rar-compressed', + 'application/x-7z-compressed', + 'application/x-tar', 'application/gzip', 'application/x-gzip', + 'text/csv', + 'application/json', 'text/json', + 'application/xml', 'text/xml', + 'application/octet-stream', +]); + +const storage = multer.diskStorage({ + destination: (_req, _file, cb) => cb(null, STORAGE_DIR), + filename: (_req, file, cb) => { + const ext = path.extname(file.originalname).toLowerCase().slice(1); + cb(null, crypto.randomUUID() + (ext ? '.' + ext : '')); + }, +}); + +function fileFilter(_req, file, cb) { + const ext = path.extname(file.originalname).toLowerCase().slice(1); + if (!ext || !ALLOWED_EXT.has(ext)) { + return cb(Object.assign(new Error('INVALID_EXT'), { code: 'INVALID_EXT' })); + } + // Empty MIME happens on some Linux/OS configs β€” extension check is the primary gate + if (file.mimetype && !ALLOWED_MIME.has(file.mimetype)) { + return cb(Object.assign(new Error('INVALID_MIME'), { code: 'INVALID_MIME' })); + } + cb(null, true); +} + +const upload = multer({ storage, limits: { fileSize: MAX_FILE_BYTES }, fileFilter }); + +function getUserStorageUsed(userId) { + return db.prepare('SELECT COALESCE(SUM(size), 0) AS used FROM user_files WHERE user_id = ?').get(userId).used; +} + +router.get('/', requireAuth, (req, res) => { + const files = db.prepare( + 'SELECT id, original_name, mime_type, size, created_at FROM user_files WHERE user_id = ? ORDER BY created_at DESC' + ).all(req.user.id); + const used = getUserStorageUsed(req.user.id); + res.json({ files, used, quota: MAX_USER_BYTES }); +}); + +router.post('/', requireAuth, (req, res) => { + upload.single('file')(req, res, (err) => { + if (err) { + if (err.code === 'LIMIT_FILE_SIZE') return res.status(413).json({ error: 'Datei zu groß (max. 50 MB)' }); + if (err.code === 'INVALID_EXT') return res.status(400).json({ error: 'Dateityp nicht erlaubt' }); + if (err.code === 'INVALID_MIME') return res.status(400).json({ error: 'MIME-Typ nicht erlaubt' }); + return res.status(400).json({ error: 'Upload fehlgeschlagen' }); + } + if (!req.file) return res.status(400).json({ error: 'Keine Datei angegeben' }); + + const used = getUserStorageUsed(req.user.id); + if (used + req.file.size > MAX_USER_BYTES) { + fs.unlink(req.file.path, () => {}); + return res.status(413).json({ error: 'Speicherplatz voll (max. 2 GB pro Nutzer)' }); + } + + const ext = path.extname(req.file.originalname).toLowerCase().slice(1); + const mime = EXT_MIME[ext] || 'application/octet-stream'; + + const result = db.prepare( + 'INSERT INTO user_files (user_id, original_name, stored_name, mime_type, size) VALUES (?, ?, ?, ?, ?)' + ).run(req.user.id, req.file.originalname, req.file.filename, mime, req.file.size); + + res.json({ + id: result.lastInsertRowid, + original_name: req.file.originalname, + mime_type: mime, + size: req.file.size, + created_at: new Date().toISOString(), + }); + }); +}); + +router.get('/:id/download', requireAuth, (req, res) => { + const id = parseInt(req.params.id, 10); + if (!id) return res.status(400).json({ error: 'UngΓΌltige ID' }); + const file = db.prepare('SELECT * FROM user_files WHERE id = ? AND user_id = ?').get(id, req.user.id); + if (!file) return res.status(404).json({ error: 'Datei nicht gefunden' }); + + const filePath = path.join(STORAGE_DIR, file.stored_name); + if (!fs.existsSync(filePath)) return res.status(404).json({ error: 'Datei nicht gefunden' }); + + res.setHeader('Content-Type', file.mime_type); + res.setHeader('Content-Disposition', `attachment; filename*=UTF-8''${encodeURIComponent(file.original_name)}`); + res.setHeader('X-Content-Type-Options', 'nosniff'); + res.setHeader('Cache-Control', 'private, no-cache'); + res.sendFile(filePath); +}); + +router.delete('/:id', requireAuth, (req, res) => { + const id = parseInt(req.params.id, 10); + if (!id) return res.status(400).json({ error: 'UngΓΌltige ID' }); + const file = db.prepare('SELECT * FROM user_files WHERE id = ? AND user_id = ?').get(id, req.user.id); + if (!file) return res.status(404).json({ error: 'Datei nicht gefunden' }); + + fs.unlink(path.join(STORAGE_DIR, file.stored_name), () => {}); + db.prepare('DELETE FROM user_files WHERE id = ?').run(id); + res.json({ ok: true }); +}); + +function deleteUserFiles(userId) { + const files = db.prepare('SELECT stored_name FROM user_files WHERE user_id = ?').all(userId); + files.forEach(f => fs.unlink(path.join(STORAGE_DIR, f.stored_name), () => {})); + db.prepare('DELETE FROM user_files WHERE user_id = ?').run(userId); +} + +module.exports = { router, deleteUserFiles }; diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 0000000..58b2708 --- /dev/null +++ b/src/routes.js @@ -0,0 +1,394 @@ +const express = require('express'); +const bcrypt = require('bcryptjs'); +const rateLimit = require('express-rate-limit'); +const db = require('./db'); +const { signToken, requireAuth } = require('./auth'); +const { deleteUserFiles } = require('./files'); + +const router = express.Router(); + +const loginLimiter = rateLimit({ + windowMs: 15 * 60 * 1000, + max: 10, + message: { error: 'Zu viele Anmeldeversuche. Bitte 15 Minuten warten.' }, + standardHeaders: true, + legacyHeaders: false, +}); + +// --- AUTH --- +const IFB_EMAIL_RE = /^[a-z]\.[a-z]{2,}@ifb-schulen\.com$/i; + +router.post('/register', (req, res) => { + const { email, password, role } = req.body; + if (!email || !password) return res.status(400).json({ error: 'Alle Felder erforderlich' }); + if (!IFB_EMAIL_RE.test(email)) return res.status(403).json({ error: 'UngΓΌltige E-Mail-Adresse' }); + if (password.length < 6) return res.status(400).json({ error: 'Passwort zu kurz (min. 6 Zeichen)' }); + const username = email.split('@')[0].toLowerCase(); + const safeRole = (role === 'teacher') ? 'teacher' : 'student'; + const initialStatus = safeRole === 'teacher' ? 'pending' : 'active'; + + const hash = bcrypt.hashSync(password, 12); + try { + const result = db.prepare('INSERT INTO users (username, email, password_hash, role, status) VALUES (?, ?, ?, ?, ?)').run(username, email.toLowerCase(), hash, safeRole, initialStatus); + if (safeRole === 'teacher') { + return res.json({ ok: true, pending: true }); + } + const user = { id: result.lastInsertRowid, username, role: safeRole }; + const token = signToken(user); + res.cookie('token', token, { httpOnly: true, maxAge: 30 * 24 * 60 * 60 * 1000, sameSite: 'lax' }); + res.json({ ok: true, pending: false }); + } catch (e) { + if (e.message.includes('UNIQUE')) { + if (e.message.includes('email')) return res.status(409).json({ error: 'Diese E-Mail-Adresse ist bereits registriert' }); + return res.status(409).json({ error: 'Benutzername bereits vergeben' }); + } + res.status(500).json({ error: 'Serverfehler' }); + } +}); + +router.post('/login', loginLimiter, (req, res) => { + const { username, password } = req.body; + const user = db.prepare('SELECT * FROM users WHERE username = ?').get(username); + if (!user || !bcrypt.compareSync(password, user.password_hash)) { + return res.status(401).json({ error: 'Falscher Benutzername oder Passwort' }); + } + if (user.status === 'pending') { + return res.status(403).json({ error: 'Dein Konto wartet noch auf Freischaltung durch einen Administrator.' }); + } + if (user.status === 'banned') { + return res.status(403).json({ error: 'Dein Konto wurde gesperrt. Bitte wende dich an einen Administrator.' }); + } + if (user.status === 'rejected') { + return res.status(403).json({ error: 'Deine Registrierung als Lehrer/in wurde abgelehnt.' }); + } + if (user.status !== 'active') { + return res.status(403).json({ error: 'Dein Konto ist nicht aktiv.' }); + } + const token = signToken(user); + res.cookie('token', token, { httpOnly: true, maxAge: 30 * 24 * 60 * 60 * 1000, sameSite: 'lax' }); + res.json({ ok: true, username: user.username, role: user.role }); +}); + +router.post('/logout', (req, res) => { + res.clearCookie('token'); + res.json({ ok: true }); +}); + +router.get('/me', requireAuth, (req, res) => { + const user = db.prepare('SELECT id, username, email, role, status FROM users WHERE id = ?').get(req.user.id); + if (!user || user.status !== 'active') return res.status(403).json({ error: 'Konto nicht aktiv' }); + res.json({ username: user.username, id: user.id, role: user.role, email: user.email }); +}); + +router.put('/me/password', requireAuth, (req, res) => { + const { currentPassword, newPassword } = req.body; + if (!currentPassword || !newPassword) return res.status(400).json({ error: 'Felder erforderlich' }); + if (newPassword.length < 6) return res.status(400).json({ error: 'Neues Passwort zu kurz (min. 6 Zeichen)' }); + const user = db.prepare('SELECT * FROM users WHERE id = ?').get(req.user.id); + if (!bcrypt.compareSync(currentPassword, user.password_hash)) { + return res.status(401).json({ error: 'Aktuelles Passwort falsch' }); + } + const hash = bcrypt.hashSync(newPassword, 12); + db.prepare('UPDATE users SET password_hash = ? WHERE id = ?').run(hash, req.user.id); + res.json({ ok: true }); +}); + +router.delete('/me', requireAuth, (req, res) => { + const { password } = req.body; + const user = db.prepare('SELECT * FROM users WHERE id = ?').get(req.user.id); + if (!bcrypt.compareSync(password, user.password_hash)) { + return res.status(401).json({ error: 'Passwort falsch' }); + } + const tables = ['timetable','homework','grades','absences','todos','countdowns','quicklinks','chat_messages']; + tables.forEach(t => db.prepare(`DELETE FROM ${t} WHERE user_id = ?`).run(req.user.id)); + deleteUserFiles(req.user.id); + db.prepare('DELETE FROM users WHERE id = ?').run(req.user.id); + res.clearCookie('token'); + res.json({ ok: true }); +}); + +// --- ADMIN --- +function requireAdmin(req, res, next) { + if (req.user.role !== 'admin') return res.status(403).json({ error: 'Keine Administratorrechte' }); + next(); +} + +function logAdmin(adminId, action, targetId = null, details = null) { + db.prepare('INSERT INTO admin_logs (admin_id, action, target_id, details) VALUES (?, ?, ?, ?)') + .run(adminId, action, targetId, details ? JSON.stringify(details) : null); +} + +router.get('/admin/users', requireAuth, requireAdmin, (req, res) => { + const { role, status } = req.query; + let sql = 'SELECT id, username, email, role, status, created_at FROM users'; + const params = []; + const conditions = []; + if (role) { conditions.push('role = ?'); params.push(role); } + if (status) { conditions.push('status = ?'); params.push(status); } + if (conditions.length) sql += ' WHERE ' + conditions.join(' AND '); + sql += ' ORDER BY created_at DESC'; + res.json(db.prepare(sql).all(...params)); +}); + +router.post('/admin/teachers/:id/approve', requireAuth, requireAdmin, (req, res) => { + const target = db.prepare('SELECT id, role FROM users WHERE id = ?').get(req.params.id); + if (!target) return res.status(404).json({ error: 'Benutzer nicht gefunden' }); + if (target.role !== 'teacher') return res.status(400).json({ error: 'Kein Lehrerkonto' }); + db.prepare('UPDATE users SET status = ? WHERE id = ?').run('active', req.params.id); + logAdmin(req.user.id, 'teacher_approve', Number(req.params.id)); + res.json({ ok: true }); +}); + +router.post('/admin/teachers/:id/reject', requireAuth, requireAdmin, (req, res) => { + const target = db.prepare('SELECT id, role FROM users WHERE id = ?').get(req.params.id); + if (!target) return res.status(404).json({ error: 'Benutzer nicht gefunden' }); + if (target.role !== 'teacher') return res.status(400).json({ error: 'Kein Lehrerkonto' }); + db.prepare('UPDATE users SET status = ? WHERE id = ?').run('rejected', req.params.id); + logAdmin(req.user.id, 'teacher_reject', Number(req.params.id)); + res.json({ ok: true }); +}); + +router.patch('/admin/users/:id', requireAuth, requireAdmin, (req, res) => { + const { role, status } = req.body; + const allowed_roles = ['student', 'teacher', 'admin']; + const allowed_status = ['active', 'pending', 'banned', 'rejected']; + if (role && !allowed_roles.includes(role)) return res.status(400).json({ error: 'UngΓΌltige Rolle' }); + if (status && !allowed_status.includes(status)) return res.status(400).json({ error: 'UngΓΌltiger Status' }); + if (!role && !status) return res.status(400).json({ error: 'Keine Γ„nderung angegeben' }); + + const target = db.prepare('SELECT id FROM users WHERE id = ?').get(req.params.id); + if (!target) return res.status(404).json({ error: 'Benutzer nicht gefunden' }); + + if (role) db.prepare('UPDATE users SET role = ? WHERE id = ?').run(role, req.params.id); + if (status) db.prepare('UPDATE users SET status = ? WHERE id = ?').run(status, req.params.id); + logAdmin(req.user.id, 'user_update', Number(req.params.id), { role, status }); + res.json({ ok: true }); +}); + +router.delete('/admin/users/:id', requireAuth, requireAdmin, (req, res) => { + const target = db.prepare('SELECT id FROM users WHERE id = ?').get(req.params.id); + if (!target) return res.status(404).json({ error: 'Benutzer nicht gefunden' }); + if (Number(req.params.id) === req.user.id) return res.status(400).json({ error: 'Eigenes Konto kann nicht gelΓΆscht werden' }); + const tables = ['timetable','homework','grades','absences','todos','countdowns','quicklinks','chat_messages']; + tables.forEach(t => db.prepare(`DELETE FROM ${t} WHERE user_id = ?`).run(req.params.id)); + deleteUserFiles(Number(req.params.id)); + db.prepare('DELETE FROM users WHERE id = ?').run(req.params.id); + logAdmin(req.user.id, 'user_delete', Number(req.params.id)); + res.json({ ok: true }); +}); + +router.get('/admin/tickets', requireAuth, requireAdmin, (req, res) => { + const tickets = db.prepare(` + SELECT t.id, t.user_id, t.subject, t.message, t.status, t.created_at, + u.username, u.email + FROM support_tickets t + JOIN users u ON u.id = t.user_id + ORDER BY t.created_at DESC + `).all(); + res.json(tickets); +}); + +router.patch('/admin/tickets/:id', requireAuth, requireAdmin, (req, res) => { + const allowed = ['open', 'in_progress', 'closed']; + const { status } = req.body; + if (!status || !allowed.includes(status)) return res.status(400).json({ error: 'UngΓΌltiger Status' }); + const ticket = db.prepare('SELECT id FROM support_tickets WHERE id = ?').get(req.params.id); + if (!ticket) return res.status(404).json({ error: 'Ticket nicht gefunden' }); + db.prepare('UPDATE support_tickets SET status = ? WHERE id = ?').run(status, req.params.id); + logAdmin(req.user.id, 'ticket_update', Number(req.params.id), { status }); + res.json({ ok: true }); +}); + +router.get('/admin/logs', requireAuth, requireAdmin, (req, res) => { + const logs = db.prepare(` + SELECT l.id, l.action, l.target_id, l.details, l.created_at, + u.username AS admin_username + FROM admin_logs l + JOIN users u ON u.id = l.admin_id + ORDER BY l.created_at DESC + LIMIT 500 + `).all(); + res.json(logs); +}); + +router.get('/admin/usage', requireAuth, requireAdmin, (req, res) => { + const users = db.prepare('SELECT id, username, email, role, status FROM users ORDER BY username').all(); + const tables = ['timetable','homework','grades','absences','todos','countdowns','quicklinks','support_tickets']; + const usage = users.map(u => { + const counts = {}; + tables.forEach(t => { + const col = t === 'support_tickets' ? 'user_id' : 'user_id'; + counts[t] = db.prepare(`SELECT COUNT(*) AS c FROM ${t} WHERE user_id = ?`).get(u.id).c; + }); + return { ...u, counts }; + }); + res.json(usage); +}); + +// --- SUPPORT TICKETS (user-facing) --- +router.get('/tickets', requireAuth, (req, res) => { + res.json(db.prepare('SELECT id, subject, message, status, created_at FROM support_tickets WHERE user_id = ? ORDER BY created_at DESC').all(req.user.id)); +}); + +router.post('/tickets', requireAuth, (req, res) => { + const { subject, message } = req.body; + if (!subject || !message) return res.status(400).json({ error: 'Betreff und Nachricht erforderlich' }); + if (typeof subject !== 'string' || typeof message !== 'string') return res.status(400).json({ error: 'UngΓΌltige Eingabe' }); + const subjectT = subject.trim(), messageT = message.trim(); + if (!subjectT || !messageT) return res.status(400).json({ error: 'Felder dΓΌrfen nicht leer sein' }); + if (subjectT.length > 200) return res.status(400).json({ error: 'Betreff zu lang (max. 200 Zeichen)' }); + if (messageT.length > 5000) return res.status(400).json({ error: 'Nachricht zu lang (max. 5000 Zeichen)' }); + const result = db.prepare('INSERT INTO support_tickets (user_id, subject, message) VALUES (?, ?, ?)').run(req.user.id, subjectT, messageT); + res.json({ id: result.lastInsertRowid }); +}); + +const ticketMsgLimiter = rateLimit({ + windowMs: 60 * 1000, + max: 15, + keyGenerator: (req) => String(req.user.id), + message: { error: 'Zu viele Nachrichten. Bitte warten.' }, + standardHeaders: true, + legacyHeaders: false, + validate: { keyGeneratorIpFallback: false }, +}); + +router.get('/tickets/:id/messages', requireAuth, (req, res) => { + const ticket = db.prepare('SELECT id, user_id FROM support_tickets WHERE id = ?').get(req.params.id); + if (!ticket) return res.status(404).json({ error: 'Ticket nicht gefunden' }); + if (req.user.role !== 'admin' && ticket.user_id !== req.user.id) return res.status(403).json({ error: 'Kein Zugriff' }); + const messages = db.prepare(` + SELECT m.id, m.message, m.created_at, u.username, u.role + FROM ticket_messages m + JOIN users u ON u.id = m.sender_id + WHERE m.ticket_id = ? + ORDER BY m.created_at ASC + `).all(req.params.id); + res.json(messages); +}); + +router.post('/tickets/:id/messages', requireAuth, ticketMsgLimiter, (req, res) => { + const { message } = req.body; + if (!message || typeof message !== 'string') return res.status(400).json({ error: 'Nachricht erforderlich' }); + const trimmed = message.trim(); + if (!trimmed) return res.status(400).json({ error: 'Nachricht darf nicht leer sein' }); + if (trimmed.length > 5000) return res.status(400).json({ error: 'Nachricht zu lang (max. 5000 Zeichen)' }); + const ticket = db.prepare('SELECT id, user_id, status FROM support_tickets WHERE id = ?').get(req.params.id); + if (!ticket) return res.status(404).json({ error: 'Ticket nicht gefunden' }); + if (req.user.role !== 'admin' && ticket.user_id !== req.user.id) return res.status(403).json({ error: 'Kein Zugriff' }); + if (ticket.status === 'closed') return res.status(400).json({ error: 'Ticket ist geschlossen' }); + db.prepare('INSERT INTO ticket_messages (ticket_id, sender_id, message) VALUES (?, ?, ?)').run(ticket.id, req.user.id, trimmed); + if (req.user.role === 'admin' && ticket.status === 'open') { + db.prepare("UPDATE support_tickets SET status = 'in_progress' WHERE id = ?").run(ticket.id); + } + res.json({ ok: true }); +}); + +// --- CLASS EVENTS (shared, no user filter for GET) --- +router.get('/class-events', (req, res) => { + res.json(db.prepare('SELECT * FROM class_events ORDER BY date ASC').all()); +}); + +router.post('/class-events', requireAuth, (req, res) => { + const { type, title, date, date_end, description } = req.body; + if (!type || !title) return res.status(400).json({ error: 'Typ und Titel erforderlich' }); + const result = db.prepare('INSERT INTO class_events (type, title, date, date_end, description, created_by) VALUES (?,?,?,?,?,?)') + .run(type, title, date||null, date_end||null, description||null, req.user.id); + res.json({ id: result.lastInsertRowid }); +}); + +router.delete('/class-events/:id', requireAuth, (req, res) => { + db.prepare('DELETE FROM class_events WHERE id = ?').run(req.params.id); + res.json({ ok: true }); +}); + +// --- CHAT --- +const chatLimiter = rateLimit({ + windowMs: 30 * 1000, + max: 5, + keyGenerator: (req) => String(req.user.id), + message: { error: 'Zu viele Nachrichten. Bitte 30 Sekunden warten.' }, + standardHeaders: true, + legacyHeaders: false, + validate: { keyGeneratorIpFallback: false }, +}); + +const CLASS_ID = 'info1'; +const CHAT_MAX_LEN = 500; + +router.get('/chat', requireAuth, (req, res) => { + const after = parseInt(req.query.after, 10) || 0; + const msgs = after + ? db.prepare(` + SELECT m.id, m.content, m.created_at, u.username + FROM chat_messages m + JOIN users u ON u.id = m.user_id + WHERE m.class_id = ? AND m.id > ? + ORDER BY m.id ASC + `).all(CLASS_ID, after) + : db.prepare(` + SELECT m.id, m.content, m.created_at, u.username + FROM chat_messages m + JOIN users u ON u.id = m.user_id + WHERE m.class_id = ? + ORDER BY m.id DESC + LIMIT 50 + `).all(CLASS_ID).reverse(); + res.json(msgs); +}); + +router.post('/chat', requireAuth, chatLimiter, (req, res) => { + const { content } = req.body; + if (!content || typeof content !== 'string') return res.status(400).json({ error: 'Nachricht erforderlich' }); + const trimmed = content.trim(); + if (!trimmed) return res.status(400).json({ error: 'Nachricht darf nicht leer sein' }); + if (trimmed.length > CHAT_MAX_LEN) return res.status(400).json({ error: `Nachricht zu lang (max. ${CHAT_MAX_LEN} Zeichen)` }); + const result = db.prepare('INSERT INTO chat_messages (user_id, class_id, content) VALUES (?, ?, ?)').run(req.user.id, CLASS_ID, trimmed); + const msg = db.prepare(` + SELECT m.id, m.content, m.created_at, u.username + FROM chat_messages m JOIN users u ON u.id = m.user_id + WHERE m.id = ? + `).get(result.lastInsertRowid); + res.json(msg); +}); + +router.delete('/chat/:id', requireAuth, (req, res) => { + const msg = db.prepare('SELECT id, user_id FROM chat_messages WHERE id = ?').get(req.params.id); + if (!msg) return res.status(404).json({ error: 'Nachricht nicht gefunden' }); + if (msg.user_id !== req.user.id && req.user.role !== 'admin') return res.status(403).json({ error: 'Keine Berechtigung' }); + db.prepare('DELETE FROM chat_messages WHERE id = ?').run(req.params.id); + res.json({ ok: true }); +}); + +// --- PERSONAL CRUD --- +function crudRoutes(path, table, fields) { + router.get(`/${path}`, requireAuth, (req, res) => { + res.json(db.prepare(`SELECT * FROM ${table} WHERE user_id = ?`).all(req.user.id)); + }); + router.post(`/${path}`, requireAuth, (req, res) => { + const vals = fields.map(f => req.body[f] ?? null); + const cols = ['user_id', ...fields].join(', '); + const placeholders = ['?', ...fields.map(() => '?')].join(', '); + const result = db.prepare(`INSERT INTO ${table} (${cols}) VALUES (${placeholders})`).run(req.user.id, ...vals); + res.json({ id: result.lastInsertRowid }); + }); + router.put(`/${path}/:id`, requireAuth, (req, res) => { + const sets = fields.map(f => `${f} = ?`).join(', '); + const vals = fields.map(f => req.body[f] ?? null); + db.prepare(`UPDATE ${table} SET ${sets} WHERE id = ? AND user_id = ?`).run(...vals, req.params.id, req.user.id); + res.json({ ok: true }); + }); + router.delete(`/${path}/:id`, requireAuth, (req, res) => { + db.prepare(`DELETE FROM ${table} WHERE id = ? AND user_id = ?`).run(req.params.id, req.user.id); + res.json({ ok: true }); + }); +} + +crudRoutes('timetable', 'timetable', ['day', 'time_start', 'time_end', 'subject', 'room', 'teacher']); +crudRoutes('homework', 'homework', ['subject', 'title', 'due_date', 'done']); +crudRoutes('grades', 'grades', ['subject', 'grade', 'type', 'note']); +crudRoutes('absences', 'absences', ['date', 'subject', 'reason']); +crudRoutes('todos', 'todos', ['title', 'done']); +crudRoutes('countdowns', 'countdowns', ['title', 'target_date']); +crudRoutes('quicklinks', 'quicklinks', ['label', 'url']); + +module.exports = router;