-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[WEB-1116] feat: pages realtime sync #5057
Merged
Merged
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
f5afa92
init: live server for editor realtime sync
aaryan610 09e0331
chore: authentication added
aaryan610 cfa6f4e
fix: merge conflicts resolved from preview
aaryan610 03ca244
chore: updated logic to convert html to binary for old pages
aaryan610 d94c5b0
chore: added description json on page update
NarayanBavisetti 0936708
chore: made all functions generic
aaryan610 1745aa9
Merge branch 'feat-realtime-sync' of https://github.com/makeplane/pla…
aaryan610 607ec56
chore: save description in json and html formats
aaryan610 746109c
refactor: document editor components
aaryan610 c174501
chore: uncomment ui package components
aaryan610 3d82ae7
fix: without props extensions refactor
aaryan610 ac986b3
fix: merge conflicts resolved from preview
aaryan610 093b9b3
fix: merge conflicts resolved from preview
aaryan610 ba244aa
chore: init docker compose
aaryan610 8a84518
fix: merge conflicts resolved from preview
aaryan610 23a05d5
Merge branch 'develop' of github.com:makeplane/plane into feat-realti…
sriramveeraghanta 8044d42
Merge branch 'preview' of github.com:makeplane/plane into feat-realti…
NarayanBavisetti 73f3b69
chore: pages custom error codes
NarayanBavisetti d80ab7e
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
aaryan610 0d9b346
fix: merge conflicts resolved from preview
aaryan610 616e885
chore: add health check endpoint to the live server
aaryan610 e7a1265
chore: update without props extensions type
aaryan610 b354547
fix: merge conflicts resolved from preview
aaryan610 f38fd54
chore: better error handling
aaryan610 67fd504
Merge branch 'develop' of https://github.com/makeplane/plane into fea…
aaryan610 fda0344
chore: update react-hook-form versions
aaryan610 4e043a1
fix: build errors
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 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 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 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 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,10 @@ | ||
ERROR_CODES = { | ||
# issues | ||
"INVALID_ARCHIVE_STATE_GROUP": 4091, | ||
"INVALID_ISSUE_DATES": 4100, | ||
"INVALID_ISSUE_START_DATE": 4101, | ||
"INVALID_ISSUE_TARGET_DATE": 4102, | ||
# pages | ||
"PAGE_LOCKED": 4701, | ||
"PAGE_ARCHIVED": 4702, | ||
} |
This file contains 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 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 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,28 @@ | ||
# Use a Node.js base image | ||
FROM node:latest | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY ./channel/package*.json ./ | ||
|
||
# Install dependencies | ||
RUN yarn install | ||
|
||
# COPY ./plane/editor-core ./node_modules/@plane/editor-core | ||
|
||
# Install TypeScript | ||
RUN yarn add typescript | ||
|
||
# Copy the rest of the application | ||
COPY ./channel . | ||
|
||
# Compile TypeScript to JavaScript | ||
RUN npx tsc | ||
|
||
# Expose port 3003 | ||
EXPOSE 3003 | ||
|
||
# Start the Node.js server | ||
CMD ["node", "dist/index.js"] |
This file contains 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/channel/node_modules"] | ||
CMD ["yarn","dev", "--filter=live"] |
This file contains 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,42 @@ | ||
{ | ||
"name": "live", | ||
"version": "0.22.0", | ||
"description": "", | ||
"main": "./src/index.ts", | ||
"scripts": { | ||
"build": "tsup", | ||
"start": "node dist/index.js", | ||
"dev": "tsup --watch" | ||
}, | ||
"keywords": [], | ||
"type": "module", | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@hocuspocus/extension-database": "^2.11.3", | ||
"@hocuspocus/extension-logger": "^2.11.3", | ||
"@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 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,55 @@ | ||
import { ConnectionConfiguration } from "@hocuspocus/server"; | ||
// services | ||
import { UserService } from "./services/user.service.js"; | ||
aaryan610 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// 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 | ||
const response = await userService.currentUser(cookie); | ||
if (response.id !== token) { | ||
throw Error("Token doesn't match"); | ||
aaryan610 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
if (documentType === "project_page") { | ||
if (!workspaceSlug || !projectId) { | ||
throw Error( | ||
"Incomplete query params, workspaceSlug or projectId 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("Invalid document type provided"); | ||
} | ||
aaryan610 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return { | ||
user: { | ||
id: response.id, | ||
name: response.display_name, | ||
}, | ||
}; | ||
}; |
Oops, something went wrong.
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.
Specify a Node.js version instead of using
latest
.Using
node:latest
can introduce instability due to potential breaking changes in future releases. It's better to use a specific version.Committable suggestion