diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5bea11f07268edad138302f93d387cd0d444de3f..50e9608367d60945979830b4f754f91c28396a61 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -97,6 +97,8 @@ stop_review: - if: '$REVIEW_DISABLED' when: never - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' + when: manual + .development: &development_template diff --git a/.gitlab/development-values.yaml b/.gitlab/development-values.yaml index 87dfff8a0dfd9ed3b3dc84415a1d2f9025a5c76b..79a91f517659cc4da7469e51aab67d05f610f851 100644 --- a/.gitlab/development-values.yaml +++ b/.gitlab/development-values.yaml @@ -2,12 +2,20 @@ service: externalPort: 80 internalPort: 80 hpa: + enabled: true minReplicas: 1 maxReplicas: 5 +resources: + limits: + cpu: 500m + memory: 1Gi + requests: + cpu: 500m + memory: 1Gi podDisruptionBudget: enabled: true - minAvailable: 1 - maxUnavailable: + minAvailable: + maxUnavailable: 0 podAnnotations: prometheus.io/scrape: "true" prometheus.io/path: /metrics @@ -17,6 +25,14 @@ ingress: annotations: cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_headers "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; connect-src 'self'; media-src; object-src; prefetch-src; child-src; frame-src 'self'; worker-src; frame-ancestors 'self' https://scripts.zdv.uni-mainz.de; form-action 'self'; base-uri; manifest-src; plugin-types; report-uri; report-to"; + more_set_headers "X-Frame-Options: sameorigin"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "ReferrerPolicy: origin"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + if ($arg_out = "results-with-style") { + more_set_headers "X-Frame-Options: allow-from https://scripts.zdv.uni-mainz.de/"; + } if ($host = "www.metager3.de") { return 301 https://metager3.de$request_uri; } diff --git a/.gitlab/production-values.yaml b/.gitlab/production-values.yaml index 6957184b5045a8e99002899647d690348255d13c..294b2cfc1d2be43870bc69f3f6568a621a843e87 100644 --- a/.gitlab/production-values.yaml +++ b/.gitlab/production-values.yaml @@ -2,7 +2,8 @@ service: externalPort: 80 internalPort: 80 hpa: - minReplicas: 5 + enabled: true + minReplicas: 1 maxReplicas: 100 resources: limits: @@ -13,8 +14,8 @@ resources: memory: 1Gi podDisruptionBudget: enabled: true - minAvailable: 4 - maxUnavailable: + minAvailable: + maxUnavailable: 0 podAnnotations: prometheus.io/scrape: "true" prometheus.io/path: /metrics @@ -24,6 +25,14 @@ ingress: annotations: cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_headers "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; connect-src 'self'; media-src; object-src; prefetch-src; child-src; frame-src 'self'; worker-src; frame-ancestors 'self' https://scripts.zdv.uni-mainz.de; form-action 'self'; base-uri; manifest-src; plugin-types; report-uri; report-to"; + more_set_headers "X-Frame-Options: sameorigin"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "ReferrerPolicy: origin"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + if ($arg_out = "results-with-style") { + more_set_headers "X-Frame-Options: allow-from https://scripts.zdv.uni-mainz.de/"; + } if ($host = "www.metager.de") { return 301 https://metager.de$request_uri; } diff --git a/.gitlab/review-apps-values.yaml b/.gitlab/review-apps-values.yaml index 81eb62cecff6ed6b1b29aa3321cb1f2b7e911237..ac869bc42b7ef0b5e240fed2fad08c93292da833 100644 --- a/.gitlab/review-apps-values.yaml +++ b/.gitlab/review-apps-values.yaml @@ -5,6 +5,15 @@ ingress: annotations: kubernetes.io/tls-acme: "false" nginx.ingress.kubernetes.io/ssl-redirect: "false" + nginx.ingress.kubernetes.io/configuration-snippet: | + more_set_headers "Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'self' 'unsafe-inline'; img-src 'self'; font-src 'self'; connect-src 'self'; media-src; object-src; prefetch-src; child-src; frame-src 'self'; worker-src; frame-ancestors 'self' https://scripts.zdv.uni-mainz.de; form-action 'self'; base-uri; manifest-src; plugin-types; report-uri; report-to"; + more_set_headers "X-Frame-Options: sameorigin"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "ReferrerPolicy: origin"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + if ($arg_out = "results-with-style") { + more_set_headers "X-Frame-Options: allow-from https://scripts.zdv.uni-mainz.de/"; + } tls: enabled: false service: diff --git a/Dockerfile b/Dockerfile index a74f916b948735b21b1bc4ae838d4f2a515dae5d..bfdd92cae87b08678e11b1a889fdbe02edccc19c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ RUN apk add --update \ dcron \ zip \ redis \ + libpng \ php7 \ php7-fpm \ php7-common \ @@ -38,10 +39,10 @@ RUN sed -i 's/;error_log = log\/php7\/error.log/error_log = \/dev\/stderr/g' /et sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/group = nobody/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \ - sed -i 's/pm.max_children = 5/pm.max_children = 100/g' /etc/php7/php-fpm.d/www.conf && \ - sed -i 's/pm.start_servers = 2/pm.start_servers = 5/g' /etc/php7/php-fpm.d/www.conf && \ + sed -i 's/pm.max_children = 5/pm.max_children = 1024/g' /etc/php7/php-fpm.d/www.conf && \ + sed -i 's/pm.start_servers = 2/pm.start_servers = 50/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g' /etc/php7/php-fpm.d/www.conf && \ - sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 25/g' /etc/php7/php-fpm.d/www.conf && \ + sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 50/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/user = www-data/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/group = www-data/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \ sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php7/php.ini && \ diff --git a/app/Http/Controllers/HumanVerification.php b/app/Http/Controllers/HumanVerification.php index 741e55fef5a42d6e28090e6660d2f9e1488b560d..d304fc1b36e8619c1ef61a6632716e9f201c527a 100644 --- a/app/Http/Controllers/HumanVerification.php +++ b/app/Http/Controllers/HumanVerification.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use Captcha; use Carbon; +use Cookie; use Illuminate\Hashing\BcryptHasher as Hasher; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; @@ -21,7 +22,17 @@ class HumanVerification extends Controller if ($url != null) { $url = base64_decode(str_replace("<<SLASH>>", "/", $url)); } else { - $url = $request->input('url'); + $url = $request->input('url', url("/")); + } + + $protocol = "http://"; + + if ($request->secure()) { + $protocol = "https://"; + } + + if (stripos($url, $protocol . $request->getHttpHost()) !== 0) { + $url = url("/"); } $userlist = Cache::get(HumanVerification::PREFIX . "." . $id, []); @@ -40,7 +51,6 @@ class HumanVerification extends Controller $key = strtolower($key); if (!$hasher->check($key, $lockedKey)) { - sleep(\random_int(1, 8)); $captcha = Captcha::create("default", true); $user["lockedKey"] = $captcha["key"]; HumanVerification::saveUser($user); @@ -67,7 +77,7 @@ class HumanVerification extends Controller } } } - sleep(\random_int(1, 8)); + $captcha = Captcha::create("default", true); $user["lockedKey"] = $captcha["key"]; HumanVerification::saveUser($user); @@ -146,9 +156,9 @@ class HumanVerification extends Controller $ip = $request->ip(); $id = ""; if (HumanVerification::couldBeSpammer($ip)) { - $id = hash("sha512", "999.999.999.999"); + $id = hash("sha1", "999.999.999.999"); } else { - $id = hash("sha512", $ip); + $id = hash("sha1", $ip); } $userlist = Cache::get(HumanVerification::PREFIX . "." . $id, []); @@ -185,9 +195,9 @@ class HumanVerification extends Controller $uid = ""; $ip = $request->ip(); if (HumanVerification::couldBeSpammer($ip)) { - $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); + $uid = hash("sha1", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); } else { - $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid"); + $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); } if ($uid === $id) { @@ -217,11 +227,11 @@ class HumanVerification extends Controller $uid = ""; $ip = $request->ip(); if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) { - $id = hash("sha512", "999.999.999.999"); - $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", "999.999.999.999"); + $uid = hash("sha1", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); } else { - $id = hash("sha512", $ip); - $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", $ip); + $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); } $userList = Cache::get(HumanVerification::PREFIX . "." . $id); @@ -240,11 +250,11 @@ class HumanVerification extends Controller $uid = ""; $ip = $request->ip(); if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) { - $id = hash("sha512", "999.999.999.999"); - $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", "999.999.999.999"); + $uid = hash("sha1", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); } else { - $id = hash("sha512", $ip); - $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", $ip); + $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); } $userList = Cache::get(HumanVerification::PREFIX . "." . $id); @@ -261,4 +271,84 @@ class HumanVerification extends Controller HumanVerification::saveUser($user); return redirect('admin/bot'); } + + public function browserVerification(Request $request) + { + $key = $request->input("id", ""); + + // Verify that key is a md5 checksum + if (!preg_match("/^[a-f0-9]{32}$/", $key)) { + abort(404); + } + + Redis::connection("cache")->pipeline(function ($redis) use ($key) { + $redis->rpush($key, true); + $redis->expire($key, 30); + }); + + return response(view('layouts.resultpage.verificationCss'), 200)->header("Content-Type", "text/css"); + } + + public static function block(Request $request) + { + $prefix = "humanverification"; + + $ip = $request->ip(); + $id = ""; + $uid = ""; + if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) { + $id = hash("sha1", "999.999.999.999"); + $uid = hash("sha1", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); + } else { + $id = hash("sha1", $ip); + $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); + } + + /** + * If the user sends a Password or a key + * We will not verificate the user. + * If someone that uses a bot finds this out we + * might have to change it at some point. + */ + if ($request->filled('password') || $request->filled('key') || Cookie::get('key') !== null || $request->filled('appversion') || !env('BOT_PROTECTION', false)) { + $update = false; + return $next($request); + } + + # Get all Users of this IP + $users = Cache::get($prefix . "." . $id, []); + + $user = []; + $changed = false; + if (empty($users[$uid])) { + $user = [ + 'uid' => $uid, + 'id' => $id, + 'unusedResultPages' => 0, + 'whitelist' => false, + 'locked' => true, + "lockedKey" => "", + "expiration" => now()->addWeeks(2), + ]; + $changed = true; + } else { + $user = $users[$uid]; + if (!$user["locked"]) { + $user["locked"] = true; + $changed = true; + } + } + + if ($user["whitelist"]) { + $user["expiration"] = now()->addWeeks(2); + } else { + $user["expiration"] = now()->addHours(72); + } + if ($changed) { + $userList = Cache::get($prefix . "." . $user["id"], []); + $userList[$user["uid"]] = $user; + Cache::put($prefix . "." . $user["id"], $userList, 2 * 7 * 24 * 60 * 60); + } + return [$id, $uid]; + } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 24a8c577ad62a61ca1483aa960a79c646daf5593..cb14ae7025a3077233dfb5cd09cd401242a20a52 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -62,5 +62,6 @@ class Kernel extends HttpKernel 'referer.check' => \App\Http\Middleware\RefererCheck::class, 'humanverification' => \App\Http\Middleware\HumanVerification::class, 'useragentmaster' => \App\Http\Middleware\UserAgentMaster::class, + 'browserverification' => \App\Http\Middleware\BrowserVerification::class, ]; } diff --git a/app/Http/Middleware/BrowserVerification.php b/app/Http/Middleware/BrowserVerification.php new file mode 100644 index 0000000000000000000000000000000000000000..fa0d3c433adc6af10269b129233f60c5e99e17f1 --- /dev/null +++ b/app/Http/Middleware/BrowserVerification.php @@ -0,0 +1,66 @@ +<?php + +namespace App\Http\Middleware; + +use Closure; +use Illuminate\Support\Facades\Redis; + +class BrowserVerification +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $bvEnabled = config("metager.metager.browserverification_enabled"); + if (empty($bvEnabled) || !$bvEnabled) { + return $next($request); + } + + $mgv = $request->input('mgv', ""); + if (!empty($mgv)) { + // Verify that key is a md5 checksum + if (!preg_match("/^[a-f0-9]{32}$/", $mgv)) { + abort(404); + } + $result = boolval(Redis::connection("cache")->blpop($mgv, 5)); + if ($result === true) { + return $next($request); + } else { + return redirect("/"); + } + } + + header('Content-type: text/html; charset=utf-8'); + header('X-Accel-Buffering: no'); + ini_set('zlib.output_compression', 'Off'); + ini_set('output_buffering', 'Off'); + ini_set('output_handler', ''); + + ob_end_clean(); + + $key = md5($request->ip() . microtime(true)); + + echo (view('layouts.resultpage.verificationHeader')->with('key', $key)->render()); + flush(); + + $answer = boolval(Redis::connection("cache")->blpop($key, 2)); + + if ($answer === true) { + return $next($request); + } + + $params = $request->all(); + $params["mgv"] = $key; + $url = route("resultpage", $params); + + echo (view('layouts.resultpage.unverifiedResultPage') + ->with('url', $url) + ->render()); + + } +} diff --git a/app/Http/Middleware/HumanVerification.php b/app/Http/Middleware/HumanVerification.php index 5599671c6102f335ee32d1c2e3b9f8b8eefa2453..34abf5f20bf9fbc7e221c75121dc11fa73d954cc 100644 --- a/app/Http/Middleware/HumanVerification.php +++ b/app/Http/Middleware/HumanVerification.php @@ -3,10 +3,8 @@ namespace App\Http\Middleware; use Cache; -use Captcha; use Closure; use Cookie; -use Illuminate\Http\Response; use Log; use URL; @@ -30,11 +28,11 @@ class HumanVerification $id = ""; $uid = ""; if (\App\Http\Controllers\HumanVerification::couldBeSpammer($ip)) { - $id = hash("sha512", "999.999.999.999"); - $uid = hash("sha512", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", "999.999.999.999"); + $uid = hash("sha1", "999.999.999.999" . $ip . $_SERVER["AGENT"] . "uid"); } else { - $id = hash("sha512", $ip); - $uid = hash("sha512", $ip . $_SERVER["AGENT"] . "uid"); + $id = hash("sha1", $ip); + $uid = hash("sha1", $ip . $_SERVER["AGENT"] . "uid"); } unset($_SERVER["AGENT"]); @@ -101,19 +99,7 @@ class HumanVerification # If the user is locked we will force a Captcha validation if ($user["locked"]) { - sleep(\random_int(1, 8)); - $captcha = Captcha::create("default", true); - $user["lockedKey"] = $captcha["key"]; - \App\PrometheusExporter::CaptchaShown(); - return - new Response( - view('humanverification.captcha') - ->with('title', "Bestätigung erforderlich") - ->with('uid', $uid) - ->with('id', $id) - ->with('url', url()->full()) - ->with('image', $captcha["img"]) - ); + return redirect()->route('captcha', ["id" => $id, "uid" => $uid, "url" => url()->full()]); } $user["unusedResultPages"]++; diff --git a/app/Http/Middleware/LocalizationRedirect.php b/app/Http/Middleware/LocalizationRedirect.php index c8513b202703ab03885440824e3dab56237c6394..6d2e0e047c3b443af64089c001258512894cd5f9 100644 --- a/app/Http/Middleware/LocalizationRedirect.php +++ b/app/Http/Middleware/LocalizationRedirect.php @@ -19,27 +19,31 @@ class LocalizationRedirect $locale = LaravelLocalization::getCurrentLocale(); $host = $request->getHttpHost(); - // We only redirect to the TLDs in the production version and exclude our onion domain - if(env("APP_ENV", "") !== "production" || $host === "b7cxf4dkdsko6ah2.onion" || $request->is('metrics')){ + if (env("APP_ENV", "") !== "production" || $host === "metagerv65pwclop2rsfzg4jwowpavpwd6grhhlvdgsswvo6ii4akgyd.onion" || $request->is('metrics')) { return $next($request); } + // Redirect from v2 onion to v3 onion + if ($host === "b7cxf4dkdsko6ah2.onion") { + return redirect("http://metagerv65pwclop2rsfzg4jwowpavpwd6grhhlvdgsswvo6ii4akgyd.onion"); + } + $url = url()->full(); $url = preg_replace("/^http:\/\//", "https://", $url); - if($host !== "metager.de" && $locale == "de"){ + if ($host !== "metager.de" && $locale == "de") { $url = str_replace($host, "metager.de", $url); $url = preg_replace("/^(https:\/\/[^\/]+)\/de/", "$1", $url); return redirect($url); } - if($host !== "metager.es" && $locale == "es"){ + if ($host !== "metager.es" && $locale == "es") { $url = str_replace($host, "metager.es", $url); $url = preg_replace("/^(https:\/\/[^\/]+)\/es/", "$1", $url); return redirect($url); } - if($host !== "metager.org" && $locale == "en"){ + if ($host !== "metager.org" && $locale == "en") { $url = str_replace($host, "metager.org", $url); $url = preg_replace("/^(https:\/\/[^\/]+)\/en/", "$1", $url); return redirect($url); diff --git a/app/MetaGer.php b/app/MetaGer.php index 247c8104b879aee8d0ffb71fcc5ddb8546e7dc1a..4f0964b0d9556317cc0da3a374400ca373f6ecfc 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -723,8 +723,8 @@ class MetaGer if (!empty($filter->sumas->$engineName)) { if (empty($availableFilter[$filterName])) { $availableFilter[$filterName] = $filter; - foreach($availableFilter[$filterName]->values as $key => $value){ - if($key !== "nofilter"){ + foreach ($availableFilter[$filterName]->values as $key => $value) { + if ($key !== "nofilter") { unset($availableFilter[$filterName]->values->{$key}); } } @@ -749,8 +749,8 @@ class MetaGer } if (empty($availableFilter[$filterName])) { $availableFilter[$filterName] = $filter; - foreach($availableFilter[$filterName]->values as $key => $value){ - if($key !== "nofilter"){ + foreach ($availableFilter[$filterName]->values as $key => $value) { + if ($key !== "nofilter") { unset($availableFilter[$filterName]->values->{$key}); } } @@ -928,6 +928,13 @@ class MetaGer # Sucheingabe $this->eingabe = trim($request->input('eingabe', '')); $this->q = $this->eingabe; + + if ($request->filled("mgv")) { + $this->framed = true; + } else { + $this->framed = false; + } + # IP $this->ip = $this->anonymizeIp($request->ip()); @@ -953,16 +960,18 @@ class MetaGer # Sprüche if (!App::isLocale("de") || (\Cookie::has($this->getFokus() . '_setting_zitate') && \Cookie::get($this->getFokus() . '_setting_zitate') === "off")) { $this->sprueche = "off"; - }else{ + } else { $this->sprueche = "on"; } - if($request->filled("zitate") && $request->input('zitate') === "on" || $request->input('zitate') === "off"){ + if ($request->filled("zitate") && $request->input('zitate') === "on" || $request->input('zitate') === "off") { $this->sprueche = $request->input('quotes'); } - + $this->newtab = $request->input('newtab', 'on'); if ($this->newtab === "on") { $this->newtab = "_blank"; + } else if ($this->framed) { + $this->newtab = "_top"; } else { $this->newtab = "_self"; } @@ -1020,19 +1029,19 @@ class MetaGer $this->request = $request->replace($request->except(['verification_id', 'uid', 'verification_count'])); // Disable freshness filter if custom freshness filter isset - if($this->request->filled("ff") && $this->request->filled("f")){ + if ($this->request->filled("ff") && $this->request->filled("f")) { $this->request = $this->request->replace($this->request->except(["f"])); } // Remove custom time filter if either of the dates isn't set or is not a date - if($this->request->input("fc") === "on"){ - if(!$this->request->filled("ff") || !$this->request->filled("ft")){ + if ($this->request->input("fc") === "on") { + if (!$this->request->filled("ff") || !$this->request->filled("ft")) { $this->request = $this->request->replace($this->request->except(["fc", "ff", "ft"])); - }else{ + } else { $ff = $this->request->input("ff"); $ft = $this->request->input("ft"); - if(!preg_match("/^\d{4}-\d{2}-\d{2}$/", $ff) || !preg_match("/^\d{4}-\d{2}-\d{2}$/", $ft)){ + if (!preg_match("/^\d{4}-\d{2}-\d{2}$/", $ff) || !preg_match("/^\d{4}-\d{2}-\d{2}$/", $ft)) { $this->request = $this->request->replace($this->request->except(["fc", "ff", "ft"])); - }else{ + } else { // Now Check if there is something wrong with the dates $from = $this->request->input("ff"); $to = $this->request->input("ft"); @@ -1040,21 +1049,21 @@ class MetaGer $from = Carbon::createFromFormat("Y-m-d H:i:s", $from . " 00:00:00"); $to = Carbon::createFromFormat("Y-m-d H:i:s", $to . " 00:00:00"); - if($from > Carbon::now()){ + if ($from > Carbon::now()) { $from = Carbon::now(); $changed = true; } - if($to > Carbon::now()){ + if ($to > Carbon::now()) { $to = Carbon::now(); $changed = true; } - if($from > $to){ + if ($from > $to) { $tmp = $to; $to = $from; $from = $tmp; $changed = true; } - if($changed){ + if ($changed) { $oldParameters = $this->request->all(); $oldParameters["ff"] = $from->format("Y-m-d"); $oldParameters["ft"] = $to->format("Y-m-d"); @@ -1062,7 +1071,7 @@ class MetaGer } } } - }else if($this->request->filled("ff") || $this->request->filled("ft")){ + } else if ($this->request->filled("ff") || $this->request->filled("ft")) { $this->request = $this->request->replace($this->request->except(["fc", "ff", "ft"])); } @@ -1170,7 +1179,7 @@ class MetaGer if (($request->filled($filter->{"get-parameter"}) && $request->input($filter->{"get-parameter"}) !== "off") || \Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"}) !== null ) { # If the filter is set via Cookie - $this->parameterFilter[$filterName] = $filter; + $this->parameterFilter[$filterName] = $filter; $this->parameterFilter[$filterName]->value = $request->input($filter->{"get-parameter"}, ''); if (empty($this->parameterFilter[$filterName]->value)) { $this->parameterFilter[$filterName]->value = \Cookie::get($this->getFokus() . "_setting_" . $filter->{"get-parameter"}); @@ -1349,7 +1358,7 @@ class MetaGer public function nextSearchLink() { if (isset($this->next) && isset($this->next['engines']) && count($this->next['engines']) > 0) { - $requestData = $this->request->except(['page', 'out']); + $requestData = $this->request->except(['page', 'out', 'submit-query', 'mgv']); if ($this->request->input('out', '') !== "results" && $this->request->input('out', '') !== '') { $requestData["out"] = $this->request->input('out'); } @@ -1495,7 +1504,7 @@ class MetaGer public function generateSearchLink($fokus, $results = true) { - $except = ['page', 'next', 'out']; + $except = ['page', 'next', 'out', 'submit-query', 'mgv']; # Remove every Filter foreach ($this->sumaFile->filter->{"parameter-filter"} as $filterName => $filter) { $except[] = $filter->{"get-parameter"}; @@ -1509,7 +1518,7 @@ class MetaGer public function generateEingabeLink($eingabe) { - $except = ['page', 'next', 'out', 'eingabe']; + $except = ['page', 'next', 'out', 'eingabe', 'submit-query', 'mgv']; $requestData = $this->request->except($except); $requestData['eingabe'] = $eingabe; @@ -1528,7 +1537,7 @@ class MetaGer public function generateSiteSearchLink($host) { $host = urlencode($host); - $requestData = $this->request->except(['page', 'out', 'next']); + $requestData = $this->request->except(['page', 'out', 'next', 'submit-query', 'mgv']); $requestData['eingabe'] .= " site:$host"; $requestData['focus'] = "web"; $link = action('MetaGerSearch@search', $requestData); @@ -1538,7 +1547,7 @@ class MetaGer public function generateRemovedHostLink($host) { $host = urlencode($host); - $requestData = $this->request->except(['page', 'out', 'next']); + $requestData = $this->request->except(['page', 'out', 'next', 'submit-query', 'mgv']); $requestData['eingabe'] .= " -site:$host"; $link = action('MetaGerSearch@search', $requestData); return $link; @@ -1547,7 +1556,7 @@ class MetaGer public function generateRemovedDomainLink($domain) { $domain = urlencode($domain); - $requestData = $this->request->except(['page', 'out', 'next']); + $requestData = $this->request->except(['page', 'out', 'next', 'submit-query', 'mgv']); $requestData['eingabe'] .= " -site:*.$domain"; $link = action('MetaGerSearch@search', $requestData); return $link; @@ -1812,6 +1821,12 @@ class MetaGer { return $this->engines; } + + public function isFramed() + { + return $this->framed; + } + /** * Used by JS result loader to restore MetaGer Object of previous request */ diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 25bf29e5e87ae243868f6199f8477b10c6f308db..bdf168cc0e8561bb226705f25721d93c78f8dfba 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -63,6 +63,9 @@ spec: - name: blacklist-ad secret: secretName: metager-ad-blacklist + - name: metager-config + configMap: + name: metager containers: - name: {{ .Chart.Name }}-phpfpm image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" @@ -93,6 +96,9 @@ spec: initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} volumeMounts: + - name: metager-config + mountPath: /html/config/metager + readOnly: true - name: mglogs-persistent-storage mountPath: /html/storage/logs/metager readOnly: false diff --git a/composer.json b/composer.json index 9355e6fc34eaa29601f2daeac6f4da7c30793eea..407ce059478e48ba5a5fac922658a3e2356d2965 100644 --- a/composer.json +++ b/composer.json @@ -8,18 +8,17 @@ ], "license": "MIT", "require": { - "laravel/framework": "5.8.*", "php": "^7.1.3", + "endclothing/prometheus_client_php": "^1.0", "fideloper/proxy": "^4.0", - "laravel/tinker": "^1.0", "globalcitizen/php-iban": "^2.6", "jenssegers/agent": "^2.6", - "mcamara/laravel-localization": "^1.3", + "laravel/framework": "5.8.*", + "laravel/tinker": "^1.0", + "mcamara/laravel-localization": "dev-master#13f418e481ed06f482e4fca87ec5ff67c2949373", "mews/captcha": "^2.2", - "monospice/laravel-redis-sentinel-drivers": "^2.6", "predis/predis": "^1.1", - "symfony/dom-crawler": "^4.1", - "endclothing/prometheus_client_php": "^1.0" + "symfony/dom-crawler": "^4.1" }, "require-dev": { "beyondcode/laravel-dump-server": "^1.0", diff --git a/config/metager/metager.php b/config/metager/metager.php new file mode 100644 index 0000000000000000000000000000000000000000..cb7825e6ff35e166caaad4bb108e456ae9960652 --- /dev/null +++ b/config/metager/metager.php @@ -0,0 +1,5 @@ +<?php + +return [ + "browserverification_enabled" => true, +]; diff --git a/config/session.php b/config/session.php index e769fac0e564350ada90982fc87dff1e1470869f..1db9bc0769c20dc7137d7496682363666723d724 100644 --- a/config/session.php +++ b/config/session.php @@ -70,7 +70,7 @@ return [ | */ - 'connection' => null, + 'connection' => "cache", /* |-------------------------------------------------------------------------- diff --git a/resources/js/scriptResultPage.js b/resources/js/scriptResultPage.js index 9e899d7da05263988bdb29685097afb1cc3d2eb1..ff57833d7f140116ba45b89821a13008f51d2840 100644 --- a/resources/js/scriptResultPage.js +++ b/resources/js/scriptResultPage.js @@ -8,9 +8,13 @@ function botProtection() { $('.result').find('a').click(function () { var link = $(this).attr('href'); var newtab = false; + var top = false; if ($(this).attr('target') == '_blank') { newtab = true; + } else if ($(this).attr('target') == "_top") { + top = true; } + $.ajax({ url: '/img/cat.jpg', type: 'post', @@ -20,8 +24,13 @@ function botProtection() { timeout: 2000 }) .always(function () { - if (!newtab) - document.location.href = link; + if (!newtab) { + if (top) { + window.top.location.href = link; + } else { + document.location.href = link; + } + } }); if (!newtab) return false; diff --git a/resources/lang/de/429.php b/resources/lang/de/429.php new file mode 100644 index 0000000000000000000000000000000000000000..60911729971a159d9d5853a63ba9a28b4aaf49ee --- /dev/null +++ b/resources/lang/de/429.php @@ -0,0 +1,6 @@ +<?php + +return [ + 'title' => '429 - Zu viele Anfragen', + 'text' => '', +]; diff --git a/resources/lang/de/hilfe.php b/resources/lang/de/hilfe.php index 387158d7562747791be1f472764645820e97b4fd..d7091d395166667733879fe21c56f0bbfd0a5675 100644 --- a/resources/lang/de/hilfe.php +++ b/resources/lang/de/hilfe.php @@ -88,7 +88,7 @@ return [ "tor.title" => "Tor-Hidden-Service", "tor.1" => "Bei MetaGer werden schon seit vielen Jahren die IP-Adressen ausgeblendet und nicht gespeichert. Nichtsdestotrotz sind diese Adressen auf dem MetaGer-Server zeitweise, während eine Suche läuft, sichtbar: wenn MetaGer also einmal kompromittiert sein sollte, dann könnte dieser Angreifer Ihre Adressen mitlesen und speichern. Um dem höchsten Sicherheitsbedürfnis entgegenzukommen, unterhalten wir eine MetaGer-Instanz im Tor-Netzwerk: den MetaGer-TOR-hidden-Service - erreichbar über: <a href=\"/tor/\" target=\"_blank\" rel=\"noopener\">https://metager.de/tor/</a>. Für die Benutzung benötigen Sie einen speziellen Browser, den Sie auf <a href=\"https://www.torproject.org/\" target=\"_blank\" rel=\"noopener\">https://www.torproject.org/</a> herunter laden können.", - "tor.2" => "MetaGer erreichen Sie im Tor-Browser dann unter: http://b7cxf4dkdsko6ah2.onion .", + "tor.2" => "MetaGer erreichen Sie im Tor-Browser dann unter: http://metagerv65pwclop2rsfzg4jwowpavpwd6grhhlvdgsswvo6ii4akgyd.onion .", "proxy.title" => "Anonymisierender MetaGer-Proxyserver", "proxy.1" => "Um ihn zu verwenden, müssen Sie auf der MetaGer-Ergebnisseite nur auf \"ANONYM ÖFFNEN\" am unteren Rand des Ergebnisses klicken. Dann wird Ihre Anfrage an die Zielwebseite über unseren anonymisierenden Proxy-Server geleitet und Ihre persönlichen Daten bleiben weiterhin völlig geschützt. Wichtig: wenn Sie ab dieser Stelle den Links auf den Seiten folgen, bleiben Sie durch den Proxy geschützt. Sie können aber oben im Adressfeld keine neue Adresse ansteuern. In diesem Fall verlieren Sie den Schutz. Ob Sie noch geschützt sind, sehen Sie ebenfalls im Adressfeld. Es zeigt: https://proxy.suma-ev.de/?url=hier steht die eigentlich Adresse.", diff --git a/resources/lang/de/tor.php b/resources/lang/de/tor.php index d5cf9f0ca5cf96121b263832090ebb559eba1e3b..80503cd3dfe8f92d188909f1e1243d7ee640006b 100644 --- a/resources/lang/de/tor.php +++ b/resources/lang/de/tor.php @@ -1,5 +1,6 @@ <?php return [ - 'torbutton' => 'Hidden-Service öffnen', + 'description' => 'Nachfolgend finden Sie den Link zum Hidden-Service von MetaGer. Achtung: Dieser Link ist ausschließlich über das Tor-Netzwerk erreichbar. Ihr Browser produziert eine Fehlermeldung, wenn er nicht mit diesem verbunden ist.', + 'torbutton' => 'Hidden-Service öffnen', ]; diff --git a/resources/lang/en/429.php b/resources/lang/en/429.php new file mode 100644 index 0000000000000000000000000000000000000000..ccc7579bf259d84c33ab5efc69d11978529a0a7d --- /dev/null +++ b/resources/lang/en/429.php @@ -0,0 +1,6 @@ +<?php + +return [ + 'title' => '429 - Too many Requests', + 'text' => '', +]; diff --git a/resources/lang/en/hilfe.php b/resources/lang/en/hilfe.php index 0c88f48715a032eb533fbd4e3f2f68f44455228c..9fbdbf728ca4a2bc162194641525660d22d1993c 100644 --- a/resources/lang/en/hilfe.php +++ b/resources/lang/en/hilfe.php @@ -89,7 +89,7 @@ return [ "tor.title" => "Tor Hidden Service", "tor.1" => "MetaGer provides the highest reachable security level for your privacy (anonymised IP addresses, servers under german privacy protection law). For further security needs or fear of compromised servers you may use the MetaGer-Tor branch. Please download the specialized webbrowser from <a href=\"https://www.torproject.org/\" target=\"_blank\" rel=\"noopener\">https://www.torproject.org/</a>. You will find help there, too.", - "tor.2" => "MetaGer Tor address: http://b7cxf4dkdsko6ah2.onion/tor/", + "tor.2" => "MetaGer Tor address: http://metagerv65pwclop2rsfzg4jwowpavpwd6grhhlvdgsswvo6ii4akgyd.onion", "proxy.title" => "MetaGer proxy server", "proxy.1" => "Click or touch \"open anonymously\" to use the MetaGer proxy server. The provided protection is limited to the website you reached from our result page. Protection persists while you see https://proxy.suma-ev.de/?url=...in your webbrowser‘s address field.", diff --git a/resources/lang/en/tor.php b/resources/lang/en/tor.php index f884a01f06fac3cf49b52778e9b5e3820c413add..fa32eac9675a5eeb80f586813c9a25f18a51684f 100644 --- a/resources/lang/en/tor.php +++ b/resources/lang/en/tor.php @@ -1,5 +1,6 @@ <?php return [ - "torbutton" => "Open TOR-hidden service" + 'description' => "Below you will find the link to MetaGer's hidden service. Attention: This link can only be reached via the Tor network. Your browser produces an error message if it is not connected to it.", + "torbutton" => "Open TOR-hidden service", ]; diff --git a/resources/lang/es/tor.php b/resources/lang/es/tor.php index 53db5286ab7adb3fe2ee30b02a9944208a99fda9..6223da8f87d279c5d68955470260373eb66ecc32 100644 --- a/resources/lang/es/tor.php +++ b/resources/lang/es/tor.php @@ -1,5 +1,6 @@ <?php return [ - "torbutton" => "Usar Tor" -]; \ No newline at end of file + 'description' => 'A continuación, encontrará el enlace al servicio oculto de MetaGer. Atención: Solo se puede acceder a este enlace a través de la red Tor. Su navegador genera un mensaje de error si no está conectado a él.', + "torbutton" => "Usar Tor", +]; diff --git a/resources/less/metager/pages/resultpage/result.less b/resources/less/metager/pages/resultpage/result.less index c95117783fbb571c4a71f570b75113d67eeb3791..d4a2f224fdcfd029fb3fa339aa73cfaa6cedfa02 100644 --- a/resources/less/metager/pages/resultpage/result.less +++ b/resources/less/metager/pages/resultpage/result.less @@ -60,6 +60,7 @@ .result-subheadline { width: 100%; display: flex; + align-items: center; line-height: 1.3; .result-link { .overflow-ellipsis; @@ -91,7 +92,8 @@ top: -2px; } } - span.partnershop-info { + a.partnershop-info { + display: block; background-color: white; color: #333; text-shadow: none; @@ -101,8 +103,6 @@ margin-left: 8px; border-radius: 4px; font-size: .6em; - position: relative; - top: -2px; } } } diff --git a/resources/less/metager/parts/searchbar.less b/resources/less/metager/parts/searchbar.less index 582b31449fdacf44108edcb4dafd6285ac43f2a2..957c32659d0c48d2e19148e096f9c2d69bc9c422 100644 --- a/resources/less/metager/parts/searchbar.less +++ b/resources/less/metager/parts/searchbar.less @@ -42,6 +42,7 @@ display: -webkit-box; display: -ms-flexbox; display: flex; + align-items: center; #search-key { display: flex; @@ -98,7 +99,6 @@ border: 0; background-color: transparent; padding: 0; - height: 100%; } } } @@ -173,4 +173,8 @@ width: 100%; max-width: 760px; height: 51px; +} + +#searchForm { + margin: 0; } \ No newline at end of file diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php index f4f87a3057bccc53b632151c4679f545cbdab650..0f928a9db9a03e120b1787b72b5b93c3ff09f5be 100644 --- a/resources/views/errors/404.blade.php +++ b/resources/views/errors/404.blade.php @@ -3,6 +3,12 @@ @section('title', 'Fehler 404 - Seite nicht gefunden') @section('content') + <style> + main#main-content { + align-items: center; + justify-content: center; + } + </style> <h1>{{ trans('404.title') }}</h1> <p>{{ trans('404.text') }}</p> @endsection diff --git a/resources/views/errors/429.blade.php b/resources/views/errors/429.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..4592b922a7e228614cd567fbd511d165be4fd9f7 --- /dev/null +++ b/resources/views/errors/429.blade.php @@ -0,0 +1,14 @@ +@extends('layouts.subPages') + +@section('title', trans('429.title')) + +@section('content') + <style> + main#main-content { + align-items: center; + justify-content: center; + } + </style> + <h1>{{ trans('429.title') }}</h1> + <p>{{ trans('429.text') }}</p> +@endsection diff --git a/resources/views/layouts/researchandtabs.blade.php b/resources/views/layouts/researchandtabs.blade.php index 9e9596e0cc281bb673cf0a82750fbd6df5e41859..17a26ccd3eae3913021bea12859c68c075c6baac 100644 --- a/resources/views/layouts/researchandtabs.blade.php +++ b/resources/views/layouts/researchandtabs.blade.php @@ -3,10 +3,10 @@ <div id="research-bar-container"> <div id="research-bar"> <div id="header-logo"> - <a class="screen-large" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}" tabindex="4"> + <a class="screen-large" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}" @if(!empty($metager) && $metager->isFramed())target="_top" @endif tabindex="4"> <h1><img src="/img/metager.svg" alt="MetaGer" /></h1> </a> - <a class="screen-small" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}"> + <a class="screen-small" href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}" @if(!empty($metager) && $metager->isFramed())target="_top" @endif> <h1><img src="/img/metager-schloss-orange.svg" alt="MetaGer" /></h1> </a> </div> diff --git a/resources/views/layouts/result.blade.php b/resources/views/layouts/result.blade.php index c09efba694028c8631a68bef542aaa29aa930888..04c53ea16b3cc83fe47b59f84a7f122639bd1c35 100644 --- a/resources/views/layouts/result.blade.php +++ b/resources/views/layouts/result.blade.php @@ -16,8 +16,8 @@ {{ $result->anzeigeLink }} </a> @if( isset($result->partnershop) && $result->partnershop === TRUE) - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/partnershops") }}" target="_blank" rel="noopener"> - <span class="partnershop-info">{!! trans('result.options.4') !!}</span> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/partnershops") }}" target="_blank" class="partnershop-info" rel="noopener"> + <span>{!! trans('result.options.4') !!}</span> </a> @endif </div> @@ -49,7 +49,7 @@ </div> <input type="checkbox" id="result-toggle-{{$result->hash}}" class="result-toggle" style="display: none"> <div class="result-footer"> - <a class="result-open" href="{{ $result->link }}" target="_self" rel="noopener"> + <a class="result-open" href="{{ $result->link }}" @if($metager->isFramed())target="_top"@else target="_self"@endif rel="noopener"> {!! trans('result.options.7') !!} </a> <a class="result-open-newtab" href="{{ $result->link }}" target="_blank" rel="noopener"> @@ -75,19 +75,19 @@ </li> @if(strlen($metager->getSite()) === 0) <li> - <a href="{{ $metager->generateSiteSearchLink($result->strippedHost) }}"> + <a href="{{ $metager->generateSiteSearchLink($result->strippedHost) }}" @if($metager->isFramed())target="_top"@else target="_self"@endif> <nobr>{!! trans('result.options.1') !!}</nobr> </a> </li> @endif <li> - <a href="{{ $metager->generateRemovedHostLink($result->strippedHost) }}"> + <a href="{{ $metager->generateRemovedHostLink($result->strippedHost) }}" @if($metager->isFramed())target="_top"@else target="_self"@endif> <nobr>{!! trans('result.options.2', ['host' => $result->strippedHost]) !!}</nobr> </a> </li> @if( $result->strippedHost !== $result->strippedDomain ) <li> - <a href="{{ $metager->generateRemovedDomainLink($result->strippedDomain) }}"> + <a href="{{ $metager->generateRemovedDomainLink($result->strippedDomain) }}" @if($metager->isFramed())target="_top"@else target="_self"@endif> <nobr>{!! trans('result.options.3', ['domain' => $result->strippedDomain]) !!}</nobr> </a> </li> diff --git a/resources/views/layouts/resultPage.blade.php b/resources/views/layouts/resultPage.blade.php index 697c6ecdec8683a5fd2eaac6de7d67e7409f9741..4180f17b55ea6c73469fb78b584f439c3b096935 100644 --- a/resources/views/layouts/resultPage.blade.php +++ b/resources/views/layouts/resultPage.blade.php @@ -1,7 +1,9 @@ +@if(empty(config("metager.metager.browserverification_enabled")) || !config("metager.metager.browserverification_enabled")) <!DOCTYPE html> <html lang="{!! trans('staticPages.meta.language') !!}"> <head> <meta charset="utf-8"> +@endif <title>{{ $eingabe }} - MetaGer</title> <link href="/favicon.ico" rel="icon" type="image/x-icon" /> <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" /> diff --git a/resources/views/layouts/resultpage/unverifiedResultPage.blade.php b/resources/views/layouts/resultpage/unverifiedResultPage.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..0f9f0f229e3e2b8a88aa8f74f60214b8ae82b374 --- /dev/null +++ b/resources/views/layouts/resultpage/unverifiedResultPage.blade.php @@ -0,0 +1,6 @@ +<title>{{ Request::input('eingabe', '') }} - MetaGer</title> +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> +</head> +<body> + <iframe id="mg-framed" src="{{ $url }}" autofocus="true" onload="this.contentWindow.focus();"></iframe> +</body> diff --git a/resources/views/layouts/resultpage/verificationCss.blade.php b/resources/views/layouts/resultpage/verificationCss.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..2c5cfc5b67d757ceb0ca991cfe7eb5f75a3c856d --- /dev/null +++ b/resources/views/layouts/resultpage/verificationCss.blade.php @@ -0,0 +1,16 @@ +html { + height: 100%; +} + +body { + margin: 0; + height: 100%; +} + +iframe#mg-framed { + display: block; + width: 100%; + border: 0; + height: 100%; + height: 100vh; +} \ No newline at end of file diff --git a/resources/views/layouts/resultpage/verificationHeader.blade.php b/resources/views/layouts/resultpage/verificationHeader.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..f982f6dd6017e1d165f5b01f4cf2a4f8baf175c2 --- /dev/null +++ b/resources/views/layouts/resultpage/verificationHeader.blade.php @@ -0,0 +1,5 @@ +<!DOCTYPE html> +<html lang="{!! trans('staticPages.meta.language') !!}"> +<head> + <meta charset="UTF-8"> + <link rel="stylesheet" href="/index.css?id={{ $key }}"> diff --git a/resources/views/parts/filter.blade.php b/resources/views/parts/filter.blade.php index 9eec9fc6bbcb6dae976e73ddc911ab923ec73d69..e69889e2b196a818d414eda4c714c84aec79b88c 100644 --- a/resources/views/parts/filter.blade.php +++ b/resources/views/parts/filter.blade.php @@ -1,7 +1,7 @@ <div id="options"> <div id="toggle-box"> <div id="settings"> - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('settings', ["fokus" => $metager->getFokus(), "url" => url()->full()])) }}"> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), route('settings', ["fokus" => $metager->getFokus(), "url" => $metager->generateSearchLink($metager->getFokus())])) }}" @if(!empty($metager) && $metager->isFramed())target="_top" @endif> <i class="fas fa-cogs"></i> @if($metager->getSavedSettingCount() > 0) <span class="badge badge-primary"></span>{{ $metager->getSavedSettingCount() }}@endif @lang('metaGer.settings')… @@ -17,7 +17,7 @@ @endif @if($metager->getManualParameterFilterSet()) <div id="options-reset"> - <a href="{{$metager->generateSearchLink($metager->getFokus())}}"><nobr>{{ trans('metaGer.filter.reset') }}</nobr></a> + <a href="{{$metager->generateSearchLink($metager->getFokus())}}" @if(!empty($metager) && $metager->isFramed())target="_top" @endif><nobr>{{ trans('metaGer.filter.reset') }}</nobr></a> </div> @endif </div> diff --git a/resources/views/parts/foki.blade.php b/resources/views/parts/foki.blade.php index b0648202d1822881c09ef7aef64bec1a2b8d1258..3905c52c9f4c503f809a5eda87bfb9027922ac01 100644 --- a/resources/views/parts/foki.blade.php +++ b/resources/views/parts/foki.blade.php @@ -1,11 +1,11 @@ @foreach($metager->getSumaFile()->foki as $name => $fokus) <div id="{{$name}}" @if($metager->getFokus() === $name)class="active"@endif> - <a href="@if($metager->getFokus() === $name)#@else{!!$metager->generateSearchLink($name)!!}@endif" target="_self" tabindex="0">@lang($fokus->{"display-name"})</a> + <a href="@if($metager->getFokus() === $name)#@else{!!$metager->generateSearchLink($name)!!}@endif" @if(!empty($metager) && $metager->isFramed())target="_top" @else target="_self"@endif tabindex="0">@lang($fokus->{"display-name"})</a> </div> @endforeach @if (LaravelLocalization::getCurrentLocale() == "de") <div id="maps"> - <a href="https://maps.metager.de/map/{{ urlencode($metager->getQ()) }}/9.7380161,52.37119740000003,12" target="_blank"> + <a href="https://maps.metager.de/map/{{ urlencode($metager->getQ()) }}/9.7380161,52.37119740000003,12" @if(!empty($metager) && $metager->isFramed())target="_top" @else target="_blank"@endif> Maps </a> </div> diff --git a/resources/views/parts/footer.blade.php b/resources/views/parts/footer.blade.php index 1634790b6b9a776c5f4680ecc279a7f8daa28791..90c948debeb9ffd0fca91dc119fd0d05fd925a09 100644 --- a/resources/views/parts/footer.blade.php +++ b/resources/views/parts/footer.blade.php @@ -1,13 +1,13 @@ @if ($type === 'startpage' || $type === 'subpage' || $type === 'resultpage') <footer class="{{ $id }} noprint"> <div> - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "kontakt") }}">{{ trans('sidebar.nav5') }}</a> - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "impressum") }}">{{ trans('sidebar.nav8') }}</a> - <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "datenschutz") }}">{{ trans('sidebar.nav3') }}</a> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "kontakt") }}" @if(!empty($metager) && $metager->isFramed())target="_top"@endif>{{ trans('sidebar.nav5') }}</a> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "impressum") }}" @if(!empty($metager) && $metager->isFramed())target="_top"@endif>{{ trans('sidebar.nav8') }}</a> + <a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "datenschutz") }}" @if(!empty($metager) && $metager->isFramed())target="_top"@endif>{{ trans('sidebar.nav3') }}</a> </div> @if($type !== 'startpage') <div> - <span class="hidden-xs">{{ trans('footer.sumaev.1') }} <a href="{{ trans('footer.sumaev.link') }}">{{ trans('footer.sumaev.2') }}</a></span> + <span class="hidden-xs">{{ trans('footer.sumaev.1') }} <a href="{{ trans('footer.sumaev.link') }}" @if(!empty($metager) && $metager->isFramed())target="_top"@endif>{{ trans('footer.sumaev.2') }}</a></span> </div> @endif </footer> diff --git a/resources/views/parts/pager.blade.php b/resources/views/parts/pager.blade.php index 5bb3011ca9911019820cf0c06f4c652da82320c9..9e17061b71c80fa278ab6da19f6529f9bdb2a4a1 100644 --- a/resources/views/parts/pager.blade.php +++ b/resources/views/parts/pager.blade.php @@ -4,6 +4,6 @@ <a @if($metager->getPage() !== 1) href="javascript:history.back()" @endif>{{ trans('results.zurueck') }}</a> </div> <div id="next-search-link" @if($metager->nextSearchLink() === "#") class="disabled" @endif> - <a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif>{{ trans('results.weiter') }}</a> + <a @if($metager->nextSearchLink() !== "#") href="{{ $metager->nextSearchLink() }}" @endif @if($metager->isFramed())target="_top"@else target="_self"@endif>{{ trans('results.weiter') }}</a> </div> </nav> diff --git a/resources/views/parts/searchbar.blade.php b/resources/views/parts/searchbar.blade.php index eefb203ef4463ba7717863df7352993d50234fbc..af89e43e96135a9399b113e1817861ac815fb7b6 100644 --- a/resources/views/parts/searchbar.blade.php +++ b/resources/views/parts/searchbar.blade.php @@ -1,9 +1,9 @@ <fieldset> - <form id="searchForm" method={{ $request }} action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3 ") }}" accept-charset="UTF-8"> + <form id="searchForm" method={{ $request }} @if(!empty($metager) && $metager->isFramed())target="_top" @endif action="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/meta/meta.ger3 ") }}" accept-charset="UTF-8"> <div class="searchbar {{$class ?? ''}}"> <div class="search-input-submit"> <div id="search-key"> - <a id="key-link" @if(isset($apiAuthorized) && $apiAuthorized)class="authorized" @else class="unauthorized"@endif href="{{ action('KeyController@index', ['redirUrl' => url()->full() ]) }}" data-tooltip="{{ trans ('index.key.tooltip') }}" tabindex="0"> + <a id="key-link" @if(isset($apiAuthorized) && $apiAuthorized)class="authorized" @else class="unauthorized"@endif href="{{ action('KeyController@index', ['redirUrl' => !empty($metager) ? $metager->generateSearchLink($metager->getFokus()) : url()->full() ]) }}" @if(!empty($metager) && $metager->isFramed())target="_top" @endif data-tooltip="{{ trans ('index.key.tooltip') }}" tabindex="0"> <i class="fa fa-key" aria-hidden="true"></i> </a> </div> diff --git a/resources/views/tor.blade.php b/resources/views/tor.blade.php index e7acf2e16995b70501e34225bdc1245fe960dcd9..fba63f18a0aaf93f57b7170f54097fad8da78e07 100644 --- a/resources/views/tor.blade.php +++ b/resources/views/tor.blade.php @@ -4,5 +4,6 @@ @section('content') <h1>MetaGer hidden service</h1> - <a class="btn btn-primary" href="http://b7cxf4dkdsko6ah2.onion/" role="button">{{trans('tor.torbutton')}}</a> + <p>@lang('tor.description')</p> + <a class="btn btn-primary" href="http://metagerv65pwclop2rsfzg4jwowpavpwd6grhhlvdgsswvo6ii4akgyd.onion/" role="button">{{trans('tor.torbutton')}}</a> @endsection diff --git a/routes/web.php b/routes/web.php index caf716a5e8aad65efd1db41fcf78f767980d6a89..b614fa1e8d305194edf4df2fd43f56a1d8916828 100644 --- a/routes/web.php +++ b/routes/web.php @@ -195,12 +195,14 @@ Route::group( return redirect(LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/')); }); - Route::match(['get', 'post'], 'meta/meta.ger3', 'MetaGerSearch@search')->middleware('humanverification', 'useragentmaster'); + Route::match(['get', 'post'], 'meta/meta.ger3', 'MetaGerSearch@search')->middleware('browserverification', 'humanverification', 'useragentmaster')->name("resultpage"); Route::get('meta/loadMore', 'MetaGerSearch@loadMore'); Route::post('img/cat.jpg', 'HumanVerification@remove'); + Route::get('verify/metager/{id}/{uid}', ['as' => 'captcha', 'uses' => 'HumanVerification@captcha', 'middleware' => 'throttle:12,1']); Route::get('r/metager/{mm}/{pw}/{url}', ['as' => 'humanverification', 'uses' => 'HumanVerification@removeGet']); Route::post('img/dog.jpg', 'HumanVerification@whitelist'); + Route::get('index.css', 'HumanVerification@browserVerification'); Route::get('meta/picture', 'Pictureproxy@get'); Route::get('clickstats', 'LogController@clicklog');