@@ -5,7 +5,7 @@ import { defaultPrefValue } from '@/share/core/constant';
55import emitter from '@/share/core/emitter' ;
66import { prefs } from '@/share/core/prefs' ;
77import type { PrefValue } from '@/share/core/types' ;
8- import { t } from '@/share/core/utils' ;
8+ import { IS_SUPPORT_STREAM_FILTER , t } from '@/share/core/utils' ;
99import Api from '@/share/pages/api' ;
1010
1111interface OptionsProps {
@@ -17,27 +17,25 @@ interface OptionsState {
1717}
1818
1919const 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