Commit 3cd6ea3f authored by hlarget's avatar hlarget 👹
Browse files

New error pages and bugfix

Merge branch 'release/3.0.2'
parents 55ac0ec1 56d50682
......@@ -9,11 +9,10 @@
namespace Aboutgoods\KonnectBundle\Controller;
use Aboutgoods\KonnectBundle\ImgProxyClient;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class ResourceController extends AbstractController
{
......@@ -22,7 +21,8 @@ class ResourceController extends AbstractController
* @Route("/resource")
* @return Response
*/
public function getResource(ImgProxyClient $imgProxyClient, Request $request) {
public function getResource(ImgProxyClient $imgProxyClient, Request $request)
{
// we encode the url in base64 on the front to avoid problems when passing URLS to the backend
// so we have to decode it
$url = base64_decode($request->query->get("url"));
......@@ -35,7 +35,11 @@ class ResourceController extends AbstractController
$extension = $request->query->get("useDefaultExtension", false) ? null : "png";
$path = $imgProxyClient->getResourceUrl($url, $resize, $width, $height, $gravity, $enlarge, $extension);
return new Response(file_get_contents($path),200,["Content-Type"=>"application/octet-stream"]);
try {
$content = file_get_contents($path);
return new Response($content, 200, ["Content-Type" => "application/octet-stream"]);
} catch (\Throwable $throwable) {
return new Response("Resource not found", 404);
}
}
}
\ No newline at end of file
<?php
namespace Aboutgoods\KonnectBundle\EventSubscriber;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class LocaleFromBrowserEventSubscriber
{
public function onKernelRequest(RequestEvent $event)
{
$request = $event->getRequest();
$request->setLocale($request->getPreferredLanguage(["en", "fr"]));
$request->setDefaultLocale($request->getLocale());
}
}
\ No newline at end of file
......@@ -63,4 +63,8 @@ services:
arguments: ['@Aboutgoods\KonnectBundle\AntarClient']
tags: ['security.voter']
Aboutgoods\KonnectBundle\Security\AntarVoter:
alias: konnect.voter
\ No newline at end of file
alias: konnect.voter
konnect.events.locale:
class: Aboutgoods\KonnectBundle\EventSubscriber\LocaleFromBrowserEventSubscriber
tags:
- { name: kernel.event_listener, event: kernel.request, priority: 260 }
\ No newline at end of file
<svg width="168" height="49" viewBox="0 0 168 49" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M24.5 48C37.4787 48 48 37.4787 48 24.5C48 11.5213 37.4787 1 24.5 1C11.5213 1 1 11.5213 1 24.5C1 37.4787 11.5213 48 24.5 48Z" stroke="#7069FA" stroke-width="2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4715 12.224C29.176 12.224 28.8954 12.3543 28.7048 12.5801L21.8055 20.7513L23.2327 21.2389C23.4576 21.3158 23.6095 21.5263 23.6114 21.7639L23.6489 26.3352C23.6509 26.579 23.4948 26.796 23.263 26.8717L21.7158 27.377L28.7042 36.4024C28.8942 36.6479 29.1872 36.7916 29.4976 36.7916H31.4126C32.1705 36.7916 32.6549 35.9836 32.2977 35.3152L26.4862 24.4388C26.3313 24.149 26.3282 23.8017 26.4778 23.5091L31.5006 13.6843C31.8419 13.0166 31.357 12.224 30.6071 12.224L29.4715 12.224ZM17.8664 13.633C17.8664 12.8433 18.7365 12.363 19.4047 12.784L20.3167 13.3584C20.6083 13.5421 20.7853 13.8627 20.7853 14.2075V35.4548C20.7853 36.2238 19.9559 36.7071 19.2869 36.3278L18.375 35.8108C18.0607 35.6326 17.8664 35.2992 17.8664 34.9379V27.203L16.7581 26.805C16.5374 26.7258 16.3895 26.5174 16.3876 26.2829L16.3501 21.7052C16.3481 21.4613 16.5042 21.2443 16.736 21.1686L17.8664 20.7995V13.633Z" fill="#7069FA"/>
<g style="mix-blend-mode:hard-light">
<path d="M63.988 37V13.456H68.164V24.148H68.272L76.66 13.456H81.304L74.068 22.636L82.528 37H77.92L71.548 25.912L68.164 30.124V37H63.988ZM87.251 37L82.571 19.324H86.747L88.871 28.504C89.063 29.344 89.219 30.184 89.339 31.024C89.483 31.864 89.639 32.716 89.807 33.58H89.951C90.119 32.716 90.287 31.864 90.455 31.024C90.647 30.184 90.851 29.344 91.067 28.504L93.371 19.324H97.151L99.491 28.504C99.707 29.344 99.911 30.184 100.103 31.024C100.295 31.864 100.487 32.716 100.679 33.58H100.823C100.991 32.716 101.147 31.864 101.291 31.024C101.435 30.184 101.591 29.344 101.759 28.504L103.883 19.324H107.771L103.271 37H98.339L96.287 28.756C96.095 27.916 95.915 27.088 95.747 26.272C95.579 25.432 95.399 24.544 95.207 23.608H95.063C94.895 24.544 94.727 25.432 94.559 26.272C94.391 27.112 94.211 27.952 94.019 28.792L92.003 37H87.251ZM118.614 37.432C117.39 37.432 116.25 37.228 115.194 36.82C114.138 36.388 113.214 35.776 112.422 34.984C111.63 34.192 111.006 33.232 110.55 32.104C110.118 30.952 109.902 29.644 109.902 28.18C109.902 26.74 110.13 25.444 110.586 24.292C111.042 23.14 111.642 22.168 112.386 21.376C113.154 20.584 114.03 19.972 115.014 19.54C115.998 19.108 117.006 18.892 118.038 18.892C119.238 18.892 120.294 19.096 121.206 19.504C122.118 19.912 122.874 20.488 123.474 21.232C124.098 21.976 124.566 22.864 124.878 23.896C125.19 24.928 125.346 26.056 125.346 27.28C125.346 27.688 125.322 28.072 125.274 28.432C125.25 28.792 125.214 29.08 125.166 29.296H113.934C114.126 30.88 114.678 32.104 115.59 32.968C116.526 33.808 117.714 34.228 119.154 34.228C119.922 34.228 120.63 34.12 121.278 33.904C121.95 33.664 122.61 33.34 123.258 32.932L124.662 35.524C123.822 36.076 122.886 36.532 121.854 36.892C120.822 37.252 119.742 37.432 118.614 37.432ZM113.898 26.488H121.746C121.746 25.12 121.446 24.052 120.846 23.284C120.27 22.492 119.37 22.096 118.146 22.096C117.09 22.096 116.166 22.468 115.374 23.212C114.582 23.956 114.09 25.048 113.898 26.488ZM136.86 37.432C135.636 37.432 134.496 37.228 133.44 36.82C132.384 36.388 131.46 35.776 130.668 34.984C129.876 34.192 129.252 33.232 128.796 32.104C128.364 30.952 128.148 29.644 128.148 28.18C128.148 26.74 128.376 25.444 128.832 24.292C129.288 23.14 129.888 22.168 130.632 21.376C131.4 20.584 132.276 19.972 133.26 19.54C134.244 19.108 135.252 18.892 136.284 18.892C137.484 18.892 138.54 19.096 139.452 19.504C140.364 19.912 141.12 20.488 141.72 21.232C142.344 21.976 142.812 22.864 143.124 23.896C143.436 24.928 143.592 26.056 143.592 27.28C143.592 27.688 143.568 28.072 143.52 28.432C143.496 28.792 143.46 29.08 143.412 29.296H132.18C132.372 30.88 132.924 32.104 133.836 32.968C134.772 33.808 135.96 34.228 137.4 34.228C138.168 34.228 138.876 34.12 139.524 33.904C140.196 33.664 140.856 33.34 141.504 32.932L142.908 35.524C142.068 36.076 141.132 36.532 140.1 36.892C139.068 37.252 137.988 37.432 136.86 37.432ZM132.144 26.488H139.992C139.992 25.12 139.692 24.052 139.092 23.284C138.516 22.492 137.616 22.096 136.392 22.096C135.336 22.096 134.412 22.468 133.62 23.212C132.828 23.956 132.336 25.048 132.144 26.488ZM147.546 37V19.324H150.966L151.254 22.456H151.398C152.022 21.304 152.778 20.428 153.666 19.828C154.554 19.204 155.466 18.892 156.402 18.892C157.242 18.892 157.914 19.012 158.418 19.252L157.698 22.852C157.386 22.756 157.098 22.684 156.834 22.636C156.57 22.588 156.246 22.564 155.862 22.564C155.166 22.564 154.434 22.84 153.666 23.392C152.898 23.92 152.238 24.856 151.686 26.2V37H147.546ZM160.976 37V19.324H165.116V37H160.976ZM163.064 16.228C162.32 16.228 161.708 16.012 161.228 15.58C160.748 15.148 160.508 14.584 160.508 13.888C160.508 13.192 160.748 12.628 161.228 12.196C161.708 11.74 162.32 11.512 163.064 11.512C163.808 11.512 164.42 11.74 164.9 12.196C165.38 12.628 165.62 13.192 165.62 13.888C165.62 14.584 165.38 15.148 164.9 15.58C164.42 16.012 163.808 16.228 163.064 16.228Z" fill="#212932"/>
</g>
</svg>
This image diff could not be displayed because it is too large. You can view the blob instead.
.logo-kweeri {
display: flex;
width: 100%;
margin: 36px 0;
text-align: center;
}
.logo-kweeri img {
height: 190px;
}
.image-status {
body {
display: flex;
width: 100%;
z-index: 100;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0px;
font-family: 'Source Sans Pro', sans-serif;
color: #212932;
flex-direction: column;
}
.status-code{
display: inline-flex;
width: 100%;
margin-top: 2rem;
h1 {
font-family: 'Source Code Pro', monospace;
font-size: 200px;
margin: 0px;
font-weight: 500;
}
.status-code-error{
display: inline-flex;
width: 100%;
}
.container {
.status-content{
margin: auto;
display: flex;
justify-content: center;
height: 20rem;
position:relative;
flex-direction: column;
align-items: center;
margin-bottom:10px;
}
.width-500{
width: 39rem;
height: 19.4rem;
}
.width-404{
width: 42rem;
height: 21.3rem;
padding-top: 2rem;
}
width: 100%;
.status-image{
max-width: 320px;
z-index: 100;
}
.first-number-position{
position:absolute;
left:60px;
.content {
display: flex;
justify-content: space-evenly;
width: 100%;
}
.error-number{
font-family: Rubik;
font-style: normal;
font-weight: 500;
color: #FFFFFF;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
font-size: 370px;
line-height: 24rem;
letter-spacing: -1.5rem;
.content > * {
flex: 1 1 44px;
}
.second-number-position{
position:absolute;
right:60px;
.content > *:not(div) {
margin-left: 44px;
}
.image-position{
z-index: 50;
}
.content > div {
text-align: right;
.status-number{
font-family: Rubik;
font-style: normal;
font-weight: 500;
font-size: 400px;
line-height: 22rem;
color: #FFFFFF;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}
.n-404{
line-height: 17rem;
.gif {
border-radius: 9px;
height: 174px;
}
.planet-position{
}
.image-planet{
.links {
list-style: none;
margin: 0px;
padding: 0px;
display: flex;
flex-direction: column;;
justify-content: center;
}
.center-image {
margin: auto;
.links a {
color: #7069FA;
text-decoration: none;
font-size: 24px;
}
.ant-layout {
position: relative;
min-height: 95vh;
.links a:hover{
color: #4D3DF7;
text-decoration: underline;
}
.error-card {
padding: 48px 0px;
max-width: 754px;
margin: 0px auto;
text-align: -webkit-center;
.links li:last-of-type {
margin-top: 28px;
}
.error-card-500 {
padding: 48px;
max-width: 754px;
margin: -5px auto 0px auto;
text-align: -webkit-center;
i {
margin-right: 13px;
}
.text-error {
font-size: 1.3rem;
line-height: 2rem;
.message {
margin-top: 43px;
font-size: 24px;
text-align: center;
}
.content {
justify-content: space-around;
.footer {
font-size: 14px;
justify-self: end;
display: flex;
width: 70%;
margin-top: 2rem;
justify-content: space-between;
position:absolute;
bottom: 36px;
width: 100%;
padding-left: 34px;
padding-right: 34px;
box-sizing: border-box;
}
.exception-message {
font-weight: bold;
.footer a{
text-decoration: none;
color: #212932;
}
.footer {
position: relative;
.footer a:hover{
text-decoration: underline;
opacity: 0.8;
}
@media screen and (max-width: 660px) {
.status-number {
font-size: 300px;
}
.status-image {
max-width: 280px;
}
.error-number {
font-size: 270px;
}
}
@media screen and (max-width: 500px) {
.width-404 {
padding-top: 1rem;
height: 15rem;
}
.content {
flex-direction: column;
align-items: center;
}
.text-error {
margin: 10px;
}
.status-image {
max-width: 190px;
}
.status-number {
font-size: 200px;
}
.first-number-position {
left: 45px;
}
.second-number-position {
right: 45px;
}
.error-number {
font-size: 190px;
}
}
\ No newline at end of file
errors:
linktohome: "Return to Home"
linktosupport: "Fill a ticket in our support center"
E404: "😟 It looks like nothing was found in this location"
E500: "😟 We encountered some difficulties to display this page, fill a ticket and our support will handle this"
errors:
linktohome: "Retourner sur la page principale"
linktosupport: "Envoyer un ticket au support"
E404: "😟 La page demandée est introuvable"
E500: "😟 Une erreur interne est survenue.<br/>Si le problème persiste, contactez notre centre de support."
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext" target-language="en">
<body>
<group id="error404">
<trans-unit id="error404.notFound">
<source>error404.notFound</source>
<target>It looks like nothing was found in this location. Maybe try to:</target>
</trans-unit>
<trans-unit id="error404.visit">
<source>error404.visit</source>
<target>or visit our</target>
</trans-unit>
<trans-unit id="error404.goHomePage">
<source>error404.goHomePage</source>
<target>HOME PAGE</target>
</trans-unit>
</group>
<group id="errorPage">
<trans-unit id="errorPage.getBackButton">
<source>errorPage.getBackButton</source>
<target>GET BACK</target>
</trans-unit>
<trans-unit id="errorPage.messageText">
<source>errorPage.messageText</source>
<target>Something is broken.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextLink">
<source>errorPage.messageTextLink</source>
<target>Send us an email to report this issue.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextSecond">
<source>errorPage.messageTextSecond</source>
<target>Please let us know what you were doing when this error occurred ? We will fix it as soon as possible. Sorry for any inconvenience caused.</target>
</trans-unit>
</group>
<group id="error500">
<trans-unit id="error500.internalServerText">
<source>error500.internalServerText</source>
<target>The server has been deserted for a while. Please be patient or try again later, or send us a </target>
</trans-unit>
<trans-unit id="error500.internalServerMail">
<source>error500.internalServerMail</source>
<target>email to fix it.</target>
</trans-unit>
</group>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext" target-language="fr">
<body>
<group id="error404">
<trans-unit id="error404.notFound">
<source>error404.notFound</source>
<target>On dirait que rien ne se trouve ici ! Essayez de :</target>
</trans-unit>
<trans-unit id="error404.visit">
<source>error404.visit</source>
<target>ou visitez notre</target>
</trans-unit>
<trans-unit id="error404.goHomePage">
<source>error404.goHomePage</source>
<target>PAGE D'ACCUEIL</target>
</trans-unit>
</group>
<group id="errorPage">
<trans-unit id="errorPage.getBackButton">
<source>errorPage.getBackButton</source>
<target>RETOUR</target>
</trans-unit>
<trans-unit id="errorPage.messageText">
<source>errorPage.messageText</source>
<target>Quelque chose ne marche pas.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextLink">
<source>errorPage.messageTextLink</source>
<target>Envoyez-nous un mail pour signaler ce problème.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextSecond">
<source>errorPage.messageTextSecond</source>
<target>Veuillez nous indiquer que vouliez vous faire lorsque l'erreur est apparue ? Nous allons corriger ce problème aussitôt que possible. Nous sommes désolé pour la gêne occasionnée.</target>
</trans-unit>
</group>
<group id="error500">
<trans-unit id="error500.internalServerText">
<source>error500.internalServerText</source>
<target>Il y a eu un problème de notre coté ! Vous pouvez re-tenter plus tard ou nous signaler</target>
</trans-unit>
<trans-unit id="error500.internalServerMail">
<source>error500.internalServerMail</source>
<target>le problème par message.</target>
</trans-unit>
</group>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -4,16 +4,17 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{% block title %}Welcome!{% endblock %}</title>
<script src="https://kit.fontawesome.com/329e22cc9d.js" crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="{{ asset('favicon.png') }}" />
{{ encore_entry_link_tags("app") }}
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
<script src="{{ path("utils_routing_js") }}"></script>
{% block javascripts %}{% endblock %}
{{ encore_entry_script_tags("app") }}
</body>
</html>
{% extends '@KonnectBundle/errors/error_base.html.twig' %}
{% trans_default_domain "translations" %}
{% block title %}
{% extends '@KonnectBundle/base.html.twig' %}
{% block title %}{{ status_code }} | {{ status_text }}{% endblock %}
{% block body %}
<div class="container">
An Error Occurred: {{ status_text }} - {{ exception.statusCode }}
<img src="{{ asset('bundles/konnect/images/KweeriLogo.svg') }}"/>
<h1>{{ status_code }}</h1>
<div class="content">
<div>
{% set randGif=random(["missing-1","missing-2","solar-system","confused","jim","trex"]) %}
<img class="gif" src="{{ asset('bundles/konnect/images/gifs/'~randGif~'.gif') }}"/>
{{ error.message }}
{% endblock %}
</div>
<ul class="links">
<li>
<a href="/"><i class="fal fa-home"></i>{% trans %}errors.linktohome{% endtrans %}</a>
</li>
<li>
<a target="_blank" href="https://aboutgoods.zendesk.com/hc/en-us/requests/new"><i class="fal fa-headset"></i>{% trans %}errors.linktosupport{% endtrans %}</a>
</li>
</ul>
</div>
{% set existing=[404,500] %}
{% block body %}
<div class="ant-layout">
<div class="message">
{% if status_code==404 %}
{% trans %}errors.E404{% endtrans %}
{% elseif status_code==500 %}
{% trans %}errors.E500{% endtrans %}
{% else %}
{% trans %}errors.E500{% endtrans %} ({{ status_text }})
{% endif %}
<div class="logo-kweeri">
<img class="center-image" src="{{ asset('bundles/konnect/images/kweeri-text.png') }}">
</div>
</div>
<div class="footer">
<div><a href="https://legal.kweeri.io/">Terms & Conditions</a> | <a target="_blank" href="https://aboutgoods.zendesk.com/hc/en-us/">Help</a> | <a href="mailto:support@aboutgoods.net">Contact</a></div><div>Copyright © {{ 'now'|date('Y')}} Aboutgoods Company. All rights reserved. </div>
</div>
<div class="status-code-error">
<div class="status-content">
<div class="error-number">{{ exception.statusCode }}</div>
</div>
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/konnect/style/error-pages.css') }}"/>
{% endblock %}
</div>
{% block javascripts %}
<div class="container">
<div class="ant-card error-card-500">
<h2>😵 {{ status_text }} 😵</h2>
<p class="exception-message">{{ exception.message }}</p>
<p>
{% trans %}errorPage.messageTextSecond{% endtrans %}
</p>
<p>
{% if(app.token.user != "anon.") %}
<a href="mailto:support%40aboutgoods.net?cc={{ app.token.user.email }}&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}errorPage.messageTextLink{% endtrans %}
</a>
{% else %}
<a href="mailto:support%40aboutgoods.net?&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}errorPage.messageTextLink{% endtrans %}
</a>