Hacking searx

This revision is from 2024/08/07 04:33. You can Restore it.

In no specific order...

I want to add a new checkbox for the custom_option. I direct preferences.html to the the preferences folder and then add a new template for the option.

Update the preferences UI: searx/templates/preferences/custom_option.html, simply copy center_alignment.html and rename it to custom_option.html for this exercise.

<fieldset>{{- '' -}}

<legend id="pref_custom_option">{{ _('Custom Option Language') }}</legend>{{- '' -}}

<p class="value">{{- '' -}}

<input type="checkbox" {{- ' ' -}}

name="custom_option" {{- ' ' -}}

aria-labelledby="pref_custom_option" {{- ' ' -}}

class="checkbox-onoff" {{- ' ' -}}

{%- if preferences.get_value('custom_option') -%}

checked

{%- endif -%}{{- ' ' -}}

/>{{- '' -}}

</p>{{- '' -}}

<div class="description">

{{- _('Displays my cock (Oscar layout).') -}}

</div>{{- '' -}}

</fieldset>{{- '' -}}

Add the custom template to preferences.html: searx/templates/preferences.html, for example line 197 slot in...

{%- if 'custom_option' not in locked_preferences -%}

{%- include 'simple/preferences/custom_option.html' -%}

{%- endif -%}

Open searx/preferences.py and add a new preference say on line 450

'custom_option': BooleanSetting(

settings['ui']['custom_option'],

locked=is_locked('custom_option')

),

Add the setting in settings.yaml... line 131

custom_option: false

Open searx/settings_defaults.py on Line 199 add...

        

'custom_option': SettingsValue(bool, False),

Open searx/webapp.py on Line 396 add...

kwargs['custom_option'] = request.preferences.get_value('custom_option')

  

📝 📜 ⏱️ ⬆️