Skip to content

Commit

Permalink
fix: do not use WS_SERVER_URL, build docker on branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenjohanson committed Sep 11, 2024
1 parent 0acb3f8 commit 06aedeb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ name: Create and publish a Docker image
on:
release:
types: [published]
pull_request:
branches:
- 'remove-external-resources'

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -46,6 +49,6 @@ jobs:
uses: docker/build-push-action@v4
with:
target: production
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
19 changes: 13 additions & 6 deletions excalidraw-app/collab/Collab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import type {
ReconciledExcalidrawElement,
RemoteExcalidrawElement,
} from "../../packages/excalidraw/data/reconcile";
import { createServerUrl } from "../data/httpStorage";

export const collabAPIAtom = atom<CollabAPI | null>(null);
export const isCollaboratingAtom = atom(false);
Expand Down Expand Up @@ -401,7 +402,7 @@ class Collab extends PureComponent<CollabProps, CollabState> {
!element.isDeleted &&
(opts.forceFetchFiles
? element.status !== "pending" ||
Date.now() - element.updated > 10000
Date.now() - element.updated > 10000
: element.status === "saved")
);
})
Expand Down Expand Up @@ -483,10 +484,16 @@ class Collab extends PureComponent<CollabProps, CollabState> {
};
this.fallbackInitializationHandler = fallbackInitializationHandler;

let socketUrl = import.meta.env.VITE_APP_WS_SERVER_URL;

if (import.meta.env.VITE_APP_HTTP_STORAGE_WS_URL_PART_NAME) {
socketUrl = createServerUrl(import.meta.env.VITE_APP_HTTP_STORAGE_WS_URL_PART_NAME);
}

try {
this.portal.socket = this.portal.open(
socketIOClient(import.meta.env.VITE_APP_WS_SERVER_URL, {
transports: ["websocket", "polling"],
socketIOClient(socketUrl, {
transports: ["websocket", "polling"]
}),
roomId,
roomKey,
Expand Down Expand Up @@ -665,9 +672,9 @@ class Collab extends PureComponent<CollabProps, CollabState> {
roomLinkData,
}:
| {
fetchScene: true;
roomLinkData: { roomId: string; roomKey: string } | null;
}
fetchScene: true;
roomLinkData: { roomId: string; roomKey: string } | null;
}
| { fetchScene: false; roomLinkData?: null }) => {
clearTimeout(this.socketInitializationTimer!);
if (this.portal.socket && this.fallbackInitializationHandler) {
Expand Down

0 comments on commit 06aedeb

Please sign in to comment.