|
|
@@ -0,0 +1,42 @@
|
|
|
+import {
|
|
|
+ Controller, Get, Inject, View,
|
|
|
+} from '@tsed/common';
|
|
|
+
|
|
|
+import { InstallerService } from '~/services/InstallerService';
|
|
|
+import loggerFactory from '~/utils/logger';
|
|
|
+
|
|
|
+
|
|
|
+const logger = loggerFactory('slackbot-proxy:controllers:index');
|
|
|
+
|
|
|
+
|
|
|
+@Controller('/')
|
|
|
+export class TopCtrl {
|
|
|
+
|
|
|
+ @Inject()
|
|
|
+ installerService: InstallerService;
|
|
|
+
|
|
|
+ @Get('/')
|
|
|
+ @View('top.ejs')
|
|
|
+ async getTopPage(): Promise<any> {
|
|
|
+ const url = await this.installerService.installer.generateInstallUrl({
|
|
|
+ // Add the scopes your app needs
|
|
|
+ scopes: [
|
|
|
+ 'channels:history',
|
|
|
+ 'commands',
|
|
|
+ 'groups:history',
|
|
|
+ 'im:history',
|
|
|
+ 'mpim:history',
|
|
|
+ 'chat:write',
|
|
|
+ 'team:read',
|
|
|
+ ],
|
|
|
+ });
|
|
|
+
|
|
|
+ return { startDate: new Date(), name: 'MyEvent' };
|
|
|
+
|
|
|
+ return `<a href="${url}">`
|
|
|
+ // eslint-disable-next-line max-len
|
|
|
+ + '<img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcSet="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x" />'
|
|
|
+ + '</a>';
|
|
|
+ }
|
|
|
+
|
|
|
+}
|