Parcourir la source

implement page

itizawa il y a 4 ans
Parent
commit
a95d29d58d

+ 7 - 0
packages/slackbot-proxy/src/Server.ts

@@ -96,6 +96,13 @@ const helmetOptions = isProduction ? {} : {
       ejs: 'ejs',
     },
   },
+  statics: {
+    '/': [
+      {
+        root: `${rootDir}/public`,
+      },
+    ],
+  },
 })
 export class Server {
 

+ 2 - 9
packages/slackbot-proxy/src/controllers/top.ts

@@ -3,10 +3,8 @@ import {
 } from '@tsed/common';
 
 import { InstallerService } from '~/services/InstallerService';
-import loggerFactory from '~/utils/logger';
 
-
-const logger = loggerFactory('slackbot-proxy:controllers:index');
+const isOfficialMode = process.env.OFFICIAL_MODE === 'true';
 
 
 @Controller('/')
@@ -31,12 +29,7 @@ export class TopCtrl {
       ],
     });
 
-    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>';
+    return { url, isOfficialMode };
   }
 
 }

BIN
packages/slackbot-proxy/src/public/images/growi-bot.png


+ 20 - 4
packages/slackbot-proxy/src/views/top.ejs

@@ -1,4 +1,20 @@
-<h1><%- name %></h1>
-<div>
-    Start: hoge
-</div>
+<head>
+  <meta name="viewport" content="width=device-width,initial-scale=1">
+</head>
+
+<body style="padding-top:100px; text-align:center;">
+  <h1 >GROWI Bot</h1>
+  <div>
+    <img height="300" width="300" alt="GROWi Bot" src="/images/growi-bot.png" />
+  </div>
+  <div style="display:flex; justify-content: space-between; max-width: 500px; margin:30px auto;">
+    <a href=<%- url %>>
+      <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>
+    <% if (isOfficialMode) { %>
+      <a href="/privacy">
+        Privacy Policy
+      </a>
+    <% } %>
+  </div>
+</body>