Skip to content

Commit e40f591

Browse files
committed
fix: options page
1 parent d8274f9 commit e40f591

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

src/pages/background/request-handler/web-request-handler.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ class WebRequestHandler {
9595
private loadPrefs() {
9696
emitter.on(emitter.EVENT_PREFS_UPDATE, (key: string, val: any) => {
9797
switch (key) {
98-
case 'exclude-he':
99-
this.excludeHe = val;
100-
break;
10198
case 'disable-all':
10299
this.disableAll = val;
103100
break;
@@ -113,7 +110,6 @@ class WebRequestHandler {
113110
});
114111

115112
prefs.ready(() => {
116-
this.excludeHe = Boolean(prefs.get('exclude-he'));
117113
this.disableAll = Boolean(prefs.get('disable-all'));
118114
this.includeHeaders = Boolean(prefs.get('include-headers'));
119115
this.modifyBody = Boolean(prefs.get('modify-body'));

src/pages/options/sections/options/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { defaultPrefValue } from '@/share/core/constant';
55
import emitter from '@/share/core/emitter';
66
import { prefs } from '@/share/core/prefs';
77
import type { PrefValue } from '@/share/core/types';
8-
import { t } from '@/share/core/utils';
8+
import { IS_SUPPORT_STREAM_FILTER, t } from '@/share/core/utils';
99
import Api from '@/share/pages/api';
1010

1111
interface OptionsProps {
@@ -17,27 +17,25 @@ interface OptionsState {
1717
}
1818

1919
const prefItems: {
20-
[key: string]: { langKey: string; type: 'switch' | 'select'; optionList?: Array<{ label: string; value: string }> };
20+
[key: string]: { langKey: string; type: 'switch' | 'select'; optionList?: Array<{ label: string; value: string }>; disabled?: boolean };
2121
} = {
2222
'manage-collapse-group': {
2323
langKey: 'manage_collapse_group',
2424
type: 'switch',
2525
},
26-
'exclude-he': {
27-
langKey: 'rules_no_effect_for_he',
28-
type: 'switch',
29-
},
3026
'show-common-header': {
3127
langKey: 'display_common_header',
3228
type: 'switch',
3329
},
3430
'include-headers': {
3531
langKey: 'include_header_in_custom_function',
3632
type: 'switch',
33+
disabled: !ENABLE_EVAL,
3734
},
3835
'modify-body': {
3936
langKey: 'modify_body',
4037
type: 'switch',
38+
disabled: !IS_SUPPORT_STREAM_FILTER,
4139
},
4240
'is-debug': {
4341
langKey: 'debug_mode_enable',
@@ -161,9 +159,10 @@ export default class Options extends React.Component<OptionsProps, OptionsState>
161159
optionList={item.optionList}
162160
onChange={(v) => this.handleChange(key, v)}
163161
value={this.state.prefs[key]}
162+
disabled={item.disabled}
164163
/>
165164
) : (
166-
<Switch checked={this.state.prefs[key]} onChange={(v) => this.handleChange(key, Boolean(v))} />
165+
<Switch checked={this.state.prefs[key]} onChange={(v) => this.handleChange(key, Boolean(v))} disabled={item.disabled} />
167166
)
168167
}
169168
/>

0 commit comments

Comments
 (0)