Merge branch 'RetroShare:master' into cleanupoldiconsandnewsvg

This commit is contained in:
defnax 2022-02-25 18:05:41 +01:00 committed by GitHub
commit 701b2e4ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 438 additions and 246 deletions

5
.gitignore vendored
View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: (C) 2004-2019 Retroshare Team <contact@retroshare.cc>
# SPDX-FileCopyrightText: (C) 2004-2022 Retroshare Team <contact@retroshare.cc>
# SPDX-License-Identifier: CC0-1.0
*.o
@ -17,3 +17,6 @@ Thumbs.db
*.kdev4
!supportlibs/libsam3/Makefile
# QtCreator cruft
*CMakeLists.txt.user

View File

@ -67,43 +67,3 @@ test-ubuntu:
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList | jq
- docker container stop retroshare
build-android-arm-apk:
stage: build
script:
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--build-arg RS_SERVICE_QMAKE_EXTRA_OPTS="$RS_SERVICE_QMAKE_EXTRA_OPTS"
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile
Dockercontext
# see https://stackoverflow.com/a/59055906
- >
docker cp
$(docker create --rm retroshare:android_arm_latest):/retroshare-service-android-build/android-build/build/outputs/apk/debug/android-build-debug.apk
$CI_PROJECT_DIR/RetroShare_Android_Service-arm.apk
artifacts:
paths:
- RetroShare_Android_Service-arm.apk
# Use separate runner to avoid no space left on device
build-android-arm64-apk:
stage: build
script:
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm64_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--build-arg ANDROID_PLATFORM_VER=21
--build-arg ANDROID_NDK_ARCH=arm64
--build-arg RS_SERVICE_QMAKE_EXTRA_OPTS="$RS_SERVICE_QMAKE_EXTRA_OPTS"
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile
Dockercontext
- >
docker cp
$(docker create --rm retroshare:android_arm64_latest):/retroshare-service-android-build/android-build/build/outputs/apk/debug/android-build-debug.apk
$CI_PROJECT_DIR/RetroShare_Android_Service-arm64.apk
artifacts:
paths:
- RetroShare_Android_Service-arm64.apk

View File

@ -9,9 +9,10 @@ RetroShare provides file sharing, chat, messages, forums, channels and more.
.Build Status
|===============================================================================
|GNU/Linux, Android (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"]
|GNU/Linux (via Gitlab CI) | image:https://gitlab.com/RetroShare/RetroShare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/RetroShare/-/commits/master",title="pipeline status"]
|Windows (via AppVeyor) | image:https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true[link="https://ci.appveyor.com/project/RetroShare58622/retroshare"]
|macOS, (via Travis CI) | image:https://app.travis-ci.com/RetroShare/RetroShare.svg?branch=master[link="https://app.travis-ci.com/github/RetroShare/RetroShare"]
|libretroshare GNU/Linux, Android (via Gitlab CI) | image:https://gitlab.com/RetroShare/libretroshare/badges/master/pipeline.svg[link="https://gitlab.com/RetroShare/libretroshare/-/commits/master",title="pipeline status"]
|===============================================================================
== Get the source

View File

@ -12,16 +12,26 @@
## To run the container
# docker run -it -p 127.0.0.1:9092:9092 "${CI_REGISTRY_IMAGE}" retroshare-service --jsonApiPort 9092 --jsonApiBindAddress 0.0.0.0
FROM ubuntu
FROM ubuntu:21.10
ENV DEBIAN_FRONTEND=noninteractive
ENV APT_UNAT="--assume-yes --quiet"
RUN apt-get update -y && apt-get upgrade -y -qq && \
apt-get install -y -qq build-essential cimg-dev libssl-dev libbz2-dev \
libsqlite3-dev \
libsqlcipher-dev libupnp-dev pkg-config libz-dev \
qt5-default libxapian-dev qttools5-dev doxygen rapidjson-dev \
git cmake curl
RUN apt-get update $APT_UNAT && \
apt-get upgrade --show-upgraded $APT_UNAT && \
apt-get clean $APT_UNAT && \
apt-get install --no-install-recommends $APT_UNAT \
bash build-essential cimg-dev libssl-dev libbz2-dev \
libminiupnpc-dev \
libsqlite3-dev libsqlcipher-dev \
pkg-config libz-dev \
libxapian-dev doxygen rapidjson-dev \
git cmake curl python3
## Avoid git cloning spuriously failing with
# server certificate verification failed. CAfile: none CRLfile: none
RUN apt-get install --no-install-recommends $APT_UNAT --reinstall \
ca-certificates
RUN git clone --depth 1 https://github.com/aetilius/pHash.git && \
rm -rf pHash-build && mkdir pHash-build && cd pHash-build && \
@ -34,11 +44,14 @@ ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
ARG REPO_BRANCH=master
ARG REPO_DEPTH="--depth 2000"
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \
git fetch --tags && cd ..
RUN mkdir RetroShare-build && cd RetroShare-build && \
qmake ../RetroShare \
CONFIG+=no_retroshare_plugins \
CONFIG+=retroshare_service CONFIG+=no_retroshare_gui \
CONFIG+=rs_jsonapi CONFIG+=rs_deep_search && \
(make -j$(nproc) || make -j$(nproc) || make) && make install && \
git fetch --tags && \
git submodule update --init --remote --force \
libbitdht/ libretroshare/ openpgpsdk/ && \
cd ..
RUN \
mkdir RetroShare-build && cd RetroShare-build && \
cmake -B. -S../RetroShare/retroshare-service \
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON && \
make -j$(nproc) && make install && \
cd .. && rm -rf RetroShare-build

View File

@ -8,11 +8,12 @@ RUN \
cd RetroShare && git remote add testing $REPO_URL && \
git fetch --tags testing $REPO_BRANCH && \
git reset --hard testing/$REPO_BRANCH && \
git submodule update --init --remote --force \
libbitdht/ libretroshare/ openpgpsdk/ && \
git --no-pager log --max-count 1
RUN \
mkdir RetroShare-build && cd RetroShare-build && \
qmake ../RetroShare CONFIG+=no_retroshare_gui \
CONFIG+=retroshare_service \
CONFIG+=rs_jsonapi CONFIG+=rs_deep_search && \
(make -j$(nproc) || make -j$(nproc) || make) && make install && \
cmake -B. -S../RetroShare/retroshare-service \
-DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON && \
make -j$(nproc) && make install && \
cd .. && rm -rf RetroShare-build

View File

@ -1,18 +1,18 @@
ZLIB_VERSION=1.2.3
BZIP2_VERSION=1.0.6
MINIUPNPC_VERSION=2.0
OPENSSL_VERSION=1.1.1h
ZLIB_VERSION=1.2.11
BZIP2_VERSION=1.0.8
MINIUPNPC_VERSION=2.2.3
OPENSSL_VERSION=1.1.1m
SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2rc3
LIBXML2_VERSION=2.9.7
LIBXSLT_VERSION=1.1.32
CURL_VERSION=7.58.0
SPEEXDSP_VERSION=1.2.0
LIBXML2_VERSION=2.9.12
LIBXSLT_VERSION=1.1.34
CURL_VERSION=7.81.0
TCL_VERSION=8.6.10
SQLCIPHER_VERSION=4.4.0
LIBMICROHTTPD_VERSION=0.9.59
FFMPEG_VERSION=3.4
SQLCIPHER_VERSION=4.5.0
LIBMICROHTTPD_VERSION=0.9.75
FFMPEG_VERSION=4.4
RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.7
XAPIAN_VERSION=1.4.19
DOWNLOAD_PATH?=download
BUILD_PATH=build
@ -56,8 +56,7 @@ $(BUILD_PATH)/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
rm -r -f $(BUILD_PATH)/zlib-*
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# build
cd zlib-$(ZLIB_VERSION) && ./configure
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../$(BUILD_PATH)"
cd zlib-$(ZLIB_VERSION) && make -f win32/Makefile.gcc libz.a
cd zlib-$(ZLIB_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include
@ -72,7 +71,7 @@ $(BUILD_PATH)/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
bzip2: $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz:
wget https://sourceforge.net/projects/bzip2/files/bzip2-$(BZIP2_VERSION).tar.gz/download -O $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
wget https://www.sourceware.org/pub/bzip2/bzip2-$(BZIP2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
$(BUILD_PATH)/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# prepare
@ -100,10 +99,10 @@ $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIU
rm -r -f $(BUILD_PATH)/miniupnpc-*
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# build
cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && export PATH=.:$$PATH && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && export PATH=.:$$PATH && make -f Makefile.mingw libminiupnpc.a miniupnpc.dll
# copy files
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
cp miniupnpc-$(MINIUPNPC_VERSION)/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
cp miniupnpc-$(MINIUPNPC_VERSION)/include/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib/
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin
@ -314,7 +313,7 @@ $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION
rm -r -f $(BUILD_PATH)/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# build
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && make install
# cleanup
rm -r -f ffmpeg-$(FFMPEG_VERSION)

@ -1 +1 @@
Subproject commit 659423769541169457c41f71c8a038e2d64ba079
Subproject commit 6abbec95073f3c1eb5059cbf8441111ef4a317a7

@ -1 +1 @@
Subproject commit 5a6f09ee11a34f1c52b5be3f0a440f185b9b2a89
Subproject commit 16758995237494a1f39fa86f0f04cf37de121a91

View File

@ -121,6 +121,11 @@ win32 {
#Have to reorder libs, else got /libs/lib/libcrypto.a(bio_lib.o):bio_lib.c:(.text+0x0): multiple definition of `BIO_new'
LIBS = -lcurl -lxml2 -lz -lxslt -lws2_32 -lwldap32 -lssl -lcrypto -lgdi32 $${LIBS}
isEmpty(QMAKE_SH) {
# MinGW
LIBS += -lcrypt32
}
# Check for msys2
!isEmpty(PREFIX_MSYS2) {
message(Use msys2 xml2.)

View File

@ -55,6 +55,11 @@ linux-* {
PKGCONFIG += speex speexdsp
} else {
LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
win32:isEmpty(QMAKE_SH) {
# MinGW
LIBS += -lbcrypt
}
}
#################################### Windows #####################################

View File

@ -229,7 +229,7 @@ void GetStartedDialog::inviteFriends()
{
RsAutoUpdatePage::lockAllEvents();
cert = rsPeers->GetRetroshareInvite(RsPeerId(),RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::FULL_IP_HISTORY);
cert = rsPeers->GetRetroshareInvite(RsPeerId(),RsPeers::defaultCertificateFlags | RetroshareInviteFlags::FULL_IP_HISTORY);
RsAutoUpdatePage::unlockAllEvents() ;
}

View File

@ -50,14 +50,10 @@
HomePage::HomePage(QWidget *parent) :
MainPage(parent),
ui(new Ui::HomePage),
mIncludeAllIPs(false),
mUseShortFormat(true)
ui(new Ui::HomePage)
{
ui->setupUi(this);
updateCertificate();
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend()));
connect(ui->copyIDButton, SIGNAL(clicked()), this, SLOT(copyId()));
@ -76,26 +72,45 @@ HomePage::HomePage(QWidget *parent) :
QMenu *menu = new QMenu();
menu->addAction(CopyIdAction);
if(!RsAccounts::isHiddenNode())
{
QAction *includeIPsAct = new QAction(QIcon(), tr("Include all your known IPs"),this);
connect(includeIPsAct, SIGNAL(triggered()), this, SLOT(toggleIncludeAllIPs()));
includeIPsAct->setCheckable(true);
includeIPsAct->setChecked(mIncludeAllIPs);
menu->addAction(includeIPsAct);
}
QAction *useOldFormatAct = new QAction(QIcon(), tr("Use old certificate format"),this);
useOldFormatAct->setToolTip(tr("Displays the certificate format used up to version 0.6.5\nOld Retroshare nodes will not understand the\nnew short format"));
connect(useOldFormatAct, SIGNAL(triggered()), this, SLOT(toggleUseOldFormat()));
useOldFormatAct->setCheckable(true);
useOldFormatAct->setChecked(!mUseShortFormat);
menu->addAction(useOldFormatAct);
menu->addSeparator();
menu->addAction(SendAction);
menu->addAction(WebMailAction);
menu->addAction(RecAction);
menu->addSeparator();
mUseOldFormatact = new QAction(QIcon(), tr("Use old certificate format"),this);
mUseOldFormatact->setToolTip(tr("Displays the certificate format used up to version 0.6.5\nOld Retroshare nodes will not understand the\nnew short format"));
connect(mUseOldFormatact, SIGNAL(triggered()), this, SLOT(updateOwnCert()));
mUseOldFormatact->setCheckable(true);
mUseOldFormatact->setChecked(false);
menu->addAction(mUseOldFormatact);
if(!RsAccounts::isHiddenNode())
{
mIncludeLocIPact = new QAction(QIcon(), tr("Include current local IP"),this);
connect(mIncludeLocIPact, SIGNAL(triggered()), this, SLOT(updateOwnCert()));
mIncludeLocIPact->setCheckable(true);
mIncludeLocIPact->setChecked(true);
menu->addAction(mIncludeLocIPact);
mIncludeExtIPact = new QAction(QIcon(), tr("Include current external IP"),this);
connect(mIncludeExtIPact, SIGNAL(triggered()), this, SLOT(updateOwnCert()));
mIncludeExtIPact->setCheckable(true);
mIncludeExtIPact->setChecked(true);
menu->addAction(mIncludeExtIPact);
mIncludeDNSact = new QAction(QIcon(), tr("Include my DNS"),this);
connect(mIncludeDNSact, SIGNAL(triggered()), this, SLOT(updateOwnCert()));
mIncludeDNSact->setCheckable(true);
mIncludeDNSact->setChecked(true);
menu->addAction(mIncludeDNSact);
mIncludeIPHistoryact = new QAction(QIcon(), tr("Include all IPs history"),this);
connect(mIncludeIPHistoryact, SIGNAL(triggered()), this, SLOT(updateOwnCert()));
mIncludeIPHistoryact->setCheckable(true);
mIncludeIPHistoryact->setChecked(false);
menu->addAction(mIncludeIPHistoryact);
}
ui->shareButton->setMenu(menu);
@ -118,6 +133,8 @@ HomePage::HomePage(QWidget *parent) :
mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
updateOwnCert();
}
void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
@ -139,13 +156,15 @@ void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
case RsNetworkEventCode::DNS_UPDATED: // [fallthrough]
RsQThreadUtils::postToObject( [=]()
{
updateCertificate();
updateOwnCert();
},this);
break;
default:
break;
}
}
#ifdef DEAD_CODE
void HomePage::certContextMenu(QPoint /*point*/)
{
QMenu menu(this) ;
@ -178,17 +197,7 @@ void HomePage::certContextMenu(QPoint /*point*/)
menu.exec(QCursor::pos());
}
void HomePage::toggleUseShortFormat()
{
mUseShortFormat = !mUseShortFormat;
updateCertificate();
}
void HomePage::toggleIncludeAllIPs()
{
mIncludeAllIPs = !mIncludeAllIPs;
updateCertificate();
}
#endif
HomePage::~HomePage()
{
@ -196,15 +205,8 @@ HomePage::~HomePage()
delete ui;
}
void HomePage::updateCertificate()
void HomePage::getOwnCert(QString& invite,QString& description) const
{
updateOwnCert();
}
void HomePage::updateOwnCert()
{
bool include_extra_locators = mIncludeAllIPs;
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
@ -213,23 +215,46 @@ void HomePage::updateOwnCert()
return ;
}
QString invite ;
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::DNS;
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::NOTHING;
if(mIncludeAllIPs)
if(mIncludeLocIPact->isChecked())
invite_flags |= RetroshareInviteFlags::CURRENT_LOCAL_IP;
if(mIncludeExtIPact->isChecked())
invite_flags |= RetroshareInviteFlags::CURRENT_EXTERNAL_IP;
if(mIncludeDNSact->isChecked())
invite_flags |= RetroshareInviteFlags::DNS;
if(mIncludeIPHistoryact->isChecked())
invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
if(mUseShortFormat)
if(!mUseOldFormatact->isChecked())
{
std::string short_invite;
rsPeers->getShortInvite(short_invite,rsPeers->getOwnId(),invite_flags | RetroshareInviteFlags::RADIX_FORMAT);
invite = QString::fromStdString(short_invite);
}
else
invite = QString::fromStdString(rsPeers->GetRetroshareInvite(detail.id,invite_flags));
description = ConfCertDialog::getCertificateDescription(detail,false,!mUseOldFormatact->isChecked(),invite_flags);
}
void HomePage::updateOwnCert()
{
QString certificate, description;
getOwnCert(certificate,description);
if(!mUseOldFormatact->isChecked()) // in this case we have to split the cert for a better display
{
QString S;
QString txt;
for(uint32_t i=0;i<short_invite.size();)
for(int i=0;i<certificate.size();)
if(S.length() < 100)
S += short_invite[i++];
S += certificate[i++];
else
{
txt += S + "\n";
@ -237,16 +262,10 @@ void HomePage::updateOwnCert()
}
txt += S;
invite = txt; // the "\n" is here to make some space
certificate = txt; // the "\n" is here to make some space
}
else
invite = QString::fromStdString(rsPeers->GetRetroshareInvite(detail.id,invite_flags));
ui->retroshareid->setText("\n"+invite+"\n");
QString description = ConfCertDialog::getCertificateDescription(detail,false,mUseShortFormat,include_extra_locators);
ui->retroshareid->setText("\n"+certificate+"\n");
ui->retroshareid->setToolTip(description);
}
@ -348,9 +367,3 @@ void HomePage::openWebHelp()
{
QDesktopServices::openUrl(QUrl(QString("https://retrosharedocs.readthedocs.io/en/latest/")));
}
void HomePage::toggleUseOldFormat()
{
mUseShortFormat = !mUseShortFormat;
updateCertificate();
}

View File

@ -46,28 +46,32 @@ public:
virtual QString pageName() const { return tr("Home") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
// Returns the certificate along with its description using current options.
void getOwnCert(QString& invite,QString& description) const;
private slots:
#ifdef DEAD_CODE
void certContextMenu(QPoint);
#endif
void updateOwnCert();
void updateCertificate();
void runEmailClient();
void copyCert();
void copyId();
void saveCert();
void addFriend();
void webMail();
//void loadCert();
void openWebHelp() ;
void toggleUseOldFormat() ;
void recommendFriends();
void toggleIncludeAllIPs();
void toggleUseShortFormat();
private:
Ui::HomePage *ui;
bool mIncludeAllIPs;
bool mUseShortFormat;
QAction *mIncludeDNSact;
QAction *mIncludeIPHistoryact;
QAction *mIncludeExtIPact;
QAction *mIncludeLocIPact;
QAction *mUseOldFormatact;
RsEventsHandlerId_t mEventHandlerId;

View File

@ -1081,6 +1081,8 @@ void SetForegroundWindowInternal(HWND hWnd)
return _instance->gxsforumDialog;
case Posted:
return _instance->postedDialog;
case Home:
return _instance->homePage;
}
return NULL;

View File

@ -102,7 +102,8 @@ public:
Search = 8, /** Search page. */
Posted = 11, /** Posted links */
People = 12, /** People page. */
Options = 13 /** People page. */
Options = 13, /** People page. */
Home = 14 /** Home page. */
};

View File

@ -495,7 +495,7 @@ void PostedItem::fill()
ui->voteUpButton->setDisabled(true);
ui->voteDownButton->setDisabled(true);
ui->thumbnailLabel->setPixmap( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
ui->thumbnailLabel->setPicture( FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"));
ui->fromLabel->setId(mPost.mMeta.mAuthorId);
ui->titleLabel->setText(tr( "<p><font color=\"#ff0000\"><b>The author of this message (with ID %1) is banned.</b>").arg(QString::fromStdString(mPost.mMeta.mAuthorId.toStdString()))) ;
QDateTime qtime;
@ -509,8 +509,10 @@ void PostedItem::fill()
QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png");
mInFill = true;
int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height());
int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
int desired_height = ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height();
int desired_width = 16/9.0 * desired_height; //sqpixmap2.width()*desired_height/(float)sqpixmap2.height();
ui->thumbnailLabel->setFixedSize(desired_width,desired_height);
QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs);
@ -573,18 +575,18 @@ void PostedItem::fill()
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail.
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPixmap(sqpixmap);
// QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPicture(pixmap);
ui->thumbnailLabel->setToolTip(tr("Click to view Picture"));
ui->thumbnailLabel->setEnableZoom(false);
QPixmap scaledpixmap;
if(pixmap.width() > 800){
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(scaledpixmap);
}else{
}else
ui->pictureLabel->setPixmap(pixmap);
}
}
else if (urlOkay && (mPost.mImage.mData == NULL))
{
ui->expandButton->setDisabled(true);

View File

@ -112,11 +112,11 @@ protected:
void setCommentsSize(int comNb) override;
private slots:
void doExpand(bool open);
void toggle();
void makeUpVote();
void makeDownVote();
void toggleNotes() ;
void doExpand(bool open) override;
void toggle() override;
void makeUpVote() override;
void makeDownVote() override;
void toggleNotes() override;
private:
/** Qt Designer generated object */

View File

@ -176,6 +176,12 @@
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
@ -190,7 +196,7 @@
<number>6</number>
</property>
<item>
<widget class="ClickableLabel" name="thumbnailLabel">
<widget class="ZoomableLabel" name="thumbnailLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -732,15 +738,15 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ClickableLabel</class>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>util/ClickableLabel.h</header>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="Posted_images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -22,6 +22,7 @@
#include "ChatLobbyWidget.h"
#include "MainWindow.h"
#include "HomePage.h"
#include "chat/ChatDialog.h"
#include "common/PeerDefs.h"
#include "common/RsCollection.h"
@ -561,12 +562,21 @@ RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
// - we should not need to parse and re-read a cert in old format.
//
RsPeerDetails detail;
if (rsPeers->getPeerDetails(ssl_id, detail) == false) {
if (rsPeers->getPeerDetails(ssl_id, detail) == false)
std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl;
} else {
else
{
link._type = TYPE_CERTIFICATE;
if(rsPeers->getOwnId() == ssl_id) // in this case, use application-wide parameters set in HomePage
{
QString invite,description;
static_cast<HomePage*>(MainWindow::getPage(MainWindow::Home))->getOwnCert(invite,description);
link._radix = invite;
}
else
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str());
link._name = QString::fromUtf8(detail.name.c_str());
link._location = QString::fromUtf8(detail.location.c_str());
link._radix.replace("\n","");

View File

@ -1359,7 +1359,7 @@ bool NewFriendList::exportFriendlist(QString &fileName)
if (!rsPeers->getPeerDetails(*list_iter2, detailSSL))
continue;
std::string certificate = rsPeers->GetRetroshareInvite(detailSSL.id, RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::DNS | RetroshareInviteFlags::RADIX_FORMAT);
std::string certificate = rsPeers->GetRetroshareInvite(detailSSL.id, RsPeers::defaultCertificateFlags | RetroshareInviteFlags::RADIX_FORMAT);
// remove \n from certificate
certificate.erase(std::remove(certificate.begin(), certificate.end(), '\n'), certificate.end());

View File

@ -264,7 +264,7 @@ void ConfCertDialog::loadInvitePage()
ui._shouldAddSignatures_CB->setEnabled(detail.gpgSigners.size() > 1) ;
std::string invite ;
RetroshareInviteFlags flags = RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::RADIX_FORMAT;
RetroshareInviteFlags flags = RsPeers::defaultCertificateFlags | RetroshareInviteFlags::RADIX_FORMAT;
if(!detail.isHiddenNode && ui._includeIPHistory_CB->isChecked())
flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
@ -283,7 +283,7 @@ void ConfCertDialog::loadInvitePage()
ui.stabWidget->setTabText(PageCertificate, tr("Retroshare Certificate"));
}
QString infotext = getCertificateDescription(detail,ui._shouldAddSignatures_CB->isChecked(),ui._shortFormat_CB->isChecked(), ui._includeIPHistory_CB->isChecked() );
QString infotext = getCertificateDescription(detail,ui._shouldAddSignatures_CB->isChecked(),ui._shortFormat_CB->isChecked(), flags );
ui.userCertificateText->setToolTip(infotext) ;
@ -297,19 +297,15 @@ void ConfCertDialog::loadInvitePage()
ui.userCertificateText->setText(QString::fromUtf8(invite.c_str()));
}
QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bool signatures_included,bool use_short_format,bool include_additional_locators)
QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail, bool signatures_included, bool use_short_format,RetroshareInviteFlags invite_flags)
{
//infotext += tr("<p>Use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
QString infotext;
if(use_short_format)
{
infotext += tr("<p>This Retroshare ID contains:") ;
}
else
{
infotext += tr("<p>This certificate contains:") ;
}
infotext += "<UL>" ;
@ -334,17 +330,28 @@ QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bo
if(detail.isHiddenNode)
infotext += tr("<li> <b>onion address</b> and <b>port</b>") +" (" + detail.hiddenNodeAddress.c_str() + ":" + QString::number(detail.hiddenNodePort)+ ")</li>";
else if(!include_additional_locators)
{
if(!detail.localAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.localAddr.c_str() + ":" + QString::number(detail.localPort)+ "</li>";
if(!detail.extAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>";
}
else for(auto it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
else if(!!(invite_flags & RetroshareInviteFlags::FULL_IP_HISTORY))
for(auto it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
{
infotext += "<li>" ;
infotext += tr("<b>IP address</b> and <b>port</b>: ") + QString::fromStdString(*it) ;
infotext += "</li>" ;
}
else
{
if(!!(invite_flags & RetroshareInviteFlags::CURRENT_LOCAL_IP) && !detail.localAddr.empty())
infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.localAddr.c_str() + ":" + QString::number(detail.localPort)+ "</li>";
if(!!(invite_flags & RetroshareInviteFlags::CURRENT_EXTERNAL_IP) && !detail.extAddr.empty())
infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>";
}
if(!!(invite_flags & RetroshareInviteFlags::DNS) && !detail.dyndns.empty())
{
infotext += "<li>" ;
infotext += tr("<b>DNS:</b> : ") + QString::fromStdString(detail.dyndns);
infotext += "</li>" ;
}
infotext += QString("</p>") ;

View File

@ -59,7 +59,7 @@ public:
/* window will destroy itself! */
}
static void loadAll();
static QString getCertificateDescription(const RsPeerDetails& det, bool signatures_included, bool use_short_format, bool extra_locators_included);
static QString getCertificateDescription(const RsPeerDetails& det, bool signatures_included, bool use_short_format,RetroshareInviteFlags invite_flags);
signals:
void configChanged();

View File

@ -891,7 +891,9 @@ void ConnectFriendWizard::cleanFriendCert()
whileBlocking(ui->friendCertEdit)->setPlainText(QString::fromUtf8(cleanCert.c_str()));
whileBlocking(ui->friendCertEdit)->setTextCursor(textCursor);
certDetail = ConfCertDialog::getCertificateDescription(details,false,mIsShortInvite,!details.ipAddressList.empty());
// use dummy flags so that the content of the description is driven by what's in the "details" variable.
RetroshareInviteFlags dummy_flags = RetroshareInviteFlags::ALL;
certDetail = ConfCertDialog::getCertificateDescription(details,false,mIsShortInvite,dummy_flags);
}
if (mIsShortInvite)

View File

@ -61,6 +61,10 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WindowFlags flags)
//connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(profilemanager()));
connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(exportProfile()));
// Remove this because it duplicates functionality of the HomePage.
ui.retroshareId_LB->hide();
ui.retroshareId_content_LB->hide();
ui.stackPageCertificate->hide();
ui.onlinesince->setText(DateTime::formatLongDateTime(Rshare::startupTime()));
}
@ -103,8 +107,8 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
ui.pgpfingerprint->setText(misc::fingerPrintStyleSplit(QString::fromStdString(detail.fpr.toStdString())));
std::string invite ;
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP);
ui.retroshareid->setText(QString::fromUtf8(invite.c_str()));
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RsPeers::defaultCertificateFlags);
ui.retroshareId_content_LB->setText(QString::fromUtf8(invite.c_str()));
/* set retroshare version */
ui.version->setText(Rshare::retroshareVersion(true));
@ -139,7 +143,7 @@ void
CryptoPage::load()
{
std::string cert ;
RetroshareInviteFlags flags = RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP;
RetroshareInviteFlags flags = RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_LOCAL_IP | RetroshareInviteFlags::CURRENT_EXTERNAL_IP;
if(ui._shortFormat_CB->isChecked())
{
@ -161,7 +165,7 @@ CryptoPage::load()
RsPeerDetails detail;
rsPeers->getPeerDetails(rsPeers->getOwnId(),detail);
ui.certplainTextEdit->setToolTip(ConfCertDialog::getCertificateDescription(detail, ui._includeSignatures_CB->isChecked(), ui._shortFormat_CB->isChecked(), ui._includeAllIPs_CB->isChecked() ));
ui.certplainTextEdit->setToolTip(ConfCertDialog::getCertificateDescription(detail, ui._includeSignatures_CB->isChecked(), ui._shortFormat_CB->isChecked(), flags));
}
void

View File

@ -7,25 +7,19 @@
<x>0</x>
<y>0</y>
<width>869</width>
<height>487</height>
<height>493</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Node information</string>
</attribute>
<widget class="QStackedWidget" name="stackedWidget">
<widget class="QWidget" name="stackPageNodeInfo" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_1">
<layout class="QGridLayout" name="gridLayout_4">
<item row="6" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="retroshareId_LB">
<property name="text">
<string>Retroshare ID:</string>
</property>
@ -248,7 +242,7 @@
<item row="14" column="1">
<widget class="QPushButton" name="exportprofile">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use this to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use this button to export your profile key. You can then import it in a different computer and make a new node with the same profile. Doing so, existing friends that you also add to the new node will automatically recognise that new node as friend.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Export</string>
@ -474,7 +468,7 @@
</widget>
</item>
<item row="6" column="1" colspan="3">
<widget class="QLabel" name="retroshareid">
<widget class="QLabel" name="retroshareId_content_LB">
<property name="font">
<font>
<weight>75</weight>
@ -539,10 +533,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Certificate</string>
</attribute>
<widget class="QWidget" name="stackPageCertificate" native="true">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="certplainTextEdit">

View File

@ -0,0 +1,162 @@
# RetroShare decentralized communication platform
#
# Copyright (C) 2021-2022 Gioacchino Mazzurco <gio@retroshare.cc>
# Copyright (C) 2021-2022 Asociación Civil Altermundi <info@altermundi.net>
#
# SPDX-License-Identifier: CC0-1.0
cmake_minimum_required (VERSION 3.18.0)
project(retroshare-service)
include(CMakeDependentOption)
option(
RS_DEVELOPMENT_BUILD
"Disable optimization to speed up build, enable verbose build log. \
just for development purposes, not suitable for library usage"
OFF )
option(
RS_JSON_API
"Use restbed to expose libretroshare as JSON API via HTTP"
ON )
option(
RS_SERVICE_DESKTOP
"Install icons and shortcuts for desktop environements"
OFF )
option(
RS_SERVICE_TERMINAL_LOGIN
"Enable RetroShare login via terminal"
ON )
cmake_dependent_option(
RS_SERVICE_TERMINAL_WEBUI_PASSWORD
"Enable settin Web UI password via terminal in retroshare-service"
OFF
"RS_WEBUI"
ON )
cmake_dependent_option(
RS_WEBUI
"Install RetroShare Web UI"
OFF
"RS_JSON_API"
ON )
################################################################################
set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
find_package(Git REQUIRED)
################################################################################
if(RS_DEVELOPMENT_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif(RS_DEVELOPMENT_BUILD)
################################################################################
list(
APPEND RS_SERVICE_SOURCES
src/retroshare-service.cc )
add_executable(${PROJECT_NAME} ${RS_SERVICE_SOURCES})
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
################################################################################
if(RS_DEVELOPMENT_BUILD)
target_compile_options(${PROJECT_NAME} PRIVATE "-O0")
endif(RS_DEVELOPMENT_BUILD)
################################################################################
set(LIBRETROSHARE_DEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../libretroshare/")
if(EXISTS "${LIBRETROSHARE_DEVEL_DIR}/.git" )
message(
STATUS
"libretroshare submodule found at ${LIBRETROSHARE_DEVEL_DIR} using it" )
add_subdirectory(
"${LIBRETROSHARE_DEVEL_DIR}" "${CMAKE_BINARY_DIR}/libretroshare" )
else()
FetchContent_Declare(
libretroshare
GIT_REPOSITORY "https://gitlab.com/RetroShare/libretroshare.git"
GIT_TAG "origin/master"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
TIMEOUT 10
)
FetchContent_MakeAvailable(libretroshare)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE retroshare)
################################################################################
if(RS_SERVICE_DESKTOP)
if(UNIX AND NOT APPLE)
install(
FILES data/retroshare-service.svg
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/ )
install(
FILES data/retroshare-service_48x48.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps/retroshare-service.png )
install(
FILES data/retroshare-service_128x128.png
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/retroshare-service.png )
install(
FILES data/retroshare-service.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/data/retroshare-service.desktop )
endif(UNIX AND NOT APPLE)
endif(RS_SERVICE_DESKTOP)
################################################################################
if(RS_JSON_API)
target_compile_definitions(${PROJECT_NAME} PUBLIC RS_JSONAPI)
endif(RS_JSON_API)
if(RS_SERVICE_TERMINAL_LOGIN)
target_compile_definitions(${PROJECT_NAME} PUBLIC RS_SERVICE_TERMINAL_LOGIN)
endif(RS_SERVICE_TERMINAL_LOGIN)
if(RS_WEBUI)
set(RS_WEBUI_DEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../webui/")
if(EXISTS "${RS_WEBUI_DEVEL_DIR}/.git" )
message(
STATUS
"RetroShare WebUI repository found at ${RS_WEBUI_DEVEL_DIR} using it" )
add_subdirectory(
"${RS_WEBUI_DEVEL_DIR}" "${CMAKE_BINARY_DIR}/webui" )
else()
FetchContent_Declare(
webui
GIT_REPOSITORY "https://gitlab.com/RetroShare/RetroShareWebUI.git"
GIT_TAG "origin/master"
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
TIMEOUT 10
)
FetchContent_MakeAvailable(webui)
endif()
add_dependencies(${PROJECT_NAME} retroshare-webui)
target_compile_definitions(${PROJECT_NAME} PUBLIC RS_WEBUI)
endif(RS_WEBUI)
if(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
target_compile_definitions(
${PROJECT_NAME} PUBLIC RS_SERVICE_TERMINAL_WEBUI_PASSWORD )
endif(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
################################################################################

View File

@ -1,7 +1,7 @@
/*
* RetroShare Service
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net>
* Copyright (C) 2016-2022 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2021-2022 Asociación Civil Altermundi <info@altermundi.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -26,15 +26,16 @@
#include <iomanip>
#include <atomic>
#include "util/stacktrace.h"
#include "util/argstream.h"
#include "util/rskbdinput.h"
#include "util/rsdir.h"
#include "retroshare/rsinit.h"
#include "retroshare/rstor.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsinit.h"
#include "retroshare/rsiface.h"
#include "util/stacktrace.h"
#include "util/argstream.h"
#include "util/rskbdinput.h"
#include "util/rsdir.h"
#include "util/rsdebug.h"
#ifdef RS_JSONAPI
@ -176,7 +177,7 @@ int main(int argc, char* argv[])
as.defaultErrorHandling(true, true);
#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
std::string webui_pass1 = "Y";
std::string webui_pass1;
if(askWebUiPassword)
{
std::string webui_pass2 = "N";
@ -210,7 +211,7 @@ int main(int argc, char* argv[])
int initResult = RsInit::InitRetroShare(conf);
if(initResult != RS_INIT_OK)
{
RsErr() << "Retroshare core initalization failed with: " << initResult
RsFatal() << "Retroshare core initalization failed with: " << initResult
<< std::endl;
return -initResult;
}