From 3893dfb13e164d644222c8683d320f4c90127387 Mon Sep 17 00:00:00 2001 From: patwie Date: Fri, 29 Mar 2024 13:53:53 +0000 Subject: [PATCH] Add excalidraw as submodule --- .gitmodules | 3 +++ README.md | 12 +++++++++--- excalidraw | 1 + main.go | 10 ++++++---- ui-build.Dockerfile | 12 ++++++++++++ 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 .gitmodules create mode 160000 excalidraw create mode 100644 ui-build.Dockerfile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3f441c3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "excalidraw"] + path = excalidraw + url = https://github.com/excalidraw/excalidraw.git diff --git a/README.md b/README.md index 93b3143..18bb441 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,17 @@ Interested in contributing or customizing? Build Excalidraw Complete from source ```bash # Clone and prepare the Excalidraw frontend -git clone https://github.com/excalidraw/excalidraw.git +git clone https://github.com/PatWie/excalidraw-complete.git --recursive cd excalidraw -git checkout tags/v0.17.3 +# git checkout tags/v0.17.3 +# Fix docker build +git remote add jcobol https://github.com/jcobol/excalidraw +git fetch jcobol +git checkout 7582_fix_docker_build git apply ../frontend.patch -# Follow build instructions to compile assets into the frontend directory +cd ../ +docker build -t exalidraw-ui-build excalidraw -f ui-build.Dockerfile +docker run -v ${PWD}/:/pwd/ -it exalidraw-ui-build cp -r /frontend /pwd ``` Compile the Go application: diff --git a/excalidraw b/excalidraw new file mode 160000 index 0000000..37ad34c --- /dev/null +++ b/excalidraw @@ -0,0 +1 @@ +Subproject commit 37ad34c4c221e1da5202782ba65bbdffd2393d87 diff --git a/main.go b/main.go index f560709..88c6bc1 100644 --- a/main.go +++ b/main.go @@ -22,12 +22,13 @@ import ( type ( UserToFollow struct { - SocketId string - Username string + SocketId string `json:"socketId"` + Username string `json:"username"` } + OnUserFollowedPayload struct { - UserToFollow UserToFollow - action string + UserToFollow UserToFollow `json:"userToFollow"` + Action string `json:"action"` // "FOLLOW" | "UNFOLLOW" } ) @@ -72,6 +73,7 @@ func setupSocketIO() *socketio.Server { Credentials: true, }) ioo := socketio.NewServer(nil, opts) + ioo.On("connection", func(clients ...any) { socket := clients[0].(*socketio.Socket) ioo.To(socketio.Room(socket.Id())).Emit("init-room") diff --git a/ui-build.Dockerfile b/ui-build.Dockerfile new file mode 100644 index 0000000..a5b0ad0 --- /dev/null +++ b/ui-build.Dockerfile @@ -0,0 +1,12 @@ +FROM node:18 AS build + +WORKDIR /home/node/app + +COPY . . + +RUN npm install +RUN cd excalidraw-app && npm run build:app:docker + +FROM ubuntu:20.04 +COPY --from=build /home/node/app/excalidraw-app/build /frontend +