Ghost/ghost/core
Kevin Ansfield b286faf011
Initial setup for Lexical multiplayer websockets service (#16611)
no issue

Rough prototype only, current limitations:
- **No persistence**. Docs are in-memory only, YJS state will be lost on server restart although it could be re-populated by clients if they reconnect without closing their local doc (needs testing/investigation)
- **No tie-in with saved lexical state**. Lexical state is updated in the post model via normal API requests from Admin which can mean the multiplayer doc and the saved lexical state become out of sync but there's no detection/indication of that state at present. Will also trigger the "someone else is editing" errors because multiplayer doesn't yet override the default post update collision detection
- **New posts don't start in multiplayer**. New posts don't have an ID and so can't have a respective YJS doc, after initial save we don't transition to multiplayer because the React component in Ember doesn't re-render on prop changes yet
- **No tests**. Experimental code just to get something working and help answer questions for what's next

Changes:
- added `lexicalMultiplayer` labs flag
- updated `<KoenigLexicalEditor>` to pass through the required `<KoenigComposer>` props for multiplayer when enabled
- added `lexical-multiplayer` service
  - `init()` called during boot, used to set up the `enable()` and `disable()` methods so the flag can be toggled without restarts
  - when enabled it adds `upgrade` request handling to the base Ghost server
    - returns 404 if the URL doesn't match `/ghost/api/admin/posts/multiplayer/*`
    - returns 401 if a valid session cookie is not present
    - if everything is good, hands off to code in `y-websocket.js` that handles YJS doc creation, awareness, keepalive, etc
    - uses doc names in the format `${post.id}/${docId}` where `docId` is `main` for the primary document and a GUID for any sub-documents like captions and nested editors in cards
- updated `SettingsBREADService` to check if the `labs` setting is changed, and enables/disables the `lexical-multiplayer` service as needed so the websockets server can be started and shutdown when toggling without requiring a restart
2023-04-12 20:24:02 +01:00
..
content 🎨 Updated Casper to v5.4.9 2023-04-12 11:38:08 +01:00
core Initial setup for Lexical multiplayer websockets service (#16611) 2023-04-12 20:24:02 +01:00
test Fixed flaky test: posts API export can export with order (#16605) 2023-04-10 18:40:03 -07:00
.c8rc.e2e.json Reduced coverage to accommodate Node 18 discrepancies 2023-03-22 09:59:55 +01:00
.c8rc.json Removed service.js files from unit test coverage 2023-03-13 17:26:03 +07:00
.eslintignore Updated .eslintignore list for core 2022-10-10 15:12:52 +07:00
.eslintrc.js Updated Eslint ECMAScript compatibility to 2022 2022-08-09 15:51:40 +02:00
.npmignore Updated .npmignore with new files 2022-11-30 12:40:47 +07:00
config.development.json Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
ghost.js Added browser-based testing framework 2022-11-22 14:12:34 +00:00
index.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
jsconfig.json Deleted reference to core/admin 2022-08-03 16:28:41 +02:00
loggingrc.js Added version information to log lines 2023-01-20 13:18:44 +01:00
MigratorConfig.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
package.json Initial setup for Lexical multiplayer websockets service (#16611) 2023-04-12 20:24:02 +01:00
playwright.config.js Separated admin and portal tests to different projects 2023-03-16 18:35:09 +04:00