whitebophir/server/configuration.js

62 lines
2.8 KiB
JavaScript
Raw Normal View History

const path = require("path");
const app_root = path.dirname(__dirname); // Parent of the directory where this file is
module.exports = {
/** Port on which the application will listen */
PORT: parseInt(process.env["PORT"]) || 8080,
/** Host on which the application will listen (defaults to undefined,
hence listen on all interfaces on all IP addresses, but could also be
'127.0.0.1' **/
HOST: process.env["HOST"] || undefined,
/** Path to the directory where boards will be saved by default */
HISTORY_DIR:
process.env["WBO_HISTORY_DIR"] || path.join(app_root, "server-data"),
/** Folder from which static files will be served */
WEBROOT: process.env["WBO_WEBROOT"] || path.join(app_root, "client-data"),
/** Number of milliseconds of inactivity after which the board should be saved to a file */
SAVE_INTERVAL: parseInt(process.env["WBO_SAVE_INTERVAL"]) || 1000 * 2, // Save after 2 seconds of inactivity
/** Periodicity at which the board should be saved when it is being actively used (milliseconds) */
MAX_SAVE_DELAY: parseInt(process.env["WBO_MAX_SAVE_DELAY"]) || 1000 * 60, // Save after 60 seconds even if there is still activity
/** Maximal number of items to keep in the board. When there are more items, the oldest ones are deleted */
MAX_ITEM_COUNT: parseInt(process.env["WBO_MAX_ITEM_COUNT"]) || 32768,
/** Max number of sub-items in an item. This prevents flooding */
MAX_CHILDREN: parseInt(process.env["WBO_MAX_CHILDREN"]) || 192,
/** Maximum value for any x or y on the board */
MAX_BOARD_SIZE: parseInt(process.env["WBO_MAX_BOARD_SIZE"]) || 65536,
Add a cursor (#46) * Added cursors * Prepare cursor code for future settings to toggle cursors on or off. Let cursor be the color the person has currently selected * fix cursor on mobile (still won't display it in most cases as there is no hover on mobile but at least it won't throw errors) * use correct size for cursor * throttle cursor update rate to dramatically improve performance by eliminating congestion * fix remote cursor size on desktop * show own cursor by default and renove offset * use svg as mouse cursor for pencil to be able to apply a reduced opacity to it and view our cursor * don't throttle local cursor * throttle local cursor at an independent higher rate. This could be made user adjustable for low power devices * remove let and const from client-side code * get emit count and emit count period from configuration * reduce network cursor updates a lot to prevent instantly getting banned with the current defaults * prevent eraser from deleting cursors * use group inside of svg as drawing area and only delete elements inside it with the eraser * use transform: translate to move cursors around instead of manipulating x and y directly * fix: add socket ids to cursor messages * fix incorrect remote cursor scaling and make local cursor visible again after it has been moved after being hidden due to inactivity * create cursors in a proper fashion and keep them in a separate group * scaling has been fixed in a1a5580 * move duplicated cursor creation code to function * show cursors above content * pass some of ther server configuration through to the client * fix bug introduced in a833ce9 * allocate at most half of the allowed traffic to cursor updates * remove debugging leftover * use feature detection instead of ua sniffing Co-Authored-By: Ophir LOJKINE <ophir.lojkine@auto-grid.com> * fix regression where local cursor color was not updated on color change * Define the cursor as a tool * Remove the cursor tool from the UI * Throttle remote cursor updates, not local ones * Do not increment notification count on cursor move * Use only one pencil icon Use the same image for the pencil icon in the menu and the pencil cursor that appears while drawing * Add a test for the new cursor feature * only stop drawing remote cursor when using some tools and always draw local cursor * increase idle period before hiding cursor * change idle duration back and set whether a cursor should be sent when using a tool in the respective tool Co-authored-by: Robert Beach <rdbeach@gmail.com> Co-authored-by: Ophir LOJKINE <ophir.lojkine@auto-grid.com> Co-authored-by: ophir <pere.jobs@gmail.com>
2020-05-02 04:13:48 +00:00
/** Maximum messages per user over the given time period before banning them */
MAX_EMIT_COUNT: parseInt(process.env["WBO_MAX_EMIT_COUNT"]) || 192,
Add a cursor (#46) * Added cursors * Prepare cursor code for future settings to toggle cursors on or off. Let cursor be the color the person has currently selected * fix cursor on mobile (still won't display it in most cases as there is no hover on mobile but at least it won't throw errors) * use correct size for cursor * throttle cursor update rate to dramatically improve performance by eliminating congestion * fix remote cursor size on desktop * show own cursor by default and renove offset * use svg as mouse cursor for pencil to be able to apply a reduced opacity to it and view our cursor * don't throttle local cursor * throttle local cursor at an independent higher rate. This could be made user adjustable for low power devices * remove let and const from client-side code * get emit count and emit count period from configuration * reduce network cursor updates a lot to prevent instantly getting banned with the current defaults * prevent eraser from deleting cursors * use group inside of svg as drawing area and only delete elements inside it with the eraser * use transform: translate to move cursors around instead of manipulating x and y directly * fix: add socket ids to cursor messages * fix incorrect remote cursor scaling and make local cursor visible again after it has been moved after being hidden due to inactivity * create cursors in a proper fashion and keep them in a separate group * scaling has been fixed in a1a5580 * move duplicated cursor creation code to function * show cursors above content * pass some of ther server configuration through to the client * fix bug introduced in a833ce9 * allocate at most half of the allowed traffic to cursor updates * remove debugging leftover * use feature detection instead of ua sniffing Co-Authored-By: Ophir LOJKINE <ophir.lojkine@auto-grid.com> * fix regression where local cursor color was not updated on color change * Define the cursor as a tool * Remove the cursor tool from the UI * Throttle remote cursor updates, not local ones * Do not increment notification count on cursor move * Use only one pencil icon Use the same image for the pencil icon in the menu and the pencil cursor that appears while drawing * Add a test for the new cursor feature * only stop drawing remote cursor when using some tools and always draw local cursor * increase idle period before hiding cursor * change idle duration back and set whether a cursor should be sent when using a tool in the respective tool Co-authored-by: Robert Beach <rdbeach@gmail.com> Co-authored-by: Ophir LOJKINE <ophir.lojkine@auto-grid.com> Co-authored-by: ophir <pere.jobs@gmail.com>
2020-05-02 04:13:48 +00:00
/** Duration after which the emit count is reset in miliseconds */
MAX_EMIT_COUNT_PERIOD:
parseInt(process.env["WBO_MAX_EMIT_COUNT_PERIOD"]) || 4096,
/** Blocked Tools. A comma-separated list of tools that should not appear on boards. */
BLOCKED_TOOLS: (process.env["WBO_BLOCKED_TOOLS"] || "").split(","),
/** Selection Buttons. A comma-separated list of selection buttons that should not be available. */
BLOCKED_SELECTION_BUTTONS: (process.env["WBO_BLOCKED_SELECTION_BUTTONS"] || "").split(","),
/** Automatically switch to White-out on finger touch after drawing
with Pencil using a stylus. Only supported on iPad with Apple Pencil. */
AUTO_FINGER_WHITEOUT: process.env["AUTO_FINGER_WHITEOUT"] !== "disabled",
/** If this variable is set, it should point to a statsd listener that will
* receive WBO's monitoring information.
* example: udp://127.0.0.1
*/
STATSD_URL: process.env["STATSD_URL"],
2022-01-04 16:03:48 +00:00
/** Secret key for jwt */
AUTH_SECRET_KEY: (process.env["AUTH_SECRET_KEY"] || ""),
2022-09-03 09:01:24 +00:00
};