working basic live collab

This commit is contained in:
Ishaan Dey
2024-05-03 14:58:56 -07:00
parent a18bcf9c14
commit 17af48fe2c
6 changed files with 65 additions and 19 deletions

View File

@ -57,7 +57,8 @@ io.use((socket, next) => __awaiter(void 0, void 0, void 0, function* () {
return;
}
const sandbox = dbUserJSON.sandbox.find((s) => s.id === sandboxId);
if (!sandbox) {
const sharedSandboxes = dbUserJSON.usersToSandboxes.find((uts) => uts.sandboxId === sandboxId);
if (!sandbox && !sharedSandboxes) {
console.log("Invalid credentials.");
next(new Error("Invalid credentials."));
return;

View File

@ -63,8 +63,11 @@ io.use(async (socket, next) => {
}
const sandbox = dbUserJSON.sandbox.find((s) => s.id === sandboxId)
const sharedSandboxes = dbUserJSON.usersToSandboxes.find(
(uts) => uts.sandboxId === sandboxId
)
if (!sandbox) {
if (!sandbox && !sharedSandboxes) {
console.log("Invalid credentials.")
next(new Error("Invalid credentials."))
return