Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.

This commit is contained in:
becarta
2025-05-23 12:43:00 +02:00
parent f40db0f5c9
commit a544759a3b
11127 changed files with 1647032 additions and 0 deletions

21
node_modules/@oslojs/encoding/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 pilcrowOnPaper
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

23
node_modules/@oslojs/encoding/README.md generated vendored Normal file
View File

@@ -0,0 +1,23 @@
# @oslojs/encoding
**Documentation: https://encoding.oslojs.dev**
A JavaScript library for encoding and decoding data with hexadecimal, base32, base64, and base64url encoding schemes based on [RFC 4648](https://datatracker.ietf.org/doc/html/rfc4648). Implementations may be stricter than most to follow the RFC as close as possible.
- Runtime-agnostic
- No third-party dependencies
- Fully typed
```ts
import { encodeBase64, decodeBase64 } from "@oslojs/encoding";
const data: Uint8Array = new TextEncoder().encode("hello world");
const encoded = encodeBase64(data);
const decoded = decodeBase64(encoded);
```
## Installation
```
npm i @oslojs/encoding
```

10
node_modules/@oslojs/encoding/dist/base32.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
export declare function encodeBase32UpperCase(bytes: Uint8Array): string;
export declare function encodeBase32UpperCaseNoPadding(bytes: Uint8Array): string;
export declare function encodeBase32LowerCase(bytes: Uint8Array): string;
export declare function encodeBase32LowerCaseNoPadding(bytes: Uint8Array): string;
/** Replaced: Use encodeBase32UpperCase() instead. */
export declare function encodeBase32(bytes: Uint8Array): string;
/** Replaced: Use encodeBase32UpperCaseNoPadding() instead. */
export declare function encodeBase32NoPadding(bytes: Uint8Array): string;
export declare function decodeBase32(encoded: string): Uint8Array;
export declare function decodeBase32IgnorePadding(encoded: string): Uint8Array;

185
node_modules/@oslojs/encoding/dist/base32.js generated vendored Normal file
View File

@@ -0,0 +1,185 @@
export function encodeBase32UpperCase(bytes) {
return encodeBase32_internal(bytes, base32UpperCaseAlphabet, EncodingPadding.Include);
}
export function encodeBase32UpperCaseNoPadding(bytes) {
return encodeBase32_internal(bytes, base32UpperCaseAlphabet, EncodingPadding.None);
}
export function encodeBase32LowerCase(bytes) {
return encodeBase32_internal(bytes, base32LowerCaseAlphabet, EncodingPadding.Include);
}
export function encodeBase32LowerCaseNoPadding(bytes) {
return encodeBase32_internal(bytes, base32LowerCaseAlphabet, EncodingPadding.None);
}
/** Replaced: Use encodeBase32UpperCase() instead. */
export function encodeBase32(bytes) {
return encodeBase32UpperCase(bytes);
}
/** Replaced: Use encodeBase32UpperCaseNoPadding() instead. */
export function encodeBase32NoPadding(bytes) {
return encodeBase32UpperCaseNoPadding(bytes);
}
function encodeBase32_internal(bytes, alphabet, padding) {
let result = "";
for (let i = 0; i < bytes.byteLength; i += 5) {
let buffer = 0n;
let bufferBitSize = 0;
for (let j = 0; j < 5 && i + j < bytes.byteLength; j++) {
buffer = (buffer << 8n) | BigInt(bytes[i + j]);
bufferBitSize += 8;
}
if (bufferBitSize % 5 !== 0) {
buffer = buffer << BigInt(5 - (bufferBitSize % 5));
bufferBitSize += 5 - (bufferBitSize % 5);
}
for (let j = 0; j < 8; j++) {
if (bufferBitSize >= 5) {
result += alphabet[Number((buffer >> BigInt(bufferBitSize - 5)) & 0x1fn)];
bufferBitSize -= 5;
}
else if (bufferBitSize > 0) {
result += alphabet[Number((buffer << BigInt(6 - bufferBitSize)) & 0x3fn)];
bufferBitSize = 0;
}
else if (padding === EncodingPadding.Include) {
result += "=";
}
}
}
return result;
}
export function decodeBase32(encoded) {
return decodeBase32_internal(encoded, base32DecodeMap, DecodingPadding.Required);
}
export function decodeBase32IgnorePadding(encoded) {
return decodeBase32_internal(encoded, base32DecodeMap, DecodingPadding.Ignore);
}
function decodeBase32_internal(encoded, decodeMap, padding) {
const result = new Uint8Array(Math.ceil(encoded.length / 8) * 5);
let totalBytes = 0;
for (let i = 0; i < encoded.length; i += 8) {
let chunk = 0n;
let bitsRead = 0;
for (let j = 0; j < 8; j++) {
if (padding === DecodingPadding.Required) {
if (encoded[i + j] === "=") {
continue;
}
if (i + j >= encoded.length) {
throw new Error("Invalid padding");
}
}
if (padding === DecodingPadding.Ignore) {
if (i + j >= encoded.length || encoded[i + j] === "=") {
continue;
}
}
if (j > 0 && encoded[i + j - 1] === "=") {
throw new Error("Invalid padding");
}
if (!(encoded[i + j] in decodeMap)) {
throw new Error("Invalid character");
}
chunk |= BigInt(decodeMap[encoded[i + j]]) << BigInt((7 - j) * 5);
bitsRead += 5;
}
if (bitsRead < 40) {
let unused;
if (bitsRead === 10) {
unused = chunk & 0xffffffffn;
}
else if (bitsRead === 20) {
unused = chunk & 0xffffffn;
}
else if (bitsRead === 25) {
unused = chunk & 0xffffn;
}
else if (bitsRead === 35) {
unused = chunk & 0xffn;
}
else {
throw new Error("Invalid padding");
}
if (unused !== 0n) {
throw new Error("Invalid padding");
}
}
const byteLength = Math.floor(bitsRead / 8);
for (let i = 0; i < byteLength; i++) {
result[totalBytes] = Number((chunk >> BigInt(32 - i * 8)) & 0xffn);
totalBytes++;
}
}
return result.slice(0, totalBytes);
}
const base32UpperCaseAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
const base32LowerCaseAlphabet = "abcdefghijklmnopqrstuvwxyz234567";
const base32DecodeMap = {
A: 0,
B: 1,
C: 2,
D: 3,
E: 4,
F: 5,
G: 6,
H: 7,
I: 8,
J: 9,
K: 10,
L: 11,
M: 12,
N: 13,
O: 14,
P: 15,
Q: 16,
R: 17,
S: 18,
T: 19,
U: 20,
V: 21,
W: 22,
X: 23,
Y: 24,
Z: 25,
a: 0,
b: 1,
c: 2,
d: 3,
e: 4,
f: 5,
g: 6,
h: 7,
i: 8,
j: 9,
k: 10,
l: 11,
m: 12,
n: 13,
o: 14,
p: 15,
q: 16,
r: 17,
s: 18,
t: 19,
u: 20,
v: 21,
w: 22,
x: 23,
y: 24,
z: 25,
"2": 26,
"3": 27,
"4": 28,
"5": 29,
"6": 30,
"7": 31
};
var EncodingPadding;
(function (EncodingPadding) {
EncodingPadding[EncodingPadding["Include"] = 0] = "Include";
EncodingPadding[EncodingPadding["None"] = 1] = "None";
})(EncodingPadding || (EncodingPadding = {}));
var DecodingPadding;
(function (DecodingPadding) {
DecodingPadding[DecodingPadding["Required"] = 0] = "Required";
DecodingPadding[DecodingPadding["Ignore"] = 1] = "Ignore";
})(DecodingPadding || (DecodingPadding = {}));

8
node_modules/@oslojs/encoding/dist/base64.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export declare function encodeBase64(bytes: Uint8Array): string;
export declare function encodeBase64NoPadding(bytes: Uint8Array): string;
export declare function encodeBase64url(bytes: Uint8Array): string;
export declare function encodeBase64urlNoPadding(bytes: Uint8Array): string;
export declare function decodeBase64(encoded: string): Uint8Array;
export declare function decodeBase64IgnorePadding(encoded: string): Uint8Array;
export declare function decodeBase64url(encoded: string): Uint8Array;
export declare function decodeBase64urlIgnorePadding(encoded: string): Uint8Array;

239
node_modules/@oslojs/encoding/dist/base64.js generated vendored Normal file
View File

@@ -0,0 +1,239 @@
export function encodeBase64(bytes) {
return encodeBase64_internal(bytes, base64Alphabet, EncodingPadding.Include);
}
export function encodeBase64NoPadding(bytes) {
return encodeBase64_internal(bytes, base64Alphabet, EncodingPadding.None);
}
export function encodeBase64url(bytes) {
return encodeBase64_internal(bytes, base64urlAlphabet, EncodingPadding.Include);
}
export function encodeBase64urlNoPadding(bytes) {
return encodeBase64_internal(bytes, base64urlAlphabet, EncodingPadding.None);
}
function encodeBase64_internal(bytes, alphabet, padding) {
let result = "";
for (let i = 0; i < bytes.byteLength; i += 3) {
let buffer = 0;
let bufferBitSize = 0;
for (let j = 0; j < 3 && i + j < bytes.byteLength; j++) {
buffer = (buffer << 8) | bytes[i + j];
bufferBitSize += 8;
}
for (let j = 0; j < 4; j++) {
if (bufferBitSize >= 6) {
result += alphabet[(buffer >> (bufferBitSize - 6)) & 0x3f];
bufferBitSize -= 6;
}
else if (bufferBitSize > 0) {
result += alphabet[(buffer << (6 - bufferBitSize)) & 0x3f];
bufferBitSize = 0;
}
else if (padding === EncodingPadding.Include) {
result += "=";
}
}
}
return result;
}
const base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const base64urlAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
export function decodeBase64(encoded) {
return decodeBase64_internal(encoded, base64DecodeMap, DecodingPadding.Required);
}
export function decodeBase64IgnorePadding(encoded) {
return decodeBase64_internal(encoded, base64DecodeMap, DecodingPadding.Ignore);
}
export function decodeBase64url(encoded) {
return decodeBase64_internal(encoded, base64urlDecodeMap, DecodingPadding.Required);
}
export function decodeBase64urlIgnorePadding(encoded) {
return decodeBase64_internal(encoded, base64urlDecodeMap, DecodingPadding.Ignore);
}
function decodeBase64_internal(encoded, decodeMap, padding) {
const result = new Uint8Array(Math.ceil(encoded.length / 4) * 3);
let totalBytes = 0;
for (let i = 0; i < encoded.length; i += 4) {
let chunk = 0;
let bitsRead = 0;
for (let j = 0; j < 4; j++) {
if (padding === DecodingPadding.Required && encoded[i + j] === "=") {
continue;
}
if (padding === DecodingPadding.Ignore &&
(i + j >= encoded.length || encoded[i + j] === "=")) {
continue;
}
if (j > 0 && encoded[i + j - 1] === "=") {
throw new Error("Invalid padding");
}
if (!(encoded[i + j] in decodeMap)) {
throw new Error("Invalid character");
}
chunk |= decodeMap[encoded[i + j]] << ((3 - j) * 6);
bitsRead += 6;
}
if (bitsRead < 24) {
let unused;
if (bitsRead === 12) {
unused = chunk & 0xffff;
}
else if (bitsRead === 18) {
unused = chunk & 0xff;
}
else {
throw new Error("Invalid padding");
}
if (unused !== 0) {
throw new Error("Invalid padding");
}
}
const byteLength = Math.floor(bitsRead / 8);
for (let i = 0; i < byteLength; i++) {
result[totalBytes] = (chunk >> (16 - i * 8)) & 0xff;
totalBytes++;
}
}
return result.slice(0, totalBytes);
}
var EncodingPadding;
(function (EncodingPadding) {
EncodingPadding[EncodingPadding["Include"] = 0] = "Include";
EncodingPadding[EncodingPadding["None"] = 1] = "None";
})(EncodingPadding || (EncodingPadding = {}));
var DecodingPadding;
(function (DecodingPadding) {
DecodingPadding[DecodingPadding["Required"] = 0] = "Required";
DecodingPadding[DecodingPadding["Ignore"] = 1] = "Ignore";
})(DecodingPadding || (DecodingPadding = {}));
const base64DecodeMap = {
"0": 52,
"1": 53,
"2": 54,
"3": 55,
"4": 56,
"5": 57,
"6": 58,
"7": 59,
"8": 60,
"9": 61,
A: 0,
B: 1,
C: 2,
D: 3,
E: 4,
F: 5,
G: 6,
H: 7,
I: 8,
J: 9,
K: 10,
L: 11,
M: 12,
N: 13,
O: 14,
P: 15,
Q: 16,
R: 17,
S: 18,
T: 19,
U: 20,
V: 21,
W: 22,
X: 23,
Y: 24,
Z: 25,
a: 26,
b: 27,
c: 28,
d: 29,
e: 30,
f: 31,
g: 32,
h: 33,
i: 34,
j: 35,
k: 36,
l: 37,
m: 38,
n: 39,
o: 40,
p: 41,
q: 42,
r: 43,
s: 44,
t: 45,
u: 46,
v: 47,
w: 48,
x: 49,
y: 50,
z: 51,
"+": 62,
"/": 63
};
const base64urlDecodeMap = {
"0": 52,
"1": 53,
"2": 54,
"3": 55,
"4": 56,
"5": 57,
"6": 58,
"7": 59,
"8": 60,
"9": 61,
A: 0,
B: 1,
C: 2,
D: 3,
E: 4,
F: 5,
G: 6,
H: 7,
I: 8,
J: 9,
K: 10,
L: 11,
M: 12,
N: 13,
O: 14,
P: 15,
Q: 16,
R: 17,
S: 18,
T: 19,
U: 20,
V: 21,
W: 22,
X: 23,
Y: 24,
Z: 25,
a: 26,
b: 27,
c: 28,
d: 29,
e: 30,
f: 31,
g: 32,
h: 33,
i: 34,
j: 35,
k: 36,
l: 37,
m: 38,
n: 39,
o: 40,
p: 41,
q: 42,
r: 43,
s: 44,
t: 45,
u: 46,
v: 47,
w: 48,
x: 49,
y: 50,
z: 51,
"-": 62,
_: 63
};

3
node_modules/@oslojs/encoding/dist/hex.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare function encodeHexUpperCase(data: Uint8Array): string;
export declare function encodeHexLowerCase(data: Uint8Array): string;
export declare function decodeHex(data: string): Uint8Array;

59
node_modules/@oslojs/encoding/dist/hex.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
export function encodeHexUpperCase(data) {
let result = "";
for (let i = 0; i < data.length; i++) {
result += alphabetUpperCase[data[i] >> 4];
result += alphabetUpperCase[data[i] & 0x0f];
}
return result;
}
export function encodeHexLowerCase(data) {
let result = "";
for (let i = 0; i < data.length; i++) {
result += alphabetLowerCase[data[i] >> 4];
result += alphabetLowerCase[data[i] & 0x0f];
}
return result;
}
export function decodeHex(data) {
if (data.length % 2 !== 0) {
throw new Error("Invalid hex string");
}
const result = new Uint8Array(data.length / 2);
for (let i = 0; i < data.length; i += 2) {
if (!(data[i] in decodeMap)) {
throw new Error("Invalid character");
}
if (!(data[i + 1] in decodeMap)) {
throw new Error("Invalid character");
}
result[i / 2] |= decodeMap[data[i]] << 4;
result[i / 2] |= decodeMap[data[i + 1]];
}
return result;
}
const alphabetUpperCase = "0123456789ABCDEF";
const alphabetLowerCase = "0123456789abcdef";
const decodeMap = {
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
a: 10,
A: 10,
b: 11,
B: 11,
c: 12,
C: 12,
d: 13,
D: 13,
e: 14,
E: 14,
f: 15,
F: 15
};

3
node_modules/@oslojs/encoding/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export { encodeHexLowerCase, encodeHexUpperCase, decodeHex } from "./hex.js";
export { encodeBase32, encodeBase32NoPadding, encodeBase32LowerCase, encodeBase32LowerCaseNoPadding, encodeBase32UpperCase, encodeBase32UpperCaseNoPadding, decodeBase32, decodeBase32IgnorePadding } from "./base32.js";
export { encodeBase64, encodeBase64NoPadding, encodeBase64url, encodeBase64urlNoPadding, decodeBase64, decodeBase64IgnorePadding, decodeBase64url, decodeBase64urlIgnorePadding } from "./base64.js";

3
node_modules/@oslojs/encoding/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export { encodeHexLowerCase, encodeHexUpperCase, decodeHex } from "./hex.js";
export { encodeBase32, encodeBase32NoPadding, encodeBase32LowerCase, encodeBase32LowerCaseNoPadding, encodeBase32UpperCase, encodeBase32UpperCaseNoPadding, decodeBase32, decodeBase32IgnorePadding } from "./base32.js";
export { encodeBase64, encodeBase64NoPadding, encodeBase64url, encodeBase64urlNoPadding, decodeBase64, decodeBase64IgnorePadding, decodeBase64url, decodeBase64urlIgnorePadding } from "./base64.js";

44
node_modules/@oslojs/encoding/package.json generated vendored Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "@oslojs/encoding",
"type": "module",
"version": "1.1.0",
"description": "Runtime-agnostic library for encoding and decoding data",
"files": [
"/dist/"
],
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"keywords": [
"auth",
"encoding",
"hex",
"base16",
"base32",
"base64",
"base64url"
],
"repository": {
"type": "git",
"url": "https://github.com/oslo-project/encoding"
},
"author": "pilcrowOnPaper",
"license": "MIT",
"devDependencies": {
"@scure/base": "^1.1.6",
"@types/node": "^20.11.25",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"auri": "^2.0.0",
"eslint": "^8.51.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"scripts": {
"build": "rm -rf dist/* && tsc --project tsconfig.build.json",
"format": "prettier -w .",
"lint": "eslint src",
"test": "vitest run --sequence.concurrent"
}
}