[Libreoffice-commits] online.git: 3 commits - kit/ChildSession.cpp loleaflet/css loleaflet/html loleaflet/images loleaflet/js loleaflet/src loolwsd.xml.in wsd/FileServer.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 29 21:46:18 UTC 2018
kit/ChildSession.cpp | 8 +++++---
loleaflet/css/toolbar.css | 1 +
loleaflet/html/loleaflet.html.m4 | 6 ++++--
loleaflet/images/close_toolbar.svg | 1 +
loleaflet/js/toolbar.js | 3 ++-
loleaflet/src/control/Signing.js | 21 +++++++++++++++++++--
loolwsd.xml.in | 4 ++--
wsd/FileServer.cpp | 8 +++-----
8 files changed, 37 insertions(+), 15 deletions(-)
New commits:
commit 7a8c5c072f4e70428deef923a2e78ab104b757b2
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 29 22:34:14 2018 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Nov 29 22:46:14 2018 +0100
Add "close" function to the document signing info bar
Change-Id: I24e967de5c2a975ec2f1321c02712761c6d48de3
Reviewed-on: https://gerrit.libreoffice.org/64299
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index daef2d11c..c7c01fad3 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -584,6 +584,7 @@ button.leaflet-control-search-next
.w2ui-icon.users{ background: url('images/contacts-dark.svg') no-repeat center !important; }
.w2ui-icon.fullscreen{ background: url('images/lc_fullscreen.svg') no-repeat center !important; }
.w2ui-icon.closemobile{ background: url('images/lc_closedocmobile.svg') no-repeat center !important; }
+.w2ui-icon.closetoolbar{ background: url('images/close_toolbar.svg') no-repeat center !important; }
.inserttable-pop {
z-index: 1000;
diff --git a/loleaflet/images/close_toolbar.svg b/loleaflet/images/close_toolbar.svg
new file mode 100644
index 000000000..68b09bb18
--- /dev/null
+++ b/loleaflet/images/close_toolbar.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#5f5f5f" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m4 20 16-16"/><path d="m20 20-16-15.9999998"/></g></svg>
diff --git a/loleaflet/js/toolbar.js b/loleaflet/js/toolbar.js
index 4e1b26591..9485d77cc 100644
--- a/loleaflet/js/toolbar.js
+++ b/loleaflet/js/toolbar.js
@@ -952,9 +952,10 @@ function initNormalToolbar(toolItems) {
{type: 'break' },
{type: 'menu', id: 'passport', caption: _('Select passport'), items: []},
{type: 'html', id: 'current-passport', html: 'Passport: N/A'},
- {type: 'break' },
+ {type: 'spacer'},
{type: 'button', id: 'logout', caption: 'Logout', img: '', hint: _('Logout')},
{type: 'button', id: 'login', caption: 'Login', img: '', hint: _('Login')},
+ {type: 'button', id: 'close', img: 'closetoolbar', hint: _('Close')},
],
onClick: function (e) {
onClick(e, e.target);
diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 47c6dbfba..fcfcd970b 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -9,6 +9,8 @@ var library = null;
var identity = null;
var currentPassport = null;
+var oldtoolbarSize = null;
+
function isSuccess(result) {
return result.code == '200';
}
@@ -227,8 +229,15 @@ function vereignRestoreIdentity() {
L.Map.include({
showSignDocument: function() {
this.initializeLibrary();
+ oldtoolbarSize = $('#document-container').css('top');
- $('#document-container').css('top', '100px');
+ $('#document-container').css('top', '110px');
+ },
+ hideSignDocument: function() {
+ library = null;
+ identity = null;
+ currentPassport = null;
+ $('#document-container').css('top', oldtoolbarSize);
},
signingInitializeBar: function() {
adjustUIState();
@@ -377,7 +386,10 @@ L.Map.include({
}
},
handleSigningClickEvent: function(id, item) {
- if (id === 'login') {
+ if (id === 'close') {
+ this.hideSignDocument();
+ }
+ else if (id === 'login') {
this.signingLogin();
}
else if (id === 'logout') {
commit 2861299c7723a259701800b8c80c398898f92d54
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 29 22:16:41 2018 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Nov 29 22:46:07 2018 +0100
make vereign server configurable, dynamically show sign. infobar
document_signing_url in loolwsd now accepts a vereign server URL
endpoint. If not provided, the signing functionallity won't be
available.
The document signing infobar is now shown dynamically so by
default it is not shown, but when the users clicks in menu the
"sign document", the infobar is shown (the document-content is
css "top" value is adjusted via JQuery).
Change-Id: I9d5f6b68ba3612eeeb9de28c9c0333b4d1bf41d8
Reviewed-on: https://gerrit.libreoffice.org/64298
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index a1b9defdb..3e46444f0 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -101,6 +101,9 @@ ifelse(MOBILEAPP,[true],
</table>
<!--%DOCUMENT_SIGNING_DIV%-->
+ <script>
+ window.documentSigningURL = '%DOCUMENT_SIGNING_URL%';
+ </script>
<input id="insertgraphic" type="file" style="position: fixed; top: -100em">
<input id="document-name-input" type="text" disabled="true"/>
@@ -111,8 +114,7 @@ ifelse(MOBILEAPP,[true],
<div id="spreadsheet-row-column-frame"></div>
- ifelse(MOBILEAPP,[true],[<div id="document-container">],[<!--%DOCUMENT_CONTAINER%-->])
-
+ <div id="document-container">
<div id="map"></div>
</div>
<div id="spreadsheet-toolbar"></div>
diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index dc1341de2..47c6dbfba 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -9,8 +9,6 @@ var library = null;
var identity = null;
var currentPassport = null;
-var vereignURL = 'https://integration2.vereign.com';
-
function isSuccess(result) {
return result.code == '200';
}
@@ -229,6 +227,8 @@ function vereignRestoreIdentity() {
L.Map.include({
showSignDocument: function() {
this.initializeLibrary();
+
+ $('#document-container').css('top', '100px');
},
signingInitializeBar: function() {
adjustUIState();
@@ -255,6 +255,7 @@ L.Map.include({
var filename = 'fileId'; // need to read the filename
library.getPassports(filename).then(function(result) {
+ var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL;
if (isSuccess(result)) {
var resultArray = result.data;
for (var i = 0; i < resultArray.length; i++) {
@@ -338,6 +339,10 @@ L.Map.include({
});
},
initializeLibrary: function() {
+ var vereignURL = window.documentSigningURL == null ? '' : window.documentSigningURL;
+ if (vereignURL.length == 0)
+ return;
+
setupViamAPI(
'signdocument-iframe-content',
{
diff --git a/loolwsd.xml.in b/loolwsd.xml.in
index 7ba63f0a0..0ce943bbd 100644
--- a/loolwsd.xml.in
+++ b/loolwsd.xml.in
@@ -17,7 +17,7 @@
<num_prespawn_children desc="Number of child processes to keep started in advance and waiting for new clients." type="uint" default="1">1</num_prespawn_children>
<per_document desc="Document-specific settings, including LO Core settings.">
<max_concurrency desc="The maximum number of threads to use while processing a document." type="uint" default="4">4</max_concurrency>
- <document_signing desc="If true show the document signing menu item." type="bool" default="false">false</document_signing>
+ <document_signing_url desc="The endpoint URL of signing server, if empty the document signing is disabled" type="string" default=""></document_signing_url>
<redlining_as_comments desc="If true show red-lines as comments" type="bool" default="true">true</redlining_as_comments>
<idle_timeout_secs desc="The maximum number of seconds before unloading an idle document. Defaults to 1 hour." type="uint" default="3600">3600</idle_timeout_secs>
<!-- Idle save and auto save are checked every 30 seconds -->
@@ -28,7 +28,7 @@
<limit_stack_mem_kb desc="The maximum stack size allowed to each document process. 0 for unlimited." type="uint">8000</limit_stack_mem_kb>
<limit_file_size_mb desc="The maximum file size allowed to each document process to write. 0 for unlimited." type="uint">0</limit_file_size_mb>
<limit_num_open_files desc="The maximum number of files allowed to each document process to open. 0 for unlimited." type="uint">0</limit_num_open_files>
- <limit_load_secs desc="Maximum number of seconds to wait for a document load to succeed. 0 for unlimited." type="uint" default="100">100</limit_load_secs>
+ <limit_load_secs desc="Maximum number of seconds to wait for a document load to succeed. 0 for unlimited." type="uint" default="100">100</limit_load_secs>
</per_document>
<per_view desc="View-specific settings.">
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 318a9ff98..cd799929f 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -640,15 +640,13 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
// Customization related to document signing.
std::string documentSigningDiv;
- std::string documentContainerTop("<div id=\"document-container\">");
- const auto documentSigning = config.getBool("per_document.document_signing", false);
- if (documentSigning)
+ const std::string documentSigningURL = config.getString("per_document.document_signing_url", "");
+ if (!documentSigningURL.empty())
{
documentSigningDiv = "<div id=\"document-signing-bar\"></div>";
- documentContainerTop = "<div id=\"document-container\" style=\"top: 100px;\">";
}
Poco::replaceInPlace(preprocess, std::string("<!--%DOCUMENT_SIGNING_DIV%-->"), documentSigningDiv);
- Poco::replaceInPlace(preprocess, std::string("<!--%DOCUMENT_CONTAINER%-->"), documentContainerTop);
+ Poco::replaceInPlace(preprocess, std::string("%DOCUMENT_SIGNING_URL%"), documentSigningURL);
const auto loleafletLogging = config.getString("loleaflet_logging", "false");
Poco::replaceInPlace(preprocess, std::string("%LOLEAFLET_LOGGING%"), loleafletLogging);
commit 2645829f407ea94bf13f76bdc2d40306ed351445
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Nov 29 22:10:47 2018 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Nov 29 22:46:00 2018 +0100
don't assert in this case, better to return
Change-Id: I38cef1185bef0de67bbb579c5c64e2697f953b0b
Reviewed-on: https://gerrit.libreoffice.org/64297
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index e5c758789..114a89a96 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -1367,10 +1367,12 @@ bool ChildSession::signDocumentContent(const char* buffer, int length, const std
Poco::JSON::Parser parser;
Poco::JSON::Object::Ptr root = parser.parse(json).extract<Poco::JSON::Object::Ptr>();
- for (auto& chainPtr : *root->getArray("chain"))
+ for (auto& rChainPtr : *root->getArray("chain"))
{
- assert(chainPtr.isString());
- std::string chainCertificate = chainPtr;
+ if (!rChainPtr.isString())
+ return false;
+
+ std::string chainCertificate = rChainPtr;
std::vector<unsigned char> binaryChainCertificate = decodeBase64(extractCertificate(chainCertificate));
bResult = getLOKitDocument()->addCertificate(
More information about the Libreoffice-commits
mailing list