// To tweak only if your webserver is shared with other conflicting resources at / (e.g. Yunohost integration)
APP_PATH: "",
+ // The API entry point. Default value: APP_PATH + '/:trivabble'
+ API_ENTRY_POINT: "/:trivabble",
+
// The color of the flash light when double clicking on a cell
FLASH_LIGHT_COLOR: "#EE6633",
setConf("FLASH_LIGHT_DURATIONS", [800, 1600, 3200]);
setConf("FLASH_LIGHT_DURATION", middle("FLASH_LIGHT_DURATIONS"));
setConf("FLASH_LIGHT_COLOR", "#ee6633");
+ setConf("API_ENTRY_POINT", Conf.APP_PATH + "/:trivabble");
function getSetting(key) {
let type;
let serverVersion = 0;
- // HTTP path url prefix for any socket (xhr,ess or ws) from browser to server access
- function getApiEntryPoint() {
- return Conf.APP_PATH + "/:trivabble";
- }
-
function mouseDown(ele, fun, stop) {
const meth = stop ? "removeEventListener" : "addEventListener";
ele[meth]("mousedown", fun, false);
closeConnections();
pollingServer = true;
- eventSource = new EventSource(getApiEntryPoint() + "/sse/" + JSON.stringify(cmdsWithContext()));
+ eventSource = new EventSource(Conf.API_ENTRY_POINT + "/sse/" + JSON.stringify(cmdsWithContext()));
bindConnectionEvents(eventSource);
return;
}
webSocket = new WebSocket(
(window.location.protocol === "http:" ? "ws://" : "wss://") +
window.location.host +
- getApiEntryPoint() + "/ws/" +
+ Conf.API_ENTRY_POINT + "/ws/" +
JSON.stringify(cmdsWithContext())
);
function xhrRequest(data, onreadystatechange) {
const xhr = new XMLHttpRequest();
- xhr.open("POST", getApiEntryPoint(), true);
+ xhr.open("POST", Conf.API_ENTRY_POINT, true);
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.send(JSON.stringify(data));