From bf41f8ad92d45f3cdac7a4735fe4a730a97da1ed Mon Sep 17 00:00:00 2001 From: Mohammed Saud Date: Fri, 19 Mar 2021 23:10:43 +0530 Subject: [PATCH 1/3] add CORS headers to rsEvents/registerEventsHandler --- libretroshare/src/jsonapi/jsonapi.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 3fc54f6b0..4b003f225 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -361,11 +361,9 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"), [this](const std::shared_ptr session) { const std::weak_ptr weakService(mService); - const std::multimap headers - { - { "Connection", "keep-alive" }, - { "Content-Type", "text/event-stream" } - }; + auto headers = corsHeaders; + headers.insert({ "Connection", "keep-alive" }); + headers.insert({ "Content-Type", "text/event-stream" }); session->yield(rb::OK, headers); size_t reqSize = static_cast( From f90692f8f25b90cd02fae9bfb862bd2222238c27 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sat, 27 Mar 2021 22:13:58 +0100 Subject: [PATCH 2/3] Fixed avatar tooltip --- retroshare-gui/src/gui/gxs/GxsIdDetails.cpp | 2 +- retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp | 3 +++ retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp | 3 +++ retroshare-gui/src/gui/msgs/MessageModel.cpp | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 51dbcf2bc..338c8aabf 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -1104,7 +1104,7 @@ QString nickname ; nickname = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE) ; - comment = QString("%1:%2
%3:%4").arg(QApplication::translate("GxsIdDetails", "Identity name"), + comment = QString("%1: %2
%3: %4").arg(QApplication::translate("GxsIdDetails", "Identity name"), nickname, QApplication::translate("GxsIdDetails", "Identity Id"), QString::fromStdString(details.mId.toStdString())); diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp index 0a8b9271b..c14d21024 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp @@ -170,7 +170,10 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const QString embeddedImage; if ( RsHtml::makeEmbeddedImage( pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation ).toImage(), embeddedImage, 8*S * 8*S ) ) + { + embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); t = "
" + embeddedImage + "" + t + "
"; + } return t; } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index 3d168acf7..2f22067eb 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -567,7 +567,10 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column QString embeddedImage; if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) + { + embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); comment = "
" + embeddedImage + "" + comment + "
"; + } return comment; } diff --git a/retroshare-gui/src/gui/msgs/MessageModel.cpp b/retroshare-gui/src/gui/msgs/MessageModel.cpp index 3d3367553..c71609ca4 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.cpp +++ b/retroshare-gui/src/gui/msgs/MessageModel.cpp @@ -403,7 +403,10 @@ QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co QString embeddedImage; if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) + { + embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); comment = "
" + embeddedImage + "" + comment + "
"; + } return comment; } From 4d6aa8ab5b26032642d4d22f181896159141f423 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sat, 27 Mar 2021 23:32:47 +0100 Subject: [PATCH 3/3] Raise avatar size to better match the amount of text --- retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp | 2 +- retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp | 4 ++-- retroshare-gui/src/gui/msgs/MessageModel.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp index c14d21024..4c1715a39 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdTreeWidgetItem.cpp @@ -169,7 +169,7 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const QString embeddedImage; - if ( RsHtml::makeEmbeddedImage( pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation ).toImage(), embeddedImage, 8*S * 8*S ) ) + if ( RsHtml::makeEmbeddedImage( pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation ).toImage(), embeddedImage, -1 ) ) { embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); t = "
" + embeddedImage + "" + t + "
"; diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index 2f22067eb..07d44ca1b 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -563,10 +563,10 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column return QVariant(); int S = QFontMetricsF(QApplication::font()).height(); - QImage pix( (*icons.begin()).pixmap(QSize(4*S,4*S)).toImage()); + QImage pix( (*icons.begin()).pixmap(QSize(5*S,5*S)).toImage()); QString embeddedImage; - if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) + if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, -1)) { embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); comment = "
" + embeddedImage + "" + comment + "
"; diff --git a/retroshare-gui/src/gui/msgs/MessageModel.cpp b/retroshare-gui/src/gui/msgs/MessageModel.cpp index c71609ca4..5196764a3 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.cpp +++ b/retroshare-gui/src/gui/msgs/MessageModel.cpp @@ -399,10 +399,10 @@ QVariant RsMessageModel::toolTipRole(const Rs::Msgs::MsgInfoSummary& fmpe,int co return QVariant(); int S = QFontMetricsF(QApplication::font()).height(); - QImage pix( (*icons.begin()).pixmap(QSize(4*S,4*S)).toImage()); + QImage pix( (*icons.begin()).pixmap(QSize(5*S,5*S)).toImage()); QString embeddedImage; - if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S)) + if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(5*S,5*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, -1)) { embeddedImage.insert(embeddedImage.indexOf("src="), "style=\"float:left\" "); comment = "
" + embeddedImage + "" + comment + "
";