Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mx-puppet-bridge

Package Overview
Dependencies
Maintainers
1
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mx-puppet-bridge - npm Package Compare versions

Comparing version 0.0.37 to 0.0.38

2

lib/src/botprovisioner.d.ts
import { PuppetBridge } from "./puppetbridge";
import { IRemoteRoom } from "./interfaces";
import { MessageEvent, TextualMessageEventContent } from "matrix-bot-sdk";
import { MessageEvent, TextualMessageEventContent } from "@sorunome/matrix-bot-sdk";
export declare type SendMessageFn = (s: string) => Promise<void>;

@@ -5,0 +5,0 @@ export declare type PidCommandFn = (pid: number, param: string, sendMessage: SendMessageFn) => Promise<void>;

@@ -1,2 +0,2 @@

import { IJoinRoomStrategy } from "matrix-bot-sdk";
import { IJoinRoomStrategy } from "@sorunome/matrix-bot-sdk";
import { PuppetBridge } from "./puppetbridge";

@@ -3,0 +3,0 @@ export declare class PuppetBridgeJoinRoomStrategy implements IJoinRoomStrategy {

@@ -25,3 +25,3 @@ "use strict";

const log_1 = require("./log");
const matrix_bot_sdk_1 = require("matrix-bot-sdk");
const matrix_bot_sdk_1 = require("@sorunome/matrix-bot-sdk");
const escapeHtml = require("escape-html");

@@ -363,3 +363,3 @@ const log = new log_1.Log("MatrixEventHandler");

const msgData = {
body: content.body,
body: content.body || "",
emote: msgtype === "m.emote",

@@ -410,2 +410,5 @@ notice: msgtype === "m.notice",

}
if (msgtype === "m.reaction") {
return; // short-circuit these out, even if they were invalid
}
log.debug("Emitting message event...");

@@ -412,0 +415,0 @@ this.bridge.emit("message", room, msgData, asUser, event);

@@ -25,3 +25,3 @@ "use strict";

const crypto_1 = require("crypto");
const matrix_bot_sdk_1 = require("matrix-bot-sdk");
const matrix_bot_sdk_1 = require("@sorunome/matrix-bot-sdk");
const log_1 = require("./log");

@@ -28,0 +28,0 @@ const util_1 = require("./util");

@@ -72,2 +72,8 @@ "use strict";

}
else if (typeof req.query.user_id !== "string") {
res.status(BAD_REQUEST).json({
error: "user_id query parameter isn't a string?",
errcode: "M_BAD_REQUEST",
});
}
else {

@@ -74,0 +80,0 @@ req.userId = req.query.user_id;

/// <reference types="node" />
import { Appservice, Intent, MatrixClient } from "matrix-bot-sdk";
import { Appservice, Intent, MatrixClient } from "@sorunome/matrix-bot-sdk";
import { EventEmitter } from "events";

@@ -4,0 +4,0 @@ import { EventSyncroniser } from "./eventsyncroniser";

@@ -25,3 +25,3 @@ "use strict";

const fs = require("fs");
const matrix_bot_sdk_1 = require("matrix-bot-sdk");
const matrix_bot_sdk_1 = require("@sorunome/matrix-bot-sdk");
const uuid = require("uuid/v4");

@@ -28,0 +28,0 @@ const yaml = require("js-yaml");

import { PuppetBridge } from "./puppetbridge";
import { IRemoteRoom, IReceiveParams, ISendingUser } from "./interfaces";
import { MatrixClient, RedactionEvent } from "matrix-bot-sdk";
import { MatrixClient, RedactionEvent } from "@sorunome/matrix-bot-sdk";
export declare class ReactionHandler {

@@ -5,0 +5,0 @@ private bridge;

@@ -122,7 +122,3 @@ "use strict";

}
const intent = this.bridge.AS.getIntentForUserId(userId);
try {
yield intent.leaveRoom(ret.mxid);
}
catch (err) { } // not in room
yield this.bridge.roomSync.maybeLeaveGhost(ret.mxid, userId);
});

@@ -158,3 +154,3 @@ }

if (matrixEventId && params.eventId) {
yield this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
yield this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -220,3 +216,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
yield this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
yield this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -281,3 +277,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
yield this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
yield this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -426,3 +422,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
yield this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
yield this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -429,0 +425,0 @@ // aaand stop typing

import { PuppetBridge } from "./puppetbridge";
import { IRemoteRoom, RemoteRoomResolvable } from "./interfaces";
import { IRoomStoreEntry } from "./db/interfaces";
import { MatrixClient } from "matrix-bot-sdk";
import { MatrixClient } from "@sorunome/matrix-bot-sdk";
export declare class RoomSyncroniser {

@@ -6,0 +6,0 @@ private bridge;

import { PuppetBridge } from "./puppetbridge";
import { IRemoteUser, IRemoteUserRoomOverride, RemoteUserResolvable } from "./interfaces";
import { MatrixClient } from "matrix-bot-sdk";
import { MatrixClient } from "@sorunome/matrix-bot-sdk";
import { IUserStoreEntry, IUserStoreRoomOverrideEntry } from "./db/interfaces";

@@ -5,0 +5,0 @@ import { ITokenResponse } from "./provisioner";

@@ -24,3 +24,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const matrix_bot_sdk_1 = require("matrix-bot-sdk");
const matrix_bot_sdk_1 = require("@sorunome/matrix-bot-sdk");
const util_1 = require("./util");

@@ -27,0 +27,0 @@ const log_1 = require("./log");

/// <reference types="node" />
import { IProfileDbEntry } from "./db/interfaces";
import { IRemoteProfile } from "./interfaces";
import { OptionsOfDefaultResponseBody } from "got/dist/source/create";
export interface IMakeUploadFileData {

@@ -9,3 +10,3 @@ avatarUrl?: string | null;

export declare class Util {
static DownloadFile(url: string, options?: any): Promise<Buffer>;
static DownloadFile(url: string, options?: OptionsOfDefaultResponseBody): Promise<Buffer>;
static GetMimeType(buffer: Buffer): string | undefined;

@@ -12,0 +13,0 @@ static str2mxid(a: string): string;

@@ -28,9 +28,8 @@ "use strict";

const log_1 = require("./log");
const request = require("request-promise");
const stringformatter_1 = require("./structures/stringformatter");
const child_process_1 = require("child_process");
const got_1 = require("got");
const log = new log_1.Log("Util");
const HTTP_OK = 200;
class Util {
// tslint:disable-next-line no-any
static DownloadFile(url, options = {}) {

@@ -42,4 +41,4 @@ return __awaiter(this, void 0, void 0, function* () {

options.url = url;
options.encoding = null;
return yield request(options);
options.encoding = undefined;
return yield got_1.default(options).buffer();
});

@@ -46,0 +45,0 @@ }

{
"name": "mx-puppet-bridge",
"version": "0.0.37",
"version": "0.0.38",
"description": "Matrix Puppeting Bridge library",

@@ -23,2 +23,4 @@ "repository": {

"dependencies": {
"@sorunome/matrix-bot-sdk": "^0.5.3-1",
"got": "^10.7.0",
"better-sqlite3": "^6.0.1",

@@ -31,6 +33,3 @@ "events": "^3.1.0",

"markdown-it": "^9.1.0",
"matrix-bot-sdk": "git+https://github.com/Sorunome/matrix-js-bot-sdk.git#8259b9e470469b243666f420e6cf972758694bbb",
"pg-promise": "^8.7.5",
"request": "^2.88.2",
"request-promise": "^4.2.5",
"pg-promise": "^10.5.0",
"uuid": "^3.4.0",

@@ -37,0 +36,0 @@ "winston": "^3.2.1",

@@ -21,3 +21,3 @@ /*

import * as MarkdownIt from "markdown-it";
import { MatrixClient, MessageEvent, TextualMessageEventContent } from "matrix-bot-sdk";
import { MatrixClient, MessageEvent, TextualMessageEventContent } from "@sorunome/matrix-bot-sdk";

@@ -24,0 +24,0 @@ const md = new MarkdownIt();

@@ -14,3 +14,3 @@ /*

import { IJoinRoomStrategy, MatrixClient } from "matrix-bot-sdk";
import { IJoinRoomStrategy, MatrixClient } from "@sorunome/matrix-bot-sdk";
import { PuppetBridge } from "./puppetbridge";

@@ -17,0 +17,0 @@ import { Log } from "./log";

@@ -19,3 +19,3 @@ /*

MembershipEventContent, RoomEventContent, MessageEventContent,
} from "matrix-bot-sdk";
} from "@sorunome/matrix-bot-sdk";
import { IFileEvent, IMessageEvent, IRemoteRoom, ISendingUser, IRemoteUser } from "./interfaces";

@@ -370,3 +370,3 @@ import * as escapeHtml from "escape-html";

const msgData: IMessageEvent = {
body: content.body,
body: content.body || "",
emote: msgtype === "m.emote",

@@ -418,2 +418,5 @@ notice: msgtype === "m.notice",

}
if (msgtype === "m.reaction") {
return; // short-circuit these out, even if they were invalid
}
log.debug("Emitting message event...");

@@ -420,0 +423,0 @@ this.bridge.emit("message", room, msgData, asUser, event);

@@ -15,3 +15,3 @@ /*

import { createHmac } from "crypto";
import { MatrixAuth } from "matrix-bot-sdk";
import { MatrixAuth } from "@sorunome/matrix-bot-sdk";
import { PuppetBridge } from "./puppetbridge";

@@ -18,0 +18,0 @@ import { DbPuppetStore, IPuppet, PuppetType } from "./db/puppetstore";

@@ -79,2 +79,7 @@ /*

});
} else if (typeof req.query.user_id !== "string") {
res.status(BAD_REQUEST).json({
error: "user_id query parameter isn't a string?",
errcode: "M_BAD_REQUEST",
});
} else {

@@ -81,0 +86,0 @@ req.userId = req.query.user_id;

@@ -22,3 +22,3 @@ /*

LogService,
} from "matrix-bot-sdk";
} from "@sorunome/matrix-bot-sdk";
import * as uuid from "uuid/v4";

@@ -25,0 +25,0 @@ import * as yaml from "js-yaml";

@@ -16,3 +16,3 @@ /*

import { IRemoteRoom, IRemoteUser, IReceiveParams, ISendingUser } from "./interfaces";
import { MatrixClient, RedactionEvent } from "matrix-bot-sdk";
import { MatrixClient, RedactionEvent } from "@sorunome/matrix-bot-sdk";
import { DbReactionStore, IReactionStoreEntry } from "./db/reactionstore";

@@ -19,0 +19,0 @@ import { Log } from "./log";

@@ -23,3 +23,3 @@ /*

VideoFileInfo, TimedFileInfo,
} from "matrix-bot-sdk";
} from "@sorunome/matrix-bot-sdk";

@@ -127,6 +127,3 @@ const log = new Log("RemoteEventHandler");

}
const intent = this.bridge.AS.getIntentForUserId(userId);
try {
await intent.leaveRoom(ret.mxid);
} catch (err) { } // not in room
await this.bridge.roomSync.maybeLeaveGhost(ret.mxid, userId);
}

@@ -160,3 +157,3 @@

if (matrixEventId && params.eventId) {
await this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
await this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -219,3 +216,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
await this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
await this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -276,3 +273,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
await this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
await this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -416,3 +413,3 @@ // aaand stop typing

if (matrixEventId && params.eventId) {
await this.bridge.eventSync.insert(params.room.puppetId, matrixEventId, params.eventId);
await this.bridge.eventSync.insert(params.room.puppetId, `${matrixEventId};${mxid}`, params.eventId);
}

@@ -419,0 +416,0 @@ // aaand stop typing

@@ -20,3 +20,3 @@ /*

import { IRoomStoreEntry } from "./db/interfaces";
import { MatrixClient } from "matrix-bot-sdk";
import { MatrixClient } from "@sorunome/matrix-bot-sdk";
import { Lock } from "./structures/lock";

@@ -23,0 +23,0 @@ import { Buffer } from "buffer";

@@ -16,3 +16,3 @@ /*

import { IRemoteUser, IRemoteUserRoomOverride, RemoteUserResolvable } from "./interfaces";
import { MatrixClient, Intent } from "matrix-bot-sdk";
import { MatrixClient, Intent } from "@sorunome/matrix-bot-sdk";
import { Util } from "./util";

@@ -19,0 +19,0 @@ import { Log } from "./log";

@@ -19,5 +19,4 @@ /*

import * as hasha from "hasha";
import { MatrixClient } from "matrix-bot-sdk";
import { MatrixClient } from "@sorunome/matrix-bot-sdk";
import { Log } from "./log";
import * as request from "request-promise";
import { IProfileDbEntry } from "./db/interfaces";

@@ -27,2 +26,5 @@ import { IRemoteProfile } from "./interfaces";

import { spawn } from "child_process";
import got, { Response } from "got";
// This import is weird and needs to stay weird as it isn't exported in the index file of got
import { OptionsOfDefaultResponseBody } from "got/dist/source/create";

@@ -39,4 +41,3 @@ const log = new Log("Util");

export class Util {
// tslint:disable-next-line no-any
public static async DownloadFile(url: string, options: any = {}): Promise<Buffer> {
public static async DownloadFile(url: string, options: OptionsOfDefaultResponseBody = {}): Promise<Buffer> {
if (!options.method) {

@@ -46,4 +47,4 @@ options.method = "GET";

options.url = url;
options.encoding = null;
return await request(options);
options.encoding = undefined;
return await got(options).buffer();
}

@@ -130,3 +131,3 @@

oldHash?: string | null,
): Promise<{ doUpdate: boolean; mxcUrl: string|undefined; hash: string; }> {
): Promise<{ doUpdate: boolean; mxcUrl: string | undefined; hash: string; }> {
let buffer = data.avatarBuffer;

@@ -250,3 +251,3 @@ if ((!buffer && !data.avatarUrl) || (buffer && buffer.byteLength === 0)) {

});
cmd.stdout.on("error", (error) => { }); // disregard
cmd.stdout.on("error", (error) => {}); // disregard
cmd.on("error", (error) => {

@@ -265,3 +266,3 @@ cmd.kill();

});
cmd.stdin.on("error", (error) => { }); // disregard
cmd.stdin.on("error", (error) => {}); // disregard
cmd.stdin.end(buffer);

@@ -268,0 +269,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc