Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ess2u-0007mB-OU for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Mar 2018 15:29:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ess2s-0004XE-BM for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Mar 2018 15:28:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ess1h-00063q-I7 for pgadmin-hackers@lists.postgresql.org; Mon, 05 Mar 2018 15:27:45 +0000 Received: from mail-io0-x22f.google.com ([2607:f8b0:4001:c06::22f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ess1d-0003ea-Gi for pgadmin-hackers@postgresql.org; Mon, 05 Mar 2018 15:27:43 +0000 Received: by mail-io0-x22f.google.com with SMTP id 30so18395048iog.2 for ; Mon, 05 Mar 2018 07:27:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fTktHYRqXsXjz1xOshW6ZaIDfeBiE5uDDvur6VCmffk=; b=eDVTO0VUuvCQv6l8mMUNDxfDI0z+Cf+mdI0C6nZAxF1ZEdSHSr+i20sY3t/T6FZ4iI 4ceTqUVxnR/IpBS5TD9lOEbYRDcH+isjiiUdbB3DjTI2WbcX8jDgOeohen+vWXimaP3U xrzfG/2CY5fytTZ/JPlHdPao724laPTPVqHj1SFaYvAlLOQD56GhuN/GXuj3hsQ/OhWa WCzrNI9Nc4jO8kTDNanKGY/LfupmE4JHkr+0g2SKhQcmAWUEmebh9CN8ME9Ilic6A0rc weYOUkDeyY7GP+gdseEWigaJH8NofZgbO3RGUd8fM/8MO76WKpnGNXtop+vE4jzQKuW+ fmEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fTktHYRqXsXjz1xOshW6ZaIDfeBiE5uDDvur6VCmffk=; b=q4TBvh1hNc2g/B0ysRRla/Fvhtavw9SydrXs5YI1JQKJG4tsjsTVDBOXZC6gecX4sg 11V7mOo9SMYkR21rJhDD/JhVmRnRrOMlAAJJBcWBthUZZiutMsWBJbhfl0S0RFy/WAUJ IiqjGt3Bef2LmP6G1c0+hIdyOtt0vVRavYl5f3jI+mgp6Skx628a2xANBrrIBRz5YxHU OW7acnnUcLKd2Ipr/HdYhSNJi2R2Ko/msWJEgeTVfVI3x0p+nh3o8WBLQJ69/RZJE6nn Mo/LCJRJSMIadN9mrnZdkg4d4JMNeSZFLrpZ4fpE4Bkl4DKY6R0A0o8pWBg6ekOsKgha 5laQ== X-Gm-Message-State: AElRT7EMcvRb3qx5JRq9EcjAFzPjgCOsO6rgV/JbBWrKxki2rl3OlqLp TeGId6Itcn4feiKzTc934ynT5c6OOY6SarKBRcghaw== X-Google-Smtp-Source: AG47ELslDy8gCB95Y1U0HXfKxW+IY/aGla7EU2lIJwl1FIKPxyae2PkD3+1dI9GY3fMSKAAqskdZMTYqYxa/Ri1D624= X-Received: by 10.107.31.133 with SMTP id f127mr16966347iof.234.1520263658753; Mon, 05 Mar 2018 07:27:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Joao De Almeida Pereira Date: Mon, 05 Mar 2018 15:27:28 +0000 Message-ID: Subject: Re: [pgAdmin4][RM#3037] Allow user to disable Gravatar image To: Murtuza Zabuawala Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a1140422a588dde0566abf78e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a1140422a588dde0566abf78e Content-Type: text/plain; charset="UTF-8" Hi Murtuza, Why are we doing this using templates? Can this be done with a request to the backend to get the image and then retrieve the Gravatar if it is defined or return a static image if not? + +{% if config.SERVER_MODE %} window.onload = function(e){ setTimeout(function() { - var gravatarImg = 'Gravatar image for {{ username }} {{ username }} '; + var gravatarImg = {{ IMG.PREPARE_HTML()|safe }} //$('#navbar-menu .navbar-right > li > a').html(gravatarImg); var navbarRight = document.getElementById("navbar-menu").getElementsByClassName("navbar-right")[0]; if (navbarRight) { what if we have var gravatarImg = 'Gravatar image for {{ username }} {{ username }} '; And then the endpoint /user/{{username}}/gravatar would be responsible for returning a Gravatar or not depending on the configuration? Thanks Joao On Mon, Mar 5, 2018 at 3:13 AM Murtuza Zabuawala < murtuza.zabuawala@enterprisedb.com> wrote: > Hi, > > PFA patch to disable Gravatar image in Server mode. > > Requirments & Issues: > - For security reasons. > - For systems which do not have internet access. > - Hangs pgAdmin4 while loading the page if connection has no internet > access (as described in the ticket) > > -- > Regards, > Murtuza Zabuawala > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > > --001a1140422a588dde0566abf78e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Murtuza,

Why are we doing this using= templates? Can this be done with a request to the backend to get the image= and then retrieve the Gravatar if it is defined or return a static image i= f not?

+
+{% if config.SERVER_MODE = %}
=C2=A0window.onload =3D function(e){
=C2=A0 setTimeo= ut(function() {
-=C2=A0 =C2=A0var gravatarImg =3D '<img sr= c=3D"{{ username | gravatar }}" width=3D"18" height=3D&= quot;18" alt=3D"Gravatar image for {{ username }}"> {{ us= ername }} <span class=3D"caret"></span>';
+=C2=A0 =C2=A0var gravatarImg =3D {{ IMG.PREPARE_HTML()|safe }}
=C2=A0 =C2=A0 //$('#navbar-menu .navbar-right > li > a').ht= ml(gravatarImg);
=C2=A0 =C2=A0 var navbarRight =3D document.getEl= ementById("navbar-menu").getElementsByClassName("navbar-righ= t")[0];
=C2=A0 =C2=A0 if (navbarRight) {
what if we have=C2=A0

var gravatarImg = =3D '<img src=3D"/user/{{username}}/gravatar" width=3D&quo= t;18" height=3D"18" alt=3D"Gravatar image for {{ userna= me }}"> {{ username }} <span class=3D"caret"></s= pan>';

And then the endpoint
= /user/{{username}}/gravatar=C2=A0
would be responsible for return= ing a Gravatar or not depending on the configuration?

<= div>
Thanks
Joao

On Mon, Mar 5, 2018 at 3:13 AM Murtuza Zabuawala &= lt;murtuza.zabuawala@= enterprisedb.com> wrote:
Hi,

PFA patch to disable Gravatar image in Server mode.

Requirments & Issues:
- = For security reasons.
- For systems which do not have intern= et access.
- Hangs pgAdmin4 while loading the page if connection has n= o internet access (as described in the ticket)

--
Regards,
Murtuza Zabuawala
Enterprise= DB:=C2=A0http://www.enterprisedb.com
The Enterprise PostgreSQL Co= mpany

--001a1140422a588dde0566abf78e--