Просмотр исходного кода

Merge pull request #4342 from weseek/imprv/7436-display-version-on-the-slackbot-proxy-top-page

imprv(slackbot-proxy): Show version on the top page
Yuki Takei 4 лет назад
Родитель
Сommit
e68ce74380

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

@@ -7,7 +7,6 @@ import { InstallerService } from '~/services/InstallerService';
 
 
 const isOfficialMode = process.env.OFFICIAL_MODE === 'true';
 const isOfficialMode = process.env.OFFICIAL_MODE === 'true';
 
 
-
 @Controller('/')
 @Controller('/')
 export class TopCtrl {
 export class TopCtrl {
 
 
@@ -22,7 +21,11 @@ export class TopCtrl {
       scopes: requiredScopes,
       scopes: requiredScopes,
     });
     });
 
 
-    return { url, isOfficialMode };
+    // use await import in order to avoid typescript-eslint error
+    const fs = await import('fs');
+    const growiBotVersion = JSON.parse(fs.readFileSync('../../package.json', 'utf8')).version;
+
+    return { url, isOfficialMode, growiBotVersion };
   }
   }
 
 
 }
 }

+ 3 - 0
packages/slackbot-proxy/src/views/commons/footer.ejs

@@ -0,0 +1,3 @@
+<footer>
+  <p class="text-center small">version: <%- growiBotVersion %></p>
+</footer>

+ 1 - 0
packages/slackbot-proxy/src/views/top.ejs

@@ -42,5 +42,6 @@
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
+    <%- include('commons/footer'); %>
   </div>
   </div>
 </body>
 </body>