mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
parent
8f98716217
commit
d6b4645cb9
@ -282,9 +282,12 @@ export class IrcBridge {
|
|||||||
json: body,
|
json: body,
|
||||||
}, (err, res, _body) => {
|
}, (err, res, _body) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
LogService.error("IrcBridge", "Error calling" + url);
|
LogService.error("IrcBridge", "Error calling " + url);
|
||||||
LogService.error("IrcBridge", err);
|
LogService.error("IrcBridge", err);
|
||||||
reject(err);
|
reject(err);
|
||||||
|
} else if (!res) {
|
||||||
|
LogService.error("IrcBridge", "There is no response for " + url);
|
||||||
|
reject(new Error("No response provided - is the service online?"));
|
||||||
} else if (res.statusCode !== 200) {
|
} else if (res.statusCode !== 200) {
|
||||||
LogService.error("IrcBridge", "Got status code " + res.statusCode + " when calling " + url);
|
LogService.error("IrcBridge", "Got status code " + res.statusCode + " when calling " + url);
|
||||||
LogService.error("IrcBridge", res.body);
|
LogService.error("IrcBridge", res.body);
|
||||||
@ -314,6 +317,10 @@ export class IrcBridge {
|
|||||||
LogService.error("IrcBridge", "Error calling" + url);
|
LogService.error("IrcBridge", "Error calling" + url);
|
||||||
LogService.error("IrcBridge", err);
|
LogService.error("IrcBridge", err);
|
||||||
reject(err);
|
reject(err);
|
||||||
|
} else if (!res) {
|
||||||
|
LogService.error("IrcBridge", "There is no response for " + url);
|
||||||
|
reject(new Error("No response provided - is the service online?"));
|
||||||
|
} else if (res.statusCode !== 200) {
|
||||||
LogService.error("IrcBridge", "Got status code " + res.statusCode + " when calling " + url);
|
LogService.error("IrcBridge", "Got status code " + res.statusCode + " when calling " + url);
|
||||||
LogService.error("IrcBridge", res.body);
|
LogService.error("IrcBridge", res.body);
|
||||||
reject(new Error("Request failed"));
|
reject(new Error("Request failed"));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Bridge } from "../integrations/Bridge";
|
import { Bridge } from "../integrations/Bridge";
|
||||||
import BridgeRecord from "./models/BridgeRecord";
|
import BridgeRecord from "./models/BridgeRecord";
|
||||||
import { IrcBridge } from "../bridges/IrcBridge";
|
import { IrcBridge } from "../bridges/IrcBridge";
|
||||||
|
import { LogService } from "matrix-js-snippets";
|
||||||
|
|
||||||
export class BridgeStore {
|
export class BridgeStore {
|
||||||
|
|
||||||
@ -12,13 +13,18 @@ export class BridgeStore {
|
|||||||
const enabledBridges: Bridge[] = [];
|
const enabledBridges: Bridge[] = [];
|
||||||
|
|
||||||
for (const bridgeRecord of allRecords) {
|
for (const bridgeRecord of allRecords) {
|
||||||
if (isEnabled === true || isEnabled === false) {
|
try {
|
||||||
const isLogicallyEnabled = await BridgeStore.isLogicallyEnabled(bridgeRecord, requestingUserId);
|
if (isEnabled === true || isEnabled === false) {
|
||||||
if (isLogicallyEnabled !== isEnabled) continue;
|
const isLogicallyEnabled = await BridgeStore.isLogicallyEnabled(bridgeRecord, requestingUserId);
|
||||||
}
|
if (isLogicallyEnabled !== isEnabled) continue;
|
||||||
|
}
|
||||||
|
|
||||||
const bridgeConfig = await BridgeStore.getConfiguration(bridgeRecord, requestingUserId, inRoomId);
|
const bridgeConfig = await BridgeStore.getConfiguration(bridgeRecord, requestingUserId, inRoomId);
|
||||||
enabledBridges.push(new Bridge(bridgeRecord, bridgeConfig));
|
enabledBridges.push(new Bridge(bridgeRecord, bridgeConfig));
|
||||||
|
} catch (e) {
|
||||||
|
LogService.error("BridgeStore", "Failed to load configuration for bridge: " + bridgeRecord.name);
|
||||||
|
LogService.error("BridgeStore", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return enabledBridges;
|
return enabledBridges;
|
||||||
|
Loading…
Reference in New Issue
Block a user