diff --git a/package-lock.json b/package-lock.json index bf6f81cb..c9d05742 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "get-stream": "^6.0.1", "h3": "^1.12.0", "heatsync": "^2.5.3", - "js-yaml": "^4.1.0", "minimist": "^1.2.8", "node-fetch": "^2.6.7", "prettier-bytes": "^1.0.4", @@ -1017,11 +1016,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" - }, "node_modules/as-table": { "version": "1.0.55", "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", @@ -1931,17 +1925,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/just-kebab-case": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/just-kebab-case/-/just-kebab-case-4.2.0.tgz", diff --git a/package.json b/package.json index 5933ba97..3fd76511 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "get-stream": "^6.0.1", "h3": "^1.12.0", "heatsync": "^2.5.3", - "js-yaml": "^4.1.0", "minimist": "^1.2.8", "node-fetch": "^2.6.7", "prettier-bytes": "^1.0.4", diff --git a/src/matrix/read-registration.js b/src/matrix/read-registration.js index 9efffdfb..84383875 100644 --- a/src/matrix/read-registration.js +++ b/src/matrix/read-registration.js @@ -4,7 +4,6 @@ const fs = require("fs") const crypto = require("crypto") const assert = require("assert").strict const path = require("path") -const yaml = require("js-yaml") const registrationFilePath = path.join(process.cwd(), "registration.yaml") @@ -60,18 +59,10 @@ function getTemplateRegistration() { function readRegistration() { /** @type {import("../types").AppServiceRegistrationConfig} */ // @ts-ignore let result = null - if (fs.existsSync(registrationFilePath)) { + try { const content = fs.readFileSync(registrationFilePath, "utf8") - if (content.startsWith("{")) { // Use JSON parser - result = JSON.parse(content) - checkRegistration(result) - } else { // Use YAML parser - result = yaml.load(content) - checkRegistration(result) - // Convert to JSON - writeRegistration(result) - } - } + result = JSON.parse(content) + } catch (e) {} return result }