diff --git a/.ci/format.sh b/.ci/format.sh index d87bfb66..d3b629c3 100755 --- a/.ci/format.sh +++ b/.ci/format.sh @@ -1,14 +1,15 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # Runs the Clang Formatter # Return codes: # - 1 there are files to be formatted # - 0 everything looks fine -set -o errexit -set -o pipefail -set -o nounset +set -eu -FILES=`find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \)` +FILES=$(find src -type f -type f \( -iname "*.cpp" -o -iname "*.h" \)) -clang-format -i $FILES && git diff --exit-code +for f in $FILES +do + clang-format -i "$f" && git diff --exit-code +done; diff --git a/.ci/install.sh b/.ci/install.sh index af935a59..d8dd67f2 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -1,8 +1,8 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -ex -if [ "$TRAVIS_OS_NAME" == "osx" ]; then +if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update brew install qt5 lmdb clang-format ninja libsodium cmark brew upgrade boost cmake icu4c || true @@ -20,7 +20,7 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then fi -if [ "$TRAVIS_OS_NAME" == "linux" ]; then +if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ -z "$QT_VERSION" ]; then QT_VERSION="592" @@ -31,19 +31,24 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo sh cmake-3.12.2-Linux-x86_64.sh --skip-license --prefix=/usr/local mkdir -p build-libsodium - pushd build-libsodium - curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz - tar xfz libsodium-1.0.16.tar.gz - cd libsodium-1.0.16/ - ./configure && make && make check && sudo make install - popd + ( cd build-libsodium + curl -L https://download.libsodium.org/libsodium/releases/libsodium-1.0.16.tar.gz -o libsodium-1.0.16.tar.gz + tar xfz libsodium-1.0.16.tar.gz + cd libsodium-1.0.16/ + ./configure && make && make check && sudo make install ) sudo add-apt-repository -y ppa:beineri/opt-qt${QT_VERSION}-trusty - sudo apt-get update -qq - sudo apt-get install -qq -y \ + # needed for git-lfs, otherwise the follow apt update fails. + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6B05F25D762E3157 + + # needed for mongodb repository: https://github.com/travis-ci/travis-ci/issues/9037 + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 + + sudo apt update -qq + sudo apt install -qq -y \ qt${QT_PKG}base \ qt${QT_PKG}tools \ qt${QT_PKG}svg \ qt${QT_PKG}multimedia \ liblmdb-dev -fi \ No newline at end of file +fi diff --git a/.ci/linux/deploy.sh b/.ci/linux/deploy.sh index 0fd23808..403fde14 100755 --- a/.ci/linux/deploy.sh +++ b/.ci/linux/deploy.sh @@ -1,13 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh set -ex APP=nheko DIR=${APP}.AppDir -TAG=`git tag -l --points-at HEAD` +# unused but may be useful... +#TAG=$(git tag -l --points-at HEAD) # Set up AppImage structure. -mkdir -p ${DIR}/usr/{bin,lib,share/pixmaps,share/applications} +for d in bin lib share/pixmaps share/applications +do + mkdir -p ${DIR}/usr/$d +done # Copy resources. cp build/nheko ${DIR}/usr/bin @@ -27,19 +31,26 @@ fi chmod a+x linuxdeployqt*.AppImage unset QTDIR -unset QT_PLUGIN_PATH +unset QT_PLUGIN_PATH unset LD_LIBRARY_PATH -export ARCH=$(uname -m) -export LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH +ARCH=$(uname -m) +export ARCH +LD_LIBRARY_PATH=$(pwd)/.deps/usr/lib/:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH -./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs -./linuxdeployqt*.AppImage ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage +for res in ./linuxdeployqt*.AppImage +do + linuxdeployqt=$res +done + +./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -bundle-non-qt-libs +./"$linuxdeployqt" ${DIR}/usr/share/applications/*.desktop -unsupported-allow-new-glibc -appimage chmod +x nheko-*x86_64.AppImage -if [ ! -z $VERSION ]; then +if [ ! -z "$VERSION" ]; then # commented out for now, as AppImage file appears to already contain the version. #mv nheko-*x86_64.AppImage nheko-${VERSION}-x86_64.AppImage echo "nheko-${VERSION}-x86_64.AppImage" -fi \ No newline at end of file +fi diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh index 79701243..45ed13bc 100755 --- a/.ci/macos/deploy.sh +++ b/.ci/macos/deploy.sh @@ -1,29 +1,30 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -set -ex +set -eux -TAG=`git tag -l --points-at HEAD` +# unused +#TAG=$(git tag -l --points-at HEAD) # Add Qt binaries to path PATH=/usr/local/opt/qt/bin/:${PATH} -pushd build +( cd build + # macdeployqt does not copy symlinks over. + # this specifically addresses icu4c issues but nothing else. + ICU_LIB="$(brew --prefix icu4c)/lib" + export ICU_LIB + mkdir -p nheko.app/Contents/Frameworks + find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true -# macdeployqt does not copy symlinks over. -# this specifically addresses icu4c issues but nothing else. -export ICU_LIB="$(brew --prefix icu4c)/lib" -mkdir -p nheko.app/Contents/Frameworks -find ${ICU_LIB} -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true + sudo macdeployqt nheko.app -dmg -always-overwrite -sudo macdeployqt nheko.app -dmg -always-overwrite - -user=$(id -nu) -sudo chown ${user} nheko.dmg -mv nheko.dmg .. -popd + user=$(id -nu) + sudo chown "${user}" nheko.dmg + mv nheko.dmg .. +) dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg -if [ ! -z $VERSION ]; then - mv nheko.dmg nheko-${VERSION}.dmg +if [ ! -z "$VERSION" ]; then + mv nheko.dmg "nheko-${VERSION}.dmg" fi diff --git a/.ci/script.sh b/.ci/script.sh index 435f2c27..cf8b524b 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -2,30 +2,33 @@ set -ex -if [ "$TRAVIS_OS_NAME" == "linux" ]; then +if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CC=${C_COMPILER} export CXX=${CXX_COMPILER} + # make build use all available cores + export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l) - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/${C_COMPILER} 10 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/${CXX_COMPILER} 10 + sudo update-alternatives --install /usr/bin/gcc gcc "/usr/bin/${C_COMPILER}" 10 + sudo update-alternatives --install /usr/bin/g++ g++ "/usr/bin/${CXX_COMPILER}" 10 sudo update-alternatives --set gcc "/usr/bin/${C_COMPILER}" sudo update-alternatives --set g++ "/usr/bin/${CXX_COMPILER}" fi -if [ "$TRAVIS_OS_NAME" == "linux" ]; then - source /opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh || true; +if [ "$TRAVIS_OS_NAME" = "linux" ]; then + # shellcheck disable=SC1090 + . "/opt/qt${QT_PKG}/bin/qt${QT_PKG}-env.sh" || true; fi -if [ "$TRAVIS_OS_NAME" == "osx" ]; then +if [ "$TRAVIS_OS_NAME" = "osx" ]; then export CMAKE_PREFIX_PATH=/usr/local/opt/qt5 fi # Build & install dependencies cmake -GNinja -Hdeps -B.deps \ - -DUSE_BUNDLED_BOOST=${USE_BUNDLED_BOOST} \ - -DUSE_BUNDLED_CMARK=${USE_BUNDLED_CMARK} \ - -DUSE_BUNDLED_JSON=${USE_BUNDLED_JSON} + -DUSE_BUNDLED_BOOST="${USE_BUNDLED_BOOST}" \ + -DUSE_BUNDLED_CMARK="${USE_BUNDLED_CMARK}" \ + -DUSE_BUNDLED_JSON="${USE_BUNDLED_JSON}" cmake --build .deps # Build nheko @@ -34,14 +37,14 @@ cmake -GNinja -H. -Bbuild \ -DCMAKE_INSTALL_PREFIX=.deps/usr cmake --build build -if [ "$TRAVIS_OS_NAME" == "osx" ]; then +if [ "$TRAVIS_OS_NAME" = "osx" ]; then make lint; - if [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ] ; then + if [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ] ; then make macos-deploy; fi fi -if [ "$TRAVIS_OS_NAME" == "linux" ] && [ $DEPLOYMENT == 1 ] && [ ! -z $VERSION ]; then +if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$DEPLOYMENT" = 1 ] && [ ! -z "$VERSION" ]; then make linux-deploy; fi diff --git a/.gitignore b/.gitignore index 0b2b05e8..e9c854d0 100644 --- a/.gitignore +++ b/.gitignore @@ -101,3 +101,6 @@ package.dir # Dependencies .third-party .deps + +# Archives +*.bz2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0efbb516..74f6c62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ ## [Unreleased] +## [0.6.4] - 2019-05-22 + +*Most* of the below fixes are due to updates in mtxclient. Make sure you compile against 0.2.1 +if you do not use the mtxclient bundled with nheko to get these fixes. + +### Features +- Support V3 Rooms + +### Improvements +- Fix #19 + - Fix initial sync issue caused by matrix-org/synapse#4898 (thanks @monokelpinguin) + - Add additional lmbd max_dbs setting (thanks @AndrewJDR) +- Update DE translations (thanks @miocho) +- Update Dutch translations (thanks @vistaus) +- Fix text input UI bug (thanks @0xd800) +- Update linkifyMessage to parse HTML better (thanks @monokelpinguin) +- Update to Boost 1.69.0 +- Fix some memory-leak scenarios due to mismatched new / delete (thanks @monokelpinguin) + +### Other Changes +- mtxclient now builds as a Shared Library by default (instead of statically) + ## [0.6.3] - 2019-02-08 ### Features diff --git a/CMakeLists.txt b/CMakeLists.txt index 352542a1..fda60b71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ include(QtCommon) project(nheko LANGUAGES C CXX) set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MINOR "6") -set(CPACK_PACKAGE_VERSION_PATCH "3") +set(CPACK_PACKAGE_VERSION_PATCH "4") set(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}) set(PROJECT_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR}) set(PROJECT_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}) @@ -104,7 +104,8 @@ if(NOT MSVC) -pedantic \ -fsized-deallocation \ -fdiagnostics-color=always \ - -Wunreachable-code" + -Wunreachable-code \ + -std=c++14" ) if (NOT CMAKE_COMPILER_IS_GNUCXX) # -Wshadow is buggy and broken in GCC, so do not enable it. diff --git a/LICENSE b/COPYING similarity index 100% rename from LICENSE rename to COPYING diff --git a/README.md b/README.md index 5df38d1d..cf7dbbb1 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@ nheko ---- [![Build Status](https://travis-ci.org/Nheko-Reborn/nheko.svg?branch=master)](https://travis-ci.org/Nheko-Reborn/nheko) [![Build status](https://ci.appveyor.com/api/projects/status/07qrqbfylsg4hw2h/branch/master?svg=true)](https://ci.appveyor.com/project/redsky17/nheko/branch/master) -[![Stable Version](https://img.shields.io/badge/download-stable-green.svg)](https://github.com/Nheko-Reborn/nheko/releases/v0.6.3) -[![Nightly](https://img.shields.io/badge/download-nightly-green.svg)](https://github.com/Nheko-Reborn/nheko/releases/nightly) +[![Stable Version](https://img.shields.io/badge/download-stable-green.svg)](https://github.com/Nheko-Reborn/nheko/releases/v0.6.4) +[![Nightly](https://img.shields.io/badge/download-nightly-green.svg)](https://bintray.com/nheko-reborn/nheko/nheko) [![#nheko-reborn:matrix.org](https://img.shields.io/matrix/nheko-reborn:matrix.org.svg?label=%23nheko-reborn:matrix.org)](https://matrix.to/#/#nheko-reborn:matrix.org) [![AUR: nheko](https://img.shields.io/badge/AUR-nheko-blue.svg)](https://aur.archlinux.org/packages/nheko) +Download on Flathub The motivation behind the project is to provide a native desktop app for [Matrix] that feels more like a mainstream chat app ([Riot], Telegram etc) and less like an IRC client. @@ -70,7 +71,7 @@ sudo apk add nheko #### Flatpak ``` -flatpak install flathub io.github.mujx.Nheko +flatpak install flathub io.github.NhekoReborn.Nheko ``` #### macOS (10.12 and above) diff --git a/appveyor.yml b/appveyor.yml index 94aa7a6e..08251174 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ --- -version: 0.6.3-{build} +version: 0.6.4-{build} configuration: Release image: Visual Studio 2017 @@ -20,7 +20,9 @@ install: - set PATH=%PATH%;%QT_DIR%\bin;C:\MinGW\bin - set PATH=%PATH%;C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" + - cd "C:\Tools\vcpkg"&& git pull && .\bootstrap-vcpkg.bat && cd %APPVEYOR_BUILD_FOLDER% - vcpkg install + nlohmann-json:%PLATFORM%-windows boost-asio:%PLATFORM%-windows boost-beast:%PLATFORM%-windows boost-iostreams:%PLATFORM%-windows @@ -37,8 +39,8 @@ build_script: # VERSION format: branch-master/branch-1.2 # INSTVERSION format: x.y.z # WINVERSION format: 9999.0.0.123/1.2.0.234 - - if "%APPVEYOR_REPO_TAG%"=="false" set INSTVERSION=0.6.3 - - if "%APPVEYOR_REPO_TAG%"=="false" set VERSION=0.6.3 + - if "%APPVEYOR_REPO_TAG%"=="false" set INSTVERSION=0.6.4 + - if "%APPVEYOR_REPO_TAG%"=="false" set VERSION=0.6.4 - if "%APPVEYOR_REPO_TAG%"=="false" if "%APPVEYOR_REPO_BRANCH%"=="master" set INSTVERSION=9999.0 - if "%APPVEYOR_REPO_TAG%"=="false" set WINVERSION=%INSTVERSION%.0.%APPVEYOR_BUILD_NUMBER% # VERSION format: v1.2.3/v1.3.4 @@ -56,7 +58,8 @@ build_script: - cmake -G "Visual Studio 15 2017 Win64" -Hdeps -B.deps -DCMAKE_TOOLCHAIN_FILE=C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake -DUSE_BUNDLED_BOOST=OFF - -DUSE_BUNDLED_JSON=ON + -DUSE_BUNDLED_JSON=OFF + -DMTX_STATIC=ON - cmake --build .deps --config Release # Build nheko @@ -102,8 +105,8 @@ after_build: # Copy installer data - copy %BUILD%\resources\nheko.ico installer\config - copy %BUILD%\resources\nheko.png installer\config - - copy %BUILD%\LICENSE installer\packages\com.mujx.nheko\meta\license.txt - - copy %BUILD%\LICENSE installer\packages\com.mujx.nheko.cleanup\meta\license.txt + - copy %BUILD%\COPYING installer\packages\com.mujx.nheko\meta\license.txt + - copy %BUILD%\COPYING installer\packages\com.mujx.nheko.cleanup\meta\license.txt - copy %BUILD%\deploy\installer\config.xml installer\config - copy %BUILD%\deploy\installer\controlscript.qs installer\config - copy %BUILD%\deploy\installer\uninstall.qs installer\packages\com.mujx.nheko\data @@ -112,9 +115,9 @@ after_build: - copy %BUILD%\deploy\installer\cleanup\package.xml installer\packages\com.mujx.nheko.cleanup\meta - copy %BUILD%\deploy\installer\cleanup\installscript.qs installer\packages\com.mujx.nheko.cleanup\meta # Amend version and date - - sed -i "s/__VERSION__/0.6.3/" installer\config\config.xml - - sed -i "s/__VERSION__/0.6.3/" installer\packages\com.mujx.nheko\meta\package.xml - - sed -i "s/__VERSION__/0.6.3/" installer\packages\com.mujx.nheko.cleanup\meta\package.xml + - sed -i "s/__VERSION__/0.6.4/" installer\config\config.xml + - sed -i "s/__VERSION__/0.6.4/" installer\packages\com.mujx.nheko\meta\package.xml + - sed -i "s/__VERSION__/0.6.4/" installer\packages\com.mujx.nheko.cleanup\meta\package.xml - sed -i "s/__DATE__/%DATE%/" installer\packages\com.mujx.nheko\meta\package.xml - sed -i "s/__DATE__/%DATE%/" installer\packages\com.mujx.nheko.cleanup\meta\package.xml # Copy nheko data diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 6461156c..43fe5831 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -30,6 +30,7 @@ option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdbxx." ${USE_BUNDLED}) option(USE_BUNDLED_MATRIX_CLIENT "Use the bundled version of mtxclient." ${USE_BUNDLED}) option(USE_BUNDLED_JSON "Use the bundled version of nlohmann json." ${USE_BUNDLED}) +option(MTX_STATIC "Compile / link bundled mtx client statically" OFF) if(USE_BUNDLED_BOOST) # bundled boost is 1.68, which requires CMake 3.12 or greater. @@ -39,9 +40,9 @@ endif() include(ExternalProject) set(BOOST_URL - https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2) + https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.bz2) set(BOOST_SHA256 - 7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7) + 8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406) set( MTXCLIENT_URL @@ -63,7 +64,7 @@ set( set(LMDBXX_HASH c57b501a4e8fa1187fa7fd348da415c7685a50a7cb25b17b3f257b9e9426f73d) -set(OLM_URL https://git.matrix.org/git/olm.git) +set(OLM_URL https://gitlab.matrix.org/matrix-org/olm.git) set(OLM_TAG 4065c8e11a33ba41133a086ed3de4da94dcb6bae) set(CMARK_URL https://github.com/commonmark/cmark/archive/0.28.3.tar.gz) diff --git a/deps/cmake/Boost.cmake b/deps/cmake/Boost.cmake index 27dc0c21..47eb723b 100644 --- a/deps/cmake/Boost.cmake +++ b/deps/cmake/Boost.cmake @@ -16,7 +16,7 @@ ExternalProject_Add( CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/boost/bootstrap.sh --with-libraries=random,thread,system,iostreams,atomic,chrono,date_time,regex --prefix=${DEPS_INSTALL_DIR} - BUILD_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 cxxstd=14 variant=release link=static threading=multi --layout=system + BUILD_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 cxxstd=14 variant=release link=shared runtime-link=shared threading=multi --layout=system INSTALL_COMMAND ${DEPS_BUILD_DIR}/boost/b2 -d0 install ) diff --git a/deps/cmake/MatrixClient.cmake b/deps/cmake/MatrixClient.cmake index e20c5d22..44992c0b 100644 --- a/deps/cmake/MatrixClient.cmake +++ b/deps/cmake/MatrixClient.cmake @@ -13,6 +13,12 @@ endif() # instead of the bundled version of Boost, like we wanted. set(BOOST_BUNDLE_ROOT "-DBOOST_ROOT=${DEPS_BUILD_DIR}/boost") +set (MTX_SHARED ON) + +if (MTX_STATIC) + set (MTX_SHARED OFF) +endif() + ExternalProject_Add( MatrixClient @@ -28,6 +34,7 @@ ExternalProject_Add( -DBUILD_LIB_EXAMPLES=OFF -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} ${BOOST_BUNDLE_ROOT} + -DBUILD_SHARED_LIBS=${MTX_SHARED} ${PLATFORM_FLAGS} ${DEPS_BUILD_DIR}/mtxclient BUILD_COMMAND diff --git a/resources/nheko.appdata.xml b/resources/nheko.appdata.xml index 0a83bfe8..b549e2e9 100644 --- a/resources/nheko.appdata.xml +++ b/resources/nheko.appdata.xml @@ -1,4 +1,5 @@ + nheko.desktop CC0-1.0 @@ -10,15 +11,39 @@ desktop app for Matrix that feels more like a mainstream chat app.

+ + + de + el + en + fr + nl + pl + ru + zh_CN + + + intense + intense + - - https://dl.dropboxusercontent.com/s/x638uft1fcnybv9/nheko-gnome.png + https://nheko-reborn.github.io/images/screenshots/chat-resized.png + + + https://nheko-reborn.github.io/images/screenshots/Start-resized.png + + + https://nheko-reborn.github.io/images/screenshots/settings-resized.png + + + https://nheko-reborn.github.io/images/screenshots/login-resized.png https://github.com/Nheko-Reborn/nheko https://github.com/Nheko-Reborn + diff --git a/scripts/archive.sh b/scripts/archive.sh index 48d913d4..f8b1a82c 100755 --- a/scripts/archive.sh +++ b/scripts/archive.sh @@ -1,4 +1,6 @@ -#!/bin/bash -e +#!/bin/sh + +set -eu PREFIX=$(basename "$(pwd -P)") { diff --git a/scripts/generate_icns.sh b/scripts/generate_icns.sh index 39d7ac77..98a5e68f 100755 --- a/scripts/generate_icns.sh +++ b/scripts/generate_icns.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/bin/sh + +set -eu # # Manually generate icon set for MacOS. @@ -9,17 +11,17 @@ OUTPUT=nheko mkdir ${OUTPUT}.iconset -sips -z 16 16 ${INPUT} --out ${OUTPUT}.iconset/icon_16x16.png -sips -z 32 32 ${INPUT} --out ${OUTPUT}.iconset/icon_16x16@2x.png -sips -z 32 32 ${INPUT} --out ${OUTPUT}.iconset/icon_32x32.png -sips -z 64 64 ${INPUT} --out ${OUTPUT}.iconset/icon_32x32@2x.png -sips -z 128 128 ${INPUT} --out ${OUTPUT}.iconset/icon_128x128.png -sips -z 256 256 ${INPUT} --out ${OUTPUT}.iconset/icon_128x128@2x.png -sips -z 256 256 ${INPUT} --out ${OUTPUT}.iconset/icon_256x256.png -sips -z 512 512 ${INPUT} --out ${OUTPUT}.iconset/icon_256x256@2x.png -sips -z 512 512 ${INPUT} --out ${OUTPUT}.iconset/icon_512x512.png +sips -z 16 16 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16.png +sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_16x16@2x.png +sips -z 32 32 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32.png +sips -z 64 64 "${INPUT}" --out ${OUTPUT}.iconset/icon_32x32@2x.png +sips -z 128 128 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128.png +sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_128x128@2x.png +sips -z 256 256 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256.png +sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_256x256@2x.png +sips -z 512 512 "${INPUT}" --out ${OUTPUT}.iconset/icon_512x512.png -cp ${INPUT} ${OUTPUT}.iconset/icon_512x512@2x.png +cp "${INPUT}" ${OUTPUT}.iconset/icon_512x512@2x.png iconutil -c icns ${OUTPUT}.iconset diff --git a/src/Config.h b/src/Config.h index bb99ca87..e1271452 100644 --- a/src/Config.h +++ b/src/Config.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include // Non-theme app configuration. Layouts, fonts spacing etc. @@ -51,8 +51,11 @@ constexpr auto LABEL_BIG_SIZE_RATIO = 2; namespace strings { const QString url_html = "\\1"; -const QRegExp url_regex( - "((www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:])"); +const QRegularExpression url_regex( + // match an URL, that is not quoted, i.e. + // vvvvvvv match quote via negative lookahead/lookbehind vvvvvv + // vvvv atomic match url -> fail if there is a " before or after vv + "(?((www\\.(?!\\.)|[a-z][a-z0-9+.-]*://)[^\\s<>'\"]+[^!,\\.\\s<>'\"\\]\\)\\:]))(?!\")"); } // Window geometry. diff --git a/src/Utils.cpp b/src/Utils.cpp index 0d3e9384..f8fdfaf9 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -291,65 +291,9 @@ utils::linkifyMessage(const QString &body) { // Convert to valid XML. auto doc = QString("%1").arg(body); + doc.replace(conf::strings::url_regex, conf::strings::url_html); - doc.replace("", ""); - doc.replace("", ""); - doc.replace("
", "

"); - - QXmlStreamReader xml{doc}; - - QString textString; - while (!xml.atEnd() && !xml.hasError()) { - auto t = xml.readNext(); - - switch (t) { - case QXmlStreamReader::Characters: { - auto text = xml.text().toString(); - text.replace(conf::strings::url_regex, conf::strings::url_html); - - textString += text; - break; - } - case QXmlStreamReader::StartDocument: - case QXmlStreamReader::EndDocument: - break; - case QXmlStreamReader::StartElement: { - if (xml.name() == "html") - break; - - textString += QString("<%1").arg(xml.name().toString()); - - const auto attrs = xml.attributes(); - for (const auto &e : attrs) - textString += QString(" %1=\"%2\"") - .arg(e.name().toString()) - .arg(e.value().toString()); - - textString += ">"; - - break; - } - case QXmlStreamReader::EndElement: { - if (xml.name() == "html") - break; - - textString += QString("").arg(xml.name().toString()); - break; - } - default: { - break; - } - } - } - - if (xml.hasError()) { - qWarning() << "error while parsing xml" << xml.errorString() << doc; - doc.replace("", ""); - doc.replace("", ""); - return doc; - } - - return textString; + return doc; } QString