1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Merge pull request #174 from searxng/static_script

[mod] add make targets to manage the build files in the /searx/static directory
This commit is contained in:
Alexandre Flament 2021-06-28 10:53:32 +02:00 committed by GitHub
commit 30e4a2a224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 288 additions and 158 deletions

View File

@ -58,15 +58,16 @@ test.shell:
dockerfiles/docker-entrypoint.sh
$(Q)shellcheck -x -s bash \
utils/brand.env \
./manage \
$(MTOOLS) \
utils/lib.sh \
utils/lib_static.sh \
utils/filtron.sh \
utils/searx.sh \
utils/morty.sh \
utils/lxc.sh \
utils/lxc-searx.env \
.config.sh
$(Q)./manage build_msg TEST "$@ OK"
$(Q)$(MTOOLS) build_msg TEST "$@ OK"
# wrap ./manage script
@ -83,12 +84,14 @@ MANAGE += pyenv pyenv.install pyenv.uninstall
MANAGE += pypi.upload pypi.upload.test
MANAGE += test.yamllint test.pylint test.pep8 test.unit test.coverage test.robot test.clean
MANAGE += themes.all themes.oscar themes.simple pygments.less
MANAGE += static.build.commit static.build.drop static.build.restore
PHONY += $(MANAGE)
$(MANAGE):
$(Q)$(MTOOLS) $@
# deprecated
PHONY += docs docs-clean docs-live docker themes

View File

@ -29,7 +29,7 @@ If you implement themes, you will need to compile styles and JavaScript before
.. code:: sh
make themes
make themes.all
Don't forget to install npm_ first.
@ -53,3 +53,24 @@ Don't forget to install npm_ first.
sudo -H dnf install npm
If you finished your *tests* you can start to commit your changes. To separate
the changed code from the build products first run:
.. code:: sh
make static.build.restore
This will restore the old build products and only your changes of the code
remain in the working tree which can now be added & commited. When all sources
are commited, you can commit the build products simply by:
.. code:: sh
make static.build.commit
Commiting the build products should be the last step, just before you send us
your PR. There is also a make target to rewind this last build commit:
.. code:: sh
make static.build.drop

28
manage
View File

@ -9,6 +9,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils/lib.sh"
source "${REPO_ROOT}/utils/brand.env"
source_dot_config
# shellcheck source=utils/lib_static.sh
source "$(dirname "${BASH_SOURCE[0]}")/utils/lib_static.sh"
# config
PYOBJECTS="searx"
@ -42,53 +45,54 @@ PYLINT_OPTIONS="-m pylint -j 0 --rcfile .pylintrc"
help() {
cat <<EOF
buildenv
buildenv:
rebuild ./utils/brand.env
babel.compile
babel.compile:
pybabel compile ./searx/translations
data.*
data.:
all : update searx/languages.py and ./data/*
languages : update searx/data/engines_languages.json & searx/languages.py
useragents: update searx/data/useragents.json with the most recent versions of Firefox.
docs.*
docs.:
html : build HTML documentation
live : autobuild HTML documentation while editing
gh-pages : deploy on gh-pages branch
prebuild : build reST include files (./${DOCS_BUILD}/includes)
clean : clean documentation build
docker
docker.:
build : build docker image
push : build and push docker image
gecko.driver
gecko.driver:
download & install geckodriver if not already installed (required for
robot_tests)
node.*
node.:
env : download & install npm dependencies locally
clean : drop npm installations
py.*
py.:
build : Build python packages at ./${PYDIST}
clean : delete virtualenv and intermediate py files
pyenv.* :
pyenv.:
install : developer install of searx into virtualenv
uninstall : uninstall developer installation
cmd ... : run command ... in virtualenv
OK : test if virtualenv is OK
pypi.upload:
Upload python packages to PyPi (to test use pypi.upload.test)
test.* :
test.:
pylint : lint PYLINT_FILES, searx/engines, searx & tests
pep8 : pycodestyle (pep8) for all files except PYLINT_FILES
unit : run unit tests
coverage : run unit tests with coverage
robot : run robot test
clean : clean intermediate test stuff
themes.* :
themes.:
all : build all themes
oscar : build oscar theme
simple : build simple theme
pygments.* :
pygments.:
less : build LESS files for pygments
EOF
static_help
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,6 @@ module.exports = function(grunt) {
uglify: {
options: {
sourceMap: true,
banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
},
dist: {
files: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
/*! searx | 22-06-2021 | https://github.com/searxng/searxng */
/*
* searx, A privacy-respecting, hackable metasearch engine
*
@ -1239,11 +1238,11 @@ tr:hover {
background: #ececec;
}
div.selectable_url {
display: block;
border: 1px solid #888;
padding: 4px;
color: #444;
width: 100%;
display: block;
margin: 0.1em;
overflow: hidden;
height: 1.2em;
@ -1263,7 +1262,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1271,7 +1270,7 @@ div.selectable_url pre {
background: #fae1e1;
border-color: #db3434;
}
.dialog-error:before {
.dialog-error::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1313,7 +1312,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1321,7 +1320,7 @@ div.selectable_url pre {
background: #faf5e1;
border-color: #dbba34;
}
.dialog-warning:before {
.dialog-warning::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1363,7 +1362,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1377,7 +1376,7 @@ div.selectable_url pre {
margin: 0 50% 0 0;
box-shadow: 0 0 1em;
}
.dialog-modal:before {
.dialog-modal::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1450,7 +1449,7 @@ div.selectable_url pre {
letter-spacing: 0.5px;
text-transform: uppercase;
border: solid white;
border-width: 0px 0px 2px 0;
border-width: 0 0 2px 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
@ -1552,10 +1551,10 @@ select:focus {
top: -5px;
cursor: pointer;
border-radius: 50px;
box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.3);
transition: all 0.4s ease;
left: 27px;
background-color: #3498DB;
background-color: #3498db;
}
.checkbox-onoff input[type=checkbox] {
visibility: hidden;
@ -1581,9 +1580,9 @@ select:focus {
left: 0;
background: white;
border-radius: 4px;
box-shadow: inset 0px 1px 1px white, 0px 1px 4px rgba(0, 0, 0, 0.5);
box-shadow: inset 0 1px 1px white, 0 1px 4px rgba(0, 0, 0, 0.5);
}
.checkbox label:after {
.checkbox label::after {
content: '';
width: 9px;
height: 5px;
@ -1600,8 +1599,8 @@ select:focus {
.checkbox input[type=checkbox] {
visibility: hidden;
}
.checkbox input[type=checkbox]:checked + label:after {
border-color: #3498DB;
.checkbox input[type=checkbox]:checked + label::after {
border-color: #3498db;
opacity: 1;
}
.checkbox input[disabled] + label {
@ -1620,7 +1619,7 @@ select:focus {
}
/* -- loader -- */
.loader,
.loader:after {
.loader::after {
border-radius: 50%;
width: 2em;
height: 2em;
@ -1665,9 +1664,9 @@ select:focus {
display: none;
position: absolute;
padding: 0.5rem 1rem;
margin: 0rem 0 0 2rem;
margin: 0 0 0 2rem;
border: 1px solid #ddd;
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.1);
box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.1);
background: white;
font-size: 14px;
font-weight: normal;
@ -1806,22 +1805,6 @@ td:hover .engine-tooltip,
text-align: left;
}
}
.ion-icon-big {
display: inline-block;
line-height: 1;
font-weight: normal;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 149%;
}
.ion-icon-big:before {
font-family: "ion";
}
.index {
text-align: center;
}
@ -1974,7 +1957,7 @@ td:hover .engine-tooltip,
border-bottom: 1px solid #3498DB;
border-right: none;
border-left: none;
border-radius: 0px;
border-radius: 0;
outline: none;
color: #222;
font-size: 16px;
@ -1986,10 +1969,6 @@ td:hover .engine-tooltip,
#clear_search.empty * {
display: none;
}
#q::-ms-clear,
#q::-webkit-search-cancel-button {
display: none;
}
#q,
#send_search {
display: block !important;
@ -2000,7 +1979,7 @@ td:hover .engine-tooltip,
height: 2.2em;
background: none repeat scroll 0 0 #FFF;
border: 1px solid #3498DB;
border-radius: 0px;
border-radius: 0;
outline: none;
color: #222;
font-size: 16px;
@ -2009,10 +1988,14 @@ td:hover .engine-tooltip,
#q {
outline: medium none;
padding-left: 8px;
padding-right: 0px !important;
padding-right: 0 !important;
border-right: none;
width: 40em;
}
#q::-ms-clear,
#q::-webkit-search-cancel-button {
display: none;
}
#send_search {
border-left: none;
width: 2.2em;
@ -2035,8 +2018,8 @@ td:hover .engine-tooltip,
clear: both;
}
#categories .checkbox_container {
margin-top: 2px;
margin: auto;
margin-top: 2px;
}
html.touch #main_index #categories_container,
html.touch #main_results #categories_container {
@ -2115,7 +2098,7 @@ td:hover .engine-tooltip,
display: inline-block;
position: relative;
margin: 0 3px;
padding: 0px;
padding: 0;
/* label:hover {
border-bottom: 2px solid @color-categories-item-border-unselected-hover;
} */
@ -2139,7 +2122,7 @@ td:hover .engine-tooltip,
user-select: none;
}
.category input[type="checkbox"]:focus + label {
box-shadow: 0px 0px 8px #3498DB;
box-shadow: 0 0 8px #3498db;
}
.category input[type="checkbox"]:checked + label {
background: #3498DB;
@ -2157,13 +2140,29 @@ td:hover .engine-tooltip,
opacity: 0;
transition: opacity 1s ease;
font-size: 0.8em;
text-position: center;
text-align: center;
background: white;
}
#categories_container:hover .help {
opacity: 0.8;
transition: opacity 1s ease;
}
.ion-icon-big {
display: inline-block;
line-height: 1;
font-weight: normal;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 149%;
}
.ion-icon-big:before {
font-family: "ion";
}
html {
font-family: arial, sans-serif;
font-size: 0.9em;
@ -2183,11 +2182,6 @@ main {
main {
width: 100%;
}
footer {
bottom: 0;
width: 100%;
height: 50px;
}
#main_preferences,
#main_about,
#main_stats {
@ -2512,7 +2506,7 @@ article.result-images[data-vim-selected]::before {
margin: 10px 8px 10px 8px;
border: 1px solid #ddd;
padding: 0.9em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
}
#answers h4 {
display: none;
@ -2530,8 +2524,8 @@ article.result-images[data-vim-selected]::before {
position: absolute;
top: 100px;
left: 57em;
margin: 0px 2px 5px 5px;
padding: 0px 2px 2px;
margin: 0 2px 5px 5px;
padding: 0 2px 2px;
max-width: 25em;
word-wrap: break-word;
}
@ -2540,7 +2534,7 @@ article.result-images[data-vim-selected]::before {
border: 1px solid #ddd;
padding: 0.9em;
font-size: 0.9em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
}
#sidebar .infobox h2 {
margin: 0 0 0.5em 0;
@ -2613,7 +2607,7 @@ article.result-images[data-vim-selected]::before {
margin: 0 0 0 2em;
padding: 0;
font-size: 1em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
background: white;
position: fixed;
bottom: 85px;
@ -2733,9 +2727,9 @@ article.result-images[data-vim-selected]::before {
}
#linkto_preferences {
display: none;
postion: fixed !important;
position: fixed !important;
top: 100px;
right: 0px;
right: 0;
}
#sidebar {
margin: 0 5px 2px 5px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
/*! searx | 22-06-2021 | https://github.com/searxng/searxng */
/*
* searx, A privacy-respecting, hackable metasearch engine
*
@ -1239,11 +1238,11 @@ tr:hover {
background: #ececec;
}
div.selectable_url {
display: block;
border: 1px solid #888;
padding: 4px;
color: #444;
width: 100%;
display: block;
margin: 0.1em;
overflow: hidden;
height: 1.2em;
@ -1263,7 +1262,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1271,7 +1270,7 @@ div.selectable_url pre {
background: #fae1e1;
border-color: #db3434;
}
.dialog-error:before {
.dialog-error::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1313,7 +1312,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1321,7 +1320,7 @@ div.selectable_url pre {
background: #faf5e1;
border-color: #dbba34;
}
.dialog-warning:before {
.dialog-warning::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1363,7 +1362,7 @@ div.selectable_url pre {
position: relative;
width: 70%;
padding: 1em 1em 1em 2.7em;
margin: 0em 8% 1em 8%;
margin: 0 8% 1em 8%;
border: 1px solid black;
border-radius: 4px;
text-align: left;
@ -1377,7 +1376,7 @@ div.selectable_url pre {
margin: 0 50% 0 0;
box-shadow: 0 0 1em;
}
.dialog-modal:before {
.dialog-modal::before {
position: absolute;
top: 0.5em;
left: 0.5em;
@ -1450,7 +1449,7 @@ div.selectable_url pre {
letter-spacing: 0.5px;
text-transform: uppercase;
border: solid white;
border-width: 0px 0px 2px 0;
border-width: 0 0 2px 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
@ -1552,10 +1551,10 @@ select:focus {
top: -5px;
cursor: pointer;
border-radius: 50px;
box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.3);
transition: all 0.4s ease;
left: 27px;
background-color: #3498DB;
background-color: #3498db;
}
.checkbox-onoff input[type=checkbox] {
visibility: hidden;
@ -1581,9 +1580,9 @@ select:focus {
left: 0;
background: white;
border-radius: 4px;
box-shadow: inset 0px 1px 1px white, 0px 1px 4px rgba(0, 0, 0, 0.5);
box-shadow: inset 0 1px 1px white, 0 1px 4px rgba(0, 0, 0, 0.5);
}
.checkbox label:after {
.checkbox label::after {
content: '';
width: 9px;
height: 5px;
@ -1600,8 +1599,8 @@ select:focus {
.checkbox input[type=checkbox] {
visibility: hidden;
}
.checkbox input[type=checkbox]:checked + label:after {
border-color: #3498DB;
.checkbox input[type=checkbox]:checked + label::after {
border-color: #3498db;
opacity: 1;
}
.checkbox input[disabled] + label {
@ -1620,7 +1619,7 @@ select:focus {
}
/* -- loader -- */
.loader,
.loader:after {
.loader::after {
border-radius: 50%;
width: 2em;
height: 2em;
@ -1665,9 +1664,9 @@ select:focus {
display: none;
position: absolute;
padding: 0.5rem 1rem;
margin: 0rem 0 0 2rem;
margin: 0 0 0 2rem;
border: 1px solid #ddd;
box-shadow: 2px 2px 2px 0px rgba(0, 0, 0, 0.1);
box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.1);
background: white;
font-size: 14px;
font-weight: normal;
@ -1806,22 +1805,6 @@ td:hover .engine-tooltip,
text-align: left;
}
}
.ion-icon-big {
display: inline-block;
line-height: 1;
font-weight: normal;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 149%;
}
.ion-icon-big:before {
font-family: "ion";
}
.index {
text-align: center;
}
@ -1974,7 +1957,7 @@ td:hover .engine-tooltip,
border-bottom: 1px solid #3498DB;
border-right: none;
border-left: none;
border-radius: 0px;
border-radius: 0;
outline: none;
color: #222;
font-size: 16px;
@ -1986,10 +1969,6 @@ td:hover .engine-tooltip,
#clear_search.empty * {
display: none;
}
#q::-ms-clear,
#q::-webkit-search-cancel-button {
display: none;
}
#q,
#send_search {
display: block !important;
@ -2000,7 +1979,7 @@ td:hover .engine-tooltip,
height: 2.2em;
background: none repeat scroll 0 0 #FFF;
border: 1px solid #3498DB;
border-radius: 0px;
border-radius: 0;
outline: none;
color: #222;
font-size: 16px;
@ -2009,10 +1988,14 @@ td:hover .engine-tooltip,
#q {
outline: medium none;
padding-left: 8px;
padding-right: 0px !important;
padding-right: 0 !important;
border-right: none;
width: 40em;
}
#q::-ms-clear,
#q::-webkit-search-cancel-button {
display: none;
}
#send_search {
border-left: none;
width: 2.2em;
@ -2035,8 +2018,8 @@ td:hover .engine-tooltip,
clear: both;
}
#categories .checkbox_container {
margin-top: 2px;
margin: auto;
margin-top: 2px;
}
html.touch #main_index #categories_container,
html.touch #main_results #categories_container {
@ -2115,7 +2098,7 @@ td:hover .engine-tooltip,
display: inline-block;
position: relative;
margin: 0 3px;
padding: 0px;
padding: 0;
/* label:hover {
border-bottom: 2px solid @color-categories-item-border-unselected-hover;
} */
@ -2139,7 +2122,7 @@ td:hover .engine-tooltip,
user-select: none;
}
.category input[type="checkbox"]:focus + label {
box-shadow: 0px 0px 8px #3498DB;
box-shadow: 0 0 8px #3498db;
}
.category input[type="checkbox"]:checked + label {
background: #3498DB;
@ -2157,13 +2140,29 @@ td:hover .engine-tooltip,
opacity: 0;
transition: opacity 1s ease;
font-size: 0.8em;
text-position: center;
text-align: center;
background: white;
}
#categories_container:hover .help {
opacity: 0.8;
transition: opacity 1s ease;
}
.ion-icon-big {
display: inline-block;
line-height: 1;
font-weight: normal;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 149%;
}
.ion-icon-big:before {
font-family: "ion";
}
html {
font-family: arial, sans-serif;
font-size: 0.9em;
@ -2183,11 +2182,6 @@ main {
main {
width: 100%;
}
footer {
bottom: 0;
width: 100%;
height: 50px;
}
#main_preferences,
#main_about,
#main_stats {
@ -2512,7 +2506,7 @@ article.result-images[data-vim-selected]::before {
margin: 10px 8px 10px 8px;
border: 1px solid #ddd;
padding: 0.9em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
}
#answers h4 {
display: none;
@ -2530,8 +2524,8 @@ article.result-images[data-vim-selected]::before {
position: absolute;
top: 100px;
left: 57em;
margin: 0px 2px 5px 5px;
padding: 0px 2px 2px;
margin: 0 2px 5px 5px;
padding: 0 2px 2px;
max-width: 25em;
word-wrap: break-word;
}
@ -2540,7 +2534,7 @@ article.result-images[data-vim-selected]::before {
border: 1px solid #ddd;
padding: 0.9em;
font-size: 0.9em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
}
#sidebar .infobox h2 {
margin: 0 0 0.5em 0;
@ -2613,7 +2607,7 @@ article.result-images[data-vim-selected]::before {
margin: 0 0 0 2em;
padding: 0;
font-size: 1em;
box-shadow: 0px 0px 5px #CCC;
box-shadow: 0 0 5px #ccc;
background: white;
position: fixed;
bottom: 85px;
@ -2733,9 +2727,9 @@ article.result-images[data-vim-selected]::before {
}
#linkto_preferences {
display: none;
postion: fixed !important;
position: fixed !important;
top: 100px;
right: 0px;
right: 0;
}
#sidebar {
margin: 0 5px 2px 5px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -71,7 +71,6 @@ module.exports = function(grunt) {
},
uglify: {
options: {
banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n',
output: {
comments: 'some'
},
@ -156,7 +155,6 @@ module.exports = function(grunt) {
development: {
options: {
paths: ["less"],
banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
},
files: {
"css/searx.css": "src/less/style.less",
@ -173,7 +171,6 @@ module.exports = function(grunt) {
sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';},
outputSourceFiles: false,
sourceMapRootpath: '../',
banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
},
files: {
"css/searx.min.css": "src/less/style.less",

View File

@ -1,4 +1,2 @@
/*! simple/searx.min.js | 22-06-2021 | https://github.com/searxng/searxng */
(function(t,e){"use strict";var a=e.currentScript||function(){var t=e.getElementsByTagName("script");return t[t.length-1]}();t.searx={touch:"ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch||false,method:a.getAttribute("data-method"),autocompleter:a.getAttribute("data-autocompleter")==="true",search_on_category_select:a.getAttribute("data-search-on-category-select")==="true",infinite_scroll:a.getAttribute("data-infinite-scroll")==="true",static_path:a.getAttribute("data-static-path"),translations:JSON.parse(a.getAttribute("data-translations"))};e.getElementsByTagName("html")[0].className=t.searx.touch?"js touch":"js"})(window,document);
//# sourceMappingURL=searx.head.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"searx.head.min.js","sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":";;CAiBA,SAAUA,EAAGC,gBAIT,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX"}
{"version":3,"file":"searx.head.min.js","sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":"CAiBA,SAAUA,EAAGC,gBAIT,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

124
utils/lib_static.sh Executable file
View File

@ -0,0 +1,124 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-or-later
STATIC_BUILD_COMMIT="[build] /static"
STATIC_BUILT_PATHS=(
searx/static/themes/oscar/css
searx/static/themes/oscar/js
searx/static/themes/oscar/src/generated/pygments-logicodev.less
searx/static/themes/oscar/src/generated/pygments-pointhi.less
searx/static/themes/simple/css
searx/static/themes/simple/js
searx/static/themes/simple/src/generated/pygments.less
)
static_help(){
cat <<EOF
static.build.: ${STATIC_BUILD_COMMIT}
commit : build & commit /static folder
drop : drop last commit if it was previously done by static.build.commit
restore : git restore of the /static folder (after themes.all)
EOF
}
is.static.build.commit() {
local commit_sha="$1"
local commit_message
local commit_files
# check commit message
commit_message=$(git show -s --format=%s "${commit_sha}")
if [ "${commit_message}" != "${STATIC_BUILD_COMMIT}" ]; then
err_msg "expecting commit message: '${STATIC_BUILD_COMMIT}'"
err_msg "commit message of ${commit_sha} is: '${commit_message}'"
return 1
fi
# check all files of the commit belongs to $STATIC_BUILT_PATHS
commit_files=$(git diff-tree --no-commit-id --name-only -r "${commit_sha}")
for i in ${STATIC_BUILT_PATHS[*]}; do
# remove files of ${STATIC_BUILT_PATHS}
commit_files=$(echo "${commit_files}" | grep -v "^${i}")
done
if [ -n "${commit_files}" ]; then
err_msg "commit ${commit_sha} contains files not a part of ${STATIC_BUILD_COMMIT}"
echo "${commit_files}" | prefix_stdout " "
return 2
fi
return 0
}
static.build.drop() {
# drop last commit if it was made by the static.build.commit command
local last_commit_id
local branch
build_msg STATIC "drop last commit if it was previously done by static.build.commit"
# get only last (option -n1) local commit not in remotes
branch="$(git branch --show-current)"
last_commit_id="$(git log -n1 "${branch}" --pretty=format:'%h'\
--not --exclude="${branch}" --branches --remotes)"
if [ -z "${last_commit_id}" ]; then
err_msg "there are no local commits"
return 1
fi
if ! is.static.build.commit "${last_commit_id}"; then
return $?
fi
build_msg STATIC "drop last commit ${last_commit_id}"
git reset --hard HEAD~1
}
static.build.commit() {
# call the "static.build.drop" command, then "themes.all" then commit the
# built files ($BUILT_PATHS).
build_msg STATIC "build & commit /static files"
# check for not commited files
if [ -n "$(git diff --name-only)" ]; then
err_msg "some files are not commited:"
git diff --name-only | prefix_stdout " "
return 1
fi
# check for staged files
if [ -n "$(git diff --name-only --cached)" ]; then
err_msg "some files are staged:"
git diff --name-only --cached | prefix_stdout " "
return 1
fi
# drop existing commit from previos build
static.build.drop &>/dev/null
( set -e
# build the themes
themes.all
# add build files
for built_path in "${STATIC_BUILT_PATHS[@]}"; do
git add -v "${built_path}"
done
# check for modified files that are not staged
if [ -n "$(git diff --name-only)" ]; then
die 42 "themes.all has created files that are not in STATIC_BUILT_PATHS"
fi
git commit -m "${STATIC_BUILD_COMMIT}"
)
}
static.build.restore() {
build_msg STATIC "git-restore of the built files (/static)"
git restore --staged "${STATIC_BUILT_PATHS[@]}"
git restore --worktree "${STATIC_BUILT_PATHS[@]}"
}