diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50e9608367d60945979830b4f754f91c28396a61..4014bae9e87bb63b3d0efe05f88116ae8f7edcf9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,8 @@ stages: - integrationtest - cleanup +.auto-deploy: + image: "registry.gitlab.com/gitlab-org/cluster-integration/auto-deploy-image:v1.0.6" build: services: @@ -163,4 +165,4 @@ integrationtest: - sed -i "s#^APP_URL=.*#APP_URL=$URL#g" .env - sed -i "s#^BRANCH_NAME=.*#BRANCH_NAME=$CI_COMMIT_REF_NAME#g" .env - sed -i "s#^COMMIT_NAME=.*#COMMIT_NAME=$CI_COMMIT_REF_SLUG#g" .env - - php artisan dusk \ No newline at end of file + - php artisan dusk diff --git a/.gitlab/development-values.yaml b/.gitlab/development-values.yaml index 8a5e39a311ff68f7f9f9c973677b4546edbe08cc..2a9382f2e426f7ccff44295c19791d77a19d7b53 100644 --- a/.gitlab/development-values.yaml +++ b/.gitlab/development-values.yaml @@ -1,3 +1,5 @@ +postgresql: + enabled: false service: externalPort: 80 internalPort: 80 diff --git a/.gitlab/production-values.yaml b/.gitlab/production-values.yaml index 130b7dc1e15d5fec3419374b390413c3ad14e833..798cc5f559ec68f6ac92778a4c3b3560575f9a55 100644 --- a/.gitlab/production-values.yaml +++ b/.gitlab/production-values.yaml @@ -1,3 +1,5 @@ +postgresql: + enabled: false service: externalPort: 80 internalPort: 80 diff --git a/.gitlab/review-apps-values.yaml b/.gitlab/review-apps-values.yaml index 8c4d37f43474dd7b4c48be7dea6b9df228c51d26..917ab1db980f75a0a74bbaa958759d7a20cefab9 100644 --- a/.gitlab/review-apps-values.yaml +++ b/.gitlab/review-apps-values.yaml @@ -1,4 +1,5 @@ ---- +postgresql: + enabled: false hpa: enabled: false ingress: @@ -20,4 +21,4 @@ service: commonName: "" externalPort: 80 internalPort: 80 -deploymentApiVersion: apps/v1 +deploymentApiVersion: apps/v1 \ No newline at end of file diff --git a/app/Http/Controllers/MetaGerSearch.php b/app/Http/Controllers/MetaGerSearch.php index ce8e4595d8cb1367cba84a215aabb09258379405..dbc9c50dd124adf5603732e73754c7ddf1daac07 100644 --- a/app/Http/Controllers/MetaGerSearch.php +++ b/app/Http/Controllers/MetaGerSearch.php @@ -245,11 +245,11 @@ class MetaGerSearch extends Controller $newResults = 0; foreach ($metager->getResults() as $index => $resultTmp) { - if ($resultTmp->new || $resultTmp->adgoalChanged) { + if ($resultTmp->new || $resultTmp->changed) { if ($metager->getFokus() !== "bilder") { $view = View::make('layouts.result', ['index' => $index, 'result' => $resultTmp, 'metager' => $metager]); $html = $view->render(); - if (!$resultTmp->new && $resultTmp->adgoalChanged) { + if (!$resultTmp->new && $resultTmp->changed) { $result['changedResults'][$index] = $html; } else { $result['newResults'][$index] = $html; @@ -258,7 +258,7 @@ class MetaGerSearch extends Controller } else { $view = View::make('layouts.image_result', ['index' => $index, 'result' => $resultTmp, 'metager' => $metager]); $html = $view->render(); - if (!$resultTmp->new && $resultTmp->adgoalChanged) { + if (!$resultTmp->new && $resultTmp->changed) { $result['changedResults'][$index] = $html; } else { $result['newResults'][$index] = $html; diff --git a/app/MetaGer.php b/app/MetaGer.php index 00147f6007be8a8c7b6bd677bf3895b429fa1727..51e0ae19abc8a651e09127fdd15803f9db1e4c85 100644 --- a/app/MetaGer.php +++ b/app/MetaGer.php @@ -277,6 +277,11 @@ class MetaGer if (!empty($timings)) { $timings["prepareResults"]["validated results"] = microtime(true) - $timings["starttime"]; } + + $this->duplicationCheck(); + if(!empty($timings)){ + $timings["prepareResults"]["duplications checked"] = microtime(true) - $timings["starttime"]; + } # Validate Advertisements $newResults = []; foreach ($this->ads as $ad) { @@ -379,6 +384,42 @@ class MetaGer } } + public function duplicationCheck() + { + $arr = []; + for($i = 0; $i < count($this->results); $i++) { + + $link = $this->results[$i]->link; + + if (strpos($link, "http://") === 0) { + $link = substr($link, 7); + } + + if (strpos($link, "https://") === 0) { + $link = substr($link, 8); + } + + if (strpos($link, "www.") === 0) { + $link = substr($link, 4); + } + + $link = trim($link, "/"); + $hash = md5($link); + + if(isset($arr[$link])){ + $arr[$link]->gefVon[] = $this->results[$i]->gefVon[0]; + $arr[$link]->gefVonLink[] = $this->results[$i]->gefVonLink[0]; + array_splice($this->results, $i, 1); + $i--; + if($arr[$link]->new === true || $this->results[$i]->new === true){ + $arr[$link]->changed = true; + } + }else{ + $arr[$link] = &$this->results[$i]; + } + } + } + public function startAdgoal(&$results) { $publicKey = getenv('adgoal_public'); @@ -485,7 +526,7 @@ class MetaGer $newLink = "https://api.smartredirect.de/api_v2/ClickGate.php?p=" . urlencode($publicKey) . "&k=" . urlencode($gateHash) . "&url=" . urlencode($targetUrl) . "&q=" . urlencode($query); $result->link = $newLink; $result->partnershop = true; - $result->adgoalChanged = true; + $result->changed = true; } } } diff --git a/app/Models/Result.php b/app/Models/Result.php index 05c2ac78bfb4bf28a9fc959efb188e8de8e26d17..51e69f0cba39432ee99d648aee65fe3abfc982ed 100644 --- a/app/Models/Result.php +++ b/app/Models/Result.php @@ -13,8 +13,8 @@ class Result public $anzeigeLink; # Der tatsächlich angezeigte Link (rein optisch) public $descr; # Die eventuell gekürzte Beschreibung des Suchergebnisses public $longDescr; # Die ungekürzte Beschreibung des Suchergebnisses - public $gefVon; # Die Suchmaschine von der dieses Ergebnis stammt - public $gefVonLink; + public $gefVon = []; # Die Suchmaschine von der dieses Ergebnis stammt + public $gefVonLink = []; public $sourceRank; # Das Ranking für dieses Suchergebnis von der Seite, die es geliefert hat (implizit durch Ergebnisreihenfolge: 20 - Position in Ergebnisliste) public $partnershop; # Ist das Ergebnis von einem Partnershop? (bool) public $image; # Ein Vorschaubild für das Suchergebnis (als URL) @@ -31,7 +31,7 @@ class Result public $strippedLinkAnzeige; # Der Link in Form "foo.bar.de/test" public $rank; # Das Ranking für das Ergebnis public $new = true; - public $adgoalChanged = false; + public $changed = false; # Erstellt ein neues Ergebnis public function __construct($provider, $titel, $link, $anzeigeLink, $descr, $gefVon, $gefVonLink, $sourceRank, $additionalInformation = []) @@ -49,8 +49,8 @@ class Result $this->descr = substr($this->descr, 0, strpos($this->descr, "\n")); $this->descr .= "…"; // Ellipsis character } - $this->gefVon = trim($gefVon); - $this->gefVonLink = trim($gefVonLink); + $this->gefVon[] = trim($gefVon); + $this->gefVonLink[] = trim($gefVonLink); $this->proxyLink = $this->generateProxyLink($this->link); $this->sourceRank = $sourceRank; if ($this->sourceRank <= 0 || $this->sourceRank > 20) { @@ -115,7 +115,7 @@ class Result } # Runter Ranken von Yandex Ergebnissen mit zu viel kyrillischen Texten - if (stripos($this->gefVon, "yandex") !== false) { + if (stripos($this->gefVon[0], "yandex") !== false) { $rank -= $this->calcYandexBoost($eingabe); } @@ -279,7 +279,7 @@ class Result /* Der Dublettenfilter, der sicher stellt, * dass wir nach Möglichkeit keinen Link doppelt in der Ergebnisliste haben. - */ + $dublettenLink = $this->strippedLink; if (!empty($this->provider->{"dubletten-include-parameter"}) && sizeof($this->provider->{"dubletten-include-parameter"}) > 0) { $dublettenLink .= "?"; @@ -300,12 +300,13 @@ class Result } } - if ($metager->addLink($dublettenLink)) { + if ($metager->addLink($this)) { $metager->addHostCount($this->strippedHost); return true; } else { return false; - } + }*/ + return true; } public function isBlackListed(\App\MetaGer $metager) diff --git a/chart/requirements.lock b/chart/requirements.lock index c92fba599d5440f06d9929ac994ed1d1da7c8ab8..ac41574152ad6f9507d5529e29c9a1bfe25e23ee 100644 --- a/chart/requirements.lock +++ b/chart/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: postgresql - repository: https://kubernetes-charts.storage.googleapis.com/ + repository: https://gitlab-org.gitlab.io/cluster-integration/helm-stable-archive version: 0.7.1 -digest: sha256:358ce85fe4d3461ea6bb96713470a80de9c1324214a2e6f97d800298c02530e2 -generated: 2017-08-28T15:22:30.690341342-05:00 +digest: sha256:0a7e2f279e3b8063cfe6365a56601227ff8934fa70a0434df0485bce9590be56 +generated: "2020-10-21T09:35:20.464079556+07:00" diff --git a/chart/requirements.yaml b/chart/requirements.yaml index 8d8838411e3d3f67a9e64109787ddb205681f33f..736a82d7a59ee10d505301f1f7a959119d9a4f57 100644 --- a/chart/requirements.yaml +++ b/chart/requirements.yaml @@ -1,5 +1,7 @@ dependencies: + # This is a legacy in-cluster PostgreSQL dependency that is no longer used for newer installations. + # We can remove this dependency when we drop support for the legacy instances. - name: postgresql version: "0.7.1" - repository: "https://kubernetes-charts.storage.googleapis.com/" + repository: "@stable-archive" condition: postgresql.enabled diff --git a/resources/lang/de/result.php b/resources/lang/de/result.php index cc538da4935c5c6ef59b1f8753068bca08d326c2..d491c90dfc622169b219b94eb8a9d04ccc5f1132 100644 --- a/resources/lang/de/result.php +++ b/resources/lang/de/result.php @@ -13,5 +13,6 @@ return [ 'options.more' => 'MEHR', 'options.less' => 'WENIGER', 'gefVon' => 'von', + 'providers' => 'Anbietern', 'proxytext' => 'Der Link wird anonymisiert geöffnet. Ihre Daten werden nicht zum Zielserver übertragen. Möglicherweise funktionieren manche Webseiten nicht wie gewohnt.', ]; diff --git a/resources/lang/en/result.php b/resources/lang/en/result.php index 407f98ed17ecc938418ffe4b2c6a140a6d683b00..53d1b7af253c85e9461ad92dd83e71a7ecc6c30b 100644 --- a/resources/lang/en/result.php +++ b/resources/lang/en/result.php @@ -13,5 +13,6 @@ return [ 'options.more' => 'MORE', 'options.less' => 'LESS', 'gefVon' => 'by', + 'providers' => 'providers', 'proxytext' => 'Result link is opened anonymously. Your data will not be transferred to destination servers. Some webpages may not work as usual.' ]; \ No newline at end of file diff --git a/resources/views/layouts/ad.blade.php b/resources/views/layouts/ad.blade.php index 8f112ca3fc5a7b31047be8b73ee5b747548cc065..f0857daf2d9eb1e4277d0fabbf8d9918d2b9feaf 100644 --- a/resources/views/layouts/ad.blade.php +++ b/resources/views/layouts/ad.blade.php @@ -8,7 +8,7 @@ {{ $ad->titel }} </a> </h2> - <a class="ad-label" href="{{ $ad->gefVonLink }}" target="_blank" rel="noopener">{!! $ad->gefVon !!}</a> + <a class="ad-label" href="{{ $ad->gefVonLink[0] }}" target="_blank" rel="noopener">{!! $ad->gefVon[0] !!}</a> </div> <div class="result-subheadline"> <a class="result-link" href="{{ $ad->link }}" target="{{ $metager->getNewtab() }}" tabindex="-1"> diff --git a/resources/views/layouts/atom10ad.blade.php b/resources/views/layouts/atom10ad.blade.php index d19f7ebddac8a59288ad3dccce7a3c2a9a1850ce..beaa2ba03565db5670b3d7a691367845dd51ca72 100644 --- a/resources/views/layouts/atom10ad.blade.php +++ b/resources/views/layouts/atom10ad.blade.php @@ -1,6 +1,6 @@ @if(isset($ad)) <ad:advertisement> - <ad:callOut type="TEXT">{!! trans('ad.werbung') !!} {!! trans('ad.von') !!} {!! $ad->gefVon !!}</ad:callOut> + <ad:callOut type="TEXT">{!! trans('ad.werbung') !!} {!! trans('ad.von') !!} {!! $ad->gefVon[0] !!}</ad:callOut> <ad:title type="TEXT">{{ $ad->titel }}</ad:title> <ad:displayUrl type="TEXT">{{ $ad->anzeigeLink }}</ad:displayUrl> <ad:subTitle type="TEXT">{{ $ad->descr }}</ad:subTitle> diff --git a/resources/views/layouts/image_result.blade.php b/resources/views/layouts/image_result.blade.php index 01c48941306fc8cd8947e66de1bd64a52cdbf5d5..d9e8a93db999f809c30ae229dfde0b904c9ec5ab 100644 --- a/resources/views/layouts/image_result.blade.php +++ b/resources/views/layouts/image_result.blade.php @@ -2,7 +2,7 @@ <a href="{{ $result->link }}" target="_blank"> <div title="{{ $result->titel }}"> <img src="{{ $metager->getImageProxyLink($result->image)}}" alt="{{ $result->titel }}"/> - <div>{{ $result->gefVon }}</div> + <div>{{ $result->gefVon[0] }}</div> </div> </a> </div> diff --git a/resources/views/layouts/result.blade.php b/resources/views/layouts/result.blade.php index 7ad73ddb914b0d227713b79197ec0396cd1dad55..28cec0e578418805dce4b11d822f60b3a3690a9f 100644 --- a/resources/views/layouts/result.blade.php +++ b/resources/views/layouts/result.blade.php @@ -9,7 +9,11 @@ {!! $result->titel !!} </a> </h2> - <a class="result-hoster" href="{{ $result->gefVonLink }}" target="{{ $metager->getNewtab() }}" rel="noopener" tabindex="-1">{{ trans('result.gefVon') . " " . $result->gefVon }} </a> + @if(sizeof($result->gefVon)===1) + <a class="result-hoster" href="{{ $result->gefVonLink[0] }}" target="{{ $metager->getNewtab() }}" rel="noopener" tabindex="-1">{{ trans('result.gefVon') . " " . $result->gefVon[0] }} </a> + @else + <span title="{{ (implode(', ', $result->gefVon)) }}" class="result-hoster"> {{ trans('result.gefVon') . " " . sizeof($result->gefVon) . " " . trans('result.providers') }} </span> + @endif </div> <div class="result-subheadline"> <a class="result-link" href="{{ $result->link }}" title="{{ $result->anzeigeLink }}" rel="noopener" tabindex="-1">