mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-09-02 23:21:58 +00:00
parent
8f98716217
commit
d6b4645cb9
@ -282,9 +282,12 @@ export class IrcBridge {
|
||||
json: body,
|
||||
}, (err, res, _body) => {
|
||||
if (err) {
|
||||
LogService.error("IrcBridge", "Error calling" + url);
|
||||
LogService.error("IrcBridge", "Error calling " + url);
|
||||
LogService.error("IrcBridge", 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", res.body);
|
||||
@ -314,6 +317,10 @@ export class IrcBridge {
|
||||
LogService.error("IrcBridge", "Error calling" + url);
|
||||
LogService.error("IrcBridge", 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", res.body);
|
||||
reject(new Error("Request failed"));
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Bridge } from "../integrations/Bridge";
|
||||
import BridgeRecord from "./models/BridgeRecord";
|
||||
import { IrcBridge } from "../bridges/IrcBridge";
|
||||
import { LogService } from "matrix-js-snippets";
|
||||
|
||||
export class BridgeStore {
|
||||
|
||||
@ -12,13 +13,18 @@ export class BridgeStore {
|
||||
const enabledBridges: Bridge[] = [];
|
||||
|
||||
for (const bridgeRecord of allRecords) {
|
||||
if (isEnabled === true || isEnabled === false) {
|
||||
const isLogicallyEnabled = await BridgeStore.isLogicallyEnabled(bridgeRecord, requestingUserId);
|
||||
if (isLogicallyEnabled !== isEnabled) continue;
|
||||
}
|
||||
try {
|
||||
if (isEnabled === true || isEnabled === false) {
|
||||
const isLogicallyEnabled = await BridgeStore.isLogicallyEnabled(bridgeRecord, requestingUserId);
|
||||
if (isLogicallyEnabled !== isEnabled) continue;
|
||||
}
|
||||
|
||||
const bridgeConfig = await BridgeStore.getConfiguration(bridgeRecord, requestingUserId, inRoomId);
|
||||
enabledBridges.push(new Bridge(bridgeRecord, bridgeConfig));
|
||||
const bridgeConfig = await BridgeStore.getConfiguration(bridgeRecord, requestingUserId, inRoomId);
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user