2016-05-16 06:37:02 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
|
|
/*
|
2023-10-30 16:58:54 -05:00
|
|
|
* Copyright the Collabora Online contributors.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
2023-11-09 12:23:00 -06:00
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-05-16 06:37:02 -05:00
|
|
|
*/
|
|
|
|
|
2020-04-18 03:39:50 -05:00
|
|
|
#pragma once
|
2016-05-16 06:37:02 -05:00
|
|
|
|
2016-11-24 08:56:06 -06:00
|
|
|
#include "Session.hpp"
|
2016-12-13 03:13:58 -06:00
|
|
|
#include "Storage.hpp"
|
2016-05-16 06:37:02 -05:00
|
|
|
#include "MessageQueue.hpp"
|
2016-12-13 18:20:05 -06:00
|
|
|
#include "SenderQueue.hpp"
|
2020-05-06 11:02:51 -05:00
|
|
|
#include "ServerURL.hpp"
|
2017-03-15 07:07:17 -05:00
|
|
|
#include "DocumentBroker.hpp"
|
2016-10-16 11:40:52 -05:00
|
|
|
#include <Poco/URI.h>
|
2018-05-30 12:35:13 -05:00
|
|
|
#include <Rectangle.hpp>
|
2018-08-03 07:25:21 -05:00
|
|
|
#include <deque>
|
2018-07-06 05:38:31 -05:00
|
|
|
#include <map>
|
2018-08-23 06:27:47 -05:00
|
|
|
#include <list>
|
|
|
|
#include <utility>
|
2020-04-10 12:02:39 -05:00
|
|
|
#include "Util.hpp"
|
2016-10-16 11:40:52 -05:00
|
|
|
|
2016-05-16 06:37:02 -05:00
|
|
|
class DocumentBroker;
|
|
|
|
|
2021-11-15 10:00:44 -06:00
|
|
|
/// Represents a session to a COOL client, in the WSD process.
|
2020-03-06 11:43:46 -06:00
|
|
|
class ClientSession final : public Session
|
2016-05-16 06:37:02 -05:00
|
|
|
{
|
|
|
|
public:
|
2020-03-06 11:43:46 -06:00
|
|
|
ClientSession(const std::shared_ptr<ProtocolHandlerInterface>& ws,
|
|
|
|
const std::string& id,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker,
|
2016-10-16 11:40:52 -05:00
|
|
|
const Poco::URI& uriPublic,
|
2019-05-29 10:26:16 -05:00
|
|
|
const bool isReadOnly,
|
2020-05-12 15:10:56 -05:00
|
|
|
const RequestDetails &requestDetails);
|
2019-05-29 10:26:16 -05:00
|
|
|
void construct();
|
2016-05-16 18:05:22 -05:00
|
|
|
virtual ~ClientSession();
|
|
|
|
|
2020-07-27 04:27:00 -05:00
|
|
|
void setReadOnly(bool bValue = true) override;
|
|
|
|
|
2021-04-20 05:06:07 -05:00
|
|
|
void sendFileMode(const bool readOnly, const bool editComments);
|
|
|
|
|
2020-07-01 03:34:08 -05:00
|
|
|
void setLockFailed(const std::string& sReason);
|
2016-05-16 17:22:41 -05:00
|
|
|
|
2022-04-05 06:50:18 -05:00
|
|
|
STATE_ENUM(SessionState,
|
|
|
|
DETACHED, // initial
|
|
|
|
LOADING, // attached to a DocBroker & waiting for load
|
|
|
|
LIVE, // Document is loaded & editable or viewable.
|
|
|
|
WAIT_DISCONNECT // closed and waiting for Kit's disconnected message
|
|
|
|
);
|
2017-01-11 15:45:14 -06:00
|
|
|
|
2017-04-19 23:08:13 -05:00
|
|
|
/// Returns true if this session has loaded a view (i.e. we got status message).
|
2019-07-04 04:50:33 -05:00
|
|
|
bool isViewLoaded() const { return _state == SessionState::LIVE; }
|
|
|
|
|
|
|
|
/// returns true if we're waiting for the kit to acknowledge disconnect.
|
|
|
|
bool inWaitDisconnected() const { return _state == SessionState::WAIT_DISCONNECT; }
|
|
|
|
|
|
|
|
/// transition to a new state
|
|
|
|
void setState(SessionState newState);
|
2017-04-19 23:08:13 -05:00
|
|
|
|
2016-11-23 00:01:39 -06:00
|
|
|
void setDocumentOwner(const bool documentOwner) { _isDocumentOwner = documentOwner; }
|
2016-11-22 11:40:10 -06:00
|
|
|
bool isDocumentOwner() const { return _isDocumentOwner; }
|
2016-08-29 13:08:01 -05:00
|
|
|
|
2022-04-01 18:50:56 -05:00
|
|
|
/// Returns true iff the view is loaded and not disconnected
|
|
|
|
/// from either the client or the Kit.
|
|
|
|
bool isLive() const { return _state == SessionState::LIVE && !isCloseFrame(); }
|
|
|
|
|
2017-01-21 19:31:22 -06:00
|
|
|
/// Handle kit-to-client message.
|
2022-06-05 17:37:03 -05:00
|
|
|
bool handleKitToClientMessage(const std::shared_ptr<Message>& payload);
|
2017-01-21 19:31:22 -06:00
|
|
|
|
2019-05-29 10:26:16 -05:00
|
|
|
/// Integer id of the view in the kit process, or -1 if unknown
|
|
|
|
int getKitViewId() const { return _kitViewId; }
|
|
|
|
|
2019-07-04 04:50:33 -05:00
|
|
|
/// Disconnect the session and do final cleanup, @returns true if we should not wait.
|
|
|
|
bool disconnectFromKit();
|
|
|
|
|
2017-03-29 19:38:41 -05:00
|
|
|
// sendTextFrame that takes std::string and string literal.
|
2016-12-13 18:20:05 -06:00
|
|
|
using Session::sendTextFrame;
|
|
|
|
|
|
|
|
bool sendBinaryFrame(const char* buffer, int length) override
|
|
|
|
{
|
2022-04-03 19:08:55 -05:00
|
|
|
if (!isCloseFrame())
|
|
|
|
{
|
|
|
|
enqueueSendMessage(std::make_shared<Message>(buffer, length, Message::Dir::Out));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2016-12-13 18:20:05 -06:00
|
|
|
}
|
|
|
|
|
2022-03-25 13:32:01 -05:00
|
|
|
ClientDeltaTracker _tracker;
|
|
|
|
|
|
|
|
void resetTileSeq(const TileDesc &desc)
|
2021-11-08 13:48:14 -06:00
|
|
|
{
|
2022-03-25 13:32:01 -05:00
|
|
|
_tracker.resetTileSeq(desc);
|
|
|
|
}
|
|
|
|
|
2023-06-27 15:54:29 -05:00
|
|
|
// no tile data - just notify the client the ids/versions updated
|
|
|
|
bool sendUpdateNow(const TileDesc &desc)
|
|
|
|
{
|
|
|
|
TileWireId lastSentId = _tracker.updateTileSeq(desc);
|
2023-07-06 06:08:59 -05:00
|
|
|
std::string header = desc.serialize("update:", "\n");
|
2023-06-27 15:54:29 -05:00
|
|
|
LOG_TRC("Sending update from " << lastSentId << " to " << header);
|
|
|
|
return sendTextFrame(header.data(), header.size());
|
|
|
|
}
|
|
|
|
|
2023-06-27 11:31:25 -05:00
|
|
|
bool sendTileNow(const TileDesc &desc, const Tile &tile)
|
2022-03-25 13:32:01 -05:00
|
|
|
{
|
|
|
|
TileWireId lastSentId = _tracker.updateTileSeq(desc);
|
|
|
|
|
|
|
|
std::string header;
|
|
|
|
if (tile->needsKeyframe(lastSentId) || tile->isPng())
|
|
|
|
header = desc.serialize("tile:", "\n");
|
|
|
|
else
|
|
|
|
header = desc.serialize("delta:", "\n");
|
|
|
|
|
|
|
|
// FIXME: performance - optimize away this copy ...
|
|
|
|
std::vector<char> output;
|
|
|
|
|
2023-07-14 15:51:36 -05:00
|
|
|
// copy in the header
|
2022-03-25 13:32:01 -05:00
|
|
|
output.resize(header.size());
|
|
|
|
std::memcpy(output.data(), header.data(), header.size());
|
2023-07-14 15:51:36 -05:00
|
|
|
|
|
|
|
bool hasContent = tile->appendChangesSince(output, tile->isPng() ? 0 : lastSentId);
|
|
|
|
LOG_TRC("Sending tile message: " << header << " lastSendId " << lastSentId << " content " << hasContent);
|
|
|
|
return sendBinaryFrame(output.data(), output.size());
|
2021-11-08 13:48:14 -06:00
|
|
|
}
|
|
|
|
|
2021-11-13 05:49:35 -06:00
|
|
|
bool sendBlob(const std::string &header, const Blob &blob)
|
2019-02-14 13:01:43 -06:00
|
|
|
{
|
|
|
|
// FIXME: performance - optimize away this copy ...
|
|
|
|
std::vector<char> output;
|
|
|
|
|
2021-11-08 13:48:14 -06:00
|
|
|
output.resize(header.size() + blob->size());
|
2019-02-14 13:01:43 -06:00
|
|
|
std::memcpy(output.data(), header.data(), header.size());
|
2021-11-08 13:48:14 -06:00
|
|
|
std::memcpy(output.data() + header.size(), blob->data(), blob->size());
|
2019-02-14 13:01:43 -06:00
|
|
|
|
|
|
|
return sendBinaryFrame(output.data(), output.size());
|
|
|
|
}
|
|
|
|
|
2016-12-13 18:20:05 -06:00
|
|
|
bool sendTextFrame(const char* buffer, const int length) override
|
|
|
|
{
|
2022-04-03 19:08:55 -05:00
|
|
|
if (!isCloseFrame())
|
|
|
|
{
|
|
|
|
enqueueSendMessage(std::make_shared<Message>(buffer, length, Message::Dir::Out));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2016-12-13 18:20:05 -06:00
|
|
|
}
|
|
|
|
|
2018-09-26 15:15:37 -05:00
|
|
|
void enqueueSendMessage(const std::shared_ptr<Message>& data);
|
2016-12-13 18:20:05 -06:00
|
|
|
|
2017-03-18 15:36:32 -05:00
|
|
|
/// Set the save-as socket which is used to send convert-to results.
|
2017-03-16 21:42:02 -05:00
|
|
|
void setSaveAsSocket(const std::shared_ptr<StreamSocket>& socket)
|
2016-05-16 18:05:22 -05:00
|
|
|
{
|
2017-03-16 21:42:02 -05:00
|
|
|
_saveAsSocket = socket;
|
2016-05-16 18:05:22 -05:00
|
|
|
}
|
|
|
|
|
2016-10-16 12:20:49 -05:00
|
|
|
std::shared_ptr<DocumentBroker> getDocumentBroker() const { return _docBroker.lock(); }
|
2016-05-16 20:03:45 -05:00
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
/// Exact URI (including query params - access tokens etc.) with which
|
|
|
|
/// client made the request to us
|
2017-05-12 10:42:03 -05:00
|
|
|
///
|
|
|
|
/// Note: This URI is unsafe - when connecting to existing sessions, we must
|
|
|
|
/// ignore everything but the access_token, and use the access_token with
|
|
|
|
/// the URI of the initial request.
|
2016-10-16 11:40:52 -05:00
|
|
|
const Poco::URI& getPublicUri() const { return _uriPublic; }
|
|
|
|
|
2017-05-12 10:42:03 -05:00
|
|
|
/// The access token of this session.
|
2022-11-22 20:21:21 -06:00
|
|
|
const Authorization& getAuthorization() const { return _auth; }
|
|
|
|
|
|
|
|
void invalidateAuthorizationToken()
|
|
|
|
{
|
|
|
|
LOG_DBG("Session [" << getId() << "] expiring its authorization token");
|
|
|
|
_auth.expire();
|
|
|
|
}
|
2017-05-12 10:42:03 -05:00
|
|
|
|
2016-12-13 03:13:58 -06:00
|
|
|
/// Set WOPI fileinfo object
|
|
|
|
void setWopiFileInfo(std::unique_ptr<WopiStorage::WOPIFileInfo>& wopiFileInfo) { _wopiFileInfo = std::move(wopiFileInfo); }
|
|
|
|
|
2018-07-10 07:23:20 -05:00
|
|
|
/// Get requested tiles waiting for sending to the client
|
2018-08-03 07:25:21 -05:00
|
|
|
std::deque<TileDesc>& getRequestedTiles() { return _requestedTiles; }
|
2018-06-07 06:13:36 -05:00
|
|
|
|
2018-07-10 07:23:20 -05:00
|
|
|
/// Mark a new tile as sent
|
2023-12-05 03:37:23 -06:00
|
|
|
void addTileOnFly(TileWireId wireId);
|
2018-07-10 07:05:36 -05:00
|
|
|
size_t getTilesOnFlyCount() const { return _tilesOnFly.size(); }
|
2023-12-04 03:12:15 -06:00
|
|
|
size_t getTilesOnFlyUpperLimit() const;
|
2023-12-07 15:59:21 -06:00
|
|
|
void removeOutdatedTilesOnFly(const std::chrono::steady_clock::time_point &now);
|
2023-12-05 03:37:23 -06:00
|
|
|
void onTileProcessed(TileWireId wireId);
|
2018-06-07 06:13:36 -05:00
|
|
|
|
2018-07-05 07:40:28 -05:00
|
|
|
Util::Rectangle getVisibleArea() const { return _clientVisibleArea; }
|
2018-08-30 10:40:42 -05:00
|
|
|
/// Visible area can have negative value as position, but we have tiles only in the positive range
|
|
|
|
Util::Rectangle getNormalizedVisibleArea() const;
|
|
|
|
|
2020-07-07 20:40:13 -05:00
|
|
|
/// The client's visible area can be divided into a maximum of 4 panes.
|
|
|
|
enum SplitPaneName {
|
|
|
|
TOPLEFT_PANE,
|
|
|
|
TOPRIGHT_PANE,
|
|
|
|
BOTTOMLEFT_PANE,
|
|
|
|
BOTTOMRIGHT_PANE
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Returns true if the given split-pane is currently valid.
|
|
|
|
bool isSplitPane(const SplitPaneName) const;
|
|
|
|
|
|
|
|
/// Returns the normalized visible area of a given split-pane.
|
|
|
|
Util::Rectangle getNormalizedVisiblePaneArea(const SplitPaneName) const;
|
|
|
|
|
2018-07-05 07:40:28 -05:00
|
|
|
int getTileWidthInTwips() const { return _tileWidthTwips; }
|
|
|
|
int getTileHeightInTwips() const { return _tileHeightTwips; }
|
|
|
|
|
2018-09-21 08:49:30 -05:00
|
|
|
bool isTextDocument() const { return _isTextDocument; }
|
2019-05-29 10:26:16 -05:00
|
|
|
|
2023-02-24 02:14:03 -06:00
|
|
|
void setThumbnailSession(const bool val) { _thumbnailSession = val; }
|
|
|
|
|
|
|
|
void setThumbnailTarget(const std::string& target) { _thumbnailTarget = target; }
|
|
|
|
|
|
|
|
const std::string& getThumbnailTarget() const { return _thumbnailTarget; }
|
|
|
|
|
2023-05-17 02:44:26 -05:00
|
|
|
void setThumbnailPosition(const std::pair<int, int>& pos) { _thumbnailPosition = pos; }
|
|
|
|
|
|
|
|
const std::pair<int, int>& getThumbnailPosition() const { return _thumbnailPosition; }
|
|
|
|
|
2023-02-24 02:14:03 -06:00
|
|
|
bool thumbnailSession() { return _thumbnailSession; }
|
|
|
|
|
2019-06-21 06:35:17 -05:00
|
|
|
/// Do we recognize this clipboard ?
|
|
|
|
bool matchesClipboardKeys(const std::string &viewId, const std::string &tag);
|
2019-05-29 10:26:16 -05:00
|
|
|
|
2019-06-21 06:35:17 -05:00
|
|
|
/// Handle a clipboard fetch / put request.
|
2019-06-22 11:45:36 -05:00
|
|
|
void handleClipboardRequest(DocumentBroker::ClipboardRequest type,
|
|
|
|
const std::shared_ptr<StreamSocket> &socket,
|
2019-07-04 04:50:33 -05:00
|
|
|
const std::string &tag,
|
2019-06-22 11:45:36 -05:00
|
|
|
const std::shared_ptr<std::string> &data);
|
2017-03-14 21:19:51 -05:00
|
|
|
|
2019-05-29 10:26:16 -05:00
|
|
|
/// Create URI for transient clipboard content.
|
2019-06-21 11:48:57 -05:00
|
|
|
std::string getClipboardURI(bool encode = true);
|
2019-06-21 06:35:17 -05:00
|
|
|
|
2022-10-25 06:42:46 -05:00
|
|
|
/// Utility to create a publicly accessible URI.
|
|
|
|
std::string createPublicURI(const std::string& subPath, const std::string& tag, bool encode);
|
|
|
|
|
2019-07-04 10:47:03 -05:00
|
|
|
/// Adds and/or modified the copied payload before sending on to the client.
|
2020-06-02 02:44:08 -05:00
|
|
|
void postProcessCopyPayload(const std::shared_ptr<Message>& payload);
|
2019-07-04 10:47:03 -05:00
|
|
|
|
2019-07-04 04:50:33 -05:00
|
|
|
/// Returns true if we're expired waiting for a clipboard and should be removed
|
|
|
|
bool staleWaitDisconnect(const std::chrono::steady_clock::time_point &now);
|
|
|
|
|
2019-06-21 06:35:17 -05:00
|
|
|
/// Generate and rotate a new clipboard hash, sending it if appropriate
|
2019-06-22 15:23:12 -05:00
|
|
|
void rotateClipboardKey(bool notifyClient);
|
2019-05-29 10:26:16 -05:00
|
|
|
|
2020-05-12 17:52:25 -05:00
|
|
|
/// Generate an access token for this session via proxy protocol.
|
|
|
|
const std::string &getOrCreateProxyAccess();
|
|
|
|
|
2022-08-02 21:04:49 -05:00
|
|
|
#if ENABLE_FEATURE_LOCK
|
2022-07-05 07:03:14 -05:00
|
|
|
void sendLockedInfo();
|
|
|
|
#endif
|
|
|
|
|
2023-08-24 05:00:34 -05:00
|
|
|
#if ENABLE_FEATURE_RESTRICTION
|
|
|
|
void sendRestrictionInfo();
|
|
|
|
#endif
|
|
|
|
|
2022-10-25 07:30:12 -05:00
|
|
|
/// Process an SVG to replace embedded file:/// media URIs with public http URLs.
|
|
|
|
std::string processSVGContent(const std::string& svg);
|
2022-07-05 07:03:14 -05:00
|
|
|
|
2023-02-23 16:41:06 -06:00
|
|
|
int getCanonicalViewId() { return _canonicalViewId; }
|
|
|
|
|
2019-06-21 06:35:17 -05:00
|
|
|
private:
|
2020-03-06 11:43:46 -06:00
|
|
|
std::shared_ptr<ClientSession> client_from_this()
|
|
|
|
{
|
|
|
|
return std::static_pointer_cast<ClientSession>(shared_from_this());
|
|
|
|
}
|
|
|
|
|
2017-03-14 21:19:51 -05:00
|
|
|
/// SocketHandler: disconnection event.
|
|
|
|
void onDisconnect() override;
|
2019-06-21 06:35:17 -05:00
|
|
|
|
2020-03-06 11:43:46 -06:00
|
|
|
/// Does SocketHandler: have messages to send ?
|
|
|
|
bool hasQueuedMessages() const override;
|
|
|
|
|
|
|
|
/// SocketHandler: send those messages
|
2021-03-07 11:57:13 -06:00
|
|
|
void writeQueuedMessages(std::size_t capacity) override;
|
2017-03-06 10:26:52 -06:00
|
|
|
|
2016-10-29 20:15:00 -05:00
|
|
|
virtual bool _handleInput(const char* buffer, int length) override;
|
2016-05-16 18:05:22 -05:00
|
|
|
|
2020-02-28 03:50:58 -06:00
|
|
|
bool loadDocument(const char* buffer, int length, const StringVector& tokens,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2016-10-29 20:15:00 -05:00
|
|
|
bool getStatus(const char* buffer, int length,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2020-02-28 03:50:58 -06:00
|
|
|
bool getCommandValues(const char* buffer, int length, const StringVector& tokens,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2020-02-28 03:50:58 -06:00
|
|
|
bool sendTile(const char* buffer, int length, const StringVector& tokens,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2020-02-28 03:50:58 -06:00
|
|
|
bool sendCombinedTiles(const char* buffer, int length, const StringVector& tokens,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2016-05-16 18:20:35 -05:00
|
|
|
|
2020-02-28 03:50:58 -06:00
|
|
|
bool sendFontRendering(const char* buffer, int length, const StringVector& tokens,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
|
|
|
|
2016-10-16 12:43:44 -05:00
|
|
|
bool forwardToChild(const std::string& message,
|
2016-10-16 12:20:49 -05:00
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
2016-10-08 13:25:27 -05:00
|
|
|
|
2017-01-21 20:38:11 -06:00
|
|
|
bool forwardToClient(const std::shared_ptr<Message>& payload);
|
|
|
|
|
2016-12-05 06:18:33 -06:00
|
|
|
/// Returns true if given message from the client should be allowed or not
|
|
|
|
/// Eg. in readonly mode only few messages should be allowed
|
|
|
|
bool filterMessage(const std::string& msg) const;
|
|
|
|
|
2017-03-18 09:59:09 -05:00
|
|
|
void dumpState(std::ostream& os) override;
|
|
|
|
|
2020-11-06 02:54:53 -06:00
|
|
|
/// Handle invalidation message coming from a kit and transfer it to a tile request.
|
2018-05-31 13:20:09 -05:00
|
|
|
void handleTileInvalidation(const std::string& message,
|
|
|
|
const std::shared_ptr<DocumentBroker>& docBroker);
|
|
|
|
|
2020-07-07 20:40:13 -05:00
|
|
|
bool isTileInsideVisibleArea(const TileDesc& tile) const;
|
|
|
|
|
2020-07-14 14:19:14 -05:00
|
|
|
/// If this session is read-only because of failed lock, try to unlock and make it read-write.
|
|
|
|
bool attemptLock(const std::shared_ptr<DocumentBroker>& docBroker);
|
|
|
|
|
2021-10-22 02:20:19 -05:00
|
|
|
/// Removes the <meta name="origin" ...> tag which was added in
|
|
|
|
/// ClientSession::postProcessCopyPayload().
|
2022-06-04 08:16:04 -05:00
|
|
|
void preProcessSetClipboardPayload(std::string& payload);
|
2021-10-22 02:20:19 -05:00
|
|
|
|
2016-05-16 06:37:02 -05:00
|
|
|
private:
|
2016-10-16 12:20:49 -05:00
|
|
|
std::weak_ptr<DocumentBroker> _docBroker;
|
2016-05-16 20:03:45 -05:00
|
|
|
|
2016-10-16 11:40:52 -05:00
|
|
|
/// URI with which client made request to us
|
|
|
|
const Poco::URI _uriPublic;
|
|
|
|
|
2020-07-02 03:15:20 -05:00
|
|
|
/// Authorization data - either access_token or access_header.
|
2022-05-05 17:17:38 -05:00
|
|
|
Authorization _auth;
|
2020-06-20 13:09:21 -05:00
|
|
|
|
2016-11-08 07:37:28 -06:00
|
|
|
/// Whether this session is the owner of currently opened document
|
|
|
|
bool _isDocumentOwner;
|
|
|
|
|
2020-07-01 03:34:08 -05:00
|
|
|
/// If it is allowed to try to switch from read-only to edit mode,
|
|
|
|
/// because it's read-only just because of transient lock failure.
|
|
|
|
bool _isLockFailed = false;
|
|
|
|
|
2017-03-16 21:42:02 -05:00
|
|
|
/// The socket to which the converted (saveas) doc is sent.
|
|
|
|
std::shared_ptr<StreamSocket> _saveAsSocket;
|
2016-05-16 06:37:02 -05:00
|
|
|
|
2019-07-04 04:50:33 -05:00
|
|
|
/// The phase of our lifecycle that we're in.
|
|
|
|
SessionState _state;
|
2017-01-11 15:45:14 -06:00
|
|
|
|
2019-07-04 04:50:33 -05:00
|
|
|
/// Time of last state transition
|
|
|
|
std::chrono::steady_clock::time_point _lastStateTime;
|
2017-04-19 23:08:13 -05:00
|
|
|
|
2016-12-13 03:13:58 -06:00
|
|
|
/// Wopi FileInfo object
|
|
|
|
std::unique_ptr<WopiStorage::WOPIFileInfo> _wopiFileInfo;
|
2016-12-13 18:20:05 -06:00
|
|
|
|
2017-09-11 12:59:38 -05:00
|
|
|
/// Count of key-strokes
|
|
|
|
uint64_t _keyEvents;
|
|
|
|
|
2017-01-21 18:51:02 -06:00
|
|
|
SenderQueue<std::shared_ptr<Message>> _senderQueue;
|
2018-05-30 12:35:13 -05:00
|
|
|
|
|
|
|
/// Visible area of the client
|
|
|
|
Util::Rectangle _clientVisibleArea;
|
|
|
|
|
2020-07-07 20:40:13 -05:00
|
|
|
/// Split position that defines the current split panes
|
|
|
|
int _splitX;
|
|
|
|
int _splitY;
|
|
|
|
|
2018-05-30 12:35:13 -05:00
|
|
|
/// Selected part of the document viewed by the client (no parts in Writer)
|
|
|
|
int _clientSelectedPart;
|
|
|
|
|
2022-08-30 00:27:44 -05:00
|
|
|
/// Selected mode of the presentation viewed by the client (in Impress)
|
|
|
|
int _clientSelectedMode;
|
|
|
|
|
2018-05-30 12:35:13 -05:00
|
|
|
/// Zoom properties of the client
|
|
|
|
int _tileWidthPixel;
|
|
|
|
int _tileHeightPixel;
|
|
|
|
int _tileWidthTwips;
|
|
|
|
int _tileHeightTwips;
|
2018-05-31 13:20:09 -05:00
|
|
|
|
2019-05-29 10:26:16 -05:00
|
|
|
/// The integer id of the view in the Kit process
|
|
|
|
int _kitViewId;
|
|
|
|
|
2020-05-06 11:02:51 -05:00
|
|
|
/// How to find our service from the client.
|
|
|
|
const ServerURL _serverURL;
|
2019-05-29 10:26:16 -05:00
|
|
|
|
2018-07-06 05:38:31 -05:00
|
|
|
/// Client is using a text document?
|
2018-06-19 09:15:37 -05:00
|
|
|
bool _isTextDocument;
|
2018-06-07 06:13:36 -05:00
|
|
|
|
2023-02-24 02:14:03 -06:00
|
|
|
/// Session used to generate thumbnail
|
|
|
|
bool _thumbnailSession;
|
|
|
|
|
|
|
|
/// Target used for thumbnail rendering
|
|
|
|
std::string _thumbnailTarget;
|
|
|
|
|
2023-05-17 02:44:26 -05:00
|
|
|
// Position used for thumbnail rendering
|
|
|
|
std::pair<int, int> _thumbnailPosition;
|
|
|
|
|
2020-01-02 15:11:54 -06:00
|
|
|
/// Rotating clipboard remote access identifiers - protected by GlobalSessionMapMutex
|
2019-06-21 06:35:17 -05:00
|
|
|
std::string _clipboardKeys[2];
|
2019-05-29 10:26:16 -05:00
|
|
|
|
2023-12-05 03:37:23 -06:00
|
|
|
/// wire-ids's of the in-flight tiles. Push by sending and pop by tileprocessed message from the client.
|
|
|
|
std::vector<std::pair<TileWireId, std::chrono::steady_clock::time_point>> _tilesOnFly;
|
2018-06-07 06:13:36 -05:00
|
|
|
|
2018-07-10 07:23:20 -05:00
|
|
|
/// Requested tiles are stored in this list, before we can send them to the client
|
2018-08-03 07:25:21 -05:00
|
|
|
std::deque<TileDesc> _requestedTiles;
|
2018-07-06 05:38:31 -05:00
|
|
|
|
2019-05-29 10:26:16 -05:00
|
|
|
/// Sockets to send binary selection content to
|
|
|
|
std::vector<std::weak_ptr<StreamSocket>> _clipSockets;
|
2019-11-12 03:50:33 -06:00
|
|
|
|
2020-05-12 17:52:25 -05:00
|
|
|
/// Time when loading of view started
|
2019-11-12 03:50:33 -06:00
|
|
|
std::chrono::steady_clock::time_point _viewLoadStart;
|
2020-05-12 17:52:25 -05:00
|
|
|
|
|
|
|
/// Secure session id token for proxyprotocol authentication
|
|
|
|
std::string _proxyAccess;
|
2021-02-10 05:13:16 -06:00
|
|
|
|
|
|
|
/// Store last sent payload of form field button, so we can filter out redundant messages.
|
|
|
|
std::string _lastSentFormFielButtonMessage;
|
2021-05-04 02:53:33 -05:00
|
|
|
|
2022-08-22 15:00:05 -05:00
|
|
|
/// Epoch of the client's performance.now() function, as microseconds since Unix epoch
|
2021-05-04 02:53:33 -05:00
|
|
|
uint64_t _performanceCounterEpoch;
|
2022-11-16 02:56:21 -06:00
|
|
|
|
|
|
|
// Saves time from setting/fetching user info multiple times using zotero API
|
|
|
|
bool _isZoteroUserInfoSet = false;
|
|
|
|
|
2023-02-23 16:41:06 -06:00
|
|
|
/// the canonical id unique to the set of rendering properties of this session
|
|
|
|
int _canonicalViewId;
|
2016-05-16 06:37:02 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|