diff options
author | WlodekM <[email protected]> | 2024-11-30 11:28:45 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2024-11-30 11:28:45 +0200 |
commit | 7bf34fb819f12e551ee8e50dcfd7e0369a68eb8e (patch) | |
tree | 2810ee013a8c517571118831b90e22ab5506a797 | |
parent | 3c11cf90f69a69be79dd5adc63c2c8d2de42741d (diff) | |
parent | 9d553a0e20011fbcf19ecada6541009e766943d9 (diff) |
Merge branch 'dev' into ts-deno-rewrite
-rw-r--r-- | accounts.ts | 4 | ||||
-rw-r--r-- | oldindex.js | 4 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | pnpm-lock.yaml | 25 | ||||
-rw-r--r-- | user.ts | 4 |
5 files changed, 26 insertions, 13 deletions
diff --git a/accounts.ts b/accounts.ts index 7d6cdfa..1dc96ac 100644 --- a/accounts.ts +++ b/accounts.ts @@ -1,7 +1,9 @@ import { createHash } from "node:crypto"; -import cuid from "cuid"; +import cuid2 from "@paralleldrive/cuid2"; import fs from "node:fs"; +const cuid = cuid2.init() + if (!fs.existsSync("db")) fs.mkdirSync("db"); if (!fs.existsSync("db/users.json")) fs.writeFileSync("db/users.json", "{}"); diff --git a/oldindex.js b/oldindex.js index 105b1dc..8acaa19 100644 --- a/oldindex.js +++ b/oldindex.js @@ -3,9 +3,11 @@ import { getRandomInt } from "./lib.js"; import { profanity } from "@2toad/profanity"; import { commands } from "./commands.ts"; import * as accounts from "./accounts.ts"; -import cuid from "cuid"; +import cuid2 from "@paralleldrive/cuid2"; import fs from "fs"; +const cuid = cuid2.init() + const server = { config: JSON.parse(String(fs.readFileSync("config.json"))), channels: ["home", "off-topic", "randomness"], diff --git a/package.json b/package.json index 86d9640..97eef83 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@2toad/profanity": "^2.2.0", "@types/node": "^22.10.0", "@types/ws": "^8.5.13", - "cuid": "^3.0.0", + "@paralleldrive/cuid2": "^2.2.2", "ini": "^5.0.0", "ws": "^8.17.1" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cd8186..6b1dc23 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,9 +17,9 @@ importers: '@types/ws': specifier: ^8.5.13 version: 8.5.13 - cuid: - specifier: ^3.0.0 - version: 3.0.0 + '@paralleldrive/cuid2': + specifier: ^2.2.2 + version: 2.2.2 ini: specifier: ^5.0.0 version: 5.0.0 @@ -43,6 +43,13 @@ packages: resolution: {integrity: sha512-d3kAz00+scjh3r1m8h3AHt49mBPWiyPhzOwX1sw8dwt15OrG/SCYw3ne/hFnxb4sEOuaMTBCFnHjVck5VVTipQ==} engines: {node: '>=12'} + '@noble/[email protected]': + resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} + engines: {node: ^14.21.3 || >=16} + + '@paralleldrive/[email protected]': + resolution: {integrity: sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA==} + '@types/[email protected]': resolution: {integrity: sha512-KmQxSBgVWCl6RSuerlLGZlIWfdxkKqat0nxN61+qu4y1KDn0Ll3j7v1Pl8GnaL3a/U6GGWVTJh75ap62kR1E8Q==} @@ -58,10 +65,6 @@ packages: [email protected]: resolution: {integrity: sha512-br5QygTEL/TwB4uQOb96Ky22j4Gq2WxWH/8Oqv20fk5HagwKXo/akB+LiYgSfzexCt6kkcUaVm+bKiPl71xPvw==} - [email protected]: - resolution: {integrity: sha512-WZYYkHdIDnaxdeP8Misq3Lah5vFjJwGuItJuV+tvMafosMzw0nF297T7mrm8IOWiPJkV6gc7sa8pzx27+w25Zg==} - deprecated: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead. - [email protected]: resolution: {integrity: sha512-+N0ngpO3e7cRUWOJAS7qw0IZIVc6XPrW4MlFBdD066F2L4k1L6ker3hLqSq7iXxU5tgS4WGkIUElWn5vogAEnw==} engines: {node: ^18.17.0 || >=20.5.0} @@ -98,6 +101,12 @@ snapshots: '@2toad/[email protected]': {} + '@noble/[email protected]': {} + + '@paralleldrive/[email protected]': + dependencies: + '@noble/hashes': 1.6.1 + '@types/[email protected]': dependencies: bun-types: 1.1.34 @@ -119,8 +128,6 @@ snapshots: '@types/node': 20.12.14 '@types/ws': 8.5.13 - [email protected]: {} - [email protected]: {} [email protected]: {} diff --git a/user.ts b/user.ts index 26d7ebb..910e8a4 100644 --- a/user.ts +++ b/user.ts @@ -1,12 +1,14 @@ // because why not make *more files import { getRandomInt } from "./lib.js"; -import cuid from "cuid"; +import cuid2 from "@paralleldrive/cuid2"; import type { WebSocket } from 'ws' import type { IncomingMessage } from "node:http"; import type Server from "./server.ts"; import Timespamp from "./timestamp.ts"; +const cuid = cuid2.init() + export default class User { id: string = cuid(); username: string; |