Compare commits
2 commits
b0a0e62a86
...
69c93ca9d9
Author | SHA1 | Date | |
---|---|---|---|
69c93ca9d9 | |||
8743910c35 |
4 changed files with 16 additions and 13 deletions
|
@ -61,6 +61,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "node start.js",
|
||||
"setup": "node scripts/setup.js",
|
||||
"addbot": "node addbot.js",
|
||||
"test": "cross-env FORCE_COLOR=true supertape --no-check-assertions-count --format tap test/test.js | tap-dot",
|
||||
"test-slow": "cross-env FORCE_COLOR=true supertape --no-check-assertions-count --format tap --no-worker test/test.js -- --slow | tap-dot",
|
||||
|
|
|
@ -81,9 +81,9 @@ Follow these steps:
|
|||
|
||||
1. Install dependencies: `npm install`
|
||||
|
||||
1. Run `node scripts/seed.js` to check your setup and set the bot's initial state. It will prompt you for information. You only need to run this once ever.
|
||||
1. Run `npm run setup` to check your setup and set the bot's initial state. It will prompt you for information. You only need to run this once ever.
|
||||
|
||||
1. Start the bridge: `npm start`
|
||||
1. Start the bridge: `npm run start`
|
||||
|
||||
1. Add the bot to a server - use any *one* of the following commands for an invite link:
|
||||
* (in the REPL) `addbot`
|
||||
|
@ -152,8 +152,8 @@ To get into the rooms on your Matrix account, use the `/invite [your mxid here]`
|
|||
│ └── *.js
|
||||
* Various files you can run once if you need them.
|
||||
└── scripts
|
||||
* First time running a new bridge? Run this file to plant a seed, which will flourish into state for the bridge:
|
||||
├── seed.js
|
||||
* First time running a new bridge? Run this file to set up prerequisites on the Matrix server:
|
||||
├── setup.js
|
||||
* Hopefully you won't need the rest of these. Code quality varies wildly.
|
||||
└── *.js
|
||||
|
||||
|
|
2
scripts/seed.js → scripts/setup.js
Executable file → Normal file
2
scripts/seed.js → scripts/setup.js
Executable file → Normal file
|
@ -305,7 +305,7 @@ async function validateHomeserverOrigin(serverUrlPrompt, url) {
|
|||
}
|
||||
// Otherwise, it's the user's problem
|
||||
if (!guild) {
|
||||
return die(`Error: The bot needs to upload some emojis. Please say where to upload them to. Run seed.js again with --emoji-guild=GUILD_ID`)
|
||||
return die(`Error: The bot needs to upload some emojis. Please say where to upload them to. Run setup again with --emoji-guild=GUILD_ID`)
|
||||
}
|
||||
// Upload those emojis to the chosen location
|
||||
db.prepare("REPLACE INTO auto_emoji (name, emoji_id, guild_id) VALUES ('_', '_', ?)").run(guild.id)
|
|
@ -5,7 +5,7 @@ const mixin = require("@cloudrac3r/mixin-deep")
|
|||
const stream = require("stream")
|
||||
const getStream = require("get-stream")
|
||||
|
||||
const {reg} = require("./read-registration.js")
|
||||
const {reg, writeRegistration} = require("./read-registration.js")
|
||||
|
||||
const baseUrl = `${reg.ooye.server_origin}/_matrix`
|
||||
|
||||
|
@ -45,13 +45,15 @@ async function mreq(method, url, body, extra = {}) {
|
|||
const root = await res.json()
|
||||
|
||||
if (!res.ok || root.errcode) {
|
||||
if (root.error?.includes("Content-Length")) {
|
||||
console.error(`OOYE cannot stream uploads to Synapse. Please choose one of these workarounds:`
|
||||
+ `\n * Run an nginx reverse proxy to Synapse, and point registration.yaml's`
|
||||
+ `\n \`server_origin\` to nginx`
|
||||
+ `\n * Set \`content_length_workaround: true\` in registration.yaml (this will`
|
||||
+ `\n halve the speed of bridging d->m files)`)
|
||||
throw new Error("Synapse is not accepting stream uploads, see the message above.")
|
||||
if (root.error?.includes("Content-Length") || !reg.ooye.content_length_workaround) {
|
||||
reg.ooye.content_length_workaround = true
|
||||
const root = await mreq(method, url, body, extra)
|
||||
console.error("OOYE cannot stream uploads to Synapse. The `content_length_workaround` option"
|
||||
+ "\nhas been activated in registration.yaml, which works around the problem, but"
|
||||
+ "\nhalves the speed of bridging d->m files. A better way to resolve this problem"
|
||||
+ "\nis to run an nginx reverse proxy to Synapse and re-run OOYE setup.")
|
||||
writeRegistration(reg)
|
||||
return root
|
||||
}
|
||||
delete opts.headers.Authorization
|
||||
throw new MatrixServerError(root, {baseUrl, url, ...opts})
|
||||
|
|
Loading…
Reference in a new issue