[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src wsd/Admin.cpp wsd/protocol.txt

Dewan iit2015097 at iiita.ac.in
Fri Mar 17 07:53:25 UTC 2017


 loleaflet/dist/admin/adminSettings.html    |   12 ++++++++++++
 loleaflet/src/admin/AdminSocketSettings.js |   24 +++++++++++++++++++++++-
 wsd/Admin.cpp                              |   12 ++++++++++++
 wsd/protocol.txt                           |   26 ++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 1 deletion(-)

New commits:
commit 92ad94f259cfbaa6c81eb86f69ebea0d59b8fdad
Author: Dewan <iit2015097 at iiita.ac.in>
Date:   Tue Mar 14 18:55:16 2017 +0530

    display lokit and loolwsd version in admin panel
    
    Change-Id: Ia5b89373bfd7e921597b73d5a84963268244b748
    Reviewed-on: https://gerrit.libreoffice.org/35199
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/dist/admin/adminSettings.html b/loleaflet/dist/admin/adminSettings.html
index d860de21..3b74b80e 100644
--- a/loleaflet/dist/admin/adminSettings.html
+++ b/loleaflet/dist/admin/adminSettings.html
@@ -59,6 +59,18 @@
             <li><a href="admin.html"><script>document.write(l10nstrings.strOverview)</script> <span class="sr-only"><script>document.write(l10nstrings.strCurrent)</script></span></a></li>
             <li><a href="adminAnalytics.html"><script>document.write(l10nstrings.strAnalytics)</script></a></li>
           </ul>
+          <hr />
+          <div style="position:absolute; bottom:0px">
+            <h3>About</h3>
+            <p>
+              <h5><b>LOOLWSD</b></h5>
+              <div id="loolwsd-version"></div>
+            </p>
+            <p>
+              <h5><b>LOKit</b></h5>
+              <div id="lokit-version"></div>
+            </p>
+          </div>
         </div>
         <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
           <h1 class="page-header"><script>document.write(l10nstrings.strSettings)</script></h1>
diff --git a/loleaflet/src/admin/AdminSocketSettings.js b/loleaflet/src/admin/AdminSocketSettings.js
index 5f4ba6f2..5a7ec207 100644
--- a/loleaflet/src/admin/AdminSocketSettings.js
+++ b/loleaflet/src/admin/AdminSocketSettings.js
@@ -41,9 +41,9 @@ var AdminSocketSettings = AdminSocketBase.extend({
 	onSocketOpen: function() {
 		// Base class' onSocketOpen handles authentication
 		this.base.call(this);
-
 		this.socket.send('subscribe settings');
 		this.socket.send('settings');
+		this.socket.send('version');
 	},
 
 	onSocketMessage: function(e) {
@@ -65,6 +65,28 @@ var AdminSocketSettings = AdminSocketBase.extend({
 				document.getElementById(settingKey).value = settingVal;
 			}
 		}
+		else if (textMsg.startsWith('loolserver ')) {
+			// This must be the first message, unless we reconnect.
+			var loolwsdVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+			var h = loolwsdVersionObj.Hash;
+			if (parseInt(h,16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
+				h = '<a target="_blank" href="https://gerrit.libreoffice.org/gitweb?p=online.git;a=log;h=' + h + '">' + h + '</a>';
+				$('#loolwsd-version').html(loolwsdVersionObj.Version + ' (git hash: ' + h + ')');
+			}
+			else {
+				$('#loolwsd-version').text(loolwsdVersionObj.Version);
+			}
+		}
+		else if (textMsg.startsWith('lokitversion ')) {
+			var lokitVersionObj = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+			var h = lokitVersionObj.BuildId.substring(0, 7);
+			if (parseInt(h,16).toString(16) === h.toLowerCase().replace(/^0+/, '')) {
+				h = '<a target="_blank" href="https://gerrit.libreoffice.org/gitweb?p=core.git;a=log;h=' + h + '">' + h + '</a>';
+			}
+			$('#lokit-version').html(lokitVersionObj.ProductName + ' ' +
+			                         lokitVersionObj.ProductVersion + lokitVersionObj.ProductExtension.replace('.10.','-') +
+			                         ' (git hash: ' + h + ')');
+		}
 	},
 
 	onSocketClose: function() {
diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp
index 1870cb0f..dfa97bc4 100644
--- a/wsd/Admin.cpp
+++ b/wsd/Admin.cpp
@@ -109,6 +109,18 @@ void AdminSocketHandler::handleMessage(bool /* fin */, WSOpCode /* code */,
         if (!result.empty())
             sendTextFrame(tokens[0] + ' ' + result);
     }
+    else if (tokens[0] == "version")
+    {
+        // Send LOOL version information
+        std::string version, hash;
+        Util::getVersionInfo(version, hash);
+        std::string versionStr =
+            "{ \"Version\":  \"" + version + "\", " +
+            "\"Hash\":  \"" + hash  + "\" }";
+        sendTextFrame("loolserver " + versionStr);
+        // Send LOKit version information
+        sendTextFrame("lokitversion " + LOOLWSD::LOKitVersion);
+    }
     else if (tokens[0] == "subscribe" && tokens.count() > 1)
     {
         for (std::size_t i = 0; i < tokens.count() - 1; i++)
diff --git a/wsd/protocol.txt b/wsd/protocol.txt
index ba3a191d..867380b3 100644
--- a/wsd/protocol.txt
+++ b/wsd/protocol.txt
@@ -476,6 +476,12 @@ subscribe <space seperated list of commands>
     Where list of commands are the ones that client wants to get notified
     about. For eg. 'subscribe adddoc rmdoc'
 
+version
+
+    Queries the server for current version of lokit and loolserver. See
+    'lokitversion' and 'loolserver' in admin -> client for the format of
+    response message.
+
 documents
 
     Queries the server for list of opened documents. See `documents` command
@@ -594,3 +600,23 @@ mem_stats <comma separated list of memory consumed values>
 
      The length of the list is equal to the value of setting
      mem_stats_size`
+
+loolserver <JSON string>
+
+    The returned JSON string contains information in the following format:
+    {Version: <>, Hash: <>}
+
+    Eg: {"Version": "master..",
+         "Hash": "4897710"}
+
+lokitversion <JSON string>
+
+    JSON string contains version information in format:
+    {ProductName: <>, ProductVersion: <>, ProductExtension: <>, BuildId: <>}
+
+    Eg: {"ProductName": "LibreOffice",
+         "ProductVersion": "5.3",
+         "ProductExtension": ".0.0.alpha0",
+         "BuildId": "<full 40 char git hash>"}
+
+


More information about the Libreoffice-commits mailing list