Compare commits
2 commits
f35c5266b6
...
76caaa1468
Author | SHA1 | Date | |
---|---|---|---|
76caaa1468 | |||
6a15f4fc0f |
4 changed files with 6 additions and 30 deletions
17
package-lock.json
generated
17
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -87,6 +87,9 @@ async function validateHomeserverOrigin(serverUrlPrompt, url) {
|
|||
if (res.status !== 200) return `There is no Matrix server at that URL (${url}/_matrix/client/versions returned ${res.status})`
|
||||
try {
|
||||
var json = await res.json()
|
||||
if (!Array.isArray(json?.versions) || !json.versions.includes("v1.11")) {
|
||||
return `OOYE needs Matrix version v1.11, but ${url} doesn't support this`
|
||||
}
|
||||
} catch (e) {
|
||||
return `There is no Matrix server at that URL (${url}/_matrix/client/versions is not JSON)`
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue