diff --git a/Dockerfile b/Dockerfile index 661ccf9..49c92b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,4 +35,4 @@ COPY scripts ./scripts COPY --from=base /opt/app/dist ./dist EXPOSE 8080 -ENTRYPOINT [ "npm", "run", "start:prod-no-build" ] +ENTRYPOINT ["node", "scripts/server.js", "--mode=production"] diff --git a/README.md b/README.md index 25507c7..6863482 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # whiteboard This is a lightweight NodeJS collaborative Whiteboard/Sketchboard witch can easily be customized... -![start](https://raw.githubusercontent.com/cracker0dks/whiteboard/master/doc/start.png) +![start](./doc/start.png) ## Demowhiteboard ## [HERE](https://cloud13.de/testwhiteboard/) (Reset every night) @@ -34,14 +34,14 @@ You can run this app with and without docker ## Development -After you have installed the app, run `npm run start:dev` to lunch the backend and a frontend development server. The website will be accessible on http://locahost:8080. +After you have installed the app, run `npm run start:dev` to start the backend and a frontend development server. The website will be accessible on http://locahost:8080. ## Default keyboard shortcuts Use keyboard shortcuts to become more productive while using Whiteboard. They are especially useful if you work with interactive displays such as XP-Pen Artist, Huion Kamvas and Wacom Cintiq. These devices have quick buttons (6-8 buttons and scrolling). By default, the buttons on these displays are mapped to standard Photoshop keyboard shortcuts. Keys can be configured to function effectively in other software. -The following are predefined shortcuts that you can override in the file [/public/js/keybinds.js](https://github.com/cracker0dks/whiteboard/blob/master/public/js/keybinds.js) +The following are predefined shortcuts that you can override in the file [./src/js/keybinds.js](./src/js/keybinds.js) Result | Windows and Linux | macOS ------ | -------------------- | ------- @@ -95,9 +95,9 @@ Call your site with GET parameters to change the WhiteboardID or the Username ## Security - AccessToken (Optional) To prevent clients who might know or guess the base URL from abusing the server to upload files and stuff..., you can set an accesstoken at server start. -Server (Without docker): `node server.js --accesstoken="mySecToken"` +Server (Without docker): `node scripts/server.js --accesstoken="mySecToken"` -Server (With docker): `docker run -d -e accesstoken="mySecToken" -p 8080:8080 rofl256/whiteboard` +Server (With docker): `docker run -d -p 8080:8080 rofl256/whiteboard --accesstoken="mySecToken"` Then set the same token on the client side as well: @@ -110,9 +110,9 @@ This function allows your users to save the whiteboard directly to a webdav serv To enable it: -Server (Without docker): `node server.js --webdav=true` +Server (Without docker): `node scripts/server.js --webdav=true` -Server (With docker): `docker run -d -e webdav=true -p 8080:8080 rofl256/whiteboard` +Server (With docker): `docker run -d -p 8080:8080 rofl256/whiteboard --webdav=true` Then set the same parameter on the client side as well: @@ -127,7 +127,7 @@ Done! ## Things you may want to know * Whiteboards are gone if you restart the Server, so keep that in mind (or save your whiteboard) -* You shoud be able to customize the layout without ever toutching the whiteboard.js (take a look at index.html & main.js) +* You should be able to customize the layout without ever touching the whiteboard.js (take a look at index.html & main.js) ## All server start parameters (also docker) * accesstoken => take a look at "Security - AccessToken" for a full explanation diff --git a/package.json b/package.json index 0ae2606..4d15a2a 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,7 @@ "scripts": { "build": "webpack --config config/webpack.build.js", "start:dev": "node scripts/server.js --mode=development", - "start:prod": "npm run build && npm run start:prod-no-build", - "start:prod-no-build": "node scripts/server.js --mode=production", + "start:prod": "npm run build && node scripts/server.js --mode=production", "test": "echo \"No tests needed!\" && exit 1" }, "repository": { diff --git a/scripts/server.js b/scripts/server.js index 8e74668..e5a52cc 100644 --- a/scripts/server.js +++ b/scripts/server.js @@ -9,8 +9,13 @@ const SERVER_MODES = { const args = getArgs(); -if ( typeof args.mode === "undefined" || (args.mode !== "production" && args.mode !== "development")) { - throw new Error("--mode=development or --mode=production is expected") +if ( typeof args.mode === "undefined") { + // default to production mode + args.mode = "production"; +} + +if (args.mode !== "production" && args.mode !== "development") { + throw new Error("--mode can only be 'development' or 'production'") } const server_mode = args.mode === "production" ? SERVER_MODES.PRODUCTION : SERVER_MODES.DEVELOPMENT;