Scanyonero/server-websocket-packets.go
David Vogel 853a1bb58d Rework into FTP scanning server
- Rename to Scanyonero
- Add FTP server that ingests TIFF, PNG, JPEG or PDF files
- Add web interface to check and modify ingested files
- Rework how ocrmypdf is invoked

Basics are working, but the program is not in a usable state.
2025-05-14 12:08:38 +02:00

71 lines
2.9 KiB
Go

package main
// ServerWebsocketPacketQueueDeleteAt represents a delete operation on a document queue list.
// The range of the deleted indices is [IndexA; IndexB).
type ServerWebsocketPacketQueueDeleteAt struct {
IndexA int `json:"indexA"` // Starting index of the deletion range.
IndexB int `json:"indexB"` // End index of the deletion range. This index is not included in the range.
}
func (s *ServerWebsocketPacketQueueDeleteAt) Type() string { return "QueueDeleteAt" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueDeleteAt{}) }
// ServerWebsocketPacketQueueDelete represents a delete operation on a document queue list.
type ServerWebsocketPacketQueueDelete struct {
IDs []QueueEntryID `json:"ids"` // IDs of the documents.
}
func (s *ServerWebsocketPacketQueueDelete) Type() string { return "QueueDelete" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueDelete{}) }
// ServerWebsocketPacketQueueInsertAt represents an insert operation on a document queue list.
type ServerWebsocketPacketQueueInsertAt struct {
Index int `json:"index"`
Documents []QueueEntry `json:"documents"`
}
func (s *ServerWebsocketPacketQueueInsertAt) Type() string { return "QueueInsertAt" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueInsertAt{}) }
// ServerWebsocketPacketQueueReplace represents a replace operation on a document queue list.
type ServerWebsocketPacketQueueReplace struct {
Documents []QueueEntry `json:"documents"`
}
func (s *ServerWebsocketPacketQueueReplace) Type() string { return "QueueReplace" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueReplace{}) }
// ServerWebsocketPacketQueueShiftAt represents a shift operation on a document queue list.
type ServerWebsocketPacketQueueShiftAt struct {
Index int `json:"index"` // Index of the to be shifted element.
Offset int `json:"offset"` // Shift offset.
}
func (s *ServerWebsocketPacketQueueShiftAt) Type() string { return "QueueShiftAt" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueShiftAt{}) }
// ServerWebsocketPacketQueueShift represents a shift operation on a document queue list.
type ServerWebsocketPacketQueueShift struct {
IDs []QueueEntryID `json:"ids"` // IDs of the documents.
Offset int `json:"offset"` // Shift offset.
}
func (s *ServerWebsocketPacketQueueShift) Type() string { return "QueueShift" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueShift{}) }
// ServerWebsocketPacketQueueUpdate represents an update operation of documents in a queue list.
// The receiver should update any of the received documents in their local queue list.
type ServerWebsocketPacketQueueUpdate struct {
Documents []QueueEntry `json:"documents"`
}
func (s *ServerWebsocketPacketQueueUpdate) Type() string { return "QueueUpdate" }
func init() { ServerWebsocketPacketRegister(&ServerWebsocketPacketQueueUpdate{}) }