Revision 9d825eaa
Added by koszko over 1 year ago
| background/patterns_query_manager.js | ||
|---|---|---|
| 49 | 49 |
#FROM common/browser.js IMPORT browser |
| 50 | 50 |
#ENDIF |
| 51 | 51 |
|
| 52 |
let default_allow = {};
|
|
| 53 |
#EXPORT default_allow |
|
| 54 |
|
|
| 52 | 55 |
let secret; |
| 53 | 56 |
|
| 54 | 57 |
const tree = pqt.make(); |
| ... | ... | |
| 72 | 75 |
script_update_needed = false; |
| 73 | 76 |
|
| 74 | 77 |
const code = `\ |
| 75 |
this.haketilo_secret = ${secret};
|
|
| 76 |
this.haketilo_pattern_tree = ${JSON.stringify(tree)};
|
|
| 78 |
this.haketilo_secret = ${JSON.stringify(secret)};
|
|
| 79 |
this.haketilo_pattern_tree = ${JSON.stringify(tree)};
|
|
| 80 |
this.haketilo_default_allow = ${JSON.stringify(default_allow.value)};
|
|
| 77 | 81 |
if (this.haketilo_content_script_main) |
| 78 | 82 |
haketilo_content_script_main();`; |
| 79 | 83 |
|
| ... | ... | |
| 151 | 155 |
initial_mappings.forEach(m => register("mappings", m));
|
| 152 | 156 |
initial_blocking.forEach(b => register("blocking", b));
|
| 153 | 157 |
|
| 158 |
const set_allow_val = ch => default_allow.value = (ch.new_val || {}).value;
|
|
| 159 |
const [setting_tracking, initial_settings] = |
|
| 160 |
await haketilodb.track.settings(set_allow_val); |
|
| 161 |
for (const setting of initial_settings) {
|
|
| 162 |
if (setting.name === "default_allow") |
|
| 163 |
Object.assign(default_allow, setting); |
|
| 164 |
} |
|
| 165 |
|
|
| 154 | 166 |
#IF MOZILLA || MV3 |
| 155 | 167 |
script_update_needed = true; |
| 156 | 168 |
await update_content_script(); |
Also available in: Unified diff
add new root content script