Documentation
¶
Index ¶
- Constants
- Variables
- func LoginSessionKey(sessionID string) string
- func MergeClientVarsExtra(cv *clientVars.ClientVars, extra map[string]any) (map[string]any, error)
- func ServeAdminWs(conn *websocket.Conn, configSettings *settings.Settings, ...)
- func ServeWs(conn *websocket.Conn, sessionID string, integratorSessionID string, ...)
- type AcceptCommitData
- type AcceptCommitMessage
- type AccessStatusMessage
- type AccountView
- type AccountsResult
- type AdminMessageHandler
- type AssignmentView
- type AuditResult
- type AuditView
- type AuthSession
- type ChangesetInfo
- type ChangesetResponse
- type ChannelOperator
- type Client
- type ClientReconnectData
- type ClientReconnectMessage
- type Hub
- type LineChange
- type Message
- type MockWebSocketConn
- func (m *MockWebSocketConn) Close() error
- func (m *MockWebSocketConn) IsClosed() bool
- func (m *MockWebSocketConn) NextWriter(messageType int) (io.WriteCloser, error)
- func (m *MockWebSocketConn) ReadMessage() (messageType int, p []byte, err error)
- func (m *MockWebSocketConn) RemoteAddr() net.Addr
- func (m *MockWebSocketConn) SetPongHandler(h func(appData string) error)
- func (m *MockWebSocketConn) SetReadDeadline(t time.Time) error
- func (m *MockWebSocketConn) SetReadLimit(size int64)
- func (m *MockWebSocketConn) SetWriteDeadline(t time.Time) error
- func (m *MockWebSocketConn) WriteControl(messageType int, data []byte, deadline time.Time) error
- func (m *MockWebSocketConn) WriteMessage(messageType int, data []byte) error
- type NewChangesMessage
- type NewChangesMessageData
- type OneTimePassword
- type PadDelete
- type PadDeleteMessage
- type PadMessageHandler
- func (p *PadMessageHandler) AppendChat(padID string, chatMessage ws.ChatMessageData) error
- func (p *PadMessageHandler) BroadcastSheetReload(padId string)
- func (p *PadMessageHandler) BroadcastSocketEvent(event string, payload interface{})
- func (p *PadMessageHandler) BroadcastSystemChatToRoom(padId string, message map[string]any)
- func (p *PadMessageHandler) BroadcastToAllClients(payload []byte)
- func (p *PadMessageHandler) ClusterUsers() (users, instances int)
- func (p *PadMessageHandler) ComposePadChangesets(retrievedPad *pad2.Pad, startNum int, endNum int) (string, error)
- func (p *PadMessageHandler) CorrectMarkersInPadForTest(atext apool.AText, pool apool.APool) *string
- func (p *PadMessageHandler) DeletePad(padId string) error
- func (p *PadMessageHandler) DisconnectAuthor(authorID string)
- func (p *PadMessageHandler) DisconnectInactiveAccounts(active func(accountID string) bool)
- func (p *PadMessageHandler) DisconnectLogout(key string)
- func (p *PadMessageHandler) EnqueueSheetOp(client *Client, msg ws.SheetOpIncoming)
- func (p *PadMessageHandler) GetPadUsers(padId string) []PadUserInfo
- func (p *PadMessageHandler) GetPadUsersCount(padId string) int
- func (p *PadMessageHandler) GetRoomSockets(padID string) []Client
- func (p *PadMessageHandler) HandleChangesetRequest(socket *Client, message ws.ChangesetReq)
- func (p *PadMessageHandler) HandleClientMessage(message ws.ClientMessage, client *Client, session *ws.Session, ...)
- func (p *PadMessageHandler) HandleClientReadyMessage(ready ws.ClientReady, client *Client, thisSession *ws.Session, ...)
- func (p *PadMessageHandler) HandleDisconnectOfPadClient(client *Client, settings *settings.Settings, logger *zap.SugaredLogger)
- func (p *PadMessageHandler) HandleMessage(message any, client *Client, retrievedSettings *settings.Settings, ...)
- func (p *PadMessageHandler) HandlePadDelete(client *Client, padDeleteMessage PadDelete, cfg *settings.Settings)
- func (p *PadMessageHandler) HandlePresence(client *Client, msg ws.SheetPresenceIncoming)
- func (p *PadMessageHandler) HandleSavedRevisionMessage(foundPad *pad2.Pad, author string)
- func (p *PadMessageHandler) HandleSheetClientReady(ready ws.ClientReady, client *Client, session *ws.Session)
- func (p *PadMessageHandler) HandleUserInfoUpdate(userInfo UserInfoUpdate, client *Client)
- func (p *PadMessageHandler) KickSessionsFromPad(padID string)
- func (p *PadMessageHandler) ReadOnlyManagerForTest() *pad.ReadOnlyManager
- func (p *PadMessageHandler) SendChatMessageToPadClients(session *ws.Session, chatMessage ws.ChatMessageData)
- func (p *PadMessageHandler) SendCustomMessageToPad(padId string, msgType string)
- func (p *PadMessageHandler) SetCluster(bus cluster.Bus)
- func (p *PadMessageHandler) SetRetention(retention *pad.Retention)
- func (p *PadMessageHandler) SheetManager() *sheetdoc.Manager
- func (p *PadMessageHandler) StopCluster()
- func (p *PadMessageHandler) UpdatePadClients(pad *pad2.Pad)
- type PadUserInfo
- type RoleView
- type SavedRevision
- type SavedRevisionData
- type SavedRevisionDataData
- type ScopeView
- type SessionInfo
- type SessionStat
- type SessionStore
- func (s *SessionStore) AddHandleClientInformationForTest(sessionId string, padId string, token string) *ws.Session
- func (s *SessionStore) AddPadReadOnlyIdsForTest(sessionId, padId string, readOnlyPadId string, readOnly bool)
- func (s *SessionStore) Count() int
- func (s *SessionStore) GetPadSessions(padId string) []PadUserInfo
- func (s *SessionStore) GetPadSessionsCount(padId string) int
- func (s *SessionStore) GetSessionForTest(sessionId string) *ws.Session
- func (s *SessionStore) GetStats() (SessionStat, error)
- func (s *SessionStore) InitSessionForTest(sessionId string)
- func (s *SessionStore) IntegratorSessionIDForTest(sessionId string) string
- func (s *SessionStore) PadUserCounts() map[string]int
- func (s *SessionStore) RemoveSessionForTest(sessionId string)
- func (s *SessionStore) SetAuthorForTest(sessionId string, authorId string)
- func (s *SessionStore) SetPadIdForTest(sessionId string, padId string)
- func (s *SessionStore) SetReadOnlyForTest(sessionId string, readOnly bool)
- func (s *SessionStore) SetRevisionForTest(sessionId string, revision int)
- type SheetChannelOperator
- type SheetTask
- type Task
- type TokenAccount
- type TokenCreated
- type TokenPolicyView
- type TokenView
- type TokensResult
- type UserDupMessage
- type UserInfoUpdate
- type UserInfoUpdateWrapper
- type WebSocketConn
- type WebSocketConnData
- type WebSocketWrapper
Constants ¶
const SheetOpsVersion = 2
SheetOpsVersion is the sheet op version this server's browser code understands; sent in the sheet CLIENT_READY.
Variables ¶
var ErrChatDropped = errors.New("the message was dropped by a plugin")
ErrChatDropped: a chatNewMessage hook dropped the message.
var ErrNoPad = errors.New("the pad does not exist")
ErrNoPad: the pad of a chat message does not exist (any more).
Functions ¶
func LoginSessionKey ¶ added in v0.7.0
LoginSessionKey is how connections and cluster notices name a pad login session: a hash, so the session id itself is not passed around.
func MergeClientVarsExtra ¶ added in v0.6.5
func MergeClientVarsExtra(cv *clientVars.ClientVars, extra map[string]any) (map[string]any, error)
MergeClientVarsExtra serializes cv to a top-level JSON object and overlays the keys from extra that the typed struct does not already own. On collision the typed field wins, so plugins cannot clobber engine-owned CLIENT_VARS keys.
func ServeAdminWs ¶ added in v0.0.2
func ServeAdminWs(conn *websocket.Conn, configSettings *settings.Settings, logger *zap.SugaredLogger, handler AdminMessageHandler, accountID string)
ServeAdminWs handles admin websocket requests using Fiber's websocket middleware. accountID is the account the admin token was issued to.
func ServeWs ¶
func ServeWs(conn *websocket.Conn, sessionID string, integratorSessionID string, clientIP string, webAccessUser any, configSettings *settings.Settings, logger *zap.SugaredLogger, handler *PadMessageHandler, cookieToken string, loginSession string)
ServeWs handles websocket requests from the peer using Fiber's websocket middleware.
Types ¶
type AcceptCommitData ¶
type AcceptCommitMessage ¶
type AcceptCommitMessage struct {
Type string `json:"type"`
Data AcceptCommitData `json:"data"`
}
type AccessStatusMessage ¶
type AccessStatusMessage struct {
AccessStatus string `json:"accessStatus"`
}
type AccountView ¶ added in v0.7.0
type AccountView struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName string `json:"displayName"`
Email string `json:"email"`
Kind string `json:"kind"`
Disabled bool `json:"disabled"`
MustChangePassword bool `json:"mustChangePassword"`
HasPassword bool `json:"hasPassword"`
CreatedAt int64 `json:"createdAt"`
LastLoginAt *int64 `json:"lastLoginAt"`
Roles []AssignmentView `json:"roles"`
// Admin: holds the admin role's rights for all pads.
Admin bool `json:"admin"`
}
AccountView is an account as the admin page lists it: never its password hash.
type AccountsResult ¶ added in v0.7.0
type AccountsResult struct {
Accounts []AccountView `json:"accounts"`
Roles []RoleView `json:"roles"`
Scopes []ScopeView `json:"scopes"`
// Me is the account of this admin connection.
Me string `json:"me"`
// Password is a new one-time password (accountCreate, accountResetPassword),
// shown once.
Password *OneTimePassword `json:"password,omitempty"`
Error string `json:"error,omitempty"`
}
AccountsResult answers every account event with the whole state.
type AdminMessageHandler ¶ added in v0.0.2
type AdminMessageHandler struct {
Logger *zap.SugaredLogger
App *fiber.App
// contains filtered or unexported fields
}
func NewAdminMessageHandler ¶ added in v0.0.2
func NewAdminMessageHandler(store db.DataStore, h *hooks.Hook, m *pad.Manager, padMessHandler *PadMessageHandler, logger *zap.SugaredLogger, hub *Hub, app *fiber.App, upd *updater.Updater) AdminMessageHandler
func (AdminMessageHandler) DeleteRevisions ¶ added in v0.0.2
func (h AdminMessageHandler) DeleteRevisions(padId string, keepRevisions int) error
func (AdminMessageHandler) HandleMessage ¶ added in v0.0.2
func (h AdminMessageHandler) HandleMessage(message admin.EventMessage, retrievedSettings *settings.Settings, c *Client)
type AssignmentView ¶ added in v0.7.0
type AuditResult ¶ added in v0.7.0
type AuthSession ¶
type ChangesetInfo ¶ added in v0.0.2
type ChangesetInfo struct {
ForwardsChangesets []string `json:"forwardsChangesets"`
BackwardsChangesets []string `json:"backwardsChangesets"`
ActualEndNum int `json:"actualEndNum"`
TimeDeltas []int64 `json:"timeDeltas"`
Start int `json:"start"`
Granularity int `json:"granularity"`
APool apool.APool `json:"apool"`
RequestId any `json:"requestID"`
}
type ChangesetResponse ¶ added in v0.0.2
type ChangesetResponse struct {
Type string `json:"type"`
Data ChangesetInfo `json:"data"`
}
type ChannelOperator ¶
type ChannelOperator struct {
// contains filtered or unexported fields
}
ChannelOperator processes USER_CHANGES.
It used to start one goroutine per pad that was never stopped, so every pad ever edited leaked a goroutine and its channel. Now each task runs on the sending client's read loop while handleUserChanges holds the pad's write lock. That keeps commits of one client in order, serialises commits per pad (also against HTTP API writes, which take the same lock) and leaves nothing running once the pad is idle.
func NewChannelOperator ¶
func NewChannelOperator(p *PadMessageHandler) ChannelOperator
func (*ChannelOperator) AddToQueue ¶
func (c *ChannelOperator) AddToQueue(_ string, t Task)
AddToQueue handles the task synchronously. The room argument is kept for compatibility; serialisation is keyed by the session's pad ID.
type Client ¶
type Client struct {
Hub *Hub
// The websocket connection.
Conn WebSocketConn
// Buffered channel of outbound messages.
Send chan []byte
Room string
SessionId string
// IntegratorSessionID carries the integrator-set sessionID cookie
// value (from createSession() HTTP API), read from the socket.io
// handshake so the cookie can be HttpOnly. Upstream #7045 / #7755.
IntegratorSessionID string
ClientIP string
WebAccessUser any
// CookieToken is the author token from the HttpOnly cookie of the
// websocket handshake; it wins over the token in CLIENT_READY.
CookieToken string
Handler *PadMessageHandler
// AdminAccount is the account of an admin connection, from its token.
AdminAccount string
// LoginSession is the key of the pad login session the connection was
// opened with (LoginSessionKey), "" without one.
LoginSession string
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
func (*Client) SafeSend ¶ added in v0.0.2
SafeSend sends a message to the client, returning false if the channel is closed.
func (*Client) SendPadDelete ¶
func (c *Client) SendPadDelete()
func (*Client) SendUserDupMessage ¶
func (c *Client) SendUserDupMessage()
type ClientReconnectData ¶ added in v0.0.2
type ClientReconnectData struct {
Type string `json:"type"`
HeadRev int `json:"headRev,omitempty"`
NewRev int `json:"newRev"`
Changeset string `json:"changeset,omitempty"`
APool apool.APool `json:"apool,omitempty"`
Author string `json:"author,omitempty"`
CurrentTime int64 `json:"currentTime,omitempty"`
NoChanges bool `json:"noChanges,omitempty"`
}
type ClientReconnectMessage ¶ added in v0.0.2
type ClientReconnectMessage struct {
Type string `json:"type"`
Data ClientReconnectData `json:"data"`
}
type Hub ¶
type Hub struct {
// Registered Clients.
Clients map[*Client]bool
ClientsRWMutex sync.RWMutex
// Inbound messages from the Clients.
Broadcast chan []byte
// Register requests from the Clients.
Register chan *Client
// Unregister requests from Clients.
Unregister chan *Client
}
Hub maintains the set of active Clients and broadcasts messages to the Clients.
func (*Hub) BroadcastShout ¶ added in v0.6.5
BroadcastShout sends a sticky/non-sticky notice to every connected client using the same COLLABROOM/result:shout envelope the admin "shout" command uses. Used by the updater to announce an imminent restart during draining.
func (*Hub) NumClients ¶ added in v0.7.0
NumClients is the number of registered clients.
type LineChange ¶ added in v0.0.2
type Message ¶
type Message struct {
Data clientVars2.ClientVars `json:"data"`
Type string `json:"type"`
}
type MockWebSocketConn ¶ added in v0.0.2
type MockWebSocketConn struct {
Data []WebSocketConnData
// contains filtered or unexported fields
}
func NewActualMockWebSocketconn ¶ added in v0.0.2
func NewActualMockWebSocketconn() *MockWebSocketConn
func (*MockWebSocketConn) Close ¶ added in v0.0.2
func (m *MockWebSocketConn) Close() error
func (*MockWebSocketConn) IsClosed ¶ added in v0.7.0
func (m *MockWebSocketConn) IsClosed() bool
IsClosed reports whether Close was called.
func (*MockWebSocketConn) NextWriter ¶ added in v0.0.2
func (m *MockWebSocketConn) NextWriter(messageType int) (io.WriteCloser, error)
func (*MockWebSocketConn) ReadMessage ¶ added in v0.0.2
func (m *MockWebSocketConn) ReadMessage() (messageType int, p []byte, err error)
func (*MockWebSocketConn) RemoteAddr ¶ added in v0.0.2
func (m *MockWebSocketConn) RemoteAddr() net.Addr
func (*MockWebSocketConn) SetPongHandler ¶ added in v0.0.2
func (m *MockWebSocketConn) SetPongHandler(h func(appData string) error)
func (*MockWebSocketConn) SetReadDeadline ¶ added in v0.0.2
func (m *MockWebSocketConn) SetReadDeadline(t time.Time) error
func (*MockWebSocketConn) SetReadLimit ¶ added in v0.0.2
func (m *MockWebSocketConn) SetReadLimit(size int64)
func (*MockWebSocketConn) SetWriteDeadline ¶ added in v0.0.2
func (m *MockWebSocketConn) SetWriteDeadline(t time.Time) error
func (*MockWebSocketConn) WriteControl ¶ added in v0.0.2
func (*MockWebSocketConn) WriteMessage ¶ added in v0.0.2
func (m *MockWebSocketConn) WriteMessage(messageType int, data []byte) error
type NewChangesMessage ¶
type NewChangesMessage struct {
Type string `json:"type"`
Data NewChangesMessageData `json:"data"`
}
type NewChangesMessageData ¶
type OneTimePassword ¶ added in v0.7.0
type PadDeleteMessage ¶
type PadDeleteMessage struct {
Disconnect string `json:"disconnect"`
}
type PadMessageHandler ¶ added in v0.0.2
type PadMessageHandler struct {
SessionStore *SessionStore
Logger *zap.SugaredLogger
// contains filtered or unexported fields
}
func NewPadMessageHandler ¶ added in v0.0.2
func NewPadMessageHandler(db db2.DataStore, hooks *hooks.Hook, padManager *pad.Manager, sessionStore *SessionStore, hub *Hub, logger *zap.SugaredLogger, uiAssets embed.FS, cfg *settings.Settings) *PadMessageHandler
func (*PadMessageHandler) AppendChat ¶ added in v0.7.0
func (p *PadMessageHandler) AppendChat(padID string, chatMessage ws.ChatMessageData) error
AppendChat stores a chat message of padID and sends it to the pad's clients on every instance, as one written in the pad. It runs the chatNewMessage hooks and takes the pad's lock itself.
func (*PadMessageHandler) BroadcastSheetReload ¶ added in v0.6.5
func (p *PadMessageHandler) BroadcastSheetReload(padId string)
BroadcastSheetReload tells every client of a sheet to re-fetch its state (used after an xlsx import replaces the workbook). The caller holds the pad's write lock. Clients on other instances are told by their instance, which notices the new epoch.
func (*PadMessageHandler) BroadcastSocketEvent ¶ added in v0.5.0
func (p *PadMessageHandler) BroadcastSocketEvent(event string, payload interface{})
func (*PadMessageHandler) BroadcastSystemChatToRoom ¶ added in v0.5.0
func (p *PadMessageHandler) BroadcastSystemChatToRoom(padId string, message map[string]any)
BroadcastSystemChatToRoom sends a chat message to all clients in a pad room without saving to the database. The message map is sent as-is inside a CHAT_MESSAGE COLLABROOM event.
func (*PadMessageHandler) BroadcastToAllClients ¶ added in v0.7.0
func (p *PadMessageHandler) BroadcastToAllClients(payload []byte)
BroadcastToAllClients sends payload to every client on every instance.
func (*PadMessageHandler) ClusterUsers ¶ added in v0.7.0
func (p *PadMessageHandler) ClusterUsers() (users, instances int)
ClusterUsers is the number of connected users on all instances: this one's now, the others' from their last heartbeat. instances counts this one too. If the registry cannot be read, it is this instance's count.
func (*PadMessageHandler) ComposePadChangesets ¶ added in v0.0.2
func (*PadMessageHandler) CorrectMarkersInPadForTest ¶ added in v0.6.3
CorrectMarkersInPadForTest exposes correctMarkersInPad for tests.
func (*PadMessageHandler) DeletePad ¶ added in v0.0.2
func (p *PadMessageHandler) DeletePad(padId string) error
func (*PadMessageHandler) DisconnectAuthor ¶ added in v0.7.0
func (p *PadMessageHandler) DisconnectAuthor(authorID string)
DisconnectAuthor closes the connections of an erased author's sessions on every instance, so none of them can write the identity back.
func (*PadMessageHandler) DisconnectInactiveAccounts ¶ added in v0.7.0
func (p *PadMessageHandler) DisconnectInactiveAccounts(active func(accountID string) bool)
DisconnectInactiveAccounts closes this instance's connections of accounts that may no longer be logged in (active says). Every instance runs it on a change of the accounts, its own or another's.
func (*PadMessageHandler) DisconnectLogout ¶ added in v0.7.0
func (p *PadMessageHandler) DisconnectLogout(key string)
DisconnectLogout closes the connections opened with a pad login session that ended, here and on the other instances: an open pad does not keep writing with the rights of a logout.
func (*PadMessageHandler) EnqueueSheetOp ¶ added in v0.6.5
func (p *PadMessageHandler) EnqueueSheetOp(client *Client, msg ws.SheetOpIncoming)
EnqueueSheetOp routes a SHEET_OP to the per-document serialization goroutine. Keyed by the session's pad id so each document keeps a total order.
func (*PadMessageHandler) GetPadUsers ¶ added in v0.0.5
func (p *PadMessageHandler) GetPadUsers(padId string) []PadUserInfo
GetPadUsers returns the list of users currently in a pad
func (*PadMessageHandler) GetPadUsersCount ¶ added in v0.0.5
func (p *PadMessageHandler) GetPadUsersCount(padId string) int
GetPadUsersCount returns the number of users currently in a pad
func (*PadMessageHandler) GetRoomSockets ¶ added in v0.0.2
func (p *PadMessageHandler) GetRoomSockets(padID string) []Client
func (*PadMessageHandler) HandleChangesetRequest ¶ added in v0.0.2
func (p *PadMessageHandler) HandleChangesetRequest(socket *Client, message ws.ChangesetReq)
func (*PadMessageHandler) HandleClientMessage ¶ added in v0.6.3
func (p *PadMessageHandler) HandleClientMessage(message ws.ClientMessage, client *Client, session *ws.Session, retrievedSettings *settings.Settings)
HandleClientMessage handles the COLLABROOM CLIENT_MESSAGE family, mirroring the original's handleSuggestUserName / handlePadOptionsMessage.
func (*PadMessageHandler) HandleClientReadyMessage ¶ added in v0.0.2
func (p *PadMessageHandler) HandleClientReadyMessage(ready ws.ClientReady, client *Client, thisSession *ws.Session, retrievedSettings *settings.Settings, logger *zap.SugaredLogger)
func (*PadMessageHandler) HandleDisconnectOfPadClient ¶ added in v0.0.2
func (p *PadMessageHandler) HandleDisconnectOfPadClient(client *Client, settings *settings.Settings, logger *zap.SugaredLogger)
func (*PadMessageHandler) HandleMessage ¶ added in v0.0.2
func (p *PadMessageHandler) HandleMessage(message any, client *Client, retrievedSettings *settings.Settings, logger *zap.SugaredLogger)
func (*PadMessageHandler) HandlePadDelete ¶ added in v0.0.2
func (p *PadMessageHandler) HandlePadDelete(client *Client, padDeleteMessage PadDelete, cfg *settings.Settings)
HandlePadDelete deletes the pad the session is on, like etherpad-lite's handlePadDelete: allowed for the creator, for anyone with the pad's deletion token, and, with allowPadDeletionByAllUsers, for anyone who can edit it. A supplied token must be valid; read-only sessions can only delete with a token.
func (*PadMessageHandler) HandlePresence ¶ added in v0.6.5
func (p *PadMessageHandler) HandlePresence(client *Client, msg ws.SheetPresenceIncoming)
HandlePresence relays an ephemeral cursor / live-edit frame to the other clients of the sheet. It is NOT persisted and NOT ordered through the per-doc goroutine. Identity is stamped server-side from the session author (no client spoofing); read-only sessions may move a cursor but never broadcast a live edit.
func (*PadMessageHandler) HandleSavedRevisionMessage ¶ added in v0.0.4
func (p *PadMessageHandler) HandleSavedRevisionMessage(foundPad *pad2.Pad, author string)
func (*PadMessageHandler) HandleSheetClientReady ¶ added in v0.6.5
func (p *PadMessageHandler) HandleSheetClientReady(ready ws.ClientReady, client *Client, session *ws.Session)
HandleSheetClientReady materializes the pad as a sheet, then either sends the full SHEET_VARS snapshot (fresh connect) or the missed ops (reconnect), and announces presence to the other clients of the document.
func (*PadMessageHandler) HandleUserInfoUpdate ¶ added in v0.0.2
func (p *PadMessageHandler) HandleUserInfoUpdate(userInfo UserInfoUpdate, client *Client)
func (*PadMessageHandler) KickSessionsFromPad ¶ added in v0.0.2
func (p *PadMessageHandler) KickSessionsFromPad(padID string)
func (*PadMessageHandler) ReadOnlyManagerForTest ¶ added in v0.7.0
func (p *PadMessageHandler) ReadOnlyManagerForTest() *pad.ReadOnlyManager
ReadOnlyManagerForTest exposes the handler's read-only manager to tests.
func (*PadMessageHandler) SendChatMessageToPadClients ¶ added in v0.0.2
func (p *PadMessageHandler) SendChatMessageToPadClients(session *ws.Session, chatMessage ws.ChatMessageData)
func (*PadMessageHandler) SendCustomMessageToPad ¶ added in v0.6.3
func (p *PadMessageHandler) SendCustomMessageToPad(padId string, msgType string)
SendCustomMessageToPad broadcasts a custom COLLABROOM message type to all clients of a pad, mirroring the original handleCustomMessage (backing the sendClientsMessage HTTP API).
func (*PadMessageHandler) SetCluster ¶ added in v0.7.0
func (p *PadMessageHandler) SetCluster(bus cluster.Bus)
SetCluster connects the handler to the other instances on the database.
func (*PadMessageHandler) SetRetention ¶ added in v0.6.8
func (p *PadMessageHandler) SetRetention(retention *pad.Retention)
func (*PadMessageHandler) SheetManager ¶ added in v0.6.5
func (p *PadMessageHandler) SheetManager() *sheetdoc.Manager
SheetManager exposes the shared sheet document manager so HTTP handlers (xlsx import/export) operate on the same live state as the websocket clients.
func (*PadMessageHandler) StopCluster ¶ added in v0.7.0
func (p *PadMessageHandler) StopCluster()
StopCluster ends the periodic catch-up.
func (*PadMessageHandler) UpdatePadClients ¶ added in v0.0.2
func (p *PadMessageHandler) UpdatePadClients(pad *pad2.Pad)
UpdatePadClients sends every client of the pad the revisions it hasn't seen yet (NEW_CHANGES).
type PadUserInfo ¶ added in v0.0.5
PadUserInfo represents a user in a pad
type RoleView ¶ added in v0.7.0
type RoleView struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Builtin bool `json:"builtin"`
Scopes []string `json:"scopes"`
Includes []string `json:"includes"`
Limits map[string]int64 `json:"limits"`
// Modified: a built-in role that differs from how it was shipped.
Modified bool `json:"modified"`
// Fixed: cannot be changed at all (the admin role).
Fixed bool `json:"fixed"`
}
type SavedRevision ¶ added in v0.0.4
type SavedRevision struct {
Event string `json:"event"`
Data SavedRevisionData `json:"data"`
}
type SavedRevisionData ¶ added in v0.0.4
type SavedRevisionData struct {
Type string `json:"type"`
Component string `json:"component"`
Data SavedRevisionDataData `json:"data"`
}
type SavedRevisionDataData ¶ added in v0.0.4
type SavedRevisionDataData struct {
Type string `json:"type"`
}
type SessionInfo ¶
type SessionInfo struct {
// contains filtered or unexported fields
}
type SessionStat ¶ added in v0.0.5
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
func NewSessionStore ¶
func NewSessionStore() SessionStore
NewSessionStore erstellt einen neuen Session-Store
func (*SessionStore) AddHandleClientInformationForTest ¶ added in v0.0.2
func (s *SessionStore) AddHandleClientInformationForTest(sessionId string, padId string, token string) *ws.Session
AddHandleClientInformationForTest adds client information for testing
func (*SessionStore) AddPadReadOnlyIdsForTest ¶ added in v0.0.2
func (s *SessionStore) AddPadReadOnlyIdsForTest(sessionId, padId string, readOnlyPadId string, readOnly bool)
AddPadReadOnlyIdsForTest adds pad read-only IDs for testing
func (*SessionStore) Count ¶ added in v0.7.0
func (s *SessionStore) Count() int
Count is the number of sessions (connected users) of this instance.
func (*SessionStore) GetPadSessions ¶ added in v0.0.5
func (s *SessionStore) GetPadSessions(padId string) []PadUserInfo
GetPadSessions returns all sessions for a given pad (only author IDs)
func (*SessionStore) GetPadSessionsCount ¶ added in v0.0.5
func (s *SessionStore) GetPadSessionsCount(padId string) int
GetPadSessionsCount returns the count of users in a given pad
func (*SessionStore) GetSessionForTest ¶ added in v0.0.2
func (s *SessionStore) GetSessionForTest(sessionId string) *ws.Session
GetSessionForTest returns a session for testing
func (*SessionStore) GetStats ¶ added in v0.0.5
func (s *SessionStore) GetStats() (SessionStat, error)
func (*SessionStore) InitSessionForTest ¶ added in v0.0.2
func (s *SessionStore) InitSessionForTest(sessionId string)
InitSessionForTest initializes a session for testing
func (*SessionStore) IntegratorSessionIDForTest ¶ added in v0.7.0
func (s *SessionStore) IntegratorSessionIDForTest(sessionId string) string
IntegratorSessionIDForTest returns the integrator session id CLIENT_READY stored for a session.
func (*SessionStore) PadUserCounts ¶ added in v0.7.0
func (s *SessionStore) PadUserCounts() map[string]int
PadUserCounts is the number of sessions per pad.
func (*SessionStore) RemoveSessionForTest ¶ added in v0.0.2
func (s *SessionStore) RemoveSessionForTest(sessionId string)
RemoveSessionForTest removes a session for testing
func (*SessionStore) SetAuthorForTest ¶ added in v0.0.2
func (s *SessionStore) SetAuthorForTest(sessionId string, authorId string)
SetAuthorForTest sets the author for a session for testing
func (*SessionStore) SetPadIdForTest ¶ added in v0.0.2
func (s *SessionStore) SetPadIdForTest(sessionId string, padId string)
SetPadIdForTest sets the pad ID for a session for testing
func (*SessionStore) SetReadOnlyForTest ¶ added in v0.0.2
func (s *SessionStore) SetReadOnlyForTest(sessionId string, readOnly bool)
SetReadOnlyForTest sets the read-only flag for a session for testing
func (*SessionStore) SetRevisionForTest ¶ added in v0.0.2
func (s *SessionStore) SetRevisionForTest(sessionId string, revision int)
SetRevisionForTest sets the revision for a session for testing
type SheetChannelOperator ¶ added in v0.6.5
type SheetChannelOperator struct {
// contains filtered or unexported fields
}
SheetChannelOperator serializes SHEET_OPs per sheet document. Like ChannelOperator it runs each op on the sender's read loop under the document's write lock instead of keeping a goroutine per document alive forever; apply and broadcast stay in one total order per document.
func NewSheetChannelOperator ¶ added in v0.6.5
func NewSheetChannelOperator(p *PadMessageHandler) SheetChannelOperator
func (*SheetChannelOperator) AddToQueue ¶ added in v0.6.5
func (c *SheetChannelOperator) AddToQueue(ch string, t SheetTask)
type SheetTask ¶ added in v0.6.5
type SheetTask struct {
// contains filtered or unexported fields
}
SheetTask is one queued SHEET_OP awaiting serialized processing per document.
type TokenAccount ¶ added in v0.7.0
type TokenAccount struct {
ID string `json:"id"`
Username string `json:"username"`
Kind string `json:"kind"`
Disabled bool `json:"disabled"`
Scopes []string `json:"scopes"`
}
TokenAccount is an account tokens can be issued for, with the scopes it has somewhere (what the form offers and preselects).
type TokenCreated ¶ added in v0.7.0
type TokenPolicyView ¶ added in v0.7.0
type TokenView ¶ added in v0.7.0
type TokenView struct {
ID string `json:"id"`
AccountID string `json:"accountId"`
Name string `json:"name"`
Prefix string `json:"prefix"`
Scopes []string `json:"scopes"`
Pads string `json:"pads"`
ExpiresAt *int64 `json:"expiresAt"`
RevokedAt *int64 `json:"revokedAt"`
ReplacedBy string `json:"replacedBy,omitempty"`
Predecessor string `json:"predecessor,omitempty"`
CreatedBy string `json:"createdBy"`
CreatedAt int64 `json:"createdAt"`
LastUsedAt *int64 `json:"lastUsedAt"`
LastUsedIP string `json:"lastUsedIp,omitempty"`
Limits map[string]int64 `json:"limits"`
// Status: active, grace (replaced, still working until it expires),
// expired or revoked.
Status string `json:"status"`
}
TokenView is a token as the admin page lists it: never its key or hash.
type TokensResult ¶ added in v0.7.0
type TokensResult struct {
Tokens []TokenView `json:"tokens"`
Accounts []TokenAccount `json:"accounts"`
Scopes []ScopeView `json:"scopes"`
Personal TokenPolicyView `json:"personal"`
Service TokenPolicyView `json:"service"`
// Names maps account ids (owners, issuers) to usernames.
Names map[string]string `json:"names"`
Created *TokenCreated `json:"created,omitempty"`
Error string `json:"error,omitempty"`
}
TokensResult answers every token event with the whole list; for a new key (issue, rotate) the key itself, which is not shown again.
type UserDupMessage ¶
type UserDupMessage struct {
Disconnect string `json:"disconnect"`
}
type UserInfoUpdate ¶
type UserInfoUpdateWrapper ¶
type UserInfoUpdateWrapper struct {
Event string `json:"event"`
Data UserInfoUpdate `json:"data"`
}
type WebSocketConn ¶ added in v0.0.2
type WebSocketConn interface {
ReadMessage() (messageType int, p []byte, err error)
WriteMessage(messageType int, data []byte) error
Close() error
SetWriteDeadline(t time.Time) error
SetReadDeadline(t time.Time) error
SetPongHandler(h func(appData string) error)
WriteControl(messageType int, data []byte, deadline time.Time) error
RemoteAddr() net.Addr
SetReadLimit(size int64)
NextWriter(messageType int) (io.WriteCloser, error)
}
func NewMockWebSocketConn ¶ added in v0.0.2
func NewMockWebSocketConn() WebSocketConn
func NewWebSocketWrapper ¶ added in v0.0.2
func NewWebSocketWrapper(conn *websocket.Conn) WebSocketConn
type WebSocketConnData ¶ added in v0.0.2
type WebSocketConnData struct {
Data []byte
// contains filtered or unexported fields
}