diff --git a/admin/upload.html b/admin/upload.html index 83b6c67..5bbb16d 100644 --- a/admin/upload.html +++ b/admin/upload.html @@ -26,7 +26,7 @@ const segment = urlParams.get('segment'); if (!question && !syllabus && !segment) window.location.href = '/admin'; const inputElement = document.querySelector('input[type="file"]'); - const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : 'http://localhost:5000'; + const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : `http://${document.domain}:5000`; FilePond.registerPlugin(FilePondPluginFileValidateType); const pond = FilePond.create(inputElement, { server: domain + ((question) ? '/upload' : (segment) ? '/speedModeUpload' : '/syllabus'), diff --git a/src/checker/admin.js b/src/checker/admin.js index 5ed6959..70b8e25 100644 --- a/src/checker/admin.js +++ b/src/checker/admin.js @@ -1,6 +1,6 @@ import * as ui from "/src/modules/ui.js"; -const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : 'http://localhost:5000'; +const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : `http://${document.domain}:5000`; if (window.location.pathname.split('?')[0].endsWith('/admin')) window.location.pathname = '/admin/'; var courses = []; diff --git a/src/checker/checker.js b/src/checker/checker.js index 3404449..3295793 100644 --- a/src/checker/checker.js +++ b/src/checker/checker.js @@ -7,7 +7,7 @@ import { getPeriod } from "/src/periods/periods"; import { convertLatexToAsciiMath, convertLatexToMarkup, renderMathInElement } from "mathlive"; ``; -const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : 'http://localhost:5000'; +const domain = ((window.location.hostname.search('check') != -1) || (window.location.hostname.search('127') != -1)) ? 'https://api.check.vssfalcons.com' : `http://${document.domain}:5000`; const segments = document.getElementById("segment-input"); const segmentInput = document.getElementById("segment-input"); const questions = document.getElementById("question-input"); diff --git a/src/modules/storage.js b/src/modules/storage.js index b6879a4..bd9215c 100644 --- a/src/modules/storage.js +++ b/src/modules/storage.js @@ -41,9 +41,6 @@ class Storage { const cookieData = getCookie(this.id); if (cookieData) { localStorage.setItem(this.id, cookieData); - console.log(`Synchronized localStorage with cookie data: ${cookieData}`); - } else { - console.log(`No cookie data found for id: ${this.id}`); } } } @@ -55,9 +52,7 @@ function setCookie(name, value, days) { date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toUTCString(); } - const domain = ".vssfalcons.com"; - document.cookie = name + "=" + (value || "") + expires + "; path=/; domain=" + domain; - console.log(`Set cookie: ${name}=${value}; domain=${domain}`); + document.cookie = `${name}=${(value || "")}${expires}; path=/; domain=.${document.domain}`; } function getCookie(name) { @@ -71,4 +66,4 @@ function getCookie(name) { return null; } -export default new Storage("virtual-checker-2"); \ No newline at end of file +export default new Storage("virtual-falcons");