Remove useless compatibility check

The consequences of opening the file outside the extension is 
self-reinforcing.
This commit is contained in:
buzzcode2007 2024-03-23 17:51:37 +08:00
parent 0f7e461195
commit 9334f2c59d
2 changed files with 0 additions and 38 deletions

View file

@ -1,37 +0,0 @@
/* compat.js
You shouldn't be opening the HTMLs elsewhere. */
// Import modules.
import texts from "./read.JS";
// Initialize browser data.
let browser_data = {};
function refresh() {
/* Update variable containing the browser data.
Returns: (dict) the updated browser data
*/
browser_data.URL = window.location.href;
return (browser_data.URL);
}
export default class compat {
static restrict() {
/* Restrict pages containing this function from being loaded outside the extension.
Returns: (bool) page open is correct
*/
refresh();
const browser_extension_URL_contents = new RegExp(`^(?!file:\/\/|http:\/\/|https:\/\/)(.*-extension:\/\/.*)`);
const browser_condition_met = browser_extension_URL_contents.test(browser_data.URL);
if (!browser_condition_met) {
alert(texts.universal(`invalid_open`));
}
return (browser_condition_met);
}
}

View file

@ -3,7 +3,6 @@
*/ */
// Import modules. // Import modules.
import compat from "./compat.js";
import texts from "./read.JS"; import texts from "./read.JS";
// Call the main function. // Call the main function.