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 1esss8-0003pZ-RV for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Mar 2018 16:21:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1esss7-0000JE-P9 for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Mar 2018 16:21:55 +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 1esss7-0000J4-CM for pgadmin-hackers@lists.postgresql.org; Mon, 05 Mar 2018 16:21:55 +0000 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1esss3-0004tm-R5 for pgadmin-hackers@postgresql.org; Mon, 05 Mar 2018 16:21:53 +0000 Received: by mail-oi0-x241.google.com with SMTP id j79so12448910oib.12 for ; Mon, 05 Mar 2018 08:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dM5a1XXO5dU4aeei+OZxtxAAHcc4St3GWu+lTs1+gPA=; b=umznrqo5XU8hixabTLOHhxsv4Giybs5hPgIHoVxpkQyOULhQ+sLFG5aFH6ZjrltSgT hRcDa4GoMyeJgPDRfsh2HFi9sruHbrbhM9oeXz2gncBvfsymnbf60ptDauJRwAgRDQ92 N4gmn4mNa0BLUWXQTiqAN0It9y9Uhu/vRgcaz3RTiOWOAI1pPrwpARKXfzAT87mv0hH5 X7/GWb4utk1PbJIGX6mQ2qrVZWF+Bl9YwPRaGH6Z+fJsGs01SiDkiVs30kWmbHYilmX4 hqygSPcSBLDhMuo4HUeCXwvorDO0b/9vCubj04o/2zLtFyi+FGBTZ7+IhIB+ZGxYQ/dL vobw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dM5a1XXO5dU4aeei+OZxtxAAHcc4St3GWu+lTs1+gPA=; b=eNsANMlCMRIrPO6ZV+aQPtTbOCDl6Z0P62sRWUE+mVGbmp3uzx6Wk4/6DmblxMQPyu zxpt+VFOkU3vN8Cc8lLsw8BCyqHv23zREio8ouYA75uSFIDjPVM73e6rGrJwTKlrZ6Ua cj5M1HSyT1uxHzNd2t3/0IB7IC8oXwkfdgiyqGxkcI94AjhZPyVJK/9Gckb6xTRD80Ob w1x6IF6riaQDti9rOEiqjF50IMfXPlT1KuhO4I5KvLw/1xEOGf6SiABLybgdx6StXurC Q0pd4X72+GqMrRVlXLlwDXKSzH7QZisqFxk461KAifYLIxE2xXK3SG+eze4FibXQ7hcz dG2w== X-Gm-Message-State: AElRT7GdZSmSFbN84QxqIJo5cAutpjmQ9mGC8hv2xX43SzbzFVY8Zxaq 4KbkLQaISSuAcwWIakw4TyqpUNW2lpQ2qkDZA8CKCA== X-Google-Smtp-Source: AG47ELtnH7glJIU1trBih2EurRmEIz8x+EKVFmWUBCZvs3g16ykrrhy0R41zmYe/LV7ZcU46dv25Zrmd/3fTaDidoSc= X-Received: by 10.202.63.85 with SMTP id m82mr10187990oia.64.1520266910677; Mon, 05 Mar 2018 08:21:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.8.150 with HTTP; Mon, 5 Mar 2018 08:21:30 -0800 (PST) In-Reply-To: References: From: Murtuza Zabuawala Date: Mon, 5 Mar 2018 21:51:30 +0530 Message-ID: Subject: Re: [pgAdmin4][RM#3037] Allow user to disable Gravatar image To: Joao De Almeida Pereira Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a113dd4922cd6130566acb968" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a113dd4922cd6130566acb968 Content-Type: text/plain; charset="UTF-8" Hi Joao, We are using Flask-Gravatar module for this and it is designed to work with template only. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Mon, Mar 5, 2018 at 8:57 PM, Joao De Almeida Pereira < jdealmeidapereira@pivotal.io> wrote: > 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 = ' height="18" alt="Gravatar image for {{ username }}"> {{ username }} class="caret">'; > + 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 = ' height="18" alt="Gravatar image for {{ username }}"> {{ username }} class="caret">'; > > 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 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 >> >> --001a113dd4922cd6130566acb968 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Joao,

We are using Flask-Gravatar module for this and it is designed to work with templa= te only.

<= div dir=3D"ltr">
--
Regards,
Murtuza Zabuawala
Enterpris= eDB:=C2=A0http://www.enterprisedb.com
The Enterprise PostgreSQL C= ompany

<= /div>

On Mon, Mar 5, 2018 at 8:57 PM, Joao De Alme= ida Pereira <jdealmeidapereira@pivotal.io> wrote:=
Hi Murtuza,

Why are we doing this using templates? Can this be done with a requ= est 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 %}
=C2=A0window.onload =3D fun= ction(e){
=C2=A0 setTimeout(function() {
-=C2=A0 =C2=A0= var gravatarImg =3D '<img src=3D"{{ username | gravatar }}"= ; width=3D"18" height=3D"18" alt=3D"Gravatar image= for {{ username }}"> {{ username }} <span class=3D"caret&q= uot;></span>';
+=C2=A0 =C2=A0var gravatarImg =3D {{ = IMG.PREPARE_HTML()|safe }}
=C2=A0 =C2=A0 //$('#navbar-menu .n= avbar-right > li > a').html(gravatarImg);
=C2=A0 =C2=A0= var navbarRight =3D document.getElementById("navbar-menu").= getElementsByClassName("navbar-right")[0];
= =C2=A0 =C2=A0 if (navbarRight) {

what if we = have=C2=A0

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

And then the endpoint
/user/{{username}= }/gravatar=C2=A0
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.zabuawal= a@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 connectio= n has no internet access (as described in the ticket)

<= div dir=3D"ltr">
--
Regards,
Murtuza Zabuawala
Enterpris= eDB:=C2=A0http://www.enterprisedb.com
The Enterprise Postgre= SQL Company


--001a113dd4922cd6130566acb968--