From 0d2f9aa55b704efb867ea9c3b05f5579839be619 Mon Sep 17 00:00:00 2001 From: swve Date: Tue, 26 Nov 2024 00:45:57 +0100 Subject: [PATCH 1/3] feat: remove collaborative features --- apps/collaboration/.dockerignore | 1 - apps/collaboration/Dockerfile | 34 --- apps/collaboration/app.ts | 9 - apps/collaboration/package.json | 20 -- apps/collaboration/pnpm-lock.yaml | 208 ------------------ .../Objects/Editor/ActiveAvatars.tsx | 67 ------ apps/web/components/Objects/Editor/Editor.tsx | 44 +--- .../Objects/Editor/EditorWrapper.tsx | 149 +------------ .../Objects/Editor/MouseMovements.tsx | 80 ------- apps/web/package.json | 8 - apps/web/services/config/config.ts | 2 - docker-compose.yml | 4 - 12 files changed, 10 insertions(+), 616 deletions(-) delete mode 100644 apps/collaboration/.dockerignore delete mode 100644 apps/collaboration/Dockerfile delete mode 100644 apps/collaboration/app.ts delete mode 100644 apps/collaboration/package.json delete mode 100644 apps/collaboration/pnpm-lock.yaml delete mode 100644 apps/web/components/Objects/Editor/ActiveAvatars.tsx delete mode 100644 apps/web/components/Objects/Editor/MouseMovements.tsx diff --git a/apps/collaboration/.dockerignore b/apps/collaboration/.dockerignore deleted file mode 100644 index b512c09d..00000000 --- a/apps/collaboration/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -node_modules \ No newline at end of file diff --git a/apps/collaboration/Dockerfile b/apps/collaboration/Dockerfile deleted file mode 100644 index f6e6e64c..00000000 --- a/apps/collaboration/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# use the official Bun image -# see all versions at https://hub.docker.com/r/oven/bun/tags -FROM oven/bun:1 as base -WORKDIR /usr/src/app - -# install dependencies into temp directory -# this will cache them and speed up future builds -FROM base AS install -RUN mkdir -p /temp/dev -COPY package.json /temp/dev/ -RUN cd /temp/dev && bun install - -# install with --production (exclude devDependencies) -RUN mkdir -p /temp/prod -COPY package.json pnpm-lock.yaml /temp/prod/ -RUN cd /temp/prod && bun install --production - -# copy node_modules from temp directory -# then copy all (non-ignored) project files into the image -FROM base AS prerelease -COPY --from=install /temp/dev/node_modules node_modules -COPY . . - - -# copy production dependencies and source code into final image -FROM base AS release -COPY --from=install /temp/prod/node_modules node_modules -COPY --from=prerelease /usr/src/app/app.ts . -COPY --from=prerelease /usr/src/app/package.json . - -# run the app -USER bun -EXPOSE 1998/tcp -ENTRYPOINT [ "bun", "run", "app.ts" ] \ No newline at end of file diff --git a/apps/collaboration/app.ts b/apps/collaboration/app.ts deleted file mode 100644 index d5c8c110..00000000 --- a/apps/collaboration/app.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Hocuspocus } from "@hocuspocus/server"; - -// Configure the server … -const server = new Hocuspocus({ - port: 1998, -}); - -// … and run it! -server.listen(); diff --git a/apps/collaboration/package.json b/apps/collaboration/package.json deleted file mode 100644 index 9c3f3153..00000000 --- a/apps/collaboration/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "collaboration", - "version": "1.0.0", - "description": "", - "main": "app.ts", - "scripts": { - "dev": "bun app.ts", - "start": "bun app.ts" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "@hocuspocus/server": "^2.13.7", - "bun": "^1.1.32", - "typescript": "5.4.4", - "y-protocols": "^1.0.6", - "yjs": "^13.6.20" - } -} diff --git a/apps/collaboration/pnpm-lock.yaml b/apps/collaboration/pnpm-lock.yaml deleted file mode 100644 index 0f624e22..00000000 --- a/apps/collaboration/pnpm-lock.yaml +++ /dev/null @@ -1,208 +0,0 @@ -lockfileVersion: '9.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -importers: - - .: - dependencies: - '@hocuspocus/server': - specifier: ^2.13.7 - version: 2.13.7(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20) - bun: - specifier: ^1.1.32 - version: 1.1.32 - typescript: - specifier: 5.4.4 - version: 5.4.4 - y-protocols: - specifier: ^1.0.6 - version: 1.0.6(yjs@13.6.20) - yjs: - specifier: ^13.6.20 - version: 13.6.20 - -packages: - - '@hocuspocus/common@2.13.7': - resolution: {integrity: sha512-ROqYfW15XlAGd+qb/FVyp0zUC9Rosv7kdcck9LRMdfW3jT66wK9pDDWL2ily4Qj/zhbLCFtjAUPB4UKln/GYNQ==} - - '@hocuspocus/server@2.13.7': - resolution: {integrity: sha512-D9juGX9NZoKT9/Ty/HGhaimHJe71DyKbYssC831oetYF33x3WSYV6GY82RhHo9xjKZE6r0Le7jgxgQb+u08slw==} - peerDependencies: - y-protocols: ^1.0.6 - yjs: ^13.6.8 - - '@oven/bun-darwin-aarch64@1.1.32': - resolution: {integrity: sha512-/5lu8RJB/iEoC9pzFOCZLCEmNsEI3DEEyxfItZpih/piNOFhCYmoMvm7mM0YXqSc7pfxYaKukEZEHGeIOiu/3Q==} - cpu: [arm64] - os: [darwin] - - '@oven/bun-darwin-x64-baseline@1.1.32': - resolution: {integrity: sha512-XRP+APoLxrXznL7BEHipAdDu0Mn1RwD9PsaqFu1Be5Dbyi+2bYICuTiN1W9vfZNN3kK8eTyniT7kjwLSTcHbEg==} - cpu: [x64] - os: [darwin] - - '@oven/bun-darwin-x64@1.1.32': - resolution: {integrity: sha512-Slk4QFHcqZ94mnNlzsCG/9m+gET0mpi13bfizRGv8QNRku8mQTs9brN5XvovYrP5t0rfaZDFMOoaOs6wk6rcDg==} - cpu: [x64] - os: [darwin] - - '@oven/bun-linux-aarch64@1.1.32': - resolution: {integrity: sha512-7QdyRCiLHb1MuwDH7iir5xD6gTKWlvMGxvcQhbY/U1djqG/gft4+PaJrSJQcVhqRb143mrMNXIhTgc84O6htMw==} - cpu: [arm64] - os: [linux] - - '@oven/bun-linux-x64-baseline@1.1.32': - resolution: {integrity: sha512-zvXOAUTc6cOlUR26NEwh3isV+z2EW4QxFiWoxgvM7eIuZMnZjV22+H+dEzVKJzV58XgfPX//fEPi3Xjg4xXdMA==} - cpu: [x64] - os: [linux] - - '@oven/bun-linux-x64@1.1.32': - resolution: {integrity: sha512-JgsQ1ZXKmovQNzf4YdA3WDZVrtEbMlbL43Yjcczovy6lDrhSZkTu1GjzMm5JQnuqNwBC4/eSIgVL27J1Pj6nlA==} - cpu: [x64] - os: [linux] - - '@oven/bun-windows-x64-baseline@1.1.32': - resolution: {integrity: sha512-0DgP99AcBfKz3OCS5qO2/8e5TgNhBq8ZiNbPJzQaF4QOpS/Rt+mvFcQUa8x5gTOUPHH9ciaMz0IEs2Qv42eoAw==} - cpu: [x64] - os: [win32] - - '@oven/bun-windows-x64@1.1.32': - resolution: {integrity: sha512-grzRSH/9YIKWUHumygtG9Aen04wJv+v6lbmTvqsfcc/1/BJJFCLf+69EN3PINAIisih1hycxGa9eleVxjL0fqg==} - cpu: [x64] - os: [win32] - - async-lock@1.4.1: - resolution: {integrity: sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ==} - - bun@1.1.32: - resolution: {integrity: sha512-W+UO0ihRmDHscmTfQAoPPaFLqLaloyBdAIr2iX70v3Vgo+7ZiKeyj7Aa4YDWStxQQmlzD5JP3NG/5TSWAK+1WQ==} - cpu: [arm64, x64] - os: [darwin, linux, win32] - hasBin: true - - isomorphic.js@0.2.5: - resolution: {integrity: sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==} - - kleur@4.1.5: - resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==} - engines: {node: '>=6'} - - lib0@0.2.98: - resolution: {integrity: sha512-XteTiNO0qEXqqweWx+b21p/fBnNHUA1NwAtJNJek1oPrewEZs2uiT4gWivHKr9GqCjDPAhchz0UQO8NwU3bBNA==} - engines: {node: '>=16'} - hasBin: true - - typescript@5.4.4: - resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==} - engines: {node: '>=14.17'} - hasBin: true - - uuid@10.0.0: - resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==} - hasBin: true - - ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - - y-protocols@1.0.6: - resolution: {integrity: sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - peerDependencies: - yjs: ^13.0.0 - - yjs@13.6.20: - resolution: {integrity: sha512-Z2YZI+SYqK7XdWlloI3lhMiKnCdFCVC4PchpdO+mCYwtiTwncjUbnRK9R1JmkNfdmHyDXuWN3ibJAt0wsqTbLQ==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - -snapshots: - - '@hocuspocus/common@2.13.7': - dependencies: - lib0: 0.2.98 - - '@hocuspocus/server@2.13.7(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20)': - dependencies: - '@hocuspocus/common': 2.13.7 - async-lock: 1.4.1 - kleur: 4.1.5 - lib0: 0.2.98 - uuid: 10.0.0 - ws: 8.18.0 - y-protocols: 1.0.6(yjs@13.6.20) - yjs: 13.6.20 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - '@oven/bun-darwin-aarch64@1.1.32': - optional: true - - '@oven/bun-darwin-x64-baseline@1.1.32': - optional: true - - '@oven/bun-darwin-x64@1.1.32': - optional: true - - '@oven/bun-linux-aarch64@1.1.32': - optional: true - - '@oven/bun-linux-x64-baseline@1.1.32': - optional: true - - '@oven/bun-linux-x64@1.1.32': - optional: true - - '@oven/bun-windows-x64-baseline@1.1.32': - optional: true - - '@oven/bun-windows-x64@1.1.32': - optional: true - - async-lock@1.4.1: {} - - bun@1.1.32: - optionalDependencies: - '@oven/bun-darwin-aarch64': 1.1.32 - '@oven/bun-darwin-x64': 1.1.32 - '@oven/bun-darwin-x64-baseline': 1.1.32 - '@oven/bun-linux-aarch64': 1.1.32 - '@oven/bun-linux-x64': 1.1.32 - '@oven/bun-linux-x64-baseline': 1.1.32 - '@oven/bun-windows-x64': 1.1.32 - '@oven/bun-windows-x64-baseline': 1.1.32 - - isomorphic.js@0.2.5: {} - - kleur@4.1.5: {} - - lib0@0.2.98: - dependencies: - isomorphic.js: 0.2.5 - - typescript@5.4.4: {} - - uuid@10.0.0: {} - - ws@8.18.0: {} - - y-protocols@1.0.6(yjs@13.6.20): - dependencies: - lib0: 0.2.98 - yjs: 13.6.20 - - yjs@13.6.20: - dependencies: - lib0: 0.2.98 diff --git a/apps/web/components/Objects/Editor/ActiveAvatars.tsx b/apps/web/components/Objects/Editor/ActiveAvatars.tsx deleted file mode 100644 index 40d0d656..00000000 --- a/apps/web/components/Objects/Editor/ActiveAvatars.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import React, { useEffect, useState } from 'react' -import UserAvatar from '../UserAvatar' -import { useLHSession } from '@components/Contexts/LHSessionContext' -import { getUserAvatarMediaDirectory } from '@services/media/media'; -import { getCollaborationServerUrl } from '@services/config/config'; -import { useOrg } from '@components/Contexts/OrgContext'; - -type ActiveAvatarsProps = { - mouseMovements: any; - userRandomColor: string; -} - -function ActiveAvatars(props: ActiveAvatarsProps) { - const session = useLHSession() as any; - const org = useOrg() as any; - const [activeUsers, setActiveUsers] = useState({} as any); - - /* Collaboration Features */ - const collab = getCollaborationServerUrl() - const isCollabEnabledOnThisOrg = org?.config.config.features.collaboration.enabled && collab - - // Get users from the mouseMovements object - useEffect(() => { - const users: any = {}; - Object.keys(props.mouseMovements).forEach((key) => { - users[props.mouseMovements[key].user.user_uuid] = props.mouseMovements[key].user; - }); - - // Remove the current user from the list - delete users[session.data.user.user_uuid]; - - setActiveUsers(users); - } - , [props.mouseMovements, session.data.user, org]); - - - return ( -
- -
- {isCollabEnabledOnThisOrg && Object.keys(activeUsers).map((key) => ( -
- -
-
- ))} - {session.status && ( -
- -
- )} -
-
- ) -} - -export default ActiveAvatars \ No newline at end of file diff --git a/apps/web/components/Objects/Editor/Editor.tsx b/apps/web/components/Objects/Editor/Editor.tsx index 29d3fd8d..14948aff 100644 --- a/apps/web/components/Objects/Editor/Editor.tsx +++ b/apps/web/components/Objects/Editor/Editor.tsx @@ -21,7 +21,7 @@ import WarningCallout from './Extensions/Callout/Warning/WarningCallout' import ImageBlock from './Extensions/Image/ImageBlock' import Youtube from '@tiptap/extension-youtube' import VideoBlock from './Extensions/Video/VideoBlock' -import { ComputerIcon, Eye, Monitor } from 'lucide-react' +import { Eye, Monitor } from 'lucide-react' import MathEquationBlock from './Extensions/MathEquation/MathEquationBlock' import PDFBlock from './Extensions/PDF/PDFBlock' import QuizBlock from './Extensions/Quiz/QuizBlock' @@ -45,17 +45,14 @@ import html from 'highlight.js/lib/languages/xml' import python from 'highlight.js/lib/languages/python' import java from 'highlight.js/lib/languages/java' import { CourseProvider } from '@components/Contexts/CourseContext' -import { useLHSession } from '@components/Contexts/LHSessionContext' import AIEditorToolkit from './AI/AIEditorToolkit' import useGetAIFeatures from '@components/Hooks/useGetAIFeatures' -import Collaboration from '@tiptap/extension-collaboration' -import CollaborationCursor from '@tiptap/extension-collaboration-cursor' -import ActiveAvatars from './ActiveAvatars' import { getUriWithOrg } from '@services/config/config' import EmbedObjects from './Extensions/EmbedObjects/EmbedObjects' import Badges from './Extensions/Badges/Badges' import Buttons from './Extensions/Buttons/Buttons' import { useMediaQuery } from 'usehooks-ts' +import UserAvatar from '../UserAvatar' interface Editor { content: string @@ -63,16 +60,10 @@ interface Editor { course: any org: any session: any - ydoc: any - hocuspocusProvider: any, - isCollabEnabledOnThisOrg: boolean - userRandomColor: string - mouseMovements: any setContent: (content: string) => void } function Editor(props: Editor) { - const session = useLHSession() as any const dispatchAIEditor = useAIEditorDispatch() as any const aiEditorState = useAIEditor() as AIEditorStateTypes const is_ai_feature_enabled = useGetAIFeatures({ feature: 'editor' }) @@ -102,12 +93,8 @@ function Editor(props: Editor) { const editor: any = useEditor({ editable: true, - extensions: [ - StarterKit.configure({ - // The Collaboration extension comes with its own history handling - history: props.isCollabEnabledOnThisOrg ? false : undefined, - }), + StarterKit, InfoCallout.configure({ editable: true, }), @@ -159,28 +146,13 @@ function Editor(props: Editor) { TableRow, TableHeader, TableCell, - - // Add Collaboration and CollaborationCursor only if isCollabEnabledOnThisOrg is true - ...(props.isCollabEnabledOnThisOrg ? [ - Collaboration.configure({ - document: props.hocuspocusProvider?.document, - - }), - - CollaborationCursor.configure({ - provider: props.hocuspocusProvider, - user: { - name: props.session.data.user.first_name + ' ' + props.session.data.user.last_name, - color: props.userRandomColor, - }, - }), - ] : []), ], - - // If collab is enabled the onSynced callback ensures initial content is set only once using editor.setContent(), preventing repetitive content insertion on editor syncs. - content: props.isCollabEnabledOnThisOrg ? null : props.content, + content: props.content, + immediatelyRender: false, }) + console.log(props.content) + const isMobile = useMediaQuery('(max-width: 767px)') if (isMobile) { // TODO: Work on a better editor mobile experience @@ -310,7 +282,7 @@ function Editor(props: Editor) { /> - + diff --git a/apps/web/components/Objects/Editor/EditorWrapper.tsx b/apps/web/components/Objects/Editor/EditorWrapper.tsx index b9c3d7f1..3176bc8a 100644 --- a/apps/web/components/Objects/Editor/EditorWrapper.tsx +++ b/apps/web/components/Objects/Editor/EditorWrapper.tsx @@ -1,5 +1,5 @@ 'use client' -import { default as React, useEffect, useRef, useState } from 'react' +import { default as React } from 'react' import Editor from './Editor' import { updateActivity } from '@services/courses/activities' import { toast } from 'react-hot-toast' @@ -7,15 +7,7 @@ import Toast from '@components/Objects/StyledElements/Toast/Toast' import { OrgProvider } from '@components/Contexts/OrgContext' import { useLHSession } from '@components/Contexts/LHSessionContext' -// Collaboration -import { HocuspocusProvider } from '@hocuspocus/provider' -import * as Y from 'yjs' -import { IndexeddbPersistence } from 'y-indexeddb' -import { getCollaborationServerUrl } from '@services/config/config' -import randomColor from 'randomcolor' -import MouseMovements from './MouseMovements' -import { v4 as uuidv4 } from 'uuid'; -import { debounce } from '@/lib/utils'; + interface EditorWrapperProps { content: string @@ -27,61 +19,11 @@ interface EditorWrapperProps { function EditorWrapper(props: EditorWrapperProps): JSX.Element { const session = useLHSession() as any const access_token = session?.data?.tokens?.access_token; - // Define provider in the state - const [provider, setProvider] = React.useState(null); - const [thisPageColor, setThisPageColor] = useState(randomColor({ luminosity: 'light' }) as string) - let uuid = uuidv4(); - const [onlinePageInstanceID, setOnlinePageInstanceID] = useState(uuid as string) - - - /* Collaboration Features */ - const collab = getCollaborationServerUrl() - const isCollabEnabledOnThisOrg = props.org.config.config.features.collaboration.enabled && collab - const doc = new Y.Doc() - // mouse movement - const [mouseMovements, setMouseMovements] = useState({} as any); - const timeoutRef = useRef(null); - - const debouncedSetMouseMovements = (newMovements: any) => { - if (timeoutRef.current) { - clearTimeout(timeoutRef.current); - } - - timeoutRef.current = setTimeout(() => { - setMouseMovements(newMovements); - }, 10); - }; - - - // Store the Y document in the browser - new IndexeddbPersistence(props.activity.activity_uuid, doc) - - document.addEventListener( - 'mousemove', - debounce((event: MouseEvent) => { - provider?.setAwarenessField('userMouseMovement', { - user: session.data.user, - mouseX: event.clientX, - mouseY: event.clientY, - color: thisPageColor, - onlineInstanceID: onlinePageInstanceID, - }) - }, 300) - ) async function setContent(content: any) { let activity = props.activity activity.content = content - - provider?.setAwarenessField("savings_states", { - [session.data.user.user_uuid]: { - status: 'action_save', - timestamp: new Date().toISOString(), - user: session.data.user - } - }); - toast.promise(updateActivity(activity, activity.activity_uuid, access_token), { loading: 'Saving...', success: Activity saved!, @@ -90,92 +32,10 @@ function EditorWrapper(props: EditorWrapperProps): JSX.Element { } - - - // Create a ref to store the last save timestamp of each user - const lastSaveTimestampRef = useRef({}) as any; - - useEffect(() => { - // Check if provider is not already set - if (!provider) { - const newProvider = new HocuspocusProvider({ - url: collab, - name: props.activity.activity_uuid, - document: doc, - - // TODO(alpha code): This whole block of code should be improved to something more efficient and less hacky - onConnect: () => { - // Set the online page instance ID - setOnlinePageInstanceID(uuidv4()); - - // Set the user color - setThisPageColor(randomColor({ luminosity: 'light' }) as string); - }, - - onAwarenessUpdate: ({ states }) => { - const usersStates = states; - /* Showing user mouse movement */ - usersStates.forEach((userState: any) => { - if (userState.userMouseMovement) { - const userMouseMovement = userState.userMouseMovement; - - // Update the mouse movements state - debouncedSetMouseMovements((prevMovements: any) => { - return { - ...prevMovements, - [userMouseMovement.user.user_uuid]: { - user: userMouseMovement.user, - mouseX: userMouseMovement.mouseX, - mouseY: userMouseMovement.mouseY, - color: userMouseMovement.color, - onlinePageInstanceID: userMouseMovement.onlineInstanceID - }, - }; - } - ); - - } - }); - - - /* Notifiying if a user has saved course content */ - usersStates.forEach((userState: any) => { - if (userState.savings_states) { - const savingsState = userState.savings_states - - // Check if a user has saved the document - Object.keys(savingsState).forEach(user => { - const userObj = savingsState[user].user; - const status = savingsState[user].status; - const timestamp = savingsState[user].timestamp; - - // Get the current timestamp - const currentTimestamp = new Date().getTime(); - - // If the user has saved the document and the timestamp is close to the current timestamp, show the toast - if (status === 'action_save' && Math.abs(currentTimestamp - new Date(timestamp).getTime()) < 10) { // 5000 milliseconds = 5 seconds - // Update the last save timestamp for this user - lastSaveTimestampRef.current[user] = timestamp; - - toast.success(`${userObj.first_name} ${userObj.last_name} has saved the document`); - } - }); - } - }) - }, - }); - - // Set the new provider - setProvider(newProvider); - } - }, []); - - { return ( <> - {!session.isLoading && ()} diff --git a/apps/web/components/Objects/Editor/MouseMovements.tsx b/apps/web/components/Objects/Editor/MouseMovements.tsx deleted file mode 100644 index dbe0ce9e..00000000 --- a/apps/web/components/Objects/Editor/MouseMovements.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { getCollaborationServerUrl } from "@services/config/config"; -import { motion } from "framer-motion"; -import React, { useEffect } from 'react' - -interface User { - user_uuid: string; - first_name: string; - last_name: string; -} - -interface Movement { - user: User; - mouseX: number; - mouseY: number; - color: string; - onlinePageInstanceID: string; -} - -interface MouseMovementsProps { - movements: Record; - onlinePageInstanceID: string; - org ?: any; -} - -function MouseMovements({ movements, onlinePageInstanceID, org }: MouseMovementsProps): JSX.Element { - - - /* Collaboration config */ - const collab = getCollaborationServerUrl() - const isCollabEnabledOnThisOrg = org?.config.config.features.collaboration.enabled && collab - - useEffect(() => { - - } - , [movements, org]); - - return ( -
- {isCollabEnabledOnThisOrg && Object.keys(movements).map((key) => ( - movements[key].onlinePageInstanceID !== onlinePageInstanceID && ( - -
{movements[key].user.first_name} {movements[key].user.last_name}
-
) - - ))} -
- ); -} - -function CursorSvg({ color }: { color: string }) { - return ( - - - - ); -} - -export default MouseMovements; \ No newline at end of file diff --git a/apps/web/package.json b/apps/web/package.json index f6177871..b6f60e01 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -12,7 +12,6 @@ }, "dependencies": { "@emoji-mart/react": "^1.1.1", - "@hocuspocus/provider": "^2.13.7", "@icons-pack/react-simple-icons": "^10.1.0", "@radix-ui/colors": "^0.1.9", "@radix-ui/react-aspect-ratio": "^1.1.0", @@ -34,8 +33,6 @@ "@tanstack/react-table": "^8.20.5", "@tiptap/core": "^2.9.1", "@tiptap/extension-code-block-lowlight": "^2.9.1", - "@tiptap/extension-collaboration": "^2.9.1", - "@tiptap/extension-collaboration-cursor": "^2.9.1", "@tiptap/extension-table": "^2.9.1", "@tiptap/extension-table-cell": "^2.9.1", "@tiptap/extension-table-header": "^2.9.1", @@ -63,7 +60,6 @@ "next": "14.2.15", "next-auth": "^4.24.10", "nextjs-toploader": "^1.6.12", - "prosemirror-state": "^1.4.3", "randomcolor": "^0.6.2", "re-resizable": "^6.10.0", "react": "^18.3.1", @@ -83,10 +79,6 @@ "unsplash-js": "^7.0.19", "usehooks-ts": "^3.1.0", "uuid": "^9.0.1", - "y-indexeddb": "^9.0.12", - "y-prosemirror": "^1.2.12", - "y-webrtc": "^10.3.0", - "yjs": "^13.6.20", "yup": "^1.4.0" }, "devDependencies": { diff --git a/apps/web/services/config/config.ts b/apps/web/services/config/config.ts index b7ac9d56..84646bbb 100644 --- a/apps/web/services/config/config.ts +++ b/apps/web/services/config/config.ts @@ -5,8 +5,6 @@ export const LEARNHOUSE_BACKEND_URL = `${process.env.NEXT_PUBLIC_LEARNHOUSE_BACK export const LEARNHOUSE_DOMAIN = process.env.NEXT_PUBLIC_LEARNHOUSE_DOMAIN export const LEARNHOUSE_TOP_DOMAIN = process.env.NEXT_PUBLIC_LEARNHOUSE_TOP_DOMAIN -export const LEARNHOUSE_COLLABORATION_WS_URL = - process.env.NEXT_PUBLIC_LEARNHOUSE_COLLABORATION_WS_URL export const getAPIUrl = () => LEARNHOUSE_API_URL export const getBackendUrl = () => LEARNHOUSE_BACKEND_URL diff --git a/docker-compose.yml b/docker-compose.yml index 80ffe7e6..fa4390c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,10 +13,6 @@ services: condition: service_healthy redis: condition: service_healthy - collaboration: - build: apps/collaboration/. - ports: - - "1998:1998" db: image: postgres:16-alpine restart: always From 34cc8df9e7b30b3cd4a5e24a28e798bceabc6225 Mon Sep 17 00:00:00 2001 From: swve Date: Tue, 26 Nov 2024 00:46:21 +0100 Subject: [PATCH 2/3] fix: add course authorship check for paid courses --- apps/api/src/services/courses/activities/activities.py | 1 + apps/api/src/services/payments/payments_access.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/api/src/services/courses/activities/activities.py b/apps/api/src/services/courses/activities/activities.py index 985a48af..0d738530 100644 --- a/apps/api/src/services/courses/activities/activities.py +++ b/apps/api/src/services/courses/activities/activities.py @@ -116,6 +116,7 @@ async def get_activity( # Paid access check has_paid_access = await check_activity_paid_access( + request=request, activity_id=activity.id if activity.id else 0, user=current_user, db_session=db_session diff --git a/apps/api/src/services/payments/payments_access.py b/apps/api/src/services/payments/payments_access.py index 6f2632ac..9b649ac2 100644 --- a/apps/api/src/services/payments/payments_access.py +++ b/apps/api/src/services/payments/payments_access.py @@ -1,12 +1,14 @@ from sqlmodel import Session, select +from src.security.rbac.rbac import authorization_verify_if_user_is_author from src.db.payments.payments_users import PaymentStatusEnum, PaymentsUser from src.db.users import PublicUser, AnonymousUser from src.db.payments.payments_courses import PaymentsCourse from src.db.courses.activities import Activity from src.db.courses.courses import Course -from fastapi import HTTPException +from fastapi import HTTPException, Request async def check_activity_paid_access( + request: Request, activity_id: int, user: PublicUser | AnonymousUser, db_session: Session, @@ -33,6 +35,12 @@ async def check_activity_paid_access( if not course: raise HTTPException(status_code=404, detail="Course not found") + + # Check if user is author of the course + is_course_author = await authorization_verify_if_user_is_author(request, user.id, "update", course.course_uuid, db_session) + + if is_course_author: + return True # Check if course is linked to a product statement = select(PaymentsCourse).where(PaymentsCourse.course_id == course.id) From 1c6de351d361cc18103971451db20ab8dbdbfbf9 Mon Sep 17 00:00:00 2001 From: swve Date: Tue, 26 Nov 2024 00:59:57 +0100 Subject: [PATCH 3/3] fix: additional issues --- Dockerfile | 1 - apps/web/package.json | 1 + apps/web/pnpm-lock.yaml | 250 ++--------------------------- apps/web/services/config/config.ts | 4 +- 4 files changed, 11 insertions(+), 245 deletions(-) diff --git a/Dockerfile b/Dockerfile index becd6359..d5e59ab4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,6 @@ FROM base AS deps ENV NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost/api/v1/ ENV NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost/ ENV NEXT_PUBLIC_LEARNHOUSE_DOMAIN=localhost -ENV NEXT_PUBLIC_LEARNHOUSE_COLLABORATION_WS_URL=ws://localhost:1998 WORKDIR /app/web COPY ./apps/web/package.json ./apps/web/pnpm-lock.yaml* ./ diff --git a/apps/web/package.json b/apps/web/package.json index b6f60e01..c5d6fec8 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -44,6 +44,7 @@ "@tiptap/starter-kit": "^2.9.1", "@types/dompurify": "^3.0.5", "@types/randomcolor": "^0.5.9", + "prosemirror-state": "^1.4.3", "avvvatars-react": "^0.4.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", diff --git a/apps/web/pnpm-lock.yaml b/apps/web/pnpm-lock.yaml index dae8a39c..40bb31df 100644 --- a/apps/web/pnpm-lock.yaml +++ b/apps/web/pnpm-lock.yaml @@ -11,9 +11,6 @@ importers: '@emoji-mart/react': specifier: ^1.1.1 version: 1.1.1(emoji-mart@5.6.0)(react@18.3.1) - '@hocuspocus/provider': - specifier: ^2.13.7 - version: 2.13.7(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20) '@icons-pack/react-simple-icons': specifier: ^10.1.0 version: 10.1.0(react@18.3.1) @@ -77,12 +74,6 @@ importers: '@tiptap/extension-code-block-lowlight': specifier: ^2.9.1 version: 2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(@tiptap/extension-code-block@2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(@tiptap/pm@2.9.1))(@tiptap/pm@2.9.1)(highlight.js@11.10.0)(lowlight@3.1.0) - '@tiptap/extension-collaboration': - specifier: ^2.9.1 - version: 2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(@tiptap/pm@2.9.1)(y-prosemirror@1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20)) - '@tiptap/extension-collaboration-cursor': - specifier: ^2.9.1 - version: 2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(y-prosemirror@1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20)) '@tiptap/extension-table': specifier: ^2.9.1 version: 2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(@tiptap/pm@2.9.1) @@ -224,18 +215,6 @@ importers: uuid: specifier: ^9.0.1 version: 9.0.1 - y-indexeddb: - specifier: ^9.0.12 - version: 9.0.12(yjs@13.6.20) - y-prosemirror: - specifier: ^1.2.12 - version: 1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20) - y-webrtc: - specifier: ^10.3.0 - version: 10.3.0(yjs@13.6.20) - yjs: - specifier: ^13.6.20 - version: 13.6.20 yup: specifier: ^1.4.0 version: 1.4.0 @@ -420,15 +399,6 @@ packages: '@floating-ui/utils@0.2.8': resolution: {integrity: sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==} - '@hocuspocus/common@2.13.7': - resolution: {integrity: sha512-ROqYfW15XlAGd+qb/FVyp0zUC9Rosv7kdcck9LRMdfW3jT66wK9pDDWL2ily4Qj/zhbLCFtjAUPB4UKln/GYNQ==} - - '@hocuspocus/provider@2.13.7': - resolution: {integrity: sha512-BjZIIV8tWf/MD/8IcEMSFA+sW4wtR/M9MmhN+XSssYJOZxnszw44Gdwda23TmhsXvCV+qggS8lGEs+SfZSzEag==} - peerDependencies: - y-protocols: ^1.0.6 - yjs: ^13.6.8 - '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} @@ -577,9 +547,6 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@lifeomic/attempt@3.1.0': - resolution: {integrity: sha512-QZqem4QuAnAyzfz+Gj5/+SLxqwCAw2qmt7732ZXodr6VDWGeYLG6w1i/vYLa55JQM9wRuBKLmXmiZ2P0LtE5rw==} - '@next/env@14.2.15': resolution: {integrity: sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==} @@ -1599,19 +1566,6 @@ packages: peerDependencies: '@tiptap/core': ^2.7.0 - '@tiptap/extension-collaboration-cursor@2.9.1': - resolution: {integrity: sha512-mbNYEdlp22UpKY0SULVWRvOm3U19V80DokC+iDIDZXGXI2nCevB4vMQVkXmiQtiz3qT9I9mIN0vSgy3w75A7WA==} - peerDependencies: - '@tiptap/core': ^2.7.0 - y-prosemirror: ^1.2.11 - - '@tiptap/extension-collaboration@2.9.1': - resolution: {integrity: sha512-AaS66O4X0rx1WLnCC3LW5fLk7ZULr0t7/gj/7dNgbBtyg4NhoYc3PhSBiimLbgD+R8wFrfm1lsHb02deaqQB6w==} - peerDependencies: - '@tiptap/core': ^2.7.0 - '@tiptap/pm': ^2.7.0 - y-prosemirror: ^1.2.11 - '@tiptap/extension-document@2.9.1': resolution: {integrity: sha512-1a+HCoDPnBttjqExfYLwfABq8MYdiowhy/wp8eCxVb6KGFEENO53KapstISvPzqH7eOi+qRjBB1KtVYb/ZXicg==} peerDependencies: @@ -2063,9 +2017,6 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - base64-js@1.5.1: - resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} - binary-extensions@2.3.0: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} @@ -2088,9 +2039,6 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} - buffer@6.0.3: - resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} - busboy@1.6.0: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} @@ -2336,9 +2284,6 @@ packages: resolution: {integrity: sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==} engines: {node: '>=0.12'} - err-code@3.0.1: - resolution: {integrity: sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==} - es-abstract@1.23.3: resolution: {integrity: sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==} engines: {node: '>= 0.4'} @@ -2604,9 +2549,6 @@ packages: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} - get-browser-rtc@1.1.0: - resolution: {integrity: sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ==} - get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -2720,9 +2662,6 @@ packages: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} - ieee754@1.2.1: - resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} - ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -2876,9 +2815,6 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - isomorphic.js@0.2.5: - resolution: {integrity: sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==} - iterator.prototype@1.1.3: resolution: {integrity: sha512-FW5iMbeQ6rBGm/oKgzq2aW4KvAGpxPzYES8N4g4xNXUKpL1mclMvOe+76AcLDTvD+Ze+sOpVhgdAQEKF4L9iGQ==} engines: {node: '>= 0.4'} @@ -2956,11 +2892,6 @@ packages: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} - lib0@0.2.98: - resolution: {integrity: sha512-XteTiNO0qEXqqweWx+b21p/fBnNHUA1NwAtJNJek1oPrewEZs2uiT4gWivHKr9GqCjDPAhchz0UQO8NwU3bBNA==} - engines: {node: '>=16'} - hasBin: true - lilconfig@2.1.0: resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} @@ -3572,10 +3503,6 @@ packages: read-cache@1.0.0: resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==} - readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} @@ -3697,9 +3624,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - simple-peer@9.11.1: - resolution: {integrity: sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw==} - simple-swizzle@0.2.2: resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==} @@ -3755,9 +3679,6 @@ packages: resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==} engines: {node: '>= 0.4'} - string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -4090,51 +4011,10 @@ packages: wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.18.0: - resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - xtend@4.0.2: resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} engines: {node: '>=0.4'} - y-indexeddb@9.0.12: - resolution: {integrity: sha512-9oCFRSPPzBK7/w5vOkJBaVCQZKHXB/v6SIT+WYhnJxlEC61juqG0hBrAf+y3gmSMLFLwICNH9nQ53uscuse6Hg==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - peerDependencies: - yjs: ^13.0.0 - - y-prosemirror@1.2.12: - resolution: {integrity: sha512-UMnUIR5ppVn30n2kzeeBQEaesWGe4fsbnlch1HnNa3/snJMoOn7M7dieuS+o1OQwKs1dqx2eT3gFfGF2aOaQdw==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - peerDependencies: - prosemirror-model: ^1.7.1 - prosemirror-state: ^1.2.3 - prosemirror-view: ^1.9.10 - y-protocols: ^1.0.1 - yjs: ^13.5.38 - - y-protocols@1.0.6: - resolution: {integrity: sha512-vHRF2L6iT3rwj1jub/K5tYcTT/mEYDUppgNPXwp8fmLpui9f7Yeq3OEtTLVF012j39QnV+KEQpNqoN7CWU7Y9Q==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - peerDependencies: - yjs: ^13.0.0 - - y-webrtc@10.3.0: - resolution: {integrity: sha512-KalJr7dCgUgyVFxoG3CQYbpS0O2qybegD0vI4bYnYHI0MOwoVbucED3RZ5f2o1a5HZb1qEssUKS0H/Upc6p1lA==} - engines: {node: '>=12'} - hasBin: true - peerDependencies: - yjs: ^13.6.8 - yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -4146,10 +4026,6 @@ packages: engines: {node: '>= 14'} hasBin: true - yjs@13.6.20: - resolution: {integrity: sha512-Z2YZI+SYqK7XdWlloI3lhMiKnCdFCVC4PchpdO+mCYwtiTwncjUbnRK9R1JmkNfdmHyDXuWN3ibJAt0wsqTbLQ==} - engines: {node: '>=16.0.0', npm: '>=8.0.0'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -4341,22 +4217,6 @@ snapshots: '@floating-ui/utils@0.2.8': {} - '@hocuspocus/common@2.13.7': - dependencies: - lib0: 0.2.98 - - '@hocuspocus/provider@2.13.7(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20)': - dependencies: - '@hocuspocus/common': 2.13.7 - '@lifeomic/attempt': 3.1.0 - lib0: 0.2.98 - ws: 8.18.0 - y-protocols: 1.0.6(yjs@13.6.20) - yjs: 13.6.20 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - '@humanwhocodes/config-array@0.13.0': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -4479,8 +4339,6 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@lifeomic/attempt@3.1.0': {} - '@next/env@14.2.15': {} '@next/eslint-plugin-next@14.2.16': @@ -5584,17 +5442,6 @@ snapshots: dependencies: '@tiptap/core': 2.9.1(@tiptap/pm@2.9.1) - '@tiptap/extension-collaboration-cursor@2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(y-prosemirror@1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20))': - dependencies: - '@tiptap/core': 2.9.1(@tiptap/pm@2.9.1) - y-prosemirror: 1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20) - - '@tiptap/extension-collaboration@2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))(@tiptap/pm@2.9.1)(y-prosemirror@1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20))': - dependencies: - '@tiptap/core': 2.9.1(@tiptap/pm@2.9.1) - '@tiptap/pm': 2.9.1 - y-prosemirror: 1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20) - '@tiptap/extension-document@2.9.1(@tiptap/core@2.9.1(@tiptap/pm@2.9.1))': dependencies: '@tiptap/core': 2.9.1(@tiptap/pm@2.9.1) @@ -6157,8 +6004,6 @@ snapshots: balanced-match@1.0.2: {} - base64-js@1.5.1: {} - binary-extensions@2.3.0: {} brace-expansion@1.1.11: @@ -6183,11 +6028,6 @@ snapshots: buffer-from@1.1.2: {} - buffer@6.0.3: - dependencies: - base64-js: 1.5.1 - ieee754: 1.2.1 - busboy@1.6.0: dependencies: streamsearch: 1.1.0 @@ -6400,8 +6240,6 @@ snapshots: entities@5.0.0: {} - err-code@3.0.1: {} - es-abstract@1.23.3: dependencies: array-buffer-byte-length: 1.0.1 @@ -6508,8 +6346,8 @@ snapshots: '@typescript-eslint/parser': 8.12.2(eslint@8.57.1)(typescript@5.4.4) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.2(eslint@8.57.1) eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.57.1) @@ -6528,37 +6366,37 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 8.12.2(eslint@8.57.1)(typescript@5.4.4) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -6569,7 +6407,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.12.2(eslint@8.57.1)(typescript@5.4.4))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -6808,8 +6646,6 @@ snapshots: gensync@1.0.0-beta.2: {} - get-browser-rtc@1.1.0: {} - get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -6933,8 +6769,6 @@ snapshots: transitivePeerDependencies: - supports-color - ieee754@1.2.1: {} - ignore@5.3.2: {} import-fresh@3.3.0: @@ -7080,8 +6914,6 @@ snapshots: isexe@2.0.0: {} - isomorphic.js@0.2.5: {} - iterator.prototype@1.1.3: dependencies: define-properties: 1.2.1 @@ -7160,10 +6992,6 @@ snapshots: prelude-ls: 1.2.1 type-check: 0.4.0 - lib0@0.2.98: - dependencies: - isomorphic.js: 0.2.5 - lilconfig@2.1.0: {} lilconfig@3.1.2: {} @@ -7779,12 +7607,6 @@ snapshots: dependencies: pify: 2.3.0 - readable-stream@3.6.2: - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - readdirp@3.6.0: dependencies: picomatch: 2.3.1 @@ -7946,18 +7768,6 @@ snapshots: signal-exit@4.1.0: {} - simple-peer@9.11.1: - dependencies: - buffer: 6.0.3 - debug: 4.3.7 - err-code: 3.0.1 - get-browser-rtc: 1.1.0 - queue-microtask: 1.2.3 - randombytes: 2.1.0 - readable-stream: 3.6.2 - transitivePeerDependencies: - - supports-color - simple-swizzle@0.2.2: dependencies: is-arrayish: 0.3.2 @@ -8036,10 +7846,6 @@ snapshots: define-properties: 1.2.1 es-object-atoms: 1.0.0 - string_decoder@1.3.0: - dependencies: - safe-buffer: 5.2.1 - strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -8417,52 +8223,14 @@ snapshots: wrappy@1.0.2: {} - ws@8.18.0: {} - xtend@4.0.2: {} - y-indexeddb@9.0.12(yjs@13.6.20): - dependencies: - lib0: 0.2.98 - yjs: 13.6.20 - - y-prosemirror@1.2.12(prosemirror-model@1.23.0)(prosemirror-state@1.4.3)(prosemirror-view@1.35.0)(y-protocols@1.0.6(yjs@13.6.20))(yjs@13.6.20): - dependencies: - lib0: 0.2.98 - prosemirror-model: 1.23.0 - prosemirror-state: 1.4.3 - prosemirror-view: 1.35.0 - y-protocols: 1.0.6(yjs@13.6.20) - yjs: 13.6.20 - - y-protocols@1.0.6(yjs@13.6.20): - dependencies: - lib0: 0.2.98 - yjs: 13.6.20 - - y-webrtc@10.3.0(yjs@13.6.20): - dependencies: - lib0: 0.2.98 - simple-peer: 9.11.1 - y-protocols: 1.0.6(yjs@13.6.20) - yjs: 13.6.20 - optionalDependencies: - ws: 8.18.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - yallist@3.1.1: {} yallist@4.0.0: {} yaml@2.6.0: {} - yjs@13.6.20: - dependencies: - lib0: 0.2.98 - yocto-queue@0.1.0: {} youtube-player@5.5.2: diff --git a/apps/web/services/config/config.ts b/apps/web/services/config/config.ts index 84646bbb..c490f435 100644 --- a/apps/web/services/config/config.ts +++ b/apps/web/services/config/config.ts @@ -46,8 +46,6 @@ export const getDefaultOrg = () => { return process.env.NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG } -export const getCollaborationServerUrl = () => { - return `${LEARNHOUSE_COLLABORATION_WS_URL}` -} +