Merge pull request #224 from TxtDot/url-field-fix
feat: config option to choose default field, autofocus
This commit is contained in:
commit
0d9b6b8ef6
@ -15,6 +15,8 @@ IMG_COMPRESS=true # enable image compressing; proxy_res is required
|
|||||||
## Documentation
|
## Documentation
|
||||||
SWAGGER=false # whether to add API docs route
|
SWAGGER=false # whether to add API docs route
|
||||||
|
|
||||||
|
SEARCH_BY_DEFAULT=false # whether to show search instead of URL field
|
||||||
|
|
||||||
## Third-party
|
## Third-party
|
||||||
SEARX_URL="https://searx.dc09.ru" # SearXNG base URL, enables search.
|
SEARX_URL="https://searx.dc09.ru" # SearXNG base URL, enables search.
|
||||||
WEBDER_URL="http://webder.example.com" # WebDer base URL, enables browser rendering.
|
WEBDER_URL="http://webder.example.com" # WebDer base URL, enables browser rendering.
|
||||||
|
@ -7,6 +7,7 @@ class EnvConfig {
|
|||||||
public readonly reverse_proxy: boolean;
|
public readonly reverse_proxy: boolean;
|
||||||
public readonly proxy: ProxyConfig;
|
public readonly proxy: ProxyConfig;
|
||||||
public readonly swagger: boolean;
|
public readonly swagger: boolean;
|
||||||
|
public readonly search_by_default: boolean;
|
||||||
public readonly third_party: ThirdPartyConfig;
|
public readonly third_party: ThirdPartyConfig;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -26,6 +27,11 @@ class EnvConfig {
|
|||||||
|
|
||||||
this.swagger = this.parseBool(process.env.SWAGGER, false);
|
this.swagger = this.parseBool(process.env.SWAGGER, false);
|
||||||
|
|
||||||
|
this.search_by_default = this.parseBool(
|
||||||
|
process.env.SEARCH_BY_DEFAULT,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
this.third_party = {
|
this.third_party = {
|
||||||
searx_url: process.env.SEARX_URL,
|
searx_url: process.env.SEARX_URL,
|
||||||
webder_url: process.env.WEBDER_URL,
|
webder_url: process.env.WEBDER_URL,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
if (search) {
|
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">
|
<label for="switch-search" class="switch-label">
|
||||||
<span>URL</span>
|
<span>URL</span>
|
||||||
@ -13,7 +13,7 @@ if (search) {
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<form action="/search" method="get" class="input-grid main-form-search">
|
<form action="/search" method="get" class="input-grid main-form-search">
|
||||||
<%- include("./search-form.ejs") %>
|
<%- include("./search-form.ejs", {focus: true}) %>
|
||||||
</form>
|
</form>
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ if (search) {
|
|||||||
|
|
||||||
<form action="/get" method="get" class="input-grid <%= search ? "main-form-url" : "" %>">
|
<form action="/get" method="get" class="input-grid <%= search ? "main-form-url" : "" %>">
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" name="url" id="url" placeholder="URL">
|
<input type="text" name="url" id="url" placeholder="URL" autofocus>
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="submit" id="submit" class="button" value="Parse">
|
<input type="submit" id="submit" class="button" value="Parse">
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<input type="text" name="q" id="search" placeholder="Search">
|
<input type="text" name="q" id="search" placeholder="Search" <%= locals.focus ? "autofocus" : "" %>>
|
||||||
<input class="button" type="submit" value="Go"/>
|
<input class="button" type="submit" value="Go" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user