mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
Appease the linter
This commit is contained in:
parent
bc4319da7d
commit
cc921779ae
@ -87,45 +87,45 @@ export class NebStore {
|
||||
}
|
||||
|
||||
public static async getConfig(id: number): Promise<NebConfig> {
|
||||
const config = await NebConfiguration.findByPrimary(id);
|
||||
if (!config) throw new Error("Configuration not found");
|
||||
const nebConfig = await NebConfiguration.findByPrimary(id);
|
||||
if (!nebConfig) throw new Error("Configuration not found");
|
||||
|
||||
const integrations = await NebIntegration.findAll({where: {nebId: id}});
|
||||
const fullIntegrations = await NebStore.getCompleteIntegrations(config, integrations);
|
||||
const fullIntegrations = await NebStore.getCompleteIntegrations(nebConfig, integrations);
|
||||
|
||||
return new NebConfig(config, fullIntegrations);
|
||||
return new NebConfig(nebConfig, fullIntegrations);
|
||||
}
|
||||
|
||||
public static async createForUpstream(upstreamId: number): Promise<NebConfig> {
|
||||
const upstream = await Upstream.findByPrimary(upstreamId);
|
||||
if (!upstream) throw new Error("Upstream not found");
|
||||
|
||||
const config = await NebConfiguration.create({
|
||||
const nebConfig = await NebConfiguration.create({
|
||||
upstreamId: upstream.id,
|
||||
});
|
||||
|
||||
return NebStore.getConfig(config.id);
|
||||
return NebStore.getConfig(nebConfig.id);
|
||||
}
|
||||
|
||||
public static async createForAppservice(appserviceId: string, adminUrl: string): Promise<NebConfig> {
|
||||
const appservice = await AppService.findByPrimary(appserviceId);
|
||||
if (!appservice) throw new Error("Appservice not found");
|
||||
|
||||
const config = await NebConfiguration.create({
|
||||
const nebConfig = await NebConfiguration.create({
|
||||
appserviceId: appservice.id,
|
||||
adminUrl: adminUrl,
|
||||
});
|
||||
|
||||
return NebStore.getConfig(config.id);
|
||||
return NebStore.getConfig(nebConfig.id);
|
||||
}
|
||||
|
||||
public static async getOrCreateIntegration(configurationId: number, integrationType: string): Promise<NebIntegration> {
|
||||
if (!NebStore.INTEGRATIONS[integrationType]) throw new Error("Integration not supported");
|
||||
|
||||
const config = await NebConfiguration.findByPrimary(configurationId);
|
||||
if (!config) throw new Error("Configuration not found");
|
||||
const nebConfig = await NebConfiguration.findByPrimary(configurationId);
|
||||
if (!nebConfig) throw new Error("Configuration not found");
|
||||
|
||||
let integration = await NebIntegration.findOne({where: {nebId: config.id, type: integrationType}});
|
||||
let integration = await NebIntegration.findOne({where: {nebId: nebConfig.id, type: integrationType}});
|
||||
if (!integration) {
|
||||
LogService.info("NebStore", "Creating integration " + integrationType + " for NEB " + configurationId);
|
||||
integration = await NebIntegration.create({
|
||||
@ -171,9 +171,9 @@ export class NebStore {
|
||||
for (const type of Object.keys(NebStore.INTEGRATIONS)) {
|
||||
if (nebConfig.upstreamId && NebStore.INTEGRATIONS_MODULAR_SUPPORTED.indexOf(type) === -1) continue;
|
||||
|
||||
const config = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type]));
|
||||
config["type"] = type;
|
||||
result.push(config);
|
||||
const integrationConfig = JSON.parse(JSON.stringify(NebStore.INTEGRATIONS[type]));
|
||||
integrationConfig["type"] = type;
|
||||
result.push(integrationConfig);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -17,7 +17,7 @@ export class NebClient {
|
||||
}
|
||||
|
||||
public async updateUser(userId: string, isEnabled: boolean, sync = true, autoAcceptInvites = true): Promise<any> {
|
||||
const request: Client = {
|
||||
const nebRequest: Client = {
|
||||
UserID: userId,
|
||||
HomeserverURL: await getFederationUrl(config.homeserver.name),
|
||||
AccessToken: (isEnabled ? await this.getAccessToken(userId) : "DISABLED"),
|
||||
@ -25,25 +25,25 @@ export class NebClient {
|
||||
AutoJoinRooms: autoAcceptInvites
|
||||
};
|
||||
|
||||
return this.doRequest("/admin/configureClient", request);
|
||||
return this.doRequest("/admin/configureClient", nebRequest);
|
||||
}
|
||||
|
||||
public async setServiceConfig(serviceId: string, userId: string, type: string, config: any): Promise<any> {
|
||||
const request: Service = {
|
||||
public async setServiceConfig(serviceId: string, userId: string, type: string, serviceConfig: any): Promise<any> {
|
||||
const nebRequest: Service = {
|
||||
ID: serviceId,
|
||||
Type: type,
|
||||
UserID: userId,
|
||||
Config: config,
|
||||
Config: serviceConfig,
|
||||
};
|
||||
|
||||
return this.doRequest("/admin/configureService", request);
|
||||
return this.doRequest("/admin/configureService", nebRequest);
|
||||
}
|
||||
|
||||
public async getServiceConfig(serviceId: string): Promise<any> {
|
||||
const request = {ID: serviceId};
|
||||
const nebRequest = {ID: serviceId};
|
||||
|
||||
try {
|
||||
const service = await this.doRequest<Service>("/admin/getService", request);
|
||||
const service = await this.doRequest<Service>("/admin/getService", nebRequest);
|
||||
return service.Config;
|
||||
} catch (err) {
|
||||
LogService.error("NebClient", err);
|
||||
|
Loading…
Reference in New Issue
Block a user