loleaflet/reference.html              |   24 ++++++++++++++++++++++++
 loleaflet/src/map/handler/Map.WOPI.js |   23 +++++++++++++++++++++++
 wsd/FileServer.cpp                    |    2 ++
 3 files changed, 49 insertions(+)

New commits:
commit e4be0b64a6fa3f7db402b5793acfa7aa4b66ebef
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Thu Nov 29 09:16:47 2018 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Thu Nov 29 10:13:18 2018 +0100

    Always allow frame embedding in debug mode
    
    Change-Id: I81c434cfd75c0732e8b6aaaba1392059b0637182
    (cherry picked from commit 1d9a9e834abb612bbf7b6828802db64e53036723)
    Reviewed-on: https://gerrit.libreoffice.org/64210
    Reviewed-by: Thorsten Behrens <[email protected]>
    Tested-by: Thorsten Behrens <[email protected]>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 651654364..23ec0f441 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -681,6 +681,7 @@ void FileServerRequestHandler::preprocessFile(const 
HTTPRequest& request, Poco::
            << "font-src 'self' data:; "
            << "object-src blob:; ";
 
+#if !ENABLE_DEBUG // always allow iframe embedding in debug mode
     // Frame ancestors: Allow loolwsd host, wopi host and anything configured.
     std::string configFrameAncestor = config.getString("net.frame_ancestors", 
"");
     std::string frameAncestors = configFrameAncestor;
@@ -719,6 +720,7 @@ void FileServerRequestHandler::preprocessFile(const 
HTTPRequest& request, Poco::
     cspOss << "\r\n";
     // Append CSP to response headers too
     oss << cspOss.str();
+#endif
 
     // Setup HTTP Public key pinning
     if ((LOOLWSD::isSSLEnabled() || LOOLWSD::isSSLTermination()) && 
config.getBool("ssl.hpkp[@enable]", false))
commit e2d88cfdd3972dfbd40c2297c3bd566578ac6810
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Thu Nov 29 09:32:56 2018 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Thu Nov 29 10:13:08 2018 +0100

    Add postMessage methods to show/hide toolbar buttons
    
    Change-Id: Ib5ecde5a53aa0aae2346e360423e72025edade3a
    (cherry picked from commit c0d0ad736839260667c98aa0cf08feb5630e0b87)
    Reviewed-on: https://gerrit.libreoffice.org/64212
    Reviewed-by: Thorsten Behrens <[email protected]>
    Tested-by: Thorsten Behrens <[email protected]>

diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 75433f9a2..817789373 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -3074,6 +3074,30 @@ WOPI host to editor
                  is used as text of the menubar item.
                </td>
        </tr>
+       <tr>
+               <td><code><b>Hide_Button</b></code></td>
+               <td>
+                       <code><nobr>id: &lt;string&gt;</nobr></code>
+               </td>
+               <td>
+                       Hides a button from the toolbar.<br/>
+                   <code>id</code> is the button ID as defined in the
+                   <a 
href="https://opengrok.libreoffice.org/search?project=online&q=&defs=createToolbar";>createToolbar</a>
+                   function in <a 
href="https://opengrok.libreoffice.org/xref/online/loleaflet/js/toolbar.js";>loleaflet/js/toolbar.js</a>.
+               </td>
+       </tr>
+       <tr>
+               <td><code><b>Show_Button</b></code></td>
+               <td>
+                       <code><nobr>id: &lt;string&gt;</nobr></code>
+               </td>
+               <td>
+                       Hides a button from the toolbar.<br/>
+                       <code>id</code> is the button ID as defined in the
+                       <a 
href="https://opengrok.libreoffice.org/search?project=online&q=&defs=createToolbar";>createToolbar</a>
+                       function in <a 
href="https://opengrok.libreoffice.org/xref/online/loleaflet/js/toolbar.js";>loleaflet/js/toolbar.js</a>.
+               </td>
+       </tr>
 </table>
 Editor to WOPI host
 <table data-id='postmessage-misc-to-host'>
diff --git a/loleaflet/src/map/handler/Map.WOPI.js 
b/loleaflet/src/map/handler/Map.WOPI.js
index 1b7806f59..3784b7108 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -181,6 +181,29 @@ L.Map.WOPI = L.Handler.extend({
                                }
                        }
                }
+               if (msg.MessageId === 'Show_Button' || msg.MessageId === 
'Hide_Button') {
+                       if (!msg.Values) {
+                               console.error('Property "Values" not set');
+                               return;
+                       }
+                       if (!msg.Values.id) {
+                               console.error('Property "Values.id" not set');
+                               return;
+                       }
+                       if (this._map._permission !== 'edit') {
+                               console.log('No toolbar in readonly mode - 
ignoring Remove_Button request.');
+                               return;
+                       }
+                       if (!w2ui['toolbar-up'].get(msg.Values.id)) {
+                               console.error('Toolbar button with id "' + 
msg.Values.id + '" not found.');
+                               return;
+                       }
+                       if (msg.MessageId === 'Show_Button') {
+                               w2ui['toolbar-up'].show(msg.Values.id);
+                       } else {
+                               w2ui['toolbar-up'].hide(msg.Values.id);
+                       }
+               }
                else if (msg.MessageId === 'Set_Settings') {
                        if (msg.Values) {
                                var alwaysActive = msg.Values.AlwaysActive;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to