mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-07-08 12:01:48 +00:00
Appease the linter
This commit is contained in:
parent
0a6c8b7037
commit
70d1d23352
|
@ -20,6 +20,23 @@ export class DimensionIntegrationsService {
|
||||||
DimensionIntegrationsService.integrationCache.clear();
|
DimensionIntegrationsService.integrationCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static getIntegrations(isEnabledCheck?: boolean): Promise<IntegrationsResponse> {
|
||||||
|
const cachedResponse = DimensionIntegrationsService.integrationCache.get("integrations_" + isEnabledCheck);
|
||||||
|
if (cachedResponse) {
|
||||||
|
return cachedResponse;
|
||||||
|
}
|
||||||
|
const response = <IntegrationsResponse>{
|
||||||
|
widgets: [],
|
||||||
|
};
|
||||||
|
return Promise.resolve()
|
||||||
|
.then(() => WidgetStore.listAll(isEnabledCheck))
|
||||||
|
.then(widgets => response.widgets = widgets)
|
||||||
|
|
||||||
|
// Cache and return response
|
||||||
|
.then(() => DimensionIntegrationsService.integrationCache.put("integrations_" + isEnabledCheck, response))
|
||||||
|
.then(() => response);
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("enabled")
|
@Path("enabled")
|
||||||
public getEnabledIntegrations(@QueryParam("scalar_token") scalarToken: string): Promise<IntegrationsResponse> {
|
public getEnabledIntegrations(@QueryParam("scalar_token") scalarToken: string): Promise<IntegrationsResponse> {
|
||||||
|
@ -52,21 +69,4 @@ export class DimensionIntegrationsService {
|
||||||
throw new ApiError(404, "Integration not found");
|
throw new ApiError(404, "Integration not found");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getIntegrations(isEnabledCheck?: boolean): Promise<IntegrationsResponse> {
|
|
||||||
const cachedResponse = DimensionIntegrationsService.integrationCache.get("integrations_" + isEnabledCheck);
|
|
||||||
if (cachedResponse) {
|
|
||||||
return cachedResponse;
|
|
||||||
}
|
|
||||||
const response = <IntegrationsResponse>{
|
|
||||||
widgets: [],
|
|
||||||
};
|
|
||||||
return Promise.resolve()
|
|
||||||
.then(() => WidgetStore.listAll(isEnabledCheck))
|
|
||||||
.then(widgets => response.widgets = widgets)
|
|
||||||
|
|
||||||
// Cache and return response
|
|
||||||
.then(() => DimensionIntegrationsService.integrationCache.put("integrations_" + isEnabledCheck, response))
|
|
||||||
.then(() => response);
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -9,6 +9,10 @@ interface AppServiceTransaction {
|
||||||
events: SimplifiedMatrixEvent[];
|
events: SimplifiedMatrixEvent[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: There's no actual defined prefix for this API. The following was chosen to be
|
||||||
|
// somewhat consistent with the other matrix APIs. In reality, the homeserver will just
|
||||||
|
// hit the URL given in the registration - be sure to define it to match this prefix.
|
||||||
|
// Eg: `url: "http://localhost:8184/_matrix/appservice/r0"`
|
||||||
@Path("/_matrix/appservice/r0")
|
@Path("/_matrix/appservice/r0")
|
||||||
export class MatrixAppServiceApiService {
|
export class MatrixAppServiceApiService {
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,6 @@ import config from "../config";
|
||||||
|
|
||||||
export class AppserviceStore {
|
export class AppserviceStore {
|
||||||
|
|
||||||
private constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static create(userPrefix: string): Promise<AppService> {
|
public static create(userPrefix: string): Promise<AppService> {
|
||||||
const id = "dimension-" + randomString({length: 25});
|
const id = "dimension-" + randomString({length: 25});
|
||||||
const asToken = randomString({length: 100});
|
const asToken = randomString({length: 100});
|
||||||
|
@ -60,4 +57,7 @@ export class AppserviceStore {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,9 +6,6 @@ import User from "./models/User";
|
||||||
|
|
||||||
export class ScalarStore {
|
export class ScalarStore {
|
||||||
|
|
||||||
private constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static doesUserHaveTokensForAllUpstreams(userId: string): Promise<boolean> {
|
public static doesUserHaveTokensForAllUpstreams(userId: string): Promise<boolean> {
|
||||||
let upstreamTokenIds: number[] = [];
|
let upstreamTokenIds: number[] = [];
|
||||||
let hasDimensionToken = false;
|
let hasDimensionToken = false;
|
||||||
|
@ -53,4 +50,6 @@ export class ScalarStore {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,9 +5,6 @@ import { resolveIfExists } from "./DimensionStore";
|
||||||
|
|
||||||
export class WidgetStore {
|
export class WidgetStore {
|
||||||
|
|
||||||
private constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static listAll(isEnabled?: boolean): Promise<Widget[]> {
|
public static listAll(isEnabled?: boolean): Promise<Widget[]> {
|
||||||
let conditions = {};
|
let conditions = {};
|
||||||
if (isEnabled === true || isEnabled === false) conditions = {where: {isEnabled: isEnabled}};
|
if (isEnabled === true || isEnabled === false) conditions = {where: {isEnabled: isEnabled}};
|
||||||
|
@ -29,4 +26,7 @@ export class WidgetStore {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user