message: Fix provisioner access to endpoint
diff: @@ -106,16 +106,11 @@ export class Provisioner {
  }
  const appservice = this.ircBridge.getAppServiceBridge().appService;
  - // TODO: Make app public
  - // eslint-disable-next-line @typescript-eslint/no-explicit-any
  - const app = ((appservice as any).app as express.Router);
  -
  - if (enabled && !(app.use && app.get && app.post)) {
  - throw new Error('Could not start provisioning API');
  - }
  + const app = appservice?.expressApp;
  // Disable all provision endpoints by not calling 'next' and returning an error instead
  if (!enabled) {
  + if (app) {
  app.use((req, res, next) => {
  if (this.isProvisionRequest(req)) {
  res.header("Access-Control-Allow-Origin", "*");
  @@ -129,6 +124,12 @@ export class Provisioner {
  }
  });
  }
  + return;
  + }
  +
  + if (!app) {
  + throw new Error('Could not start provisioning API');
  + }
  app.use((req, res, next) => {
  // Deal with CORS (temporarily for s-web)
  @@ -171,10 +172,8 @@ export class Provisioner {
  this.createProvisionEndpoint(this.getLimits, 'limits')
  );
  - if (enabled) {
  log.info("Provisioning started");
  }
  - }
  private createProvisionEndpoint(fn: (req: ProvisionRequest) => unknown, fnName: string) {
  return async (req: express.Request, res: express.Response) => {
  