commit a3e94964f52ae993618675a557c442ea4321fb68
parent af072141a26674ef740b9ef771ff24ad9cb4ff88
Author: MTRNord <mtrnord1@gmail.com>
Date: Thu, 1 May 2025 18:19:26 +0200
Use generated API and caching
Signed-off-by: MTRNord <mtrnord1@gmail.com>
Diffstat:
15 files changed, 920 insertions(+), 53 deletions(-)
diff --git a/package.json b/package.json
@@ -27,6 +27,7 @@
"lucide-react": "^0.503.0",
"next": "15.3.1-canary.14",
"next-themes": "^0.4.6",
+ "openapi-fetch": "^0.13.5",
"plotly.js": "^3.0.1",
"react": "19.1.0",
"react-dom": "19.1.0",
@@ -44,6 +45,7 @@
"@types/react-plotly.js": "^2.6.3",
"eslint": "^9",
"eslint-config-next": "15.3.1-canary.14",
+ "openapi-typescript": "^7.6.1",
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17",
"typescript": "^5"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
@@ -62,6 +62,9 @@ importers:
next-themes:
specifier: ^0.4.6
version: 0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
+ openapi-fetch:
+ specifier: ^0.13.5
+ version: 0.13.5
plotly.js:
specifier: ^3.0.1
version: 3.0.1(mapbox-gl@1.13.3)(webpack@5.99.7)
@@ -108,6 +111,9 @@ importers:
eslint-config-next:
specifier: 15.3.1-canary.14
version: 15.3.1-canary.14(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3)
+ openapi-typescript:
+ specifier: ^7.6.1
+ version: 7.6.1(typescript@5.8.3)
postcss:
specifier: ^8.5.3
version: 8.5.3
@@ -124,6 +130,14 @@ packages:
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
engines: {node: '>=10'}
+ '@babel/code-frame@7.27.1':
+ resolution: {integrity: sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/helper-validator-identifier@7.27.1':
+ resolution: {integrity: sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==}
+ engines: {node: '>=6.9.0'}
+
'@choojs/findup@0.2.1':
resolution: {integrity: sha512-YstAqNb0MCN8PjdLCDfRsBcGVRN41f3vgLvaI0IrIcBp4AqILRSS0DeWNGkicC+f/zRIPJLc+9RURVSepwvfBw==}
hasBin: true
@@ -992,6 +1006,16 @@ packages:
'@radix-ui/rect@1.1.1':
resolution: {integrity: sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==}
+ '@redocly/ajv@8.11.2':
+ resolution: {integrity: sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==}
+
+ '@redocly/config@0.22.2':
+ resolution: {integrity: sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==}
+
+ '@redocly/openapi-core@1.34.2':
+ resolution: {integrity: sha512-glfkQFJizLdq2fBkNvc2FJW0sxDb5exd0wIXhFk+WHaFLMREBC3CxRo2Zq7uJIdfV9U3YTceMbXJklpDfmmwFQ==}
+ engines: {node: '>=18.17.0', npm: '>=9.5.0'}
+
'@rtsao/scc@1.1.0':
resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==}
@@ -1282,6 +1306,10 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
+ agent-base@7.1.3:
+ resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
+ engines: {node: '>= 14'}
+
ajv-formats@2.1.1:
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
@@ -1301,6 +1329,10 @@ packages:
ajv@8.17.1:
resolution: {integrity: sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==}
+ ansi-colors@4.1.3:
+ resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
+ engines: {node: '>=6'}
+
ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
@@ -1480,6 +1512,9 @@ packages:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
+ change-case@5.4.4:
+ resolution: {integrity: sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==}
+
chokidar@3.6.0:
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
@@ -1543,6 +1578,9 @@ packages:
resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}
engines: {node: '>=12.5.0'}
+ colorette@1.4.0:
+ resolution: {integrity: sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==}
+
commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
@@ -2276,6 +2314,10 @@ packages:
html-escaper@2.0.2:
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
+ https-proxy-agent@7.0.6:
+ resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
+ engines: {node: '>= 14'}
+
iconv-lite@0.4.24:
resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==}
engines: {node: '>=0.10.0'}
@@ -2304,6 +2346,10 @@ packages:
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
engines: {node: '>=0.8.19'}
+ index-to-position@1.1.0:
+ resolution: {integrity: sha512-XPdx9Dq4t9Qk1mTMbWONJqU7boCoumEH7fRET37HX5+khDUl3J2W6PdALxhILYlIYx2amlwYcRPp28p0tSiojg==}
+ engines: {node: '>=18'}
+
inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
@@ -2499,6 +2545,10 @@ packages:
jose@6.0.10:
resolution: {integrity: sha512-skIAxZqcMkOrSwjJvplIPYrlXGpxTPnro2/QWTDCxAdWQrSTV5/KqspMWmi5WAx5+ULswASJiZ0a+1B/Lxt9cw==}
+ js-levenshtein@1.1.6:
+ resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}
+ engines: {node: '>=0.10.0'}
+
js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
@@ -2634,6 +2684,10 @@ packages:
minimatch@3.1.2:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
+ minimatch@5.1.6:
+ resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
+ engines: {node: '>=10'}
+
minimatch@9.0.5:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'}
@@ -2789,6 +2843,18 @@ packages:
once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
+ openapi-fetch@0.13.5:
+ resolution: {integrity: sha512-AQK8T9GSKFREFlN1DBXTYsLjs7YV2tZcJ7zUWxbjMoQmj8dDSFRrzhLCbHPZWA1TMV3vACqfCxLEZcwf2wxV6Q==}
+
+ openapi-typescript-helpers@0.0.15:
+ resolution: {integrity: sha512-opyTPaunsklCBpTK8JGef6mfPhLSnyy5a0IN9vKtx3+4aExf+KxEqYwIy3hqkedXIB97u357uLMJsOnm3GVjsw==}
+
+ openapi-typescript@7.6.1:
+ resolution: {integrity: sha512-F7RXEeo/heF3O9lOXo2bNjCOtfp7u+D6W3a3VNEH2xE6v+fxLtn5nq0uvUcA1F5aT+CMhNeC5Uqtg5tlXFX/ag==}
+ hasBin: true
+ peerDependencies:
+ typescript: ^5.x
+
opener@1.5.2:
resolution: {integrity: sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==}
hasBin: true
@@ -2819,6 +2885,10 @@ packages:
parenthesis@3.1.8:
resolution: {integrity: sha512-KF/U8tk54BgQewkJPvB4s/US3VQY68BRDpH638+7O/n58TpnwiwnOtGIOsT2/i+M78s61BBpeC83STB88d8sqw==}
+ parse-json@8.3.0:
+ resolution: {integrity: sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==}
+ engines: {node: '>=18'}
+
parse-rect@1.2.0:
resolution: {integrity: sha512-4QZ6KYbnE6RTwg9E0HpLchUM9EZt6DnDxajFZZDSV4p/12ZJEvPO702DZpGvRYEPo00yKDys7jASi+/w7aO8LA==}
@@ -2876,6 +2946,10 @@ packages:
resolution: {integrity: sha512-eWEUkqdv4sblmUQJ7xGlEA+LghzEVPJOlPBZMJuagG0CsQxlmBb+7rd0UFVig5jhRnN8PQqRQaLv6qXIjnvzgg==}
engines: {node: '>=18.0.0'}
+ pluralize@8.0.0:
+ resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==}
+ engines: {node: '>=4'}
+
point-in-polygon@1.1.0:
resolution: {integrity: sha512-3ojrFwjnnw8Q9242TzgXuTD+eKiutbzyslcq1ydfu82Db2y+Ogbmyrkpv0Hgj31qwT3lbS9+QAAO/pIQM35XRw==}
@@ -3370,6 +3444,10 @@ packages:
resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==}
engines: {node: '>=10'}
+ supports-color@9.4.0:
+ resolution: {integrity: sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==}
+ engines: {node: '>=12'}
+
supports-preserve-symlinks-flag@1.0.0:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
@@ -3484,6 +3562,10 @@ packages:
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
engines: {node: '>= 0.8.0'}
+ type-fest@4.40.1:
+ resolution: {integrity: sha512-9YvLNnORDpI+vghLU/Nf+zSv0kL47KbVJ1o3sKgoTefl6i+zebxbiDQWoe/oWWqPhIgQdRZRT1KA9sCPL810SA==}
+ engines: {node: '>=16'}
+
type@2.7.3:
resolution: {integrity: sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==}
@@ -3536,6 +3618,9 @@ packages:
update-diff@1.1.0:
resolution: {integrity: sha512-rCiBPiHxZwT4+sBhEbChzpO5hYHjm91kScWgdHf4Qeafs6Ba7MBl+d9GlGv72bcTZQO0sLmtQS1pHSWoCLtN/A==}
+ uri-js-replace@1.0.1:
+ resolution: {integrity: sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==}
+
uri-js@4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
@@ -3663,11 +3748,18 @@ packages:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
+ yaml-ast-parser@0.0.43:
+ resolution: {integrity: sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==}
+
yaml@2.7.1:
resolution: {integrity: sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==}
engines: {node: '>= 14'}
hasBin: true
+ yargs-parser@21.1.1:
+ resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
+ engines: {node: '>=12'}
+
yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
@@ -3676,6 +3768,14 @@ snapshots:
'@alloc/quick-lru@5.2.0': {}
+ '@babel/code-frame@7.27.1':
+ dependencies:
+ '@babel/helper-validator-identifier': 7.27.1
+ js-tokens: 4.0.0
+ picocolors: 1.1.1
+
+ '@babel/helper-validator-identifier@7.27.1': {}
+
'@choojs/findup@0.2.1':
dependencies:
commander: 2.20.3
@@ -3708,7 +3808,7 @@ snapshots:
'@eslint/config-array@0.20.0':
dependencies:
'@eslint/object-schema': 2.1.6
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@@ -3722,7 +3822,7 @@ snapshots:
'@eslint/eslintrc@3.3.1':
dependencies:
ajv: 6.12.6
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
espree: 10.3.0
globals: 14.0.0
ignore: 5.3.2
@@ -4519,6 +4619,29 @@ snapshots:
'@radix-ui/rect@1.1.1': {}
+ '@redocly/ajv@8.11.2':
+ dependencies:
+ fast-deep-equal: 3.1.3
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+ uri-js-replace: 1.0.1
+
+ '@redocly/config@0.22.2': {}
+
+ '@redocly/openapi-core@1.34.2(supports-color@9.4.0)':
+ dependencies:
+ '@redocly/ajv': 8.11.2
+ '@redocly/config': 0.22.2
+ colorette: 1.4.0
+ https-proxy-agent: 7.0.6(supports-color@9.4.0)
+ js-levenshtein: 1.1.6
+ js-yaml: 4.1.0
+ minimatch: 5.1.6
+ pluralize: 8.0.0
+ yaml-ast-parser: 0.0.43
+ transitivePeerDependencies:
+ - supports-color
+
'@rtsao/scc@1.1.0': {}
'@rushstack/eslint-patch@1.11.0': {}
@@ -4653,7 +4776,7 @@ snapshots:
'@typescript-eslint/types': 8.30.1
'@typescript-eslint/typescript-estree': 8.30.1(typescript@5.8.3)
'@typescript-eslint/visitor-keys': 8.30.1
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
eslint: 9.25.0(jiti@2.4.2)
typescript: 5.8.3
transitivePeerDependencies:
@@ -4668,7 +4791,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 8.30.1(typescript@5.8.3)
'@typescript-eslint/utils': 8.30.1(eslint@9.25.0(jiti@2.4.2))(typescript@5.8.3)
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
eslint: 9.25.0(jiti@2.4.2)
ts-api-utils: 2.1.0(typescript@5.8.3)
typescript: 5.8.3
@@ -4681,7 +4804,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 8.30.1
'@typescript-eslint/visitor-keys': 8.30.1
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
fast-glob: 3.3.3
is-glob: 4.0.3
minimatch: 9.0.5
@@ -4851,6 +4974,8 @@ snapshots:
acorn@8.14.1: {}
+ agent-base@7.1.3: {}
+
ajv-formats@2.1.1(ajv@8.17.1):
optionalDependencies:
ajv: 8.17.1
@@ -4874,6 +4999,8 @@ snapshots:
json-schema-traverse: 1.0.0
require-from-string: 2.0.2
+ ansi-colors@4.1.3: {}
+
ansi-regex@5.0.1: {}
ansi-regex@6.1.0: {}
@@ -5065,6 +5192,8 @@ snapshots:
ansi-styles: 4.3.0
supports-color: 7.2.0
+ change-case@5.4.4: {}
+
chokidar@3.6.0:
dependencies:
anymatch: 3.1.3
@@ -5145,6 +5274,8 @@ snapshots:
color-string: 1.9.1
optional: true
+ colorette@1.4.0: {}
+
commander@2.20.3: {}
commander@4.1.1: {}
@@ -5298,9 +5429,11 @@ snapshots:
dependencies:
ms: 2.1.3
- debug@4.4.0:
+ debug@4.4.0(supports-color@9.4.0):
dependencies:
ms: 2.1.3
+ optionalDependencies:
+ supports-color: 9.4.0
deep-is@0.1.4: {}
@@ -5564,7 +5697,7 @@ snapshots:
eslint-import-resolver-typescript@3.10.0(eslint-plugin-import@2.31.0)(eslint@9.25.0(jiti@2.4.2)):
dependencies:
'@nolyfill/is-core-module': 1.0.39
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
eslint: 9.25.0(jiti@2.4.2)
get-tsconfig: 4.10.0
is-bun-module: 2.0.0
@@ -5693,7 +5826,7 @@ snapshots:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.6
- debug: 4.4.0
+ debug: 4.4.0(supports-color@9.4.0)
escape-string-regexp: 4.0.0
eslint-scope: 8.3.0
eslint-visitor-keys: 4.2.0
@@ -6094,6 +6227,13 @@ snapshots:
html-escaper@2.0.2: {}
+ https-proxy-agent@7.0.6(supports-color@9.4.0):
+ dependencies:
+ agent-base: 7.1.3
+ debug: 4.4.0(supports-color@9.4.0)
+ transitivePeerDependencies:
+ - supports-color
+
iconv-lite@0.4.24:
dependencies:
safer-buffer: 2.1.2
@@ -6115,6 +6255,8 @@ snapshots:
imurmurhash@0.1.4: {}
+ index-to-position@1.1.0: {}
+
inherits@2.0.4: {}
ini@4.1.3: {}
@@ -6301,6 +6443,8 @@ snapshots:
jose@6.0.10: {}
+ js-levenshtein@1.1.6: {}
+
js-tokens@4.0.0: {}
js-yaml@4.1.0:
@@ -6458,6 +6602,10 @@ snapshots:
dependencies:
brace-expansion: 1.1.11
+ minimatch@5.1.6:
+ dependencies:
+ brace-expansion: 2.0.1
+
minimatch@9.0.5:
dependencies:
brace-expansion: 2.0.1
@@ -6614,6 +6762,22 @@ snapshots:
dependencies:
wrappy: 1.0.2
+ openapi-fetch@0.13.5:
+ dependencies:
+ openapi-typescript-helpers: 0.0.15
+
+ openapi-typescript-helpers@0.0.15: {}
+
+ openapi-typescript@7.6.1(typescript@5.8.3):
+ dependencies:
+ '@redocly/openapi-core': 1.34.2(supports-color@9.4.0)
+ ansi-colors: 4.1.3
+ change-case: 5.4.4
+ parse-json: 8.3.0
+ supports-color: 9.4.0
+ typescript: 5.8.3
+ yargs-parser: 21.1.1
+
opener@1.5.2: {}
optionator@0.9.4:
@@ -6647,6 +6811,12 @@ snapshots:
parenthesis@3.1.8: {}
+ parse-json@8.3.0:
+ dependencies:
+ '@babel/code-frame': 7.27.1
+ index-to-position: 1.1.0
+ type-fest: 4.40.1
+
parse-rect@1.2.0:
dependencies:
pick-by-alias: 1.2.0
@@ -6746,6 +6916,8 @@ snapshots:
- supports-color
- webpack
+ pluralize@8.0.0: {}
+
point-in-polygon@1.1.0: {}
polybooljs@1.2.2: {}
@@ -7356,6 +7528,8 @@ snapshots:
dependencies:
has-flag: 4.0.0
+ supports-color@9.4.0: {}
+
supports-preserve-symlinks-flag@1.0.0: {}
svg-arc-to-cubic-bezier@3.2.0: {}
@@ -7490,6 +7664,8 @@ snapshots:
dependencies:
prelude-ls: 1.2.1
+ type-fest@4.40.1: {}
+
type@2.7.3: {}
typed-array-buffer@1.0.3:
@@ -7574,6 +7750,8 @@ snapshots:
update-diff@1.1.0: {}
+ uri-js-replace@1.0.1: {}
+
uri-js@4.4.1:
dependencies:
punycode: 2.3.1
@@ -7743,6 +7921,10 @@ snapshots:
xtend@4.0.2: {}
+ yaml-ast-parser@0.0.43: {}
+
yaml@2.7.1: {}
+ yargs-parser@21.1.1: {}
+
yocto-queue@0.1.0: {}
diff --git a/src/app/api/session/route.ts b/src/app/api/session/route.ts
@@ -26,12 +26,12 @@ export async function POST(req: Request) {
};
const response = NextResponse.json(user);
- response.cookies.set("session", JSON.stringify(user), { httpOnly: true, path: "/" });
+ response.cookies.set("d4all_session", JSON.stringify(user), { httpOnly: true, path: "/" });
return response;
}
export async function GET() {
- const session = (await cookies()).get("session")?.value;
+ const session = (await cookies()).get("d4all_session")?.value;
if (!session) {
return NextResponse.json({ error: "No active session" }, { status: 401 });
@@ -43,7 +43,7 @@ export async function GET() {
export async function DELETE(req: Request) {
const url = new URL(req.url);
const response = NextResponse.redirect(url.origin);
- response.cookies.set("session", "", { httpOnly: true, path: "/", maxAge: 0 });
+ response.cookies.set("d4all_session", "", { httpOnly: true, path: "/", maxAge: 0 });
return response;
}
\ No newline at end of file
diff --git a/src/app/dashboard/analytics/page.tsx b/src/app/dashboard/analytics/page.tsx
@@ -66,7 +66,7 @@ export default async function AnalyticsDashboard({
const timeRange = (params.timeRange as string | undefined) ?? "year"
const heatmapType = (params.heatmapType as string | undefined) ?? "reports"
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value ?? "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/dashboard/bans/page.tsx b/src/app/dashboard/bans/page.tsx
@@ -18,7 +18,7 @@ export default async function Bans({
const teamIdParam = params.team as string | undefined;
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
@@ -28,7 +28,7 @@ export default async function Bans({
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
- const selectedBot = listData.bots.find((team) => team.id === teamIdParam) || listData.bots[0];
+ const selectedBot = listData.bots.find((team) => team.id === teamIdParam) ?? listData.bots[0];
// Filter policy lists based on selected team
diff --git a/src/app/dashboard/overview/page.tsx b/src/app/dashboard/overview/page.tsx
@@ -16,7 +16,7 @@ export default async function OverviewPage({
}) {
const teamIdParam = (await searchParams).team as string | undefined;
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/dashboard/reports/page.tsx b/src/app/dashboard/reports/page.tsx
@@ -24,7 +24,7 @@ export default async function ReportsPage({
redirect(`/dashboard/reports?team=${teamIdParam}&filter=all`);
}
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/dashboard/settings/bot/page.tsx b/src/app/dashboard/settings/bot/page.tsx
@@ -14,7 +14,7 @@ export default async function BotSettingsPage({
}) {
const teamIdParam = (await searchParams).team as string | undefined;
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/dashboard/settings/members/page.tsx b/src/app/dashboard/settings/members/page.tsx
@@ -19,7 +19,7 @@ export default async function MembersSettingsPage({
}) {
const teamIdParam = (await searchParams).team as string | undefined;
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/dashboard/settings/protectedRooms/page.tsx b/src/app/dashboard/settings/protectedRooms/page.tsx
@@ -13,7 +13,7 @@ export default async function ProtectedRoomsSettingsPage({
}) {
const teamIdParam = (await searchParams).team as string | undefined;
const cookieStore = await cookies()
- const session: User = JSON.parse(cookieStore.get("session")?.value || "{}")
+ const session: User = JSON.parse(cookieStore.get("d4all_session")?.value || "{}")
if (!session.token) {
return <div className="flex h-screen w-full items-center justify-center">Loading...</div>
}
diff --git a/src/app/page.tsx b/src/app/page.tsx
@@ -13,7 +13,7 @@ const d4all_support_url = process.env.NEXT_PUBLIC_D4ALL_SUPPORT_URL || "#"
export default async function Home() {
// Get session cookie if available
const cookieStore = await cookies()
- const sessionCookie = cookieStore.has("session")
+ const sessionCookie = cookieStore.has("d4all_session")
return (
<div className="flex min-h-screen flex-col bg-black text-white">
diff --git a/src/lib/api.ts b/src/lib/api.ts
@@ -1,4 +1,7 @@
'use server'
+import createClient from "openapi-fetch";
+import type { paths } from "./api/v1";
+import { cacheLife } from "next/dist/server/use-cache/cache-life";
export interface DraupnirBot {
id: string,
@@ -16,35 +19,25 @@ export interface ListResponse {
bots: DraupnirBot[]
}
+const client = createClient<paths>({ baseUrl: `${process.env.NEXT_PUBLIC_D4ALL_INSTANCE_ADDRESS}/api` });
+
export async function listBots(mxid: string, token: string): Promise<ListResponse | undefined> {
+ 'use cache'
+ cacheLife("minutes")
+
console.log("Fetching teams from Draupnir4All instance for user:", mxid);
- const url = new URL("/api/1/appservice/list", process.env.NEXT_PUBLIC_D4ALL_INSTANCE_ADDRESS);
- const res = await fetch(url, {
- method: "GET",
- headers: {
- "X-Draupnir-UserID": mxid,
- Authorization: `Bearer ${token}`,
- "Accept": "application/json",
- },
- });
- if (!res.ok) {
- const resp: {
- error?: string;
- errcode?: string;
- } = await res.json();
- if (resp.error) {
- console.error("Failed to fetch teams:", res.status, resp.errcode, resp.error);
- } else {
- console.error("Failed to fetch teams:", res.status, res.statusText);
+
+ const { data, error } = await client.GET("/1/appservice/list", {
+ params: {
+ header: {
+ "X-Draupnir-UserID": mxid,
+ Authorization: `Bearer ${token}`,
+ }
}
- // TODO: Handle error
- return undefined;
- }
- const data = await res.json();
- if (!data.bots) {
- console.error("Invalid response:", data);
- // Handle error
- return undefined;
+ });
+ if (error) {
+ console.error("Failed to fetch teams:", error);
+ throw new Error("Failed to fetch teams");
}
- return data as ListResponse;
+ return data;
}
\ No newline at end of file
diff --git a/src/lib/api/v1.d.ts b/src/lib/api/v1.d.ts
@@ -0,0 +1,674 @@
+/**
+ * This file was auto-generated by openapi-typescript.
+ * Do not make direct changes to the file.
+ */
+
+export interface paths {
+ "/1/appservice/get/{bot_id}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get information about the bot */
+ get: operations["getBotInfo"];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/appservice/list": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get Bots for the requesting user */
+ get: operations["listBots"];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/appservice/provision": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Provision a bot */
+ post: operations["provisionBot"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/report/{room_id}/{event_id}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Send a report to draupnir */
+ post: operations["messageReports"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/spam_check/user_may_invite": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Check if a user is allowed to invite */
+ post: operations["usersMayInvite"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/spam_check/user_may_join_room": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Check if a user is allowed to join a room */
+ post: operations["userMayJoinRoom"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/1/spam_check/check_event_for_spam": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Check if an event is spam */
+ post: operations["CheckEventForSpam"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+}
+export type webhooks = Record<string, never>;
+export interface components {
+ schemas: {
+ /**
+ * @example Missing access token
+ * @enum {string}
+ */
+ BotUnauthenticatedError: "Missing access token";
+ };
+ responses: never;
+ parameters: {
+ /**
+ * @description The user ID of the openID user. This must match the matrix id of the user that created the openid token.
+ * @example @example:example.com
+ */
+ DraupnirUserID: string;
+ };
+ requestBodies: never;
+ headers: never;
+ pathItems: never;
+}
+export type $defs = Record<string, never>;
+export interface operations {
+ getBotInfo: {
+ parameters: {
+ query?: never;
+ header: {
+ /**
+ * @description The user ID of the openID user. This must match the matrix id of the user that created the openid token.
+ * @example @example:example.com
+ */
+ "X-Draupnir-UserID": components["parameters"]["DraupnirUserID"];
+ };
+ path: {
+ /**
+ * @description The ID of the bot to get information about
+ * @example @example:example.com
+ */
+ bot_id: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example !example:example.com */
+ managementRoom: string;
+ /** @example @example:example.com */
+ ownerId: string;
+ /** @example Example Bot */
+ displayName: string;
+ };
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_MISSING_PARAM" | "M_INVALID_PARAM";
+ /**
+ * @example Invalid user ID
+ * @enum {string}
+ */
+ error: "Invalid user ID" | "Missing X-Draupnir-UserID header" | "Missing bot ID" | "Invalid bot ID";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_MISSING_TOKEN";
+ /**
+ * @example Missing access token
+ * @enum {string}
+ */
+ error: "Missing access token" | "Missing or invalid openid token" | "User ID does not match the one in the header";
+ };
+ };
+ };
+ /** @description The requested bot was not found on the server. The client should check the bot ID and try again. */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_NOT_FOUND";
+ /**
+ * @example Bot not found
+ * @enum {string}
+ */
+ error: "Bot not found";
+ };
+ };
+ };
+ /** @description The server is unable to handle the request. Possibly due to a misconfiguration. Are you sure this is an appservice draupnir? */
+ 503: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_NOT_CONFIGURED";
+ /**
+ * @example Appservice manager not configured
+ * @enum {string}
+ */
+ error: "Appservice manager not configured";
+ };
+ };
+ };
+ };
+ };
+ listBots: {
+ parameters: {
+ query?: {
+ /** @description Whether to only return bots owned by the user */
+ onlyOwner?: boolean;
+ };
+ header: {
+ /**
+ * @description The user ID of the openID user. This must match the matrix id of the user that created the openid token.
+ * @example @example:example.com
+ */
+ "X-Draupnir-UserID": components["parameters"]["DraupnirUserID"];
+ };
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ bots: {
+ /** @example @example:example.com */
+ id: string;
+ /** @example !example:example.com */
+ managementRoom: string;
+ /** @example @example:example.com */
+ ownerID: string;
+ /** @example Example Bot */
+ displayName: string;
+ protectedRooms: {
+ /** @example !example:example.com */
+ room: string;
+ /** @example Example Room */
+ displayName?: string;
+ }[];
+ subscribedLists: string[];
+ }[];
+ };
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_INVALID_PARAM";
+ /**
+ * @example Invalid user ID
+ * @enum {string}
+ */
+ error: "Invalid user ID" | "Missing X-Draupnir-UserID header";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_MISSING_TOKEN";
+ /**
+ * @example Missing access token
+ * @enum {string}
+ */
+ error: "Missing access token" | "Missing or invalid openid token" | "User ID does not match the one in the header";
+ };
+ };
+ };
+ /** @description The server is unable to handle the request. Possibly due to a misconfiguration. Are you sure this is an appservice draupnir? */
+ 503: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_NOT_CONFIGURED";
+ /**
+ * @example Appservice manager not configured
+ * @enum {string}
+ */
+ error: "Appservice manager not configured";
+ };
+ };
+ };
+ };
+ };
+ provisionBot: {
+ parameters: {
+ query?: never;
+ header: {
+ /**
+ * @description The user ID of the openID user. This must match the matrix id of the user that created the openid token.
+ * @example @example:example.com
+ */
+ "X-Draupnir-UserID": components["parameters"]["DraupnirUserID"];
+ };
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ protectedRooms?: string[];
+ };
+ };
+ };
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example !example:example.com */
+ managementRoom: string;
+ /** @example @example:example.com */
+ botID?: string;
+ /** @example @example:example.com */
+ ownerID: string;
+ };
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_INVALID_PARAM";
+ /**
+ * @example Invalid user ID
+ * @enum {string}
+ */
+ error: "Invalid user ID" | "Missing X-Draupnir-UserID header";
+ /** @description Invalid room IDs */
+ invalidIDs?: string[];
+ /** @description Rooms which draupnir failed to join or protect */
+ failedIDs?: string[];
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_MISSING_TOKEN";
+ /**
+ * @example Missing access token
+ * @enum {string}
+ */
+ error: "Missing access token" | "Missing or invalid openid token" | "User ID does not match the one in the header";
+ };
+ };
+ };
+ /** @description The server is unable to handle the request. Possibly due to a misconfiguration. Are you sure this is an appservice draupnir? */
+ 503: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ errcode: "M_NOT_CONFIGURED" | "M_INTERNAL_SERVER_ERROR" | "M_UNKNOWN";
+ /**
+ * @example Appservice manager not configured
+ * @enum {string}
+ */
+ error: "Appservice manager not configured" | "Failed to provision bot" | "Failed to protect rooms because draupnir is not running. Unable to continue.";
+ };
+ };
+ };
+ };
+ };
+ messageReports: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ /** @description The room ID in which the reported event occurred */
+ room_id: string;
+ /** @description The event ID of the event to report */
+ event_id: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": Record<string, never>;
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example M_BAD_REQUEST */
+ errcode?: string;
+ /**
+ * @example Invalid room ID
+ * @enum {string}
+ */
+ error?: "Invalid room ID" | "Invalid event ID";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "text/plain": components["schemas"]["BotUnauthenticatedError"];
+ };
+ };
+ /** @description The server is currently unable to handle the request due to a temporary overload or maintenance of the server. */
+ 503: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ usersMayInvite: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @description The user ID of the inviter */
+ inviter: string;
+ /** @description The user ID of the invitee */
+ invitee: string;
+ /** @description The room ID of the room */
+ room_id: string;
+ };
+ };
+ };
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": Record<string, never>;
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example M_INVALID_PARAM */
+ errcode?: string;
+ /**
+ * @example Invalid room ID
+ * @enum {string}
+ */
+ error?: "Error handling inviter, invitee, and room_id";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "text/plain": components["schemas"]["BotUnauthenticatedError"];
+ };
+ };
+ };
+ };
+ userMayJoinRoom: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @description The user ID of the user joining the room */
+ user: string;
+ /** @description The room ID of the room to join */
+ room: string;
+ /** @description Whether the user is invited to the room */
+ is_invited: boolean;
+ };
+ };
+ };
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": Record<string, never>;
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example M_INVALID_PARAM */
+ errcode?: string;
+ /**
+ * @example Invalid room ID
+ * @enum {string}
+ */
+ error?: "Error handling user, room, and is_invited";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "text/plain": components["schemas"]["BotUnauthenticatedError"];
+ };
+ };
+ };
+ };
+ CheckEventForSpam: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @description The event to check for spam */
+ event: Record<string, never>;
+ };
+ };
+ };
+ responses: {
+ /** @description The request was successful, and the server has returned the requested resource in the response body. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": Record<string, never>;
+ };
+ };
+ /** @description The server could not understand the request due to invalid syntax. The client should modify the request and try again. */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @example M_INVALID_PARAM */
+ errcode?: string;
+ /**
+ * @example Invalid room ID
+ * @enum {string}
+ */
+ error?: "Error handling event";
+ };
+ };
+ };
+ /** @description Authentication is required to access the requested resource. The client must include the appropriate credentials. */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "text/plain": components["schemas"]["BotUnauthenticatedError"];
+ };
+ };
+ };
+ };
+}
diff --git a/src/middleware.ts b/src/middleware.ts
@@ -3,10 +3,11 @@ import type { NextRequest } from "next/server";
import { User } from "./lib/auth";
export function middleware(req: NextRequest) {
- const session = req.cookies.get("session");
+ const session = req.cookies.get("d4all_session");
// If not root url check if the session cookie is set, and check if the session expired. If it did redirect to /refresh
if (req.nextUrl.pathname !== "/" && session) {
+ console.log("Session cookie found:", session.value);
const sessionData: User = JSON.parse(session.value);
const currentTime = Math.floor(Date.now() / 1000); // Current time in seconds
diff --git a/tsconfig.json b/tsconfig.json
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2017",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -11,6 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
+ "noUncheckedIndexedAccess": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
@@ -19,9 +24,18 @@
}
],
"paths": {
- "@/*": ["./src/*"]
+ "@/*": [
+ "./src/*"
+ ]
}
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
- "exclude": ["node_modules"]
-}
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".next/types/**/*.ts"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}
+\ No newline at end of file