diff --git a/README.md b/README.md index 1ed62f292..7ca6a3087 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Some important environment variables are : - `WBO_HISTORY_DIR` : configures the directory where the boards are saved. Defaults to `./server-data/`. - `WBO_MAX_EMIT_COUNT` : the maximum number of messages that a client can send per unit of time. Increase this value if you want smoother drawings, at the expense of being susceptible to denial of service attacks if your server does not have enough processing power. By default, the units of this quantity are messages per 4 seconds, and the default value is `192`. - `AUTH_SECRET_KEY` : If you would like to authenticate your boards using jwt, this declares the secret key. - +- `WBO_SHOW_EXIT_BUTTON` : If set to `true`, an exit button will be shown on the board. This is useful if you want to run in kiosk mode and need a way to close the window. ## Troubleshooting If you experience an issue or want to propose a new feature in WBO, please [open a github issue](https://github.com/lovasoa/whitebophir/issues/new). diff --git a/client-data/board.html b/client-data/board.html index f623a1618..6559cc3f4 100644 --- a/client-data/board.html +++ b/client-data/board.html @@ -102,6 +102,7 @@ + {{#moderator}}{{/moderator}} diff --git a/client-data/tools/exit/attribution b/client-data/tools/exit/attribution new file mode 100644 index 000000000..bf8f53c26 --- /dev/null +++ b/client-data/tools/exit/attribution @@ -0,0 +1,2 @@ +exit.svg creative commons license: https://www.svgrepo.com/svg/240195/exit +https://www.svgrepo.com/page/licensing/#CC0 \ No newline at end of file diff --git a/client-data/tools/exit/exit.js b/client-data/tools/exit/exit.js new file mode 100644 index 000000000..f379f9e3a --- /dev/null +++ b/client-data/tools/exit/exit.js @@ -0,0 +1,47 @@ +/** + * WHITEBOPHIR + ********************************************************* + * @licstart The following is the entire license notice for the + * JavaScript code in this page. + * + * Copyright (C) 2013 Ophir LOJKINE + * + * + * The JavaScript code in this page is free software: you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License (GNU GPL) as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) + * any later version. The code is distributed WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. + * + * As additional permission under GNU GPL version 3 section 7, you + * may distribute non-source (e.g., minimized or compacted) forms of + * that code without the copy of the GNU GPL normally required by + * section 4, provided you include this license notice and a URL + * through which recipients can access the Corresponding Source. + * + * @licend + */ + +(function () { + //Code isolation + + const exitTool = { + name: "Exit", + shortcut: "Q", + listeners: { + }, + draw: function (ctx) {}, + onstart: function () { + if (confirm("Are you sure you want to exit?")) { + window.close(); + } + }, + onquit: function () {}, + mouseCursor: "url('tools/pencil/cursor.svg'), crosshair", + icon: "tools/exit/exit.svg", + stylesheet: "tools/pencil/pencil.css", + }; + Tools.server_config.SHOW_EXIT_BUTTON && Tools.add(exitTool); +})(); //End of code isolation diff --git a/client-data/tools/exit/exit.svg b/client-data/tools/exit/exit.svg new file mode 100644 index 000000000..4b52138ad --- /dev/null +++ b/client-data/tools/exit/exit.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/server/client_configuration.js b/server/client_configuration.js index e8957a1d1..3437314ea 100644 --- a/server/client_configuration.js +++ b/server/client_configuration.js @@ -8,4 +8,5 @@ module.exports = { BLOCKED_TOOLS: config.BLOCKED_TOOLS, BLOCKED_SELECTION_BUTTONS: config.BLOCKED_SELECTION_BUTTONS, AUTO_FINGER_WHITEOUT: config.AUTO_FINGER_WHITEOUT, + SHOW_EXIT_BUTTON: config.SHOW_EXIT_BUTTON, }; diff --git a/server/configuration.js b/server/configuration.js index 30e6ed55e..157daf9ba 100644 --- a/server/configuration.js +++ b/server/configuration.js @@ -62,4 +62,7 @@ module.exports = { /** If this variable is set, automatically redirect to this board from the root of the application. */ DEFAULT_BOARD: process.env["WBO_DEFAULT_BOARD"], + + /** If this variable is set, the exit button will be shown on the board */ + SHOW_EXIT_BUTTON: process.env["WBO_SHOW_EXIT_BUTTON"], };