Merge branch 'master' of github.com:RetroShare/RetroShare

This commit is contained in:
Gioacchino Mazzurco 2023-11-15 09:37:47 +01:00
commit 533e711d47
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
24 changed files with 268 additions and 114 deletions

@ -1 +1 @@
Subproject commit 1de347e993ed1147bb84cdaf6c0604ff220eb221 Subproject commit 353596b0ee5ea76611eb663b90bf3ab1c9f34ad7

View File

@ -16,7 +16,13 @@ if "%~1"=="clean" (
goto exit goto exit
) )
if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( set MSYS2Version=20231026
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%
set MSYS2UnpackPath=%EnvMSYS2Path%\msys64
if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" ( if "%~1"=="reinstall" (
choice /M "Found existing MSYS2 version. Do you want to proceed?" choice /M "Found existing MSYS2 version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit if !ERRORLEVEL!==2 goto exit
@ -25,30 +31,26 @@ if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
) )
) )
if "%MSYS2Architecture%"=="i686" set MSYS2Version=20210705 if exist "%MSYS2UnpackPath%" (
if "%MSYS2Architecture%"=="x86_64" set MSYS2Version=20210725 %cecho% info "Remove previous MSYS2 version"
call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%"
)
set MSYS2Install=msys2-base-%MSYS2Architecture%-%MSYS2Version%.tar.xz %cecho% info "Download MSYS2 installation files"
set MSYS2Url=https://repo.msys2.org/distrib/%MSYS2Architecture%/%MSYS2Install%
%cecho% info "Remove previous MSYS2 version"
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
%cecho% info "Download installation files"
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
%cecho% info "Unpack MSYS2" %cecho% info "Unpack MSYS2"
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%" "%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%"
set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh
%cecho% info "Initialize MSYS2" %cecho% info "Initialize MSYS2"
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Sy"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat" call "%MSYS2UnpackPath%\autorebase.bat"
:exit :exit
endlocal endlocal

View File

@ -34,7 +34,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
echo Unpack cecho echo Unpack cecho
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"

View File

@ -2,18 +2,13 @@
setlocal setlocal
if exist "%~dp0msys2\msys32" call :update 32 if not exist "%~dp0msys2\msys64" goto :EOF
if exist "%~dp0msys2\msys64" call :update 64
goto :EOF set MSYS2SH=%~dp0msys2\msys64\usr\bin\sh
:update echo Update MSYS2
set MSYS2SH=%~dp0msys2\msys%~1\usr\bin\sh
echo Update MSYS2 %~1
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
:exit
endlocal endlocal
goto :EOF goto :EOF

View File

@ -1,7 +1,7 @@
ZLIB_VERSION=1.2.11 ZLIB_VERSION=1.2.11
BZIP2_VERSION=1.0.8 BZIP2_VERSION=1.0.8
MINIUPNPC_VERSION=2.2.3 MINIUPNPC_VERSION=2.2.3
OPENSSL_VERSION=1.1.1p OPENSSL_VERSION=1.1.1w
SPEEX_VERSION=1.2.0 SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2.0 SPEEXDSP_VERSION=1.2.0
LIBXML2_VERSION=2.9.12 LIBXML2_VERSION=2.9.12

View File

@ -22,11 +22,12 @@ if "%GCCArchitecture%"=="x64" (
) )
set EnvMSYS2Path=%EnvRootPath%\msys2 set EnvMSYS2Path=%EnvRootPath%\msys2
set EnvMSYS2BasePath=%EnvMSYS2Path%\msys64
call "%~dp0tools\prepare-msys2.bat" %1 call "%~dp0tools\prepare-msys2.bat" %1
if errorlevel 1 exit /B %ERRORLEVEL% if errorlevel 1 exit /B %ERRORLEVEL%
set EnvMSYS2SH=%EnvMSYS2Path%\msys64\usr\bin\sh.exe set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc

View File

@ -16,15 +16,15 @@ if "%~1"=="clean" (
goto exit goto exit
) )
set MSYS2Version=20230318 set MSYS2Version=20231026
set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe
set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install%
set MSYS2UnpackPath=%EnvMSYS2Path%\msys64
set CMakeInstall=cmake-3.19.0-win32-x86.zip set CMakeInstall=cmake-3.19.0-win32-x86.zip
set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall% set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall%
set CMakeUnpackPath=%EnvMSYS2Path%\msys64
if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" ( if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" ( if "%~1"=="reinstall" (
choice /M "Found existing MSYS2 version. Do you want to proceed?" choice /M "Found existing MSYS2 version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit if !ERRORLEVEL!==2 goto exit
@ -33,13 +33,12 @@ if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" (
) )
) )
if exist "%MSYS2UnpackPath%" (
if exist "%CMakeUnpackPath%" (
%cecho% info "Remove previous MSYS2 version" %cecho% info "Remove previous MSYS2 version"
call "%ToolsPath%\remove-dir.bat" "%CMakeUnpackPath%" call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%"
) )
%cecho% info "Download installation files" %cecho% info "Download MSYS2 installation files"
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
@ -50,29 +49,29 @@ if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download C
"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" "%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%"
%cecho% info "Unpack CMake" %cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" "%EnvSevenZipExe%" x -o"%MSYS2UnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0
%cecho% info "Install CMake" %cecho% info "Install CMake"
set CMakeVersion= set CMakeVersion=
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF for /D %%F in (%MSYS2UnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit
%cecho% info "Found CMake version %CMakeVersion%" %cecho% info "Found CMake version %CMakeVersion%"
set FoundProfile= set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%CMakeUnpackPath%\etc\profile"') do set FoundProfile=%%F for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYS2UnpackPath%\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" ( if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%CMakeUnpackPath%\etc\profile" echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYS2UnpackPath%\etc\profile"
) )
set MSYS2SH=%CMakeUnpackPath%\usr\bin\sh set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh
%cecho% info "Initialize MSYS2" %cecho% info "Initialize MSYS2"
"%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring"
"%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Sy"
"%MSYS2SH%" -lc "pacman --noconfirm -Su" "%MSYS2SH%" -lc "pacman --noconfirm -Su"
call "%CMakeUnpackPath%\autorebase.bat" call "%MSYS2UnpackPath%\autorebase.bat"
:exit :exit
endlocal endlocal

View File

@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" (
if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error
echo Unpack cecho echo Unpack cecho
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0
copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
@ -69,7 +69,7 @@ if not exist "%EnvToolsPath%\depends.exe" (
if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error
%cecho% info "Unpack Dependency Walker" %cecho% info "Unpack Dependency Walker"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" -y -bso0
copy "%EnvTempPath%\*" "%EnvToolsPath%" copy "%EnvTempPath%\*" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
@ -85,7 +85,7 @@ if not exist "%EnvToolsPath%\cut.exe" (
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools" %cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0
copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%" copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
@ -101,7 +101,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
%cecho% info "Unpack Unix Tools" %cecho% info "Unpack Unix Tools"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0
copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%" copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
@ -121,7 +121,7 @@ if not exist "%NSISInstallPath%\nsis.exe" (
if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error
%cecho% info "Unpack NSIS" %cecho% info "Unpack NSIS"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" -y -bso0
if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%" if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%"
xcopy /s "%EnvTempPath%" "%NSISInstallPath%" xcopy /s "%EnvTempPath%" "%NSISInstallPath%"
@ -135,7 +135,7 @@ if not exist "%MinGitInstallPath%\cmd\git.exe" (
if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error
%cecho% info "Unpack MinGit" %cecho% info "Unpack MinGit"
"%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" -y -bso0
) )
if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%" if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%"
@ -148,7 +148,7 @@ if not exist "%DoxygenInstallPath%\doxygen.exe" (
if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error
%cecho% info "Unpack Doxygen" %cecho% info "Unpack Doxygen"
"%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" -y -bso0
) )
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%" if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%"
@ -163,7 +163,7 @@ if not exist "%CMakeInstallPath%\bin\cmake.exe" (
if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error
%cecho% info "Unpack CMake" %cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0
move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%" move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%"
@ -176,7 +176,7 @@ mkdir "%EnvTempPath%"
call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html" call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html"
if not exist "%EnvTempPath%\index.html" %cecho% error "Cannot download Tor installation" & goto error if not exist "%EnvTempPath%\index.html" %cecho% error "Cannot download Tor installation" & goto error
for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686.*\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error
if "%TorDownloadUrl%"=="" %cecho% error "Cannot download Tor installation" & goto error if "%TorDownloadUrl%"=="" %cecho% error "Cannot download Tor installation" & goto error
@ -189,7 +189,7 @@ if not exist "%EnvTorPath%\Tor\tor.exe" (
if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error
%cecho% info "Unpack Tor" %cecho% info "Unpack Tor"
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" -y -bso0
) )
:exit :exit

View File

@ -318,7 +318,7 @@ SectionEnd
!ifdef TOR_EXISTS !ifdef TOR_EXISTS
Section /o $(Section_Tor) Section_Tor Section /o $(Section_Tor) Section_Tor
SetOutPath "$INSTDIR\tor" SetOutPath "$INSTDIR\tor"
File /r "${TORDIR}\*" File "${TORDIR}\*"
SectionEnd SectionEnd
!endif !endif

@ -1 +1 @@
Subproject commit a10087b27a804d0a43745aa39e7515dd691740f3 Subproject commit de2b4bd80c57ca757b5f878130f98becf710236d

View File

@ -609,7 +609,9 @@ void GenCertDialog::genPerson()
QCoreApplication::processEvents(); QCoreApplication::processEvents();
QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance(); QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance();
#ifdef DEBUG_GENCERTDIALOG
std::cout << "Waiting ed->processEvents()" << std::endl; std::cout << "Waiting ed->processEvents()" << std::endl;
#endif
time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents
if (ed->hasPendingEvents()) if (ed->hasPendingEvents())
while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd)); while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd));

View File

@ -1619,7 +1619,9 @@ bool NewFriendList::isColumnVisible(int col) const
} }
void NewFriendList::setColumnVisible(int col,bool visible) void NewFriendList::setColumnVisible(int col,bool visible)
{ {
#ifdef DEBUG_NEW_FRIEND_LIST
std::cerr << "Setting column " << col << " to be visible: " << visible << std::endl; std::cerr << "Setting column " << col << " to be visible: " << visible << std::endl;
#endif
ui->peerTreeWidget->setColumnHidden(col, !visible); ui->peerTreeWidget->setColumnHidden(col, !visible);
} }
void NewFriendList::toggleColumnVisible() void NewFriendList::toggleColumnVisible()

View File

@ -34,6 +34,7 @@
#endif #endif
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/misc.h" #include "util/misc.h"
#include "ConnectFriendWizard.h" #include "ConnectFriendWizard.h"
@ -449,8 +450,9 @@ void ConnectFriendWizard::initializePage(int id)
} }
sockaddr_storage addr ; sockaddr_storage addr ;
#ifdef DEBUG_FRIENDWIZARD
std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl; std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl;
#endif
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr)) if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
{ {
@ -870,7 +872,18 @@ void ConnectFriendWizard::cleanFriendCert()
bool certValid = false; bool certValid = false;
QString errorMsg ; QString errorMsg ;
QString certDetail; QString certDetail;
std::string cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
std::string cert ;
RetroShareLink rslink(ui->friendCertEdit->toPlainText());
if(rslink.valid() && rslink.type() == RetroShareLink::TYPE_CERTIFICATE)
cert = rslink.radix().toStdString();
else
cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
#ifdef DEBUG_FRIENDWIZARD
std::cerr << "Friend cert:\"" << cert << "\"" << std::endl;
#endif
if (cert.empty()) { if (cert.empty()) {
ui->friendCertCleanLabel->setToolTip(""); ui->friendCertCleanLabel->setToolTip("");

View File

@ -37,20 +37,47 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate) GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate)
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
} }
GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) : GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) :
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate) GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate)
{ {
setup(); setup();
setGroup(group); setGroup(group);
addEventHandler();
}
void GxsChannelGroupItem::addEventHandler()
{
mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
RsQThreadUtils::postToObject([=]()
{
const auto *e = dynamic_cast<const RsGxsChannelEvent*>(event.get());
if(!e || e->mChannelGroupId != this->groupId())
return;
switch(e->mChannelEventCode)
{
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
case RsChannelEventCode::UPDATED_CHANNEL:
case RsChannelEventCode::RECEIVED_PUBLISH_KEY:
loadGroup();
break;
default:
break;
}
}, this );
}, mEventHandlerId, RsEventType::GXS_CHANNELS );
} }
GxsChannelGroupItem::~GxsChannelGroupItem() GxsChannelGroupItem::~GxsChannelGroupItem()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete(ui); delete(ui);
} }

View File

@ -60,12 +60,14 @@ private slots:
private: private:
void fill(); void fill();
void setup(); void setup();
void addEventHandler();
private: private:
RsGxsChannelGroup mGroup; RsGxsChannelGroup mGroup;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::GxsChannelGroupItem *ui; Ui::GxsChannelGroupItem *ui;
RsEventsHandlerId_t mEventHandlerId;
}; };
#endif #endif

View File

@ -251,7 +251,7 @@
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Subscribe to Channel</string> <string>Subscribe this Channel</string>
</property> </property>
<property name="text"> <property name="text">
<string>Subscribe</string> <string>Subscribe</string>

View File

@ -35,8 +35,8 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate) GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate)
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
} }
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate): GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate):
@ -45,20 +45,47 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
mRemovedModerators(removed_moderators) mRemovedModerators(removed_moderators)
{ {
setup(); setup();
requestGroup(); requestGroup();
addEventHandler();
}
void GxsForumGroupItem::addEventHandler()
{
mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
RsQThreadUtils::postToObject([=]()
{
const auto *e = dynamic_cast<const RsGxsForumEvent*>(event.get());
if(!e || e->mForumGroupId != this->groupId())
return;
switch(e->mForumEventCode)
{
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
case RsForumEventCode::UPDATED_FORUM:
case RsForumEventCode::MODERATOR_LIST_CHANGED:
loadGroup();
break;
default:
break;
}
}, this );
}, mEventHandlerId, RsEventType::GXS_FORUMS );
} }
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) : GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate) GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
{ {
setup(); setup();
setGroup(group); setGroup(group);
addEventHandler();
} }
GxsForumGroupItem::~GxsForumGroupItem() GxsForumGroupItem::~GxsForumGroupItem()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId);
delete(ui); delete(ui);
} }

View File

@ -22,6 +22,7 @@
#define _GXSFORUMGROUPITEM_H #define _GXSFORUMGROUPITEM_H
#include <retroshare/rsgxsforums.h> #include <retroshare/rsgxsforums.h>
#include <retroshare/rsevents.h>
#include "gui/gxs/GxsGroupFeedItem.h" #include "gui/gxs/GxsGroupFeedItem.h"
namespace Ui { namespace Ui {
@ -39,27 +40,28 @@ public:
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate); GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate);
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate); GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate);
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate); GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate);
~GxsForumGroupItem(); virtual ~GxsForumGroupItem() override;
bool setGroup(const RsGxsForumGroup &group); bool setGroup(const RsGxsForumGroup &group);
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumGroupItem " + groupId().toStdString()) ; } uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumGroupItem " + groupId().toStdString()) ; }
protected: protected:
/* FeedItem */ /* FeedItem */
virtual void doExpand(bool open); virtual void doExpand(bool open) override;
void toggle() override;
/* GxsGroupFeedItem */ /* GxsGroupFeedItem */
virtual QString groupName(); virtual QString groupName() override;
virtual void loadGroup() override; virtual void loadGroup() override;
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; } virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_FORUM; }
private slots: private slots:
void subscribeForum(); void subscribeForum();
void toggle() override;
private: private:
void fill(); void fill();
void setup(); void setup();
void addEventHandler();
private: private:
RsGxsForumGroup mGroup; RsGxsForumGroup mGroup;
@ -69,6 +71,8 @@ private:
std::list<RsGxsId> mAddedModerators; std::list<RsGxsId> mAddedModerators;
std::list<RsGxsId> mRemovedModerators; std::list<RsGxsId> mRemovedModerators;
RsEventsHandlerId_t mEventHandlerId;
}; };
#endif #endif

View File

@ -64,9 +64,19 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
mEventHandlerId = 0; mEventHandlerId = 0;
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */) rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e)
{ {
std::cerr << "Caught JSONAPI event!" << std::endl; if(e->mType != RsEventType::JSON_API)
return;
auto je = dynamic_cast<const RsJsonApiEvent*>(e.get());
if(!je)
return;
#ifdef DEBUG
std::cerr << "Caught JSONAPI event! code=" << static_cast<int>(je->mJsonApiEventCode) << std::endl;
#endif
RsQThreadUtils::postToObject([=]() { load(); }, this ); RsQThreadUtils::postToObject([=]() { load(); }, this );
}, },
mEventHandlerId, RsEventType::JSON_API ); mEventHandlerId, RsEventType::JSON_API );

View File

@ -58,7 +58,9 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */) rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> /* event */)
{ {
#ifdef DEBUG
std::cerr << "Caught JSONAPI event in webui!" << std::endl; std::cerr << "Caught JSONAPI event in webui!" << std::endl;
#endif
RsQThreadUtils::postToObject([=]() { load(); }, this ); RsQThreadUtils::postToObject([=]() { load(); }, this );
}, },
mEventsHandlerId, RsEventType::JSON_API ); mEventsHandlerId, RsEventType::JSON_API );
@ -132,7 +134,9 @@ bool WebuiPage::restart()
void WebuiPage::loadParams() void WebuiPage::loadParams()
{ {
#ifdef DEBUG
std::cerr << "WebuiPage::load()" << std::endl; std::cerr << "WebuiPage::load()" << std::endl;
#endif
whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled()); whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled());
whileBlocking(ui.webInterfaceFiles_LE)->setText(Settings->getWebinterfaceFilesDirectory()); whileBlocking(ui.webInterfaceFiles_LE)->setText(Settings->getWebinterfaceFilesDirectory());
@ -142,6 +146,8 @@ void WebuiPage::loadParams()
if(it != smap.end()) if(it != smap.end())
whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second)); whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second));
else
whileBlocking(ui.enableWebUI_CB)->setChecked(false);
if(rsWebUi->isRunning()) if(rsWebUi->isRunning())
ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ;

View File

@ -22,6 +22,7 @@
#include "util/stacktrace.h" #include "util/stacktrace.h"
#include "util/argstream.h" #include "util/argstream.h"
#include "retroshare/rswebui.h"
CrashStackTrace gCrashStackTrace; CrashStackTrace gCrashStackTrace;
@ -380,7 +381,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
return 1; return 1;
} }
/* recreate global settings object, now with correct path */ /* recreate global settings object, now with correct path, specific to the selected node */
RshareSettings::Create(true); RshareSettings::Create(true);
Rshare::resetLanguageAndStyle(); Rshare::resetLanguageAndStyle();
@ -537,8 +538,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
// //
qRegisterMetaType<RsPeerId>("RsPeerId") ; qRegisterMetaType<RsPeerId>("RsPeerId") ;
#ifdef DEBUG
std::cerr << "connecting signals and slots" << std::endl ; std::cerr << "connecting signals and slots" << std::endl ;
#endif
QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ;
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ; QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
@ -571,13 +573,18 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt. notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt.
#ifdef RS_JSONAPI // Read webui params in settings. We cannot save them to some webui.cfg because cfg needs the node id and
JsonApiPage::checkStartJsonApi(); // jsonapi is started before node ID selection in retroshare-service.
#ifdef RS_JSONAPI
#ifdef RS_WEBUI #ifdef RS_WEBUI
WebuiPage::checkStartWebui(); // normally we should rather save the UI flags internally to p3webui conf.enableWebUI = Settings->getWebinterfaceEnabled();
if(!Settings->getWebinterfaceFilesDirectory().isNull())
rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString());
#endif
RsInit::startupWebServices(conf,false);
#endif #endif
#endif // RS_JSONAPI
/* dive into the endless loop */ /* dive into the endless loop */
int ti = rshare.exec(); int ti = rshare.exec();

View File

@ -139,17 +139,22 @@ static bool notifyRunningInstance()
// that a new process had been started // that a new process had been started
QLocalSocket localSocket; QLocalSocket localSocket;
localSocket.connectToServer(QString(TARGET)); localSocket.connectToServer(QString(TARGET));
#ifdef DEBUG
std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl; std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl;
#endif
if( localSocket.waitForConnected(100) ) if( localSocket.waitForConnected(100) )
{ {
#ifdef DEBUG
std::cerr << "Rshare::Rshare Connection etablished. Waiting for disconnection." << std::endl; std::cerr << "Rshare::Rshare Connection etablished. Waiting for disconnection." << std::endl;
#endif
localSocket.waitForDisconnected(1000); localSocket.waitForDisconnected(1000);
return true; return true;
} }
else else
{ {
#ifdef DEBUG
std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl; std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl;
#endif
return false; return false;
} }
} }

View File

@ -33,6 +33,7 @@
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
#include "util/stacktrace.h" #include "util/stacktrace.h"
#include "util/rsprint.h"
#include "util/argstream.h" #include "util/argstream.h"
#include "util/rskbdinput.h" #include "util/rskbdinput.h"
#include "util/rsdir.h" #include "util/rsdir.h"
@ -48,6 +49,28 @@
static CrashStackTrace gCrashStackTrace; static CrashStackTrace gCrashStackTrace;
// We should move these functions to rsprint in libretroshare
#define COLOR_GREEN 0
#define COLOR_YELLOW 1
#define COLOR_BLUE 2
#define COLOR_PURPLE 3
#define COLOR_RED 4
std::string colored(int color,const std::string& s)
{
switch(color)
{
case COLOR_GREEN : return "\033[0;32m"+s+"\033[0m";
case COLOR_YELLOW: return "\033[0;33m"+s+"\033[0m";
case COLOR_BLUE : return "\033[0;36m"+s+"\033[0m";
case COLOR_PURPLE: return "\033[0;35m"+s+"\033[0m";
case COLOR_RED : return "\033[0;31m"+s+"\033[0m";
default:
return s;
}
}
#ifdef RS_SERVICE_TERMINAL_LOGIN #ifdef RS_SERVICE_TERMINAL_LOGIN
class RsServiceNotify: public NotifyClient class RsServiceNotify: public NotifyClient
{ {
@ -59,9 +82,7 @@ public:
const std::string& title, const std::string& question, const std::string& title, const std::string& question,
bool /*prev_is_bad*/, std::string& password, bool& cancel ) bool /*prev_is_bad*/, std::string& password, bool& cancel )
{ {
std::string question1 = title + std::string question1 = title + colored(COLOR_GREEN,"Please enter your PGP password for key:\n ") + question + " :";
"\nPlease enter your PGP password for key:\n " +
question + " :";
password = RsUtil::rs_getpass(question1.c_str()) ; password = RsUtil::rs_getpass(question1.c_str()) ;
cancel = false ; cancel = false ;
@ -90,6 +111,33 @@ int main(int argc, char* argv[])
signal(SIGBREAK, signalHandler); signal(SIGBREAK, signalHandler);
#endif // ifdef SIGBREAK #endif // ifdef SIGBREAK
#ifdef WINDOWS_SYS
// Enable ANSI color support in Windows console
{
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4
#endif
HANDLE hStdin = GetStdHandle(STD_OUTPUT_HANDLE);
if (hStdin) {
DWORD consoleMode;
if (GetConsoleMode(hStdin, &consoleMode)) {
if ((consoleMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0) {
if (SetConsoleMode(hStdin, consoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) {
std::cout << "Enabled ANSI color support in console" << std::endl;
} else {
RsErr() << "Error getting console mode" << std::endl;
}
}
} else {
RsErr() << "Error getting console mode" << std::endl;
}
} else {
RsErr() << "Error getting stdin handle" << std::endl;
}
}
#endif
RsInfo() << "\n" << RsInfo() << "\n" <<
"+================================================================+\n" "+================================================================+\n"
"| o---o o |\n" "| o---o o |\n"
@ -181,31 +229,45 @@ int main(int argc, char* argv[])
while(keepRunning) while(keepRunning)
{ {
webui_pass1 = RsUtil::rs_getpass( webui_pass1 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please register a password for the web interface: "));
"Please register a password for the web interface: " ); webui_pass2 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please enter the same password again : "));
webui_pass2 = RsUtil::rs_getpass(
"Please enter the same password again : " );
if(webui_pass1 != webui_pass2) if(webui_pass1 != webui_pass2)
{ {
std::cout << "Passwords do not match!" << std::endl; std::cout << colored(COLOR_RED,"Passwords do not match!") << std::endl;
continue; continue;
} }
if(webui_pass1.empty()) if(webui_pass1.empty())
{ {
std::cout << "Password cannot be empty!" << std::endl; std::cout << colored(COLOR_RED,"Password cannot be empty!") << std::endl;
continue; continue;
} }
break; break;
} }
} }
#ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD
if(askWebUiPassword && !webui_pass1.empty())
{
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi
conf.enableWebUI = true;
// JsonApi is started below in InitRetroShare(). Not calling restart here avoids multiple restart.
}
#endif
#endif /* defined(RS_JSONAPI) && defined(RS_WEBUI) #endif /* defined(RS_JSONAPI) && defined(RS_WEBUI)
&& defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) */ && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) */
conf.main_executable_path = argv[0]; conf.main_executable_path = argv[0];
int initResult = RsInit::InitRetroShare(conf); int initResult = RsInit::InitRetroShare(conf);
#ifdef RS_JSONAPI
RsInit::startupWebServices(conf,true);
rstime::rs_usleep(1000000); // waits for jas->restart to print stuff
#endif
if(initResult != RS_INIT_OK) if(initResult != RS_INIT_OK)
{ {
RsFatal() << "Retroshare core initalization failed with: " << initResult RsFatal() << "Retroshare core initalization failed with: " << initResult
@ -223,28 +285,27 @@ int main(int argc, char* argv[])
if(locations.size() == 0) if(locations.size() == 0)
{ {
RsErr() << "No available accounts. You cannot use option -U list" << std::endl; RsErr() << colored(COLOR_RED,"No available accounts. You cannot use option -U list") << std::endl;
return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; return -RsInit::ERR_NO_AVAILABLE_ACCOUNT;
} }
std::cout << std::endl << std::endl std::cout << std::endl << std::endl
<< "Available accounts:" << std::endl; << colored(COLOR_GREEN,"Available accounts:") << std::endl<<std::endl;
int accountCountDigits = static_cast<int>( ceil(log(locations.size())/log(10.0)) ); int accountCountDigits = static_cast<int>( ceil(log(locations.size())/log(10.0)) );
for( uint32_t i=0; i<locations.size(); ++i ) for( uint32_t i=0; i<locations.size(); ++i )
std::cout << "[" << std::setw(accountCountDigits) std::cout << colored(COLOR_GREEN," [" + RsUtil::NumberToString(i+1,false,'0',accountCountDigits)+"]") << " "
<< std::setfill('0') << i+1 << "] " << colored(COLOR_YELLOW,locations[i].mLocationId.toStdString())<< " "
<< locations[i].mLocationId << " (" << colored(COLOR_BLUE,"(" + locations[i].mPgpId.toStdString()+ "): ")
<< locations[i].mPgpId << "): " << colored(COLOR_PURPLE,locations[i].mPgpName + " (" + locations[i].mLocationName + ")" )
<< locations[i].mPgpName
<< " \t (" << locations[i].mLocationName << ")"
<< std::endl; << std::endl;
std::cout << std::endl;
uint32_t nacc = 0; uint32_t nacc = 0;
while(keepRunning && (nacc < 1 || nacc >= locations.size())) while(keepRunning && (nacc < 1 || nacc >= locations.size()))
{ {
std::cout << "Please enter account number: "; std::cout << colored(COLOR_GREEN,"Please enter account number: ");
std::cout.flush(); std::cout.flush();
std::string inputStr; std::string inputStr;
@ -264,7 +325,7 @@ int main(int argc, char* argv[])
RsPeerId ssl_id(prefUserString); RsPeerId ssl_id(prefUserString);
if(ssl_id.isNull()) if(ssl_id.isNull())
{ {
RsErr() << "Invalid User location id: a hexadecimal ID is expected." RsErr() << colored(COLOR_RED,"Invalid User location id: a hexadecimal ID is expected.")
<< std::endl; << std::endl;
return -EINVAL; return -EINVAL;
} }
@ -299,7 +360,7 @@ int main(int argc, char* argv[])
if(RsAccounts::isTorAuto()) if(RsAccounts::isTorAuto())
{ {
std::cerr << "(II) Hidden service is ready:" << std::endl; std::cerr << colored(COLOR_GREEN,"(II) Hidden service is ready:") << std::endl;
std::string service_id ; std::string service_id ;
std::string onion_address ; std::string onion_address ;
@ -312,13 +373,13 @@ int main(int argc, char* argv[])
RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
RsTor::getProxyServerInfo(proxy_server_address,proxy_server_port) ; RsTor::getProxyServerInfo(proxy_server_address,proxy_server_port) ;
std::cerr << " onion address : " << onion_address << std::endl; std::cerr << colored(COLOR_GREEN," onion address : ") << onion_address << std::endl;
std::cerr << " service_id : " << service_id << std::endl; std::cerr << colored(COLOR_GREEN," service_id : ") << service_id << std::endl;
std::cerr << " service port : " << service_port << std::endl; std::cerr << colored(COLOR_GREEN," service port : ") << service_port << std::endl;
std::cerr << " target port : " << service_target_port << std::endl; std::cerr << colored(COLOR_GREEN," target port : ") << service_target_port << std::endl;
std::cerr << " target address : " << service_target_address << std::endl; std::cerr << colored(COLOR_GREEN," target address : ") << service_target_address << std::endl;
std::cerr << "Setting proxy server to " << service_target_address << ":" << service_target_port << std::endl; std::cerr << colored(COLOR_GREEN,"Setting proxy server to ") << service_target_address << ":" << service_target_port << std::endl;
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address, service_target_port); rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address, service_target_port);
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address, service_port); rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address, service_port);
@ -327,15 +388,6 @@ int main(int argc, char* argv[])
} }
#endif // def RS_SERVICE_TERMINAL_LOGIN #endif // def RS_SERVICE_TERMINAL_LOGIN
#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD)
if(rsJsonApi && !webui_pass1.empty())
{
rsWebUi->setHtmlFilesDirectory(webui_base_directory);
rsWebUi->setUserPassword(webui_pass1);
rsWebUi->restart();
}
#endif
rsControl->setShutdownCallback([&](int){keepRunning = false;}); rsControl->setShutdownCallback([&](int){keepRunning = false;});
while(keepRunning) while(keepRunning)

@ -1 +1 @@
Subproject commit 542a8c07bd02f9bb9082f7aba5aaaed54e643fc1 Subproject commit ddd8b0b241c21940c7addc20c3cce774ff8dc021