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 # SPDX-License-Identifier: CC0-1.0
*.o *.o
@ -17,3 +17,6 @@ Thumbs.db
*.kdev4 *.kdev4
!supportlibs/libsam3/Makefile !supportlibs/libsam3/Makefile
# QtCreator cruft
*CMakeLists.txt.user

View File

@ -67,43 +67,3 @@ test-ubuntu:
docker exec retroshare docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList | jq curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList | jq
- docker container stop retroshare - 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 .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"] |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"] |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 == Get the source

View File

@ -12,16 +12,26 @@
## To run the container ## 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 # 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 DEBIAN_FRONTEND=noninteractive
ENV APT_UNAT="--assume-yes --quiet"
RUN apt-get update -y && apt-get upgrade -y -qq && \ RUN apt-get update $APT_UNAT && \
apt-get install -y -qq build-essential cimg-dev libssl-dev libbz2-dev \ apt-get upgrade --show-upgraded $APT_UNAT && \
libsqlite3-dev \ apt-get clean $APT_UNAT && \
libsqlcipher-dev libupnp-dev pkg-config libz-dev \ apt-get install --no-install-recommends $APT_UNAT \
qt5-default libxapian-dev qttools5-dev doxygen rapidjson-dev \ bash build-essential cimg-dev libssl-dev libbz2-dev \
git cmake curl 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 && \ RUN git clone --depth 1 https://github.com/aetilius/pHash.git && \
rm -rf pHash-build && mkdir pHash-build && cd pHash-build && \ 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_BRANCH=master
ARG REPO_DEPTH="--depth 2000" ARG REPO_DEPTH="--depth 2000"
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \ RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \
git fetch --tags && cd .. git fetch --tags && \
RUN mkdir RetroShare-build && cd RetroShare-build && \ git submodule update --init --remote --force \
qmake ../RetroShare \ libbitdht/ libretroshare/ openpgpsdk/ && \
CONFIG+=no_retroshare_plugins \ cd ..
CONFIG+=retroshare_service CONFIG+=no_retroshare_gui \
CONFIG+=rs_jsonapi CONFIG+=rs_deep_search && \ RUN \
(make -j$(nproc) || make -j$(nproc) || make) && make install && \ 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 cd .. && rm -rf RetroShare-build

View File

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

View File

@ -1,18 +1,18 @@
ZLIB_VERSION=1.2.3 ZLIB_VERSION=1.2.11
BZIP2_VERSION=1.0.6 BZIP2_VERSION=1.0.8
MINIUPNPC_VERSION=2.0 MINIUPNPC_VERSION=2.2.3
OPENSSL_VERSION=1.1.1h OPENSSL_VERSION=1.1.1m
SPEEX_VERSION=1.2.0 SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2rc3 SPEEXDSP_VERSION=1.2.0
LIBXML2_VERSION=2.9.7 LIBXML2_VERSION=2.9.12
LIBXSLT_VERSION=1.1.32 LIBXSLT_VERSION=1.1.34
CURL_VERSION=7.58.0 CURL_VERSION=7.81.0
TCL_VERSION=8.6.10 TCL_VERSION=8.6.10
SQLCIPHER_VERSION=4.4.0 SQLCIPHER_VERSION=4.5.0
LIBMICROHTTPD_VERSION=0.9.59 LIBMICROHTTPD_VERSION=0.9.75
FFMPEG_VERSION=3.4 FFMPEG_VERSION=4.4
RAPIDJSON_VERSION=1.1.0 RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.7 XAPIAN_VERSION=1.4.19
DOWNLOAD_PATH?=download DOWNLOAD_PATH?=download
BUILD_PATH=build 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-* rm -r -f $(BUILD_PATH)/zlib-*
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# build # build
cd zlib-$(ZLIB_VERSION) && ./configure cd zlib-$(ZLIB_VERSION) && make -f win32/Makefile.gcc libz.a
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../$(BUILD_PATH)"
cd zlib-$(ZLIB_VERSION) && make cd zlib-$(ZLIB_VERSION) && make
# copy files # copy files
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include 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) bzip2: $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz: $(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 $(BUILD_PATH)/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# prepare # prepare
@ -100,10 +99,10 @@ $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIU
rm -r -f $(BUILD_PATH)/miniupnpc-* rm -r -f $(BUILD_PATH)/miniupnpc-*
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# build # 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 # copy files
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc 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 mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib $(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 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-* rm -r -f $(BUILD_PATH)/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# build # 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 cd ffmpeg-$(FFMPEG_VERSION) && make install
# cleanup # cleanup
rm -r -f ffmpeg-$(FFMPEG_VERSION) 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' #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} LIBS = -lcurl -lxml2 -lz -lxslt -lws2_32 -lwldap32 -lssl -lcrypto -lgdi32 $${LIBS}
isEmpty(QMAKE_SH) {
# MinGW
LIBS += -lcrypt32
}
# Check for msys2 # Check for msys2
!isEmpty(PREFIX_MSYS2) { !isEmpty(PREFIX_MSYS2) {
message(Use msys2 xml2.) message(Use msys2 xml2.)

View File

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

View File

@ -229,7 +229,7 @@ void GetStartedDialog::inviteFriends()
{ {
RsAutoUpdatePage::lockAllEvents(); 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() ; RsAutoUpdatePage::unlockAllEvents() ;
} }

View File

@ -50,14 +50,10 @@
HomePage::HomePage(QWidget *parent) : HomePage::HomePage(QWidget *parent) :
MainPage(parent), MainPage(parent),
ui(new Ui::HomePage), ui(new Ui::HomePage)
mIncludeAllIPs(false),
mUseShortFormat(true)
{ {
ui->setupUi(this); ui->setupUi(this);
updateCertificate();
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend())); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addFriend()));
connect(ui->copyIDButton, SIGNAL(clicked()), this, SLOT(copyId())); connect(ui->copyIDButton, SIGNAL(clicked()), this, SLOT(copyId()));
@ -73,29 +69,48 @@ HomePage::HomePage(QWidget *parent) :
QAction *CopyIdAction = new QAction(QIcon(),tr("Copy your Retroshare ID to Clipboard"), this); QAction *CopyIdAction = new QAction(QIcon(),tr("Copy your Retroshare ID to Clipboard"), this);
connect(CopyIdAction, SIGNAL(triggered()), this, SLOT(copyId())); connect(CopyIdAction, SIGNAL(triggered()), this, SLOT(copyId()));
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
menu->addAction(CopyIdAction); 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->addSeparator();
menu->addAction(SendAction); menu->addAction(SendAction);
menu->addAction(WebMailAction); menu->addAction(WebMailAction);
menu->addAction(RecAction); 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); ui->shareButton->setMenu(menu);
@ -118,6 +133,8 @@ HomePage::HomePage(QWidget *parent) :
mEventHandlerId = 0; mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK ); rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId, RsEventType::NETWORK );
updateOwnCert();
} }
void HomePage::handleEvent(std::shared_ptr<const RsEvent> e) 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] case RsNetworkEventCode::DNS_UPDATED: // [fallthrough]
RsQThreadUtils::postToObject( [=]() RsQThreadUtils::postToObject( [=]()
{ {
updateCertificate(); updateOwnCert();
},this); },this);
break; break;
default: default:
break; break;
} }
} }
#ifdef DEAD_CODE
void HomePage::certContextMenu(QPoint /*point*/) void HomePage::certContextMenu(QPoint /*point*/)
{ {
QMenu menu(this) ; QMenu menu(this) ;
@ -178,17 +197,7 @@ void HomePage::certContextMenu(QPoint /*point*/)
menu.exec(QCursor::pos()); menu.exec(QCursor::pos());
} }
#endif
void HomePage::toggleUseShortFormat()
{
mUseShortFormat = !mUseShortFormat;
updateCertificate();
}
void HomePage::toggleIncludeAllIPs()
{
mIncludeAllIPs = !mIncludeAllIPs;
updateCertificate();
}
HomePage::~HomePage() HomePage::~HomePage()
{ {
@ -196,15 +205,8 @@ HomePage::~HomePage()
delete ui; delete ui;
} }
void HomePage::updateCertificate() void HomePage::getOwnCert(QString& invite,QString& description) const
{ {
updateOwnCert();
}
void HomePage::updateOwnCert()
{
bool include_extra_locators = mIncludeAllIPs;
RsPeerDetails detail; RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail)) if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
@ -213,23 +215,46 @@ void HomePage::updateOwnCert()
return ; return ;
} }
QString invite ; RetroshareInviteFlags invite_flags = RetroshareInviteFlags::NOTHING;
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::CURRENT_IP | RetroshareInviteFlags::DNS;
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; invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
if(mUseShortFormat) if(!mUseOldFormatact->isChecked())
{ {
std::string short_invite; std::string short_invite;
rsPeers->getShortInvite(short_invite,rsPeers->getOwnId(),invite_flags | RetroshareInviteFlags::RADIX_FORMAT); 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 S;
QString txt; QString txt;
for(uint32_t i=0;i<short_invite.size();) for(int i=0;i<certificate.size();)
if(S.length() < 100) if(S.length() < 100)
S += short_invite[i++]; S += certificate[i++];
else else
{ {
txt += S + "\n"; txt += S + "\n";
@ -237,16 +262,10 @@ void HomePage::updateOwnCert()
} }
txt += S; txt += S;
certificate = txt; // the "\n" is here to make some space
invite = 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); ui->retroshareid->setToolTip(description);
} }
@ -348,9 +367,3 @@ void HomePage::openWebHelp()
{ {
QDesktopServices::openUrl(QUrl(QString("https://retrosharedocs.readthedocs.io/en/latest/"))); 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 pageName() const { return tr("Home") ; } //MainPage
virtual QString helpText() const { return ""; } //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: private slots:
void certContextMenu(QPoint); #ifdef DEAD_CODE
void certContextMenu(QPoint);
#endif
void updateOwnCert(); void updateOwnCert();
void updateCertificate();
void runEmailClient(); void runEmailClient();
void copyCert(); void copyCert();
void copyId(); void copyId();
void saveCert(); void saveCert();
void addFriend(); void addFriend();
void webMail(); void webMail();
//void loadCert();
void openWebHelp() ; void openWebHelp() ;
void toggleUseOldFormat() ;
void recommendFriends(); void recommendFriends();
void toggleIncludeAllIPs();
void toggleUseShortFormat();
private: private:
Ui::HomePage *ui; Ui::HomePage *ui;
bool mIncludeAllIPs; QAction *mIncludeDNSact;
bool mUseShortFormat; QAction *mIncludeIPHistoryact;
QAction *mIncludeExtIPact;
QAction *mIncludeLocIPact;
QAction *mUseOldFormatact;
RsEventsHandlerId_t mEventHandlerId; RsEventsHandlerId_t mEventHandlerId;

View File

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

View File

@ -100,9 +100,10 @@ public:
Channels = 6, /** Channels page. */ Channels = 6, /** Channels page. */
Forums = 7, /** Forums page. */ Forums = 7, /** Forums page. */
Search = 8, /** Search page. */ Search = 8, /** Search page. */
Posted = 11, /** Posted links */ Posted = 11, /** Posted links */
People = 12, /** People page. */ 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->voteUpButton->setDisabled(true);
ui->voteDownButton->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->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()))) ; 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; QDateTime qtime;
@ -509,8 +509,10 @@ void PostedItem::fill()
QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png"); QPixmap sqpixmap2 = FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default.png");
mInFill = true; mInFill = true;
int desired_height = 1.5*(ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height()); int desired_height = ui->voteDownButton->height() + ui->voteUpButton->height() + ui->scoreLabel->height();
int desired_width = sqpixmap2.width()*desired_height/(float)sqpixmap2.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; QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs); qtime.setTime_t(mPost.mMeta.mPublishTs);
@ -573,17 +575,17 @@ void PostedItem::fill()
GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL); GxsIdDetails::loadPixmapFromData(mPost.mImage.mData, mPost.mImage.mSize, pixmap,GxsIdDetails::ORIGINAL);
// Wiping data - as its been passed to thumbnail. // Wiping data - as its been passed to thumbnail.
QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); // QPixmap sqpixmap = pixmap.scaled(desired_width,desired_height, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
ui->thumbnailLabel->setPixmap(sqpixmap); ui->thumbnailLabel->setPicture(pixmap);
ui->thumbnailLabel->setToolTip(tr("Click to view Picture")); ui->thumbnailLabel->setToolTip(tr("Click to view Picture"));
ui->thumbnailLabel->setEnableZoom(false);
QPixmap scaledpixmap; QPixmap scaledpixmap;
if(pixmap.width() > 800){ if(pixmap.width() > 800){
QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation); QPixmap scaledpixmap = pixmap.scaledToWidth(800, Qt::SmoothTransformation);
ui->pictureLabel->setPixmap(scaledpixmap); ui->pictureLabel->setPixmap(scaledpixmap);
}else{ }else
ui->pictureLabel->setPixmap(pixmap); ui->pictureLabel->setPixmap(pixmap);
}
} }
else if (urlOkay && (mPost.mImage.mData == NULL)) else if (urlOkay && (mPost.mImage.mData == NULL))
{ {

View File

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

View File

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

View File

@ -22,6 +22,7 @@
#include "ChatLobbyWidget.h" #include "ChatLobbyWidget.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "HomePage.h"
#include "chat/ChatDialog.h" #include "chat/ChatDialog.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
#include "common/RsCollection.h" #include "common/RsCollection.h"
@ -551,32 +552,41 @@ RetroShareLink RetroShareLink::createMessage(const RsGxsId& peerId, const QStrin
RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id) RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
{ {
RetroShareLink link; RetroShareLink link;
link.clear(); link.clear();
#ifndef RS_NO_WARN_CPP #ifndef RS_NO_WARN_CPP
#pragma message("csoler 2012-08-14: This is baaaaaad code") #pragma message("csoler 2012-08-14: This is baaaaaad code")
#endif #endif
// - we should not need to parse and re-read a cert in old format. // - we should not need to parse and re-read a cert in old format.
// //
RsPeerDetails detail; 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; std::cerr << "RetroShareLink::createPerson() Couldn't find peer id " << ssl_id << std::endl;
} else { else
{
link._type = TYPE_CERTIFICATE;
link._type = TYPE_CERTIFICATE; if(rsPeers->getOwnId() == ssl_id) // in this case, use application-wide parameters set in HomePage
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str()); {
link._name = QString::fromUtf8(detail.name.c_str()); QString invite,description;
link._location = QString::fromUtf8(detail.location.c_str()); static_cast<HomePage*>(MainWindow::getPage(MainWindow::Home))->getOwnCert(invite,description);
link._radix.replace("\n",""); link._radix = invite;
}
else
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str());
std::cerr << "Found radix = " << link._radix.toStdString() << std::endl; link._name = QString::fromUtf8(detail.name.c_str());
} link._location = QString::fromUtf8(detail.location.c_str());
link._radix.replace("\n","");
link.check(); std::cerr << "Found radix = " << link._radix.toStdString() << std::endl;
}
return link; link.check();
return link;
} }
RetroShareLink RetroShareLink::createUnknownSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId) RetroShareLink RetroShareLink::createUnknownSslCertificate(const RsPeerId& sslId, const RsPgpId& gpgId)
{ {

View File

@ -1359,7 +1359,7 @@ bool NewFriendList::exportFriendlist(QString &fileName)
if (!rsPeers->getPeerDetails(*list_iter2, detailSSL)) if (!rsPeers->getPeerDetails(*list_iter2, detailSSL))
continue; 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 // remove \n from certificate
certificate.erase(std::remove(certificate.begin(), certificate.end(), '\n'), certificate.end()); 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) ; ui._shouldAddSignatures_CB->setEnabled(detail.gpgSigners.size() > 1) ;
std::string invite ; 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()) if(!detail.isHiddenNode && ui._includeIPHistory_CB->isChecked())
flags |= RetroshareInviteFlags::FULL_IP_HISTORY; flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
@ -283,7 +283,7 @@ void ConfCertDialog::loadInvitePage()
ui.stabWidget->setTabText(PageCertificate, tr("Retroshare Certificate")); 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) ; ui.userCertificateText->setToolTip(infotext) ;
@ -297,19 +297,15 @@ void ConfCertDialog::loadInvitePage()
ui.userCertificateText->setText(QString::fromUtf8(invite.c_str())); 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>") ; //infotext += tr("<p>Use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
QString infotext; QString infotext;
if(use_short_format) if(use_short_format)
{
infotext += tr("<p>This Retroshare ID contains:") ; infotext += tr("<p>This Retroshare ID contains:") ;
}
else else
{
infotext += tr("<p>This certificate contains:") ; infotext += tr("<p>This certificate contains:") ;
}
infotext += "<UL>" ; infotext += "<UL>" ;
@ -334,25 +330,36 @@ QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bo
if(detail.isHiddenNode) if(detail.isHiddenNode)
infotext += tr("<li> <b>onion address</b> and <b>port</b>") +" (" + detail.hiddenNodeAddress.c_str() + ":" + QString::number(detail.hiddenNodePort)+ ")</li>"; 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) 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(!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_LOCAL_IP) && !detail.localAddr.empty())
if(!detail.extAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>"; 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>" ;
} }
else 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>" ;
}
infotext += QString("</p>") ; infotext += QString("</p>") ;
if(rsPeers->getOwnId() == detail.id) if(rsPeers->getOwnId() == detail.id)
if(use_short_format) if(use_short_format)
infotext += tr("<p>You can use this Retroshare ID to make new friends. Send it by email, or give it hand to hand.</p>") ; infotext += tr("<p>You can use this Retroshare ID to make new friends. Send it by email, or give it hand to hand.</p>") ;
else else
infotext += tr("<p>You can use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ; infotext += tr("<p>You can use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
return infotext; return infotext;
} }

View File

@ -59,7 +59,7 @@ public:
/* window will destroy itself! */ /* window will destroy itself! */
} }
static void loadAll(); 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: signals:
void configChanged(); void configChanged();

View File

@ -891,7 +891,9 @@ void ConnectFriendWizard::cleanFriendCert()
whileBlocking(ui->friendCertEdit)->setPlainText(QString::fromUtf8(cleanCert.c_str())); whileBlocking(ui->friendCertEdit)->setPlainText(QString::fromUtf8(cleanCert.c_str()));
whileBlocking(ui->friendCertEdit)->setTextCursor(textCursor); 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) 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(profilemanager()));
connect(ui.exportprofile,SIGNAL(clicked()), this, SLOT(exportProfile())); 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())); 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()))); ui.pgpfingerprint->setText(misc::fingerPrintStyleSplit(QString::fromStdString(detail.fpr.toStdString())));
std::string invite ; std::string invite ;
rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RetroshareInviteFlags::DNS | RetroshareInviteFlags::CURRENT_IP); rsPeers->getShortInvite(invite,rsPeers->getOwnId(),RetroshareInviteFlags::RADIX_FORMAT | RsPeers::defaultCertificateFlags);
ui.retroshareid->setText(QString::fromUtf8(invite.c_str())); ui.retroshareId_content_LB->setText(QString::fromUtf8(invite.c_str()));
/* set retroshare version */ /* set retroshare version */
ui.version->setText(Rshare::retroshareVersion(true)); ui.version->setText(Rshare::retroshareVersion(true));
@ -139,7 +143,7 @@ void
CryptoPage::load() CryptoPage::load()
{ {
std::string cert ; 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()) if(ui._shortFormat_CB->isChecked())
{ {
@ -161,7 +165,7 @@ CryptoPage::load()
RsPeerDetails detail; RsPeerDetails detail;
rsPeers->getPeerDetails(rsPeers->getOwnId(),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 void

View File

@ -7,25 +7,19 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>869</width> <width>869</width>
<height>487</height> <height>493</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <widget class="QWidget" name="stackPageNodeInfo" native="true">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Node information</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QGroupBox" name="groupBox_1"> <widget class="QGroupBox" name="groupBox_1">
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4">
<item row="6" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="retroshareId_LB">
<property name="text"> <property name="text">
<string>Retroshare ID:</string> <string>Retroshare ID:</string>
</property> </property>
@ -248,7 +242,7 @@
<item row="14" column="1"> <item row="14" column="1">
<widget class="QPushButton" name="exportprofile"> <widget class="QPushButton" name="exportprofile">
<property name="toolTip"> <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>
<property name="text"> <property name="text">
<string>Export</string> <string>Export</string>
@ -474,7 +468,7 @@
</widget> </widget>
</item> </item>
<item row="6" column="1" colspan="3"> <item row="6" column="1" colspan="3">
<widget class="QLabel" name="retroshareid"> <widget class="QLabel" name="retroshareId_content_LB">
<property name="font"> <property name="font">
<font> <font>
<weight>75</weight> <weight>75</weight>
@ -539,10 +533,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="stackPageCertificate" native="true">
<attribute name="title">
<string>Certificate</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QPlainTextEdit" name="certplainTextEdit"> <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 * RetroShare Service
* Copyright (C) 2016-2021 Gioacchino Mazzurco <gio@eigenlab.org> * Copyright (C) 2016-2022 Gioacchino Mazzurco <gio@eigenlab.org>
* Copyright (C) 2021 Asociación Civil Altermundi <info@altermundi.net> * Copyright (C) 2021-2022 Asociación Civil Altermundi <info@altermundi.net>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
@ -26,15 +26,16 @@
#include <iomanip> #include <iomanip>
#include <atomic> #include <atomic>
#include "util/stacktrace.h"
#include "util/argstream.h"
#include "util/rskbdinput.h"
#include "util/rsdir.h"
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "retroshare/rstor.h" #include "retroshare/rstor.h"
#include "retroshare/rspeers.h" #include "retroshare/rspeers.h"
#include "retroshare/rsinit.h" #include "retroshare/rsinit.h"
#include "retroshare/rsiface.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" #include "util/rsdebug.h"
#ifdef RS_JSONAPI #ifdef RS_JSONAPI
@ -176,7 +177,7 @@ int main(int argc, char* argv[])
as.defaultErrorHandling(true, true); as.defaultErrorHandling(true, true);
#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) #if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
std::string webui_pass1 = "Y"; std::string webui_pass1;
if(askWebUiPassword) if(askWebUiPassword)
{ {
std::string webui_pass2 = "N"; std::string webui_pass2 = "N";
@ -210,8 +211,8 @@ int main(int argc, char* argv[])
int initResult = RsInit::InitRetroShare(conf); int initResult = RsInit::InitRetroShare(conf);
if(initResult != RS_INIT_OK) if(initResult != RS_INIT_OK)
{ {
RsErr() << "Retroshare core initalization failed with: " << initResult RsFatal() << "Retroshare core initalization failed with: " << initResult
<< std::endl; << std::endl;
return -initResult; return -initResult;
} }
@ -331,11 +332,11 @@ int main(int argc, char* argv[])
#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) #if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
if(rsJsonApi && !webui_pass1.empty()) if(rsJsonApi && !webui_pass1.empty())
{ {
rsWebUi->setHtmlFilesDirectory(webui_base_directory); rsWebUi->setHtmlFilesDirectory(webui_base_directory);
rsWebUi->setUserPassword(webui_pass1); rsWebUi->setUserPassword(webui_pass1);
rsWebUi->restart(); rsWebUi->restart();
} }
#endif #endif
rsControl->setShutdownCallback([&](int){keepRunning = false;}); rsControl->setShutdownCallback([&](int){keepRunning = false;});