Sfoglia il codice sorgente

show system information in AdminPage

Yuki Takei 9 anni fa
parent
commit
2745fe640f

+ 20 - 0
lib/crowi/index.js

@@ -18,6 +18,7 @@ function Crowi (rootdir, env)
   var self = this;
   var self = this;
 
 
   this.version = pkg.version;
   this.version = pkg.version;
+  this.runtimeVersions = undefined;   // initialized by scanRuntimeVersions()
 
 
   this.rootDir     = rootdir;
   this.rootDir     = rootdir;
   this.pluginDir   = path.join(this.rootDir, 'node_modules') + sep;
   this.pluginDir   = path.join(this.rootDir, 'node_modules') + sep;
@@ -82,6 +83,8 @@ Crowi.prototype.init = function() {
         return resolve();
         return resolve();
       });
       });
     });
     });
+  }).then(function() {
+    return self.scanRuntimeVersions();
   }).then(function() {
   }).then(function() {
     return self.setupSearcher();
     return self.setupSearcher();
   }).then(function() {
   }).then(function() {
@@ -213,6 +216,23 @@ Crowi.prototype.getIo = function() {
   return this.io;
   return this.io;
 };
 };
 
 
+Crowi.prototype.scanRuntimeVersions = function() {
+  var self = this
+    , check = require('check-node-version')
+    ;
+
+
+  return new Promise((resolve, reject) => {
+    check((err, result) => {
+      if (err) {
+        reject();
+      }
+      self.runtimeVersions = result;
+      resolve();
+    })
+  });
+}
+
 Crowi.prototype.getSearcher = function() {
 Crowi.prototype.getSearcher = function() {
   return this.searcher;
   return this.searcher;
 };
 };

+ 14 - 0
lib/util/swigFunctions.js

@@ -5,6 +5,20 @@ module.exports = function(crowi, app, req, locals) {
     , User = crowi.model('User')
     , User = crowi.model('User')
   ;
   ;
 
 
+  locals.nodeVersion = function() {
+    return crowi.runtimeVersions.node ? crowi.runtimeVersions.node.version : '-';
+  }
+  locals.npmVersion = function() {
+    return crowi.runtimeVersions.npm ? crowi.runtimeVersions.npm.version : '-';
+  }
+  locals.yarnVersion = function() {
+    return crowi.runtimeVersions.yarn ? crowi.runtimeVersions.yarn.version : '-';
+  }
+
+  locals.crowiVersion = function() {
+    return crowi.version;
+  }
+
   // token getter
   // token getter
   locals.csrf = function() {
   locals.csrf = function() {
     return req.csrfToken;
     return req.csrfToken;

+ 20 - 0
lib/views/admin/index.html

@@ -29,6 +29,26 @@
       この画面はWiki管理者のみがアクセスできる画面です。<br>
       この画面はWiki管理者のみがアクセスできる画面です。<br>
       「ユーザー管理」から「管理者にする」ボタンを使ってユーザーをWiki管理者に任命することができます。
       「ユーザー管理」から「管理者にする」ボタンを使ってユーザーをWiki管理者に任命することができます。
       </p>
       </p>
+
+      <h3>システム情報</h3>
+      <table class="table table-bordered">
+        <tr>
+          <td class="col-sm-4">crowi-plus</td>
+          <td>{{ crowiVersion() }}</td>
+        </tr>
+        <tr>
+          <td class="col-sm-4">node.js</td>
+          <td>{{ nodeVersion() }}</td>
+        </tr>
+        <tr>
+          <td class="col-sm-4">npm</td>
+          <td>{{ npmVersion() }}</td>
+        </tr>
+        <tr>
+          <td class="col-sm-4">yarn</td>
+          <td>{{ yarnVersion() }}</td>
+        </tr>
+      </table>
     </div>
     </div>
   </div>
   </div>
 
 

+ 1 - 1
lib/views/layout/2column.html

@@ -20,7 +20,7 @@
     <footer class="">
     <footer class="">
       <p>
       <p>
       <a href="" data-target="#help-modal" data-toggle="modal"><i class="fa fa-question-circle"></i> {{ t('Help') }}</a>
       <a href="" data-target="#help-modal" data-toggle="modal"><i class="fa fa-question-circle"></i> {{ t('Help') }}</a>
-      &copy; {{ now|date('Y') }} {{ config.crowi['app:title']|default('Crowi') }} <img src="/logo/100x11_g.png" alt="powered by Crowi"> </p>
+      &copy; {{ now|date('Y') }} crowi-plus {{ crowiVersion() }} <img src="/logo/100x11_g.png" alt="powered by Crowi"> </p>
     </footer>
     </footer>
   </div>
   </div>
 </aside>
 </aside>

+ 1 - 1
lib/views/layout/single.html

@@ -21,7 +21,7 @@
   <footer class="">
   <footer class="">
     <p>
     <p>
     <a href="" data-target="#help-modal" data-toggle="modal"><i class="fa fa-question-circle"></i> {{ t('Help') }}</a>
     <a href="" data-target="#help-modal" data-toggle="modal"><i class="fa fa-question-circle"></i> {{ t('Help') }}</a>
-    &copy; {{ now|date('Y') }} {{ config.crowi['app:title'] }} <img src="/logo/100x11_g.png" alt="powered by Crowi"> </p>
+    &copy; {{ now|date('Y') }} crowi-plus {{ crowiVersion() }} <img src="/logo/100x11_g.png" alt="powered by Crowi"> </p>
   </footer>
   </footer>
 </div>
 </div>
 {% endblock %}
 {% endblock %}

+ 1 - 0
package.json

@@ -56,6 +56,7 @@
     "body-parser": "^1.17.1",
     "body-parser": "^1.17.1",
     "bootstrap-sass": "~3.3.6",
     "bootstrap-sass": "~3.3.6",
     "botkit": "~0.1.1",
     "botkit": "~0.1.1",
+    "check-node-version": "^2.0.1",
     "cli": "~1.0.1",
     "cli": "~1.0.1",
     "colors": "^1.1.2",
     "colors": "^1.1.2",
     "commander": "~2.9.0",
     "commander": "~2.9.0",

+ 23 - 1
yarn.lock

@@ -1141,6 +1141,16 @@ charenc@~0.0.1:
   version "0.0.2"
   version "0.0.2"
   resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
   resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
 
 
+check-node-version@^2.0.1:
+  version "2.0.1"
+  resolved "https://registry.yarnpkg.com/check-node-version/-/check-node-version-2.0.1.tgz#3f037dc17c79e24029c0c6185d9f5a0aa85d8810"
+  dependencies:
+    map-values "^1.0.1"
+    minimist "^1.2.0"
+    object-filter "^1.0.2"
+    run-parallel "^1.1.4"
+    semver "^5.0.3"
+
 chokidar@^1.4.3:
 chokidar@^1.4.3:
   version "1.6.1"
   version "1.6.1"
   resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2"
   resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2"
@@ -3472,6 +3482,10 @@ map-obj@^1.0.0, map-obj@^1.0.1:
   version "1.0.1"
   version "1.0.1"
   resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
   resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d"
 
 
+map-values@^1.0.1:
+  version "1.0.1"
+  resolved "https://registry.yarnpkg.com/map-values/-/map-values-1.0.1.tgz#768b8e79c009bf2b64fee806e22a7b1c4190c990"
+
 marked-terminal@^1.6.2:
 marked-terminal@^1.6.2:
   version "1.7.0"
   version "1.7.0"
   resolved "https://registry.yarnpkg.com/marked-terminal/-/marked-terminal-1.7.0.tgz#c8c460881c772c7604b64367007ee5f77f125904"
   resolved "https://registry.yarnpkg.com/marked-terminal/-/marked-terminal-1.7.0.tgz#c8c460881c772c7604b64367007ee5f77f125904"
@@ -4050,6 +4064,10 @@ object-component@0.0.3:
   version "0.0.3"
   version "0.0.3"
   resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
   resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
 
 
+object-filter@^1.0.2:
+  version "1.0.2"
+  resolved "https://registry.yarnpkg.com/object-filter/-/object-filter-1.0.2.tgz#af0b797ffebeaf8a52c6637cedbe8816cfec1bc8"
+
 object-get@^2.0.2:
 object-get@^2.0.2:
   version "2.1.0"
   version "2.1.0"
   resolved "https://registry.yarnpkg.com/object-get/-/object-get-2.1.0.tgz#722bbdb60039efa47cad3c6dc2ce51a85c02c5ae"
   resolved "https://registry.yarnpkg.com/object-get/-/object-get-2.1.0.tgz#722bbdb60039efa47cad3c6dc2ce51a85c02c5ae"
@@ -5070,6 +5088,10 @@ rndm@1.2.0:
   version "1.2.0"
   version "1.2.0"
   resolved "https://registry.yarnpkg.com/rndm/-/rndm-1.2.0.tgz#f33fe9cfb52bbfd520aa18323bc65db110a1b76c"
   resolved "https://registry.yarnpkg.com/rndm/-/rndm-1.2.0.tgz#f33fe9cfb52bbfd520aa18323bc65db110a1b76c"
 
 
+run-parallel@^1.1.4:
+  version "1.1.6"
+  resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.6.tgz#29003c9a2163e01e2d2dfc90575f2c6c1d61a039"
+
 rx@2.3.24:
 rx@2.3.24:
   version "2.3.24"
   version "2.3.24"
   resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7"
   resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7"
@@ -5112,7 +5134,7 @@ select@^1.1.2:
   version "1.1.2"
   version "1.1.2"
   resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
   resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"
 
 
-"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@~5.3.0:
+"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0:
   version "5.3.0"
   version "5.3.0"
   resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
   resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"