diff --git a/package-lock.json b/package-lock.json
index d7bddfd..2043820 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -23,7 +23,8 @@
"ansi-colors": "^4.1.3",
"better-sqlite3": "^11.1.2",
"chunk-text": "^2.0.1",
- "cloudstorm": "^0.10.10",
+ "cloudstorm": "^0.11.2",
+ "discord-api-types": "^0.37.119",
"domino": "^2.1.6",
"enquirer": "^2.4.1",
"entities": "^5.0.0",
@@ -35,7 +36,7 @@
"minimist": "^1.2.8",
"prettier-bytes": "^1.0.4",
"sharp": "^0.33.4",
- "snowtransfer": "^0.10.5",
+ "snowtransfer": "^0.11.0",
"stream-mime-type": "^1.0.2",
"try-to-catch": "^3.0.1",
"uqr": "^0.1.2",
@@ -47,7 +48,6 @@
"@types/node": "^18.16.0",
"c8": "^10.1.2",
"cross-env": "^7.0.3",
- "discord-api-types": "^0.37.60",
"supertape": "^10.4.0"
},
"engines": {
@@ -134,10 +134,13 @@
}
},
"node_modules/@bcoe/v8-coverage": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
- "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
- "dev": true
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz",
+ "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ }
},
"node_modules/@chriscdn/promise-semaphore": {
"version": "2.0.9",
@@ -932,9 +935,9 @@
}
},
"node_modules/@stackoverflow/stacks-icons": {
- "version": "6.0.2",
- "resolved": "https://registry.npmjs.org/@stackoverflow/stacks-icons/-/stacks-icons-6.0.2.tgz",
- "integrity": "sha512-NDXV/0w6on9fJBfaLrBtPSXTbGyitD+mBTmIpLmDWbVgZo3EJgZBdPdElO0nO7K0WR2Yee1nKhC8euRhd9nicg=="
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/@stackoverflow/stacks-icons/-/stacks-icons-6.1.0.tgz",
+ "integrity": "sha512-l5M+gcBeJBAJaxX4ByWhT/eeWhFusdalP/sq0z0uiUM+pwMfDU/pEm2u4DWVYSvBKaskbH3K0oILWaeDvEfGmA=="
},
"node_modules/@supertape/engine-loader": {
"version": "2.0.0",
@@ -1072,11 +1075,10 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "18.19.46",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.46.tgz",
- "integrity": "sha512-vnRgMS7W6cKa1/0G3/DTtQYpVrZ8c0Xm6UkLaVFrb9jtcVC3okokW09Ki1Qdrj9ISokszD69nY4WDLRlvHlhAA==",
+ "version": "18.19.75",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.75.tgz",
+ "integrity": "sha512-UIksWtThob6ZVSyxcOqCLOUNg/dyO1Qvx4McgeuhrEtHTLFTf7BBhEazaE4K806FGTPtzd/2sE90qn4fVr7cyw==",
"dev": true,
- "license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
}
@@ -1204,11 +1206,10 @@
]
},
"node_modules/better-sqlite3": {
- "version": "11.3.0",
- "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.3.0.tgz",
- "integrity": "sha512-iHt9j8NPYF3oKCNOO5ZI4JwThjt3Z6J6XrcwG85VNMVzv1ByqrHWv5VILEbCMFWDsoHhXvQ7oC8vgRXFAKgl9w==",
+ "version": "11.8.1",
+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.8.1.tgz",
+ "integrity": "sha512-9BxNaBkblMjhJW8sMRZxnxVTRgbRmssZW0Oxc1MPBTfiR+WW21e2Mk4qu8CzrcZb1LwPCnFsfDEzq+SNcBU8eg==",
"hasInstallScript": true,
- "license": "MIT",
"dependencies": {
"bindings": "^1.5.0",
"prebuild-install": "^7.1.1"
@@ -1278,12 +1279,12 @@
}
},
"node_modules/c8": {
- "version": "10.1.2",
- "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.2.tgz",
- "integrity": "sha512-Qr6rj76eSshu5CgRYvktW0uM0CFY0yi4Fd5D0duDXO6sYinyopmftUiJVuzBQxQcwQLor7JWDVRP+dUfCmzgJw==",
+ "version": "10.1.3",
+ "resolved": "https://registry.npmjs.org/c8/-/c8-10.1.3.tgz",
+ "integrity": "sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA==",
"dev": true,
"dependencies": {
- "@bcoe/v8-coverage": "^0.2.3",
+ "@bcoe/v8-coverage": "^1.0.1",
"@istanbuljs/schema": "^0.1.3",
"find-up": "^5.0.0",
"foreground-child": "^3.1.1",
@@ -1411,16 +1412,15 @@
}
},
"node_modules/cloudstorm": {
- "version": "0.10.11",
- "resolved": "https://registry.npmjs.org/cloudstorm/-/cloudstorm-0.10.11.tgz",
- "integrity": "sha512-A3lN0o404la7ryWIxN73gW2ehC0RO4h0yCA2grtOtPh8rNTd6+R2U4llyJlb61HlyOFrEVJ7AbOoFblVSmkrtw==",
- "license": "MIT",
+ "version": "0.11.2",
+ "resolved": "https://registry.npmjs.org/cloudstorm/-/cloudstorm-0.11.2.tgz",
+ "integrity": "sha512-LuKey+nTp5fEGH5TdCxCUWSG1VMcXKV57rsFvGi/XLpdPT1LUTlc5TmCONAaKzy2uZFJm9EG+iIB2Vq+uBqgog==",
"dependencies": {
- "discord-api-types": "^0.37.98",
- "snowtransfer": "^0.10.7"
+ "discord-api-types": "^0.37.119",
+ "snowtransfer": "^0.11.0"
},
"engines": {
- "node": ">=14.8.0"
+ "node": ">=16.15.0"
}
},
"node_modules/color": {
@@ -1460,15 +1460,6 @@
"simple-swizzle": "^0.2.2"
}
},
- "node_modules/consola": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz",
- "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==",
- "license": "MIT",
- "engines": {
- "node": "^14.18.0 || >=16.10.0"
- }
- },
"node_modules/constantinople": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/constantinople/-/constantinople-4.0.1.tgz",
@@ -1523,17 +1514,11 @@
}
},
"node_modules/crossws": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.2.4.tgz",
- "integrity": "sha512-DAxroI2uSOgUKLz00NX6A8U/8EE3SZHmIND+10jkVSaypvyt57J5JEOxAQOL6lQxyzi/wZbTIwssU1uy69h5Vg==",
- "license": "MIT",
- "peerDependencies": {
- "uWebSockets.js": "*"
- },
- "peerDependenciesMeta": {
- "uWebSockets.js": {
- "optional": true
- }
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/crossws/-/crossws-0.3.4.tgz",
+ "integrity": "sha512-uj0O1ETYX1Bh6uSgktfPvwDiPYGQ3aI4qVsaC/LWpkIzGj1nUYm5FK3K+t11oOlpN01lGbprFCH4wBlKdJjVgw==",
+ "dependencies": {
+ "uncrypto": "^0.1.3"
}
},
"node_modules/csstype": {
@@ -1572,8 +1557,7 @@
"node_modules/defu": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
- "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
- "license": "MIT"
+ "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="
},
"node_modules/destr": {
"version": "2.0.3",
@@ -1599,10 +1583,9 @@
}
},
"node_modules/discord-api-types": {
- "version": "0.37.101",
- "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.101.tgz",
- "integrity": "sha512-2wizd94t7G3A8U5Phr3AiuL4gSvhqistDwWnlk1VLTit8BI1jWUncFqFQNdPbHqS3661+Nx/iEyIwtVjPuBP3w==",
- "license": "MIT"
+ "version": "0.37.119",
+ "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.119.tgz",
+ "integrity": "sha512-WasbGFXEB+VQWXlo6IpW3oUv73Yuau1Ig4AZF/m13tXcTKnMpc/mHjpztIlz4+BM9FG9BHQkEXiPto3bKduQUg=="
},
"node_modules/doctypes": {
"version": "1.1.0",
@@ -1847,21 +1830,20 @@
}
},
"node_modules/h3": {
- "version": "1.12.0",
- "resolved": "https://registry.npmjs.org/h3/-/h3-1.12.0.tgz",
- "integrity": "sha512-Zi/CcNeWBXDrFNlV0hUBJQR9F7a96RjMeAZweW/ZWkR9fuXrMcvKnSA63f/zZ9l0GgQOZDVHGvXivNN9PWOwhA==",
- "license": "MIT",
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.0.tgz",
+ "integrity": "sha512-OsjX4JW8J4XGgCgEcad20pepFQWnuKH+OwkCJjogF3C+9AZ1iYdtB4hX6vAb5DskBiu5ljEXqApINjR8CqoCMQ==",
"dependencies": {
- "cookie-es": "^1.1.0",
- "crossws": "^0.2.4",
+ "cookie-es": "^1.2.2",
+ "crossws": "^0.3.3",
"defu": "^6.1.4",
"destr": "^2.0.3",
- "iron-webcrypto": "^1.1.1",
- "ohash": "^1.1.3",
+ "iron-webcrypto": "^1.2.1",
+ "node-mock-http": "^1.0.0",
+ "ohash": "^1.1.4",
"radix3": "^1.1.2",
- "ufo": "^1.5.3",
- "uncrypto": "^0.1.3",
- "unenv": "^1.9.0"
+ "ufo": "^1.5.4",
+ "uncrypto": "^0.1.3"
}
},
"node_modules/has-flag": {
@@ -2107,18 +2089,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/mime": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
- "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
- "license": "MIT",
- "bin": {
- "mime": "cli.js"
- },
- "engines": {
- "node": ">=10.0.0"
- }
- },
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
@@ -2203,11 +2173,10 @@
"node": ">=10"
}
},
- "node_modules/node-fetch-native": {
- "version": "1.6.4",
- "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz",
- "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==",
- "license": "MIT"
+ "node_modules/node-mock-http": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.0.tgz",
+ "integrity": "sha512-0uGYQ1WQL1M5kKvGRXWQ3uZCHtLTO8hln3oBjIusM75WoesZ909uQJs/Hb946i2SS+Gsrhkaa6iAO17jRIv6DQ=="
},
"node_modules/object-assign": {
"version": "4.1.1",
@@ -2218,10 +2187,9 @@
}
},
"node_modules/ohash": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.3.tgz",
- "integrity": "sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==",
- "license": "MIT"
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz",
+ "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g=="
},
"node_modules/once": {
"version": "1.4.0",
@@ -2308,12 +2276,6 @@
"url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/pathe": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
- "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
- "license": "MIT"
- },
"node_modules/peek-readable": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz",
@@ -2714,16 +2676,14 @@
}
},
"node_modules/snowtransfer": {
- "version": "0.10.7",
- "resolved": "https://registry.npmjs.org/snowtransfer/-/snowtransfer-0.10.7.tgz",
- "integrity": "sha512-lXUYp6jOou0DI8uFl3Dh78KD1gVa3dNbUt2TK6RW39mHenAR6XpoPoydUNXCWvdxi6uGU6zQ1yNICZpKjF6wMA==",
- "license": "MIT",
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/snowtransfer/-/snowtransfer-0.11.0.tgz",
+ "integrity": "sha512-07rvRnCtXdL/E3PmKTS/zHVlIIIWizKh7YzsUxN2bmX1Fr5odFgZ08J0/dE1YL6XmsbpmEB2r4LBAfdCGzKs7w==",
"dependencies": {
- "discord-api-types": "^0.37.98",
- "undici": "^6.19.8"
+ "discord-api-types": "^0.37.119"
},
"engines": {
- "node": ">=14.18.0"
+ "node": ">=16.15.0"
}
},
"node_modules/source-map": {
@@ -2925,11 +2885,10 @@
}
},
"node_modules/supertape": {
- "version": "10.7.3",
- "resolved": "https://registry.npmjs.org/supertape/-/supertape-10.7.3.tgz",
- "integrity": "sha512-t/zv0sev+5261g9KampNVL7io8UQ7zmouRWt9/UU+Yr7Ap0MqBKlyDFFvkzcfADT+O6bXZMW5x3nzYzSU+LAYg==",
+ "version": "10.10.0",
+ "resolved": "https://registry.npmjs.org/supertape/-/supertape-10.10.0.tgz",
+ "integrity": "sha512-Zxww3DePaNlRJgy4XVukEU98254DWwNbV0Ch1jJcCWZxD0AJM9fIJG1bbFmVXXdYe0G0+YnpfrP12nVM2K+cEg==",
"dev": true,
- "license": "MIT",
"dependencies": {
"@cloudcmd/stub": "^4.0.0",
"@putout/cli-keypress": "^2.0.0",
@@ -3143,34 +3102,12 @@
"integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==",
"license": "MIT"
},
- "node_modules/undici": {
- "version": "6.21.1",
- "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.1.tgz",
- "integrity": "sha512-q/1rj5D0/zayJB2FraXdaWxbhWiNKDvu8naDT2dl1yTlvJp4BLtOcp2a5BvgGNQpYYJzau7tf1WgKv3b+7mqpQ==",
- "license": "MIT",
- "engines": {
- "node": ">=18.17"
- }
- },
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
},
- "node_modules/unenv": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/unenv/-/unenv-1.10.0.tgz",
- "integrity": "sha512-wY5bskBQFL9n3Eca5XnhH6KbUo/tfvkwm9OpcdCvLaeA7piBNbavbOKJySEwQ1V0RH6HvNlSAFRTpvTqgKRQXQ==",
- "license": "MIT",
- "dependencies": {
- "consola": "^3.2.3",
- "defu": "^6.1.4",
- "mime": "^3.0.0",
- "node-fetch-native": "^1.6.4",
- "pathe": "^1.1.2"
- }
- },
"node_modules/uqr": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/uqr/-/uqr-0.1.2.tgz",
@@ -3325,9 +3262,9 @@
"dev": true
},
"node_modules/xxhash-wasm": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz",
- "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A=="
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz",
+ "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA=="
},
"node_modules/y18n": {
"version": "5.0.8",
@@ -3378,10 +3315,9 @@
}
},
"node_modules/zod": {
- "version": "3.23.8",
- "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
- "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
- "license": "MIT",
+ "version": "3.24.1",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz",
+ "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
diff --git a/package.json b/package.json
index 24555a3..12ac82a 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
"ansi-colors": "^4.1.3",
"better-sqlite3": "^11.1.2",
"chunk-text": "^2.0.1",
- "cloudstorm": "^0.10.10",
+ "cloudstorm": "^0.11.2",
+ "discord-api-types": "^0.37.119",
"domino": "^2.1.6",
"enquirer": "^2.4.1",
"entities": "^5.0.0",
@@ -44,7 +45,7 @@
"minimist": "^1.2.8",
"prettier-bytes": "^1.0.4",
"sharp": "^0.33.4",
- "snowtransfer": "^0.10.5",
+ "snowtransfer": "^0.11.0",
"stream-mime-type": "^1.0.2",
"try-to-catch": "^3.0.1",
"uqr": "^0.1.2",
@@ -56,7 +57,6 @@
"@types/node": "^18.16.0",
"c8": "^10.1.2",
"cross-env": "^7.0.3",
- "discord-api-types": "^0.37.60",
"supertape": "^10.4.0"
},
"scripts": {
diff --git a/readme.md b/readme.md
index 2fa64a4..2b21c52 100644
--- a/readme.md
+++ b/readme.md
@@ -164,14 +164,14 @@ To get into the rooms on your Matrix account, use the `/invite [your mxid here]`
## Dependency justification
-Total transitive production dependencies: 144
+Total transitive production dependencies: 139
### 🦕
* (31) better-sqlite3: SQLite3 is the best database, and this is the best library for it.
* (27) @cloudrac3r/pug: Language for dynamic web pages. This is my fork. (I released code that hadn't made it to npm, and removed the heavy pug-filters feature.)
* (16) stream-mime-type@1: This seems like the best option. Version 1 is used because version 2 is ESM-only.
-* (14) h3: Web server. OOYE needs this for the appservice listener, authmedia proxy, and more. 14 transitive dependencies is on the low end for a web server.
+* (10) h3: Web server. OOYE needs this for the appservice listener, authmedia proxy, and more. 14 transitive dependencies is on the low end for a web server.
* (11) sharp: Image resizing and compositing. OOYE needs this for the emoji sprite sheets.
### 🪱
@@ -188,6 +188,7 @@ Total transitive production dependencies: 144
* (0) ansi-colors: Helps with interactive prompting for the initial setup, and it's already pulled in by enquirer.
* (1) chunk-text: It does what I want.
* (0) cloudstorm: Discord gateway library with bring-your-own-caching that I trust.
+* (0) discord-api-types: Bitfields needed at runtime and types needed for development.
* (0) domino: DOM implementation that's already pulled in by turndown.
* (1) enquirer: Interactive prompting for the initial setup rather than forcing users to edit YAML non-interactively.
* (0) entities: Looks fine. No dependencies.
@@ -198,7 +199,7 @@ Total transitive production dependencies: 144
* (0) lru-cache: For holding unused nonce in memory and letting them be overwritten later if never used.
* (0) minimist: It's already pulled in by better-sqlite3->prebuild-install.
* (0) prettier-bytes: It does what I want and has no dependencies.
-* (2) snowtransfer: Discord API library with bring-your-own-caching that I trust.
+* (0) snowtransfer: Discord API library with bring-your-own-caching that I trust.
* (0) try-to-catch: Not strictly necessary, but it's already pulled in by supertape, so I may as well.
* (0) uqr: QR code SVG generator. Used on the website to scan in an invite link.
* (0) xxhash-wasm: Used where cryptographically secure hashing is not required.
diff --git a/scripts/setup.js b/scripts/setup.js
index 1174861..4ac6f84 100644
--- a/scripts/setup.js
+++ b/scripts/setup.js
@@ -180,7 +180,7 @@ function defineEchoHandler() {
process.stdout.write(magenta(" checking, please wait..."))
try {
snow = new SnowTransfer(token)
- client = await snow.requestHandler.request(`/applications/@me`, {}, "get")
+ client = await snow.requestHandler.request(`/applications/@me`, {}, "get", "json")
return true
} catch (e) {
return e.message
@@ -197,7 +197,7 @@ function defineEchoHandler() {
message: "Press Enter when you've enabled them",
validate: async token => {
process.stdout.write(magenta("checking, please wait..."))
- client = await snow.requestHandler.request(`/applications/@me`, {}, "get")
+ client = await snow.requestHandler.request(`/applications/@me`, {}, "get", "json")
if (client.flags & mandatoryIntentFlags) {
return true
} else {
@@ -225,7 +225,7 @@ function defineEchoHandler() {
message: "Press Enter when you've added it",
validate: async token => {
process.stdout.write(magenta("checking, please wait..."))
- client = await snow.requestHandler.request(`/applications/@me`, {}, "get")
+ client = await snow.requestHandler.request(`/applications/@me`, {}, "get", "json")
if (client.redirect_uris.includes(expectedUri)) {
return true
} else {
diff --git a/src/web/routes/oauth.js b/src/web/routes/oauth.js
index ed0da8a..ace7b72 100644
--- a/src/web/routes/oauth.js
+++ b/src/web/routes/oauth.js
@@ -3,11 +3,11 @@
const {z} = require("zod")
const {randomUUID} = require("crypto")
const {defineEventHandler, getValidatedQuery, sendRedirect, createError} = require("h3")
-const {SnowTransfer} = require("snowtransfer")
+const {SnowTransfer, tokenless} = require("snowtransfer")
const DiscordTypes = require("discord-api-types/v10")
const getRelativePath = require("get-relative-path")
-const {as, db, sync} = require("../../passthrough")
+const {discord, as, db, sync} = require("../../passthrough")
const {id} = require("../../../addbot")
/** @type {import("../auth")} */
const auth = sync.require("../auth")
@@ -59,21 +59,10 @@ as.router.get("/oauth", defineEventHandler(async event => {
if (!savedState) throw createError({status: 400, message: "Missing state", data: "Missing saved state parameter. Please try again, and make sure you have cookies enabled."})
if (savedState != parsedQuery.data.state) return tryAgain()
- const res = await fetch("https://discord.com/api/oauth2/token", {
- method: "post",
- body: new URLSearchParams({
- grant_type: "authorization_code",
- client_id: id,
- client_secret: reg.ooye.discord_client_secret,
- redirect_uri,
- code: parsedQuery.data.code
- })
- })
- const root = await res.json()
-
- const parsedToken = schema.token.safeParse(root)
- if (!res.ok || !parsedToken.success) {
- throw createError({status: 502, message: "Invalid token response", data: `Discord completed OAuth, but returned this instead of an OAuth access token: ${JSON.stringify(root)}`})
+ const oauthResult = await tokenless.getOauth2Token(id, redirect_uri, reg.ooye.discord_client_secret, parsedQuery.data.code)
+ const parsedToken = schema.token.safeParse(oauthResult)
+ if (!parsedToken.success) {
+ throw createError({status: 502, message: "Invalid token response", data: `Discord completed OAuth, but returned this instead of an OAuth access token: ${JSON.stringify(oauthResult)}`})
}
const userID = Buffer.from(parsedToken.data.access_token.split(".")[0], "base64").toString()
diff --git a/test/web.js b/test/web.js
index 350c8f5..0595a96 100644
--- a/test/web.js
+++ b/test/web.js
@@ -68,6 +68,7 @@ class Router {
}
return this.routes.get(key)(Object.assign(event, {
+ __is_event__: true,
method: method.toUpperCase(),
path: `${url.pathname}${url.search}`,
_requestBody: options.body,