mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2025-07-16 19:22:32 +03:00
Preclude kitchen configs from mutation
This commit is contained in:
parent
b77f0c85e9
commit
df09b7e0ec
|
@ -12,8 +12,7 @@
|
||||||
const ifIncontinence = 'if-incontinence';
|
const ifIncontinence = 'if-incontinence';
|
||||||
const modsKey = 'mods';
|
const modsKey = 'mods';
|
||||||
|
|
||||||
// Don't keep objects in defaults or at least freeze them!
|
const getDefaultConfigs () => {// Configs user may mutate them and we don't care!
|
||||||
const configs = {
|
|
||||||
|
|
||||||
ifProxyHttpsUrlsOnly: {
|
ifProxyHttpsUrlsOnly: {
|
||||||
dflt: false,
|
dflt: false,
|
||||||
|
@ -93,6 +92,7 @@
|
||||||
|
|
||||||
const getDefaults = function getDefaults() {
|
const getDefaults = function getDefaults() {
|
||||||
|
|
||||||
|
const configs = getDefaultConfigs();
|
||||||
return Object.keys(configs).reduce((acc, key) => {
|
return Object.keys(configs).reduce((acc, key) => {
|
||||||
|
|
||||||
acc[key] = configs[key].dflt;
|
acc[key] = configs[key].dflt;
|
||||||
|
@ -123,6 +123,7 @@
|
||||||
const getOrderedConfigsForUser = function getOrderedConfigs(category) {
|
const getOrderedConfigsForUser = function getOrderedConfigs(category) {
|
||||||
|
|
||||||
const pacMods = getCurrentConfigs();
|
const pacMods = getCurrentConfigs();
|
||||||
|
const configs = getDefaultConfigs();
|
||||||
return Object.keys(configs)
|
return Object.keys(configs)
|
||||||
.sort((keyA, keyB) => configs[keyA].order - configs[keyB].order)
|
.sort((keyA, keyB) => configs[keyA].order - configs[keyB].order)
|
||||||
.reduce((arr, key) => {
|
.reduce((arr, key) => {
|
||||||
|
@ -144,6 +145,7 @@
|
||||||
const createPacModifiers = function createPacModifiers(mods = {}) {
|
const createPacModifiers = function createPacModifiers(mods = {}) {
|
||||||
|
|
||||||
mods = mods || {}; // null?
|
mods = mods || {}; // null?
|
||||||
|
const configs = getDefaultConfigs();
|
||||||
const ifNoMods = Object.keys(configs)
|
const ifNoMods = Object.keys(configs)
|
||||||
.every((dProp) => {
|
.every((dProp) => {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user