searxng fix, ui animation

frdel committed Nov 19, 2024 at 13:11 UTC 06260ed4a6b8061ffe533d92ad1a6bcc3460eeb6
5 files changed +65 -20
docker/run/fs/etc/searxng/settings.yml
+9 -9
@@ -7,24 +7,24 @@ general:
7 instance_name: "SearXNG"
8
9 search:
10 - safe_search: 2
11 - autocomplete: 'duckduckgo'
10 + safe_search: 0
11 + # autocomplete: 'duckduckgo'
12 formats:
13 - - html
13 - json
14 + # - html
15
16 server:
17 # Is overwritten by ${SEARXNG_SECRET}
18 - secret_key: "1e91dce279fdef87eb7b6f43029c206b"
19 - limiter: true
20 - image_proxy: true
18 + secret_key: "dummy"
19 + limiter: false
20 + image_proxy: false
21 # public URL of the instance, to ensure correct inbound links. Is overwritten
22 # by ${SEARXNG_URL}.
23 # base_url: http://example.com/location
24
25 -redis:
26 - # URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.
27 - url: unix:///usr/local/searxng-redis/run/redis.sock?db=0
25 +# redis:
26 +# # URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.
27 +# url: unix:///usr/local/searxng-redis/run/redis.sock?db=0
28
29 ui:
30 static_use_hash: true
docker/run/fs/exe/run_A0.sh
+11 -7
@@ -17,20 +17,24 @@ function setup_venv() {
17 source /opt/venv/bin/activate
18 }
19
20 -# preload A0
20 +function clone_repo() {
21 + # Copy repository files if run_ui.py is missing in /a0 (if the volume is mounted)
22 + if [ ! -f "$TARGET_DIR/run_ui.py" ]; then
23 + echo "Copying files from $SOURCE_DIR to $TARGET_DIR..."
24 + cp -rn --no-preserve=ownership,mode "$SOURCE_DIR/." "$TARGET_DIR"
25 + fi
26 +}
27 +
28 +# setup and preload A0
29 setup_venv
30 +clone_repo
31 python /a0/preload.py
32
33 # Loop to restart the Python script when it finishes
34 while true; do
35
36 setup_venv
28 -
29 - # Copy repository files if run_ui.py is missing in /a0 (if the volume is mounted)
30 - if [ ! -f "$TARGET_DIR/run_ui.py" ]; then
31 - echo "Copying files from $SOURCE_DIR to $TARGET_DIR..."
32 - cp -rn --no-preserve=ownership,mode "$SOURCE_DIR/." "$TARGET_DIR"
33 - fi
37 + clone_repo
38
39 echo "Starting A0..."
40 python /a0/run_ui.py \
webui/index.css
+21
@@ -473,6 +473,27 @@ pre {
473 margin-right: 1.2em;
474 }
475
476 +.shiny-text {
477 + background: linear-gradient(
478 + to right,
479 + var(--color-primary-dark) 20%,
480 + var(--color-text) 40%,
481 + var(--color-text) 60%,
482 + var(--color-primary-dark) 60%
483 + );
484 + background-size: 200% auto;
485 + color: transparent;
486 + -webkit-background-clip: text;
487 + background-clip: text;
488 + animation: shine 1s linear infinite;
489 +}
490 +
491 +@keyframes shine {
492 + to {
493 + background-position: -200% center;
494 + }
495 +}
496 +
497 #right-panel.expanded #logo-container {
498 margin-left: 4.6rem;
499 }
webui/index.js
+18 -3
@@ -372,7 +372,7 @@ async function poll() {
372 }
373
374 function afterMessagesUpdate(logs) {
375 - if(localStorage.getItem('speech') == 'true') {
375 + if (localStorage.getItem('speech') == 'true') {
376 speakMessages(logs)
377 }
378 }
@@ -392,7 +392,14 @@ function speakMessages(logs) {
392 }
393
394 function updateProgress(progress) {
395 - if (!progress) progress = "Waiting for input"
395 + const defaultText = "Waiting for input"
396 + if (!progress) progress = defaultText
397 +
398 + if (progress == defaultText) {
399 + removeClassFromElement(progressBar, "shiny-text")
400 + } else {
401 + addClassToElement(progressBar, "shiny-text")
402 + }
403
404 if (progressBar.innerHTML != progress) {
405 progressBar.innerHTML = progress
@@ -500,7 +507,7 @@ window.toggleDarkMode = function (isDark) {
507 window.toggleSpeech = function (isOn) {
508 console.log("Speech:", isOn);
509 localStorage.setItem('speech', isOn);
503 - if(!isOn) speech.stop()
510 + if (!isOn) speech.stop()
511 };
512
513 // Modify this part
@@ -651,6 +658,14 @@ function readJsonFiles() {
658 });
659 }
660
661 +function addClassToElement(element, className) {
662 + element.classList.add(className);
663 +}
664 +
665 +function removeClassFromElement(element, className) {
666 + element.classList.remove(className);
667 +}
668 +
669
670 function toast(text, type = 'info') {
671 const toast = document.getElementById('toast');
webui/speech.js
+6 -1
@@ -422,9 +422,14 @@ class Speech {
422
423 replaceNonText(text) {
424 const nonTextRegex = /\w[^\w\s]*\w(?=\s|$)|[^\w\s]+/g;
425 - return text.replace(nonTextRegex, (match) => {
425 + text = text.replace(nonTextRegex, (match) => {
426 return ``;
427 });
428 + const longStringRegex = /\S{25,}/g;
429 + text = text.replace(longStringRegex, (match) => {
430 + return ``;
431 + });
432 + return text
433 }
434
435 stop() {