added a warning for channels to be re-edited due to admin signature checking problem

This commit is contained in:
csoler 2026-07-03 16:36:03 +02:00
parent a17464c316
commit 874b320ae3
6 changed files with 63 additions and 38 deletions

View File

@ -452,6 +452,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
item->setIcon(GTW_COLUMN_POPULARITY, PopularityDefs::icon(itemInfo.popularity));
item->setData(GTW_COLUMN_POPULARITY, ROLE_SORT, itemInfo.popularity);
/* Set tooltip */
if (itemInfo.adminKey)
tooltip += "\n" + tr("You are admin (modify names and description using Edit menu)");
@ -487,7 +488,14 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
item->setData(GTW_COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags);
/* Set color */
if (itemInfo.publishKey) {
if(itemInfo.deprecated_format)
{
item->setData(GTW_COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_WARNING);
item->setData(GTW_COLUMN_NAME, Qt::ForegroundRole, QBrush(textColorWarning()));
item->setToolTip(GTW_COLUMN_NAME,tr("This object has been created and stored \nin a format that is no longer supported. Please \"edit\" it \nand press \"Update\" to re-sign it in the new format."));
}
else if (itemInfo.publishKey) {
item->setData(GTW_COLUMN_DATA, ROLE_COLOR, GROUPTREEWIDGET_COLOR_PRIVATEKEY);
item->setData(GTW_COLUMN_NAME, Qt::ForegroundRole, QBrush(textColorPrivateKey()));
} else {

View File

@ -25,6 +25,7 @@
#include <QTreeWidgetItem>
#include <QDateTime>
#include "util/rstime.h"
#include "util/FontSizeHandler.h"
class QToolButton;
@ -35,7 +36,8 @@ class RSTreeWidget;
#define GROUPTREEWIDGET_COLOR_STANDARD -1
#define GROUPTREEWIDGET_COLOR_CATEGORY 0
#define GROUPTREEWIDGET_COLOR_PRIVATEKEY 1
#define GROUPTREEWIDGET_COLOR_COUNT 2
#define GROUPTREEWIDGET_COLOR_WARNING 2
#define GROUPTREEWIDGET_COLOR_COUNT 3
#define GTW_COLUMN_NAME 0
#define GTW_COLUMN_UNREAD 1
@ -55,8 +57,8 @@ class GroupItemInfo
{
public:
GroupItemInfo()
: popularity(0), publishKey(false), adminKey(false)
, subscribeFlags(0), max_visible_posts(0)
: popularity(0), creation_time(0),publishKey(false), adminKey(false)
, subscribeFlags(0), max_visible_posts(0), deprecated_format(false)
{}
public:
@ -65,12 +67,14 @@ public:
QString description;
int popularity;
QDateTime lastpost;
QIcon icon;
rstime_t creation_time;
QIcon icon;
bool publishKey;
bool adminKey;
quint32 subscribeFlags;
quint32 max_visible_posts ;
std::set<std::string> context_strings;
bool deprecated_format; // this was added on 07/2026 for forcing admin re-signature of incompatible groups
};
//cppcheck-suppress noConstructor
@ -78,8 +82,9 @@ class GroupTreeWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor textColorCategory READ textColorCategory WRITE setTextColorCategory)
Q_PROPERTY(QColor textColorCategory READ textColorCategory WRITE setTextColorCategory)
Q_PROPERTY(QColor textColorPrivateKey READ textColorPrivateKey WRITE setTextColorPrivateKey)
Q_PROPERTY(QColor textColorWarning READ textColorWarning WRITE setTextColorWarning)
public:
GroupTreeWidget(QWidget *parent = 0);
@ -128,9 +133,11 @@ public:
QColor textColorCategory() const { return mTextColor[GROUPTREEWIDGET_COLOR_CATEGORY]; }
QColor textColorPrivateKey() const { return mTextColor[GROUPTREEWIDGET_COLOR_PRIVATEKEY]; }
QColor textColorWarning() const { return mTextColor[GROUPTREEWIDGET_COLOR_WARNING]; }
void setTextColorCategory(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_CATEGORY] = color; }
void setTextColorPrivateKey(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_PRIVATEKEY] = color; }
void setTextColorWarning(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_WARNING] = color; }
bool getGroupName(const QString& id, QString& name);

View File

@ -961,6 +961,7 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *
groupItemInfo.publishKey = IS_GROUP_PUBLISHER(groupInfo->mMeta.mSubscribeFlags) ;
groupItemInfo.adminKey = IS_GROUP_ADMIN(groupInfo->mMeta.mSubscribeFlags) ;
groupItemInfo.max_visible_posts = groupInfo->mMeta.mVisibleMsgCount ;
groupItemInfo.creation_time = groupInfo->mMeta.mPublishTs ;
#if TOGXS
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {

View File

@ -412,26 +412,33 @@ bool GxsChannelDialog::getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo
void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
{
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
const RsGxsChannelGroup *channelGroupData = dynamic_cast<const RsGxsChannelGroup*>(groupData);
const RsGxsChannelGroup *channelGroupData = dynamic_cast<const RsGxsChannelGroup*>(groupData);
if (!channelGroupData)
if (!channelGroupData)
{
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"<< std::endl;
return;
}
std::cerr << "GxsChannelDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsChannelGroupInfoData"<< std::endl;
return;
}
if(channelGroupData->mImage.mSize > 0)
{
QPixmap image;
GxsIdDetails::loadPixmapFromData(channelGroupData->mImage.mData, channelGroupData->mImage.mSize, image,GxsIdDetails::ORIGINAL);
groupItemInfo.icon = image;
}
else
// Before apr.2026 the validation of admin signature was ommited and the service string (used in channels) was used in the
// creation of its signature. Since the service string is local, this breaks signature validation at distant nodes.
// This flag is here to warn users about re-signing their channel.
if(groupItemInfo.adminKey && (channelGroupData->mMeta.mPublishTs < QDateTime(QDate(2026,4,15),QTime(0,0)).toSecsSinceEpoch()))
groupItemInfo.deprecated_format = true;
if(channelGroupData->mImage.mSize > 0)
{
QPixmap image;
GxsIdDetails::loadPixmapFromData(channelGroupData->mImage.mData, channelGroupData->mImage.mSize, image,GxsIdDetails::ORIGINAL);
groupItemInfo.icon = image;
}
else
groupItemInfo.icon = GxsIdDetails::makeDefaultGroupIcon(channelGroupData->mMeta.mGroupId, ":icons/channel.png", GxsIdDetails::ORIGINAL);
groupItemInfo.description = QString::fromUtf8(channelGroupData->mDescription.c_str());
groupItemInfo.description = QString::fromUtf8(channelGroupData->mDescription.c_str());
}
void GxsChannelDialog::clearDistantSearchResults(TurtleRequestId id)

View File

@ -2485,6 +2485,7 @@ GroupTreeWidget
{
qproperty-textColorCategory: rgb(3, 155, 198);
qproperty-textColorPrivateKey: rgb(249,185,0);
qproperty-textColorWarning: rgb(250,91,15);
}
NetworkDialog {

View File

@ -36,12 +36,12 @@ QFrame[objectName^="info_"] > QLabel
}
/* Specifics Buttons */
QPushButton#applyButton:enabled,/*enabled is needed for not be overrided :https://doc.qt.io/qt-5/stylesheet-syntax.html#conflict-resolution*/
QPushButton#createButton:enabled,
QPushButton#postButton:enabled,
QPushButton#pushButton_History:enabled,
QToolButton#addButton:enabled,
QToolButton#followButton:enabled {
QPushButton#applyButton:enabled,/*enabled is needed for not be overrided :https://doc.qt.io/qt-5/stylesheet-syntax.html#conflict-resolution*/
QPushButton#createButton:enabled,
QPushButton#postButton:enabled,
QPushButton#pushButton_History:enabled,
QToolButton#addButton:enabled,
QToolButton#followButton:enabled {
color: white;
background: #0099cc;
border-radius: 4px;
@ -52,12 +52,12 @@ QToolButton#followButton:enabled {
padding-right: 6px;
}
QPushButton#applyButton:disabled,
QPushButton#createButton:disabled,
QPushButton#postButton:disabled,
QPushButton#pushButton_History:disabled,
QToolButton#addButton:disabled,
QToolButton#followButton:disabled {
QPushButton#applyButton:disabled,
QPushButton#createButton:disabled,
QPushButton#postButton:disabled,
QPushButton#pushButton_History:disabled,
QToolButton#addButton:disabled,
QToolButton#followButton:disabled {
color: white;
background: #d40000;
border-radius: 4px;
@ -65,12 +65,12 @@ QToolButton#followButton:disabled {
padding-right: 6px;
}
QPushButton#applyButton:hover,
QPushButton#createButton:hover,
QPushButton#postButton:hover,
QPushButton#pushButton_History:hover,
QToolButton#addButton:hover,
QToolButton#followButton:hover {
QPushButton#applyButton:hover,
QPushButton#createButton:hover,
QPushButton#postButton:hover,
QPushButton#pushButton_History:hover,
QToolButton#addButton:hover,
QToolButton#followButton:hover {
color: white;
background: #03b1f3;
border-radius: 4px;
@ -252,6 +252,7 @@ GroupTreeWidget
{
qproperty-textColorCategory: rgb(79, 79, 79);
qproperty-textColorPrivateKey: rgb(35,91,159);
qproperty-textColorWarning: rgb(250,91,15);
}
MessagesDialog