1
0
Fork 0

Switch to new application service library

This commit is contained in:
Cadence Ember 2024-08-03 22:46:09 +12:00
parent 87cad6c613
commit 7e9005216d
6 changed files with 160 additions and 684 deletions

View file

@ -1,8 +1,8 @@
const reg = require("../matrix/read-registration")
const AppService = require("matrix-appservice").AppService
const as = new AppService({
homeserverToken: reg.hs_token
})
as.listen(+(new URL(reg.url).port))
// @ts-check
module.exports = as
const reg = require("../matrix/read-registration")
const {AppService} = require("@cloudrac3r/in-your-element")
const as = new AppService(reg)
as.listen()
module.exports.as = as

800
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,7 @@
"@cloudrac3r/discord-markdown": "^2.6.2",
"@cloudrac3r/giframe": "^0.4.3",
"@cloudrac3r/html-template-tag": "^5.0.1",
"@cloudrac3r/in-your-element": "^1.0.0",
"@cloudrac3r/mixin-deep": "^3.0.0",
"@cloudrac3r/pngjs": "^7.0.3",
"@cloudrac3r/turndown": "^7.1.4",
@ -30,7 +31,6 @@
"get-stream": "^6.0.1",
"heatsync": "^2.5.3",
"js-yaml": "^4.1.0",
"matrix-appservice": "^2.0.0",
"minimist": "^1.2.8",
"node-fetch": "^2.6.7",
"prettier-bytes": "^1.0.4",

View file

@ -7,7 +7,7 @@
* @property {import("./d2m/discord-client")} discord
* @property {import("heatsync").default} sync
* @property {import("better-sqlite3/lib/database")} db
* @property {import("matrix-appservice").AppService} as
* @property {import("@cloudrac3r/in-your-element").AppService} as
* @property {import("./db/orm").from} from
* @property {import("./db/orm").select} select
*/

View file

@ -1,22 +0,0 @@
// @ts-check
const { AppServiceRegistration } = require("matrix-appservice");
let id = AppServiceRegistration.generateToken()
try {
const reg = require("../matrix/read-registration")
if (reg.id) id = reg.id
} catch (e) {}
// creating registration files
const newReg = new AppServiceRegistration(null);
newReg.setAppServiceUrl("http://localhost:6693");
newReg.setId(id);
newReg.setHomeserverToken(AppServiceRegistration.generateToken());
newReg.setAppServiceToken(AppServiceRegistration.generateToken());
newReg.setSenderLocalpart("_ooye_bot");
newReg.addRegexPattern("users", "@_ooye_.*", true);
newReg.addRegexPattern("aliases", "#_ooye_.*", true);
newReg.setProtocols(["discord"]); // For 3PID lookups
newReg.setRateLimited(false);
newReg.outputAsYaml("registration.yaml");

View file

@ -17,7 +17,7 @@ const DiscordClient = require("./d2m/discord-client")
const discord = new DiscordClient(config.discordToken, "full")
passthrough.discord = discord
const as = require("./matrix/appservice")
const {as} = require("./matrix/appservice")
passthrough.as = as
const orm = sync.require("./db/orm")