aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-09-13 16:56:44 +0200
committerWojtek Kosior <koszko@koszko.org>2021-09-13 16:56:44 +0200
commit2bd35bc4b0d32b70320b06d932db90e75e89373e (patch)
treed38333de0b9cf54d31d35812784aeca367bea42e /content
parent947fbdefffe0f6010e32abbfdce2f4b388d3f7f7 (diff)
downloadbrowser-extension-2bd35bc4b0d32b70320b06d932db90e75e89373e.tar.gz
browser-extension-2bd35bc4b0d32b70320b06d932db90e75e89373e.zip
rename the extension to "Haketilo"
Diffstat (limited to 'content')
-rw-r--r--content/activity_info_server.js7
-rw-r--r--content/main.js22
-rw-r--r--content/page_actions.js6
-rw-r--r--content/repo_query.js5
4 files changed, 23 insertions, 17 deletions
diff --git a/content/activity_info_server.js b/content/activity_info_server.js
index 1b69703..d1dfe36 100644
--- a/content/activity_info_server.js
+++ b/content/activity_info_server.js
@@ -1,7 +1,8 @@
/**
- * part of Hachette
- * Informing about activities performed by content script (script injection,
- * script blocking).
+ * This file is part of Haketilo.
+ *
+ * Function: Informing the popup about what happens in the content script
+ * (script injection, script blocking, etc.).
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
diff --git a/content/main.js b/content/main.js
index 6478ea0..cec9943 100644
--- a/content/main.js
+++ b/content/main.js
@@ -1,5 +1,7 @@
/**
- * Hachette main content script run in all frames
+ * This file is part of Haketilo.
+ *
+ * Function: Main content script that runs in all frames.
*
* Copyright (C) 2021 Wojtek Kosior
* Copyright (C) 2021 jahoti
@@ -33,7 +35,7 @@ function extract_cookie_policy(cookie, min_time)
let policy = null;
const extracted_signatures = [];
- for (const match of cookie.matchAll(/hachette-(\w*)=([^;]*)/g)) {
+ for (const match of cookie.matchAll(/haketilo-(\w*)=([^;]*)/g)) {
const new_result = extract_signed(...match.slice(1, 3));
if (new_result.fail)
continue;
@@ -60,7 +62,7 @@ function extract_url_policy(url, min_time)
const [base_url, payload, anchor] =
/^([^#]*)#?([^#]*)(#?.*)$/.exec(url).splice(1, 4);
- const match = /^hachette_([^_]+)_(.*)$/.exec(payload);
+ const match = /^haketilo_([^_]+)_(.*)$/.exec(payload);
if (!match)
return [null, url];
@@ -83,7 +85,7 @@ function employ_nonhttp_policy(policy)
policy.nonce = gen_nonce();
const [base_url, target] = /^([^#]*)(#?.*)$/.exec(policy.url).slice(1, 3);
const encoded_policy = encodeURIComponent(JSON.stringify(policy));
- const payload = "hachette_" +
+ const payload = "haketilo_" +
sign_data(encoded_policy, new Date().getTime()).join("_");
const resulting_url = `${base_url}#${payload}${target}`;
location.href = resulting_url;
@@ -187,7 +189,7 @@ function sanitize_meta(meta)
function sanitize_script(script)
{
- script.hachette_blocked_type = script.getAttribute("type");
+ script.haketilo_blocked_type = script.getAttribute("type");
script.type = "text/plain";
}
@@ -197,12 +199,12 @@ function sanitize_script(script)
*/
function desanitize_script(script)
{
- script.setAttribute("type", script.hachette_blocked_type);
+ script.setAttribute("type", script.haketilo_blocked_type);
- if ([null, undefined].includes(script.hachette_blocked_type))
+ if ([null, undefined].includes(script.haketilo_blocked_type))
script.removeAttribute("type");
- delete script.hachette_blocked_type;
+ delete script.haketilo_blocked_type;
}
const bad_url_reg = /^data:([^,;]*ml|unknown-content-type)/i;
@@ -235,7 +237,7 @@ function start_data_urls_sanitizing(doc)
*/
function prevent_script_execution(event)
{
- if (!event.target._hachette_payload)
+ if (!event.target.haketilo_payload)
event.preventDefault();
}
@@ -336,7 +338,7 @@ if (!is_privileged_url(document.URL)) {
let signatures;
[policy, signatures] = extract_cookie_policy(document.cookie, min_time);
for (const signature of signatures)
- document.cookie = `hachette-${signature}=; Max-Age=-1;`;
+ document.cookie = `haketilo-${signature}=; Max-Age=-1;`;
} else {
const scheme = /^([^:]*)/.exec(document.URL)[1];
const known_scheme = ["file", "ftp"].includes(scheme);
diff --git a/content/page_actions.js b/content/page_actions.js
index 040b4ab..db7c352 100644
--- a/content/page_actions.js
+++ b/content/page_actions.js
@@ -1,5 +1,7 @@
/**
- * Hachette handling of page actions in content scripts
+ * This file is part of Haketilo.
+ *
+ * Function: Handle page actions in a content script.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.
@@ -60,7 +62,7 @@ function add_script(script_text)
let script = document.createElement("script");
script.textContent = script_text;
script.setAttribute("nonce", nonce);
- script._hachette_payload = true;
+ script.haketilo_payload = true;
document.body.appendChild(script);
report_script(script_text);
diff --git a/content/repo_query.js b/content/repo_query.js
index 3708108..637282c 100644
--- a/content/repo_query.js
+++ b/content/repo_query.js
@@ -1,6 +1,7 @@
/**
- * part of Hachette
- * Getting available content for site from remote repositories.
+ * This file is part of Haketilo.
+ *
+ * Function: Getting available content for site from remote repositories.
*
* Copyright (C) 2021 Wojtek Kosior
* Redistribution terms are gathered in the `copyright' file.