diff --git a/etc/nginx/conf.d/spot.conf b/etc/nginx/conf.d/spot.conf index f6060096071eae605a5de5287c722630eedfba74..3026429c3f39d12bfc767fde651704fbb1439b5d 100644 --- a/etc/nginx/conf.d/spot.conf +++ b/etc/nginx/conf.d/spot.conf @@ -3,7 +3,7 @@ server { server_name _; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; - add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; form-action 'self'; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self' https://overpass-api.de; img-src 'self' data:; frame-src https://www.youtube-nocookie.com https://player.vimeo.com https://www.dailymotion.com https://www.deezer.com https://www.mixcloud.com https://w.soundcloud.com https://embed.spotify.com"; + add_header Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; form-action 'self'; font-src 'self'; frame-ancestors 'self'; base-uri 'self'; connect-src 'self' https://overpass-api.de; img-src 'self' data: https://*.tile.openstreetmap.org; frame-src 'self' https://yewtu.be https://www.youtube-nocookie.com https://player.vimeo.com https://www.dailymotion.com https://www.deezer.com https://www.mixcloud.com https://w.soundcloud.com https://embed.spotify.com"; add_header X-Frame-Options "SAMEORIGIN"; root /var/www/spot; diff --git a/searx/static/themes/etheme/js/math.init.js b/searx/static/themes/etheme/js/math.init.js new file mode 100644 index 0000000000000000000000000000000000000000..4088f00c392290ed668078d954ca0539f84b7911 --- /dev/null +++ b/searx/static/themes/etheme/js/math.init.js @@ -0,0 +1,71 @@ +window.addEventListener('load', function() { + let q = document.getElementsByName('q')[0].value + + // Define custom units here + math.createUnit('mph', '1 mile/hour') + math.createUnit('kmph', '1 km/hour') + math.createUnit('sqmt', '1 m2') + math.createUnit('cumt', '1 m3') + + const exp = new RegExp(".*?(\\d+(?:\\.\\d+)?)\s?([^.0-9]+) (?:in|to|en|dans|nel|pour|para|zu) ([^.0-9]+)", "i"); + let m = q.match(exp) + let answer_section = null + if (m) { + try { + let value = math.evaluate(m[1] + m[2] + " to " + m[3]) + + if (value.toString() !== q) { + + let info = math.evaluate(1 + m[2] + " to " + m[3]) + // Round off solution to 5 decimals + let sol = math.round(Number(value.toString().split(" ")[0]), 5) + answer_section = ` +