Add tag_privacy_violator setting and add it to preferences.py

This commit is contained in:
SepehrRasouli 2022-09-09 10:52:08 +04:30
parent d8fdfcc7b3
commit 6a5bb59099
No known key found for this signature in database
GPG Key ID: 24DAE84A8F63790E
3 changed files with 23 additions and 0 deletions

View File

@ -389,6 +389,16 @@ class Preferences:
'2': 2
}
),
'tag_privacy_violators': MapSetting(
settings['search'].get('tag_privacy_violators',False),
is_locked('tag_privacy_violators'),
map={
'0': False,
'1': True,
'False': False,
'True': True
}
),
'theme': EnumStringSetting(
settings['ui'].get('default_theme', 'oscar'),
is_locked('theme'),
@ -413,6 +423,7 @@ class Preferences:
settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'),
is_locked('oscar-style'),
choices=['', 'logicodev', 'logicodev-dark', 'pointhi']),
''
'advanced_search': MapSetting(
settings['ui'].get('advanced_search', False),
is_locked('advanced_search'),

View File

@ -20,6 +20,7 @@ search:
ban_time_on_fail : 5 # ban time in seconds after engine errors
max_ban_time_on_fail : 120 # max ban time in seconds after engine errors
prefer_configured_language: False # increase weight of results in confiugred language in ranking
tag_privacy_violators: False # tag privacy violators, disabled by default.
server:
port : 8888

View File

@ -150,6 +150,17 @@
{{ preferences_item_footer(info, label, rtl) }}
{% endif %}
{% if 'tag_privacy_violators' not in locked_preferences %}
{% set label = _('Tag privacy violators') %}
{% set info = _('Tag websites that are behind Cloudflare and other privacy violators') %}
{{ preferences_item_header(info, label, rtl, 'tag_privacy_violators') }}
<select class="form-control {{ custom_select_class(rtl) }}" name="tag_privacy_violators" id="tag_privacy_violators">
<option value="1" {% if tag_privacy_violators %}selected="selected"{% endif %}>{{ _('On') }}</option>
<option value="0" {% if not tag_privacy_violators %}selected="selected"{% endif %}>{{ _('Off')}}</option>
</select>
{{ preferences_item_footer(info, label, rtl) }}
{% endif %}
{% if 'autofocus' not in locked_preferences %}
{% set label = _('Autofocus search field') %}
{% set info = _('Turn off if you use your keyboard to scroll') %}