-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-1116] feat: pages realtime collaboration #5493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
f001bfa
[WEB-1116] feat: pages realtime sync (#5057)
aaryan610 5c668d4
fix: docker related fixes
sriramveeraghanta eb93202
fix: module type fixes
sriramveeraghanta 0ed9620
fix: nginx update
sriramveeraghanta a4c03a0
fix: adding live server workflow
sriramveeraghanta 87e94fc
fix: workflow fixes
sriramveeraghanta f831153
fix: docker compose fixes
sriramveeraghanta 3f289ce
fix: workflow fixes
sriramveeraghanta 394894b
fix: merge conflicts
sriramveeraghanta ada5e5d
fix: path config
sriramveeraghanta 988cf4d
fix: docker compose warnings
sriramveeraghanta c220472
fix: nginx port forwarding
sriramveeraghanta fcaeab1
fix: update docker compose with new env
sriramveeraghanta 5db5cf9
fix: env var fixes
sriramveeraghanta 7cd2be0
fix: error handling
sriramveeraghanta b573f81
fix: docker compose env var
sriramveeraghanta a19c168
fix: compose fixes
sriramveeraghanta 4712179
chore: update server start message
aaryan610 754006e
chore: handle errors
aaryan610 65f06f8
fix: build errors
aaryan610 6868ac4
chore: update port
aaryan610 e654a27
chore: update server port
aaryan610 bf7bcc9
chore: show error on authentication fail
aaryan610 fcfac69
chore: show error on authentication fail
aaryan610 bc7e217
feat: add redis extension
Palanikannan1437 4de8c2c
fix: merge conflicts resolved from preview
aaryan610 8231ca5
fix: merge conflicts resolved from preview
aaryan610 7e39663
Merge branch 'preview' of https://github.com/makeplane/plane into pag…
aaryan610 df579ae
chore: updated restore version logic
aaryan610 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| API_BASE_URL="http://api:8000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM node:18-alpine | ||
| RUN apk add --no-cache libc6-compat | ||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
|
|
||
| COPY . . | ||
| RUN yarn global add turbo | ||
| RUN yarn install | ||
| EXPOSE 3003 | ||
|
|
||
| VOLUME [ "/app/node_modules", "/app/live/node_modules"] | ||
| CMD ["yarn","dev", "--filter=live"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| FROM node:18-alpine AS base | ||
| # The web Dockerfile is copy-pasted into our main docs at /docs/handbook/deploying-with-docker. | ||
| # Make sure you update this Dockerfile, the Dockerfile in the web workspace and copy that over to Dockerfile in the docs. | ||
|
|
||
| FROM base AS builder | ||
| # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
| RUN apk update | ||
| RUN apk add --no-cache libc6-compat | ||
| # Set working directory | ||
| WORKDIR /app | ||
| RUN yarn global add turbo | ||
| COPY . . | ||
| RUN turbo prune live --docker | ||
|
|
||
| # Add lockfile and package.json's of isolated subworkspace | ||
| FROM base AS installer | ||
| RUN apk update | ||
| RUN apk add --no-cache libc6-compat | ||
| WORKDIR /app | ||
|
|
||
| # First install dependencies (as they change less often) | ||
| COPY .gitignore .gitignore | ||
| COPY --from=builder /app/out/json/ . | ||
| COPY --from=builder /app/out/yarn.lock ./yarn.lock | ||
| RUN yarn install | ||
|
|
||
| # Build the project and its dependencies | ||
| COPY --from=builder /app/out/full/ . | ||
| COPY turbo.json turbo.json | ||
|
|
||
| RUN yarn turbo build --filter=live | ||
|
|
||
| FROM base AS runner | ||
| WORKDIR /app | ||
|
|
||
| # Don't run production as root | ||
| RUN addgroup --system --gid 1001 expressjs | ||
| RUN adduser --system --uid 1001 expressjs | ||
| USER expressjs | ||
|
|
||
| COPY --from=installer /app . | ||
| # COPY --from=installer /app/live/node_modules ./node_modules | ||
|
|
||
| EXPOSE 3000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "name": "live", | ||
| "version": "0.22.0", | ||
| "description": "", | ||
| "main": "./src/server.ts", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "start": "node dist/server.js", | ||
| "dev": "PORT=3003 nodemon --exec \"node -r esbuild-register ./src/server.ts\" -e .ts" | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@hocuspocus/extension-database": "^2.11.3", | ||
| "@hocuspocus/extension-logger": "^2.11.3", | ||
| "@hocuspocus/extension-redis": "^2.13.5", | ||
| "@hocuspocus/server": "^2.11.3", | ||
| "@plane/editor": "*", | ||
| "@plane/types": "*", | ||
| "@tiptap/core": "^2.4.0", | ||
| "@tiptap/html": "^2.3.0", | ||
| "axios": "^1.7.2", | ||
| "dotenv": "^16.4.5", | ||
| "express": "^4.19.2", | ||
| "express-ws": "^5.0.2", | ||
| "lodash": "^4.17.21", | ||
| "y-prosemirror": "^1.2.9", | ||
| "y-protocols": "^1.0.6", | ||
| "yjs": "^13.6.14" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/dotenv": "^8.2.0", | ||
| "@types/express": "^4.17.21", | ||
| "@types/express-ws": "^3.0.4", | ||
| "@types/node": "^20.14.9", | ||
| "tsup": "^7.2.0", | ||
| "nodemon": "^3.1.0", | ||
| "ts-node": "^10.9.2", | ||
| "typescript": "^5.4.5" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // eslint-disable-next-line @typescript-eslint/ban-types | ||
| export type TAdditionalDocumentTypes = {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { ConnectionConfiguration } from "@hocuspocus/server"; | ||
| // services | ||
| import { UserService } from "../services/user.service.js"; | ||
| // types | ||
| import { TDocumentTypes } from "../types/common.js"; | ||
|
|
||
| const userService = new UserService(); | ||
|
|
||
| type Props = { | ||
| connection: ConnectionConfiguration; | ||
| cookie: string; | ||
| params: URLSearchParams; | ||
| token: string; | ||
| }; | ||
|
|
||
| export const handleAuthentication = async (props: Props) => { | ||
| const { connection, cookie, params, token } = props; | ||
| // params | ||
| const workspaceSlug = params.get("workspaceSlug")?.toString(); | ||
| const projectId = params.get("projectId")?.toString(); | ||
| const documentType = params.get("documentType")?.toString() as | ||
| | TDocumentTypes | ||
| | undefined; | ||
| // fetch current user info | ||
| let response; | ||
| try { | ||
| response = await userService.currentUser(cookie); | ||
| } catch (error) { | ||
| console.error("Failed to fetch current user:", error); | ||
| throw error; | ||
| } | ||
| if (response.id !== token) { | ||
| throw Error("Authentication failed: Token doesn't match the current user."); | ||
| } | ||
|
|
||
| if (documentType === "project_page") { | ||
| if (!workspaceSlug || !projectId) { | ||
| throw Error( | ||
| "Authentication failed: Incomplete query params. Either workspaceSlug or projectId is missing." | ||
| ); | ||
| } | ||
| // fetch current user's roles | ||
| const workspaceRoles = await userService.getUserAllProjectsRole( | ||
| workspaceSlug, | ||
| cookie | ||
| ); | ||
| const currentProjectRole = workspaceRoles[projectId]; | ||
| // make the connection read only for roles lower than a member | ||
| if (currentProjectRole < 15) { | ||
| connection.readOnly = true; | ||
| } | ||
| } else { | ||
| throw Error("Authentication failed: Invalid document type provided."); | ||
| } | ||
|
|
||
| return { | ||
| user: { | ||
| id: response.id, | ||
| name: response.display_name, | ||
| }, | ||
| }; | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define
TAdditionalDocumentTypeswith explicit properties instead of using{}.The empty object type
{}means "any non-nullable value" in TypeScript, which defeats the purpose of type checking and can lead to errors.Define the type with explicit properties and their types based on the expected additional document types. For example:
If there are no additional document types expected at the moment, consider removing the type declaration altogether until it is needed.
Let me know if you need help defining the properties and their types for
TAdditionalDocumentTypes. I can assist you in updating the type definition based on the expected additional document types in your application.Tools
Biome