feat: config option to choose default field: search or URL

This commit is contained in:
DarkCat09 2024-09-06 18:08:33 +04:00
parent 40b908d5b1
commit 3e3ce025da
No known key found for this signature in database
GPG Key ID: BD3CE9B65916CD82
3 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,8 @@ IMG_COMPRESS=true # enable image compressing; proxy_res is required
## Documentation
SWAGGER=false # whether to add API docs route
SEARCH_BY_DEFAULT=false # whether to show search instead of URL field
## Third-party
SEARX_URL="https://searx.dc09.ru" # SearXNG base URL, enables search.
WEBDER_URL="http://webder.example.com" # WebDer base URL, enables browser rendering.

View File

@ -7,6 +7,7 @@ class EnvConfig {
public readonly reverse_proxy: boolean;
public readonly proxy: ProxyConfig;
public readonly swagger: boolean;
public readonly search_by_default: boolean;
public readonly third_party: ThirdPartyConfig;
constructor() {
@ -26,6 +27,8 @@ class EnvConfig {
this.swagger = this.parseBool(process.env.SWAGGER, false);
this.search_by_default = this.parseBool(process.env.SEARCH_BY_DEFAULT, false);
this.third_party = {
searx_url: process.env.SEARX_URL,
webder_url: process.env.WEBDER_URL,

View File

@ -4,7 +4,7 @@
if (search) {
%>
<input type="checkbox" id="switch-search" checked>
<input type="checkbox" id="switch-search" <%= config.env.search_by_default ? "checked" : "" %>>
<label for="switch-search" class="switch-label">
<span>URL</span>