itizawa 5 лет назад
Родитель
Сommit
7235ae2bf6
1 измененных файлов с 13 добавлено и 5 удалено
  1. 13 5
      packages/slackbot-proxy/src/controllers/slack.ts

+ 13 - 5
packages/slackbot-proxy/src/controllers/slack.ts

@@ -113,17 +113,25 @@ export class SlackCtrl {
 
     // illegal state
     // TODO: https://youtrack.weseek.co.jp/issue/GW-5543
-    if (req.query.state === 'init') {
-      throw new Error('illegal state');
+    if (req.query.state !== 'init') {
+      res.writeHead(500, { 'Content-Type': 'text/html; charset=utf-8' });
+      res.end('<html>'
+      + '<head><meta name="viewport" content="width=device-width,initial-scale=1"></head>'
+      + '<body style="text-align:center; padding-top:20%;">'
+      + '<h1>Illegal state, try it again.</h1>'
+      + '<a href="/slack/install">'
+      + 'go to install page'
+      + '</a>'
+      + '</body></html>');
     }
 
     this.installerService.installer.handleCallback(req, res, {
       // success: (installation, metadata, req, res) => {},
       failure: (error, installOptions, req, res) => {
         res.writeHead(500, { 'Content-Type': 'text/html; charset=utf-8' });
-        res.end('<html><head>'
-        + '<meta name="viewport" content="width=device-width,initial-scale=1">'
-        + '</head><body style="text-align:center; padding-top:20%;">'
+        res.end('<html>'
+        + '<head><meta name="viewport" content="width=device-width,initial-scale=1"></head>'
+        + '<body style="text-align:center; padding-top:20%;">'
         + '<h1>GROWI Bot installation failed</h1>'
         + '<p>Please contact administrators of your workspace</p>'
         + 'Reference: <a href="https://slack.com/help/articles/222386767-Manage-app-installation-settings-for-your-workspace">'