Merge pull request #11 from idlewinn/master
Update to current production version supporting excalidraw.com (loade…
This commit is contained in:
commit
ff9e761fe3
@ -1,5 +0,0 @@
|
||||
# Exclude compiled .js files
|
||||
*.js
|
||||
|
||||
# Exclude dependencies
|
||||
node_modules/
|
110
.gitignore
vendored
110
.gitignore
vendored
@ -1,3 +1,107 @@
|
||||
*.js
|
||||
node_modules
|
||||
yarn-error.log
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
.DS_Store
|
||||
dist
|
||||
|
34
README.md
Normal file → Executable file
34
README.md
Normal file → Executable file
@ -1,32 +1,2 @@
|
||||
# excalidraw-room
|
||||
|
||||
## Requirements
|
||||
|
||||
- [Node.js](https://nodejs.org/en/)
|
||||
- [Google Cloud SDK](https://cloud.google.com/sdk/?hl=en_US)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
yarn
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
yarn start
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
Make sure you have access to the [`excalidraw-room`](https://console.cloud.google.com/home/dashboard?project=excalidraw-room) project.
|
||||
|
||||
```
|
||||
yarn deploy
|
||||
```
|
||||
# collab-server
|
||||
Excalidraw collaboration server
|
||||
|
4337
package-lock.json
generated
Executable file
4337
package-lock.json
generated
Executable file
File diff suppressed because it is too large
Load Diff
95
package.json
Normal file → Executable file
95
package.json
Normal file → Executable file
@ -1,41 +1,68 @@
|
||||
{
|
||||
"name": "excalidraw-room",
|
||||
"version": "1.0.0",
|
||||
"description": "Excalidraw collaboration server",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"postinstall": "npm run build",
|
||||
"start": "node dist/index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/excalidraw/excalidraw-room.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/excalidraw/excalidraw-room/issues"
|
||||
},
|
||||
"homepage": "https://github.com/excalidraw/excalidraw-room#readme",
|
||||
"dependencies": {
|
||||
"@types/express": "4.17.3",
|
||||
"@types/node": "13.9.0",
|
||||
"@types/socket.io": "2.1.4",
|
||||
"express": "4.17.1",
|
||||
"socket.io": "2.3.0",
|
||||
"typescript": "3.8.3"
|
||||
"@types/socket.io": "^2.1.4",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-prettier": "6.10.0",
|
||||
"eslint-plugin-prettier": "3.1.2",
|
||||
"express": "^4.17.1",
|
||||
"prettier": "1.19.1",
|
||||
"socket.io": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"husky": "4.2.3",
|
||||
"lint-staged": "10.0.8",
|
||||
"prettier": "1.19.1"
|
||||
"@types/express": "^4.17.3",
|
||||
"@types/node": "^13.9.0",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"prettier"
|
||||
],
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"curly": "warn",
|
||||
"no-console": [
|
||||
"warn",
|
||||
{
|
||||
"allow": [
|
||||
"warn",
|
||||
"error",
|
||||
"info"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-else-return": "warn",
|
||||
"no-useless-return": "warn",
|
||||
"prefer-const": [
|
||||
"warn",
|
||||
{
|
||||
"destructuring": "all"
|
||||
}
|
||||
],
|
||||
"prefer-template": "warn",
|
||||
"prettier/prettier": "warn"
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"lint-staged": {
|
||||
"*.{ts,md,json,yaml,yml}": [
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"main": "index.js",
|
||||
"name": "excalidraw-room",
|
||||
"scripts": {
|
||||
"build": "yarn gcp-build",
|
||||
"deploy": "gcloud app deploy --project=excalidraw-room",
|
||||
"fix": "yarn prettier --write",
|
||||
"gcp-build": "tsc -p .",
|
||||
"lint": "yarn prettier --list-different",
|
||||
"prepare": "yarn gcp-build",
|
||||
"pretest": "yarn gcp-build",
|
||||
"prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
|
||||
"start": "node ./index.js",
|
||||
"test": "yarn lint"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
21
index.ts → src/index.ts
Normal file → Executable file
21
index.ts → src/index.ts
Normal file → Executable file
@ -1,15 +1,9 @@
|
||||
// source: https://github.com/idlewinn/collab-server/blob/master/src/index.ts
|
||||
|
||||
import express from "express";
|
||||
import http from "http";
|
||||
import http, { ServerResponse } from "http";
|
||||
import socketIO from "socket.io";
|
||||
|
||||
const app = express();
|
||||
const port = process.env.PORT || 8080;
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.send("Hi, excalidraw-room!");
|
||||
});
|
||||
const port = process.env.PORT || 80; // default port to listen
|
||||
|
||||
const server = http.createServer(app);
|
||||
|
||||
@ -46,13 +40,10 @@ io.on("connection", socket => {
|
||||
);
|
||||
});
|
||||
|
||||
socket.on(
|
||||
"server-broadcast",
|
||||
(roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||
console.log(`${socket.id} sends update to ${roomID}`);
|
||||
socket.broadcast.to(roomID).emit("client-broadcast", encryptedData, iv);
|
||||
}
|
||||
);
|
||||
socket.on("server-broadcast", (roomID: string, encryptedData: ArrayBuffer, iv: Uint8Array) => {
|
||||
console.log(`${socket.id} sends update to ${roomID}`);
|
||||
socket.broadcast.to(roomID).emit("client-broadcast", encryptedData, iv);
|
||||
});
|
||||
|
||||
socket.on("disconnecting", () => {
|
||||
const rooms = io.sockets.adapter.rooms;
|
22
tsconfig.json
Normal file → Executable file
22
tsconfig.json
Normal file → Executable file
@ -1,8 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"esModuleInterop": true,
|
||||
"module": "CommonJS"
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user