Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chatterino7
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed May 12, 2024
2 parents b281c60 + 321d881 commit 0668f29
Show file tree
Hide file tree
Showing 55 changed files with 274 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jobs:

- name: Setup sccache (Windows)
# sccache v0.7.4
uses: hendrikmuhs/[email protected].12
uses: hendrikmuhs/[email protected].13
if: startsWith(matrix.os, 'windows')
with:
variant: sccache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Setup sccache
# sccache v0.7.4
uses: hendrikmuhs/[email protected].12
uses: hendrikmuhs/[email protected].13
with:
variant: sccache
# only save on the default (master) branch
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/winget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Publish to WinGet
on:
release:
types: [released]
jobs:
publish:
runs-on: windows-latest
if: ${{ startsWith(github.event.release.tag_name, 'v') }}
steps:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: ChatterinoTeam.Chatterino
installers-regex: ^Chatterino.Installer.exe$
token: ${{ secrets.WINGET_TOKEN }}
2 changes: 1 addition & 1 deletion BUILDING_ON_FREEBSD.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ FreeBSD 13.0-CURRENT.
mkdir build
cd build
```
1. Generate build files
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
```sh
cmake ..
```
Expand Down
2 changes: 1 addition & 1 deletion BUILDING_ON_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ nix-shell -p openssl boost qt6.full pkg-config cmake
mkdir build
cd build
```
1. Generate build files
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
```sh
cmake -DBUILD_WITH_QT6=ON -DBUILD_WITH_QTKEYCHAIN=OFF ..
```
Expand Down
2 changes: 1 addition & 1 deletion BUILDING_ON_MAC.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Local dev machines for testing are available on Apple Silicon on macOS 13.
1. Go to the project directory where you cloned Chatterino2 & its submodules
1. Create a build directory and go into it:
`mkdir build && cd build`
1. Run CMake:
1. Run CMake. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
`cmake -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5 -DOPENSSL_ROOT_DIR=/opt/homebrew/opt/[email protected] ..`
1. Build:
`make`
Expand Down
1 change: 1 addition & 0 deletions BUILDING_ON_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ nmake
```

To build a debug build, you'll also need to add the `-s compiler.runtime_type=Debug` flag to the `conan install` invocation. See [this StackOverflow post](https://stackoverflow.com/questions/59828611/windeployqt-doesnt-deploy-qwindowsd-dll-for-a-debug-application/75607313#75607313)
To build with plugins add `-DCHATTERINO_PLUGINS=ON` to `cmake` command.

#### Deploying Qt libraries

Expand Down
1 change: 1 addition & 0 deletions BUILDING_ON_WINDOWS_WITH_VCPKG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ This will require more than 30GB of free space on your hard drive.
cmake --build . --parallel <threads> --config Release
```
When using CMD, use `-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake` to specify the toolchain.
To build with plugins add `-DCHATTERINO_PLUGINS=ON` to `cmake -B build` command.
1. Run `.\bin\chatterino2.exe`
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unversioned

- Major: Release plugins alpha. (#5288)
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
- Dev: Add doxygen build target. (#5377)
- Dev: Make printing of strings in tests easier. (#5379)

## 2.5.1

- Bugfix: Fixed links without a protocol not being clickable. (#5345)
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ option(CHATTERINO_GENERATE_COVERAGE "Generate coverage files" OFF)
option(BUILD_TRANSLATIONS "" OFF)
option(BUILD_SHARED_LIBS "" OFF)
option(CHATTERINO_LTO "Enable LTO for all targets" OFF)
option(CHATTERINO_PLUGINS "Enable EXPERIMENTAL plugin support in Chatterino" OFF)
option(CHATTERINO_PLUGINS "Enable ALPHA plugin support in Chatterino" OFF)
option(CHATTERINO_NO_AVIF_PLUGIN "Disable AVIF plugin" OFF)

option(CHATTERINO_UPDATER "Enable update checks" ON)
Expand Down Expand Up @@ -201,6 +201,7 @@ find_package(PajladaSerialize REQUIRED)
find_package(PajladaSignals REQUIRED)
find_package(LRUCache REQUIRED)
find_package(MagicEnum REQUIRED)
find_package(Doxygen)

if (USE_SYSTEM_PAJLADA_SETTINGS)
find_package(PajladaSettings REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion lib/settings
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1165,3 +1165,14 @@ if(NOT CHATTERINO_UPDATER)
message(STATUS "Disabling the updater.")
target_compile_definitions(${LIBRARY_PROJECT} PUBLIC CHATTERINO_DISABLE_UPDATER)
endif()

if (DOXYGEN_FOUND)
message(STATUS "Doxygen found, adding doxygen target")
# output will be in docs/html
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs")

doxygen_add_docs(
doxygen
${CMAKE_CURRENT_LIST_DIR}
)
endif ()
11 changes: 10 additions & 1 deletion src/common/network/NetworkResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const QByteArray &NetworkResult::getData() const

QString NetworkResult::formatError() const
{
if (this->status_)
// Print the status for errors that mirror HTTP status codes (=0 || >99)
if (this->status_ && (this->error_ == QNetworkReply::NoError ||
this->error_ > QNetworkReply::UnknownNetworkError))
{
return QString::number(*this->status_);
}
Expand All @@ -77,6 +79,13 @@ QString NetworkResult::formatError() const
this->error_);
if (name == nullptr)
{
if (this->status_)
{
return QStringLiteral("unknown error (status: %1, error: %2)")
.arg(QString::number(*this->status_),
QString::number(this->error_));
}

return QStringLiteral("unknown error (%1)").arg(this->error_);
}
return name;
Expand Down
15 changes: 15 additions & 0 deletions src/widgets/settingspages/PluginsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ PluginsPage::PluginsPage()
auto group = layout.emplace<QGroupBox>("General plugin settings");
this->generalGroup = group.getElement();
auto groupLayout = group.setLayoutType<QFormLayout>();
auto *scaryLabel = new QLabel(
"Plugins can expand functionality of "
"Chatterino. They can be made in Lua. This functionality is "
"still in public alpha stage. Use ONLY the plugins you trust. "
"The permission system is best effort, always "
"assume plugins can bypass permissions and can execute "
"arbitrary code. To see how to create plugins " +
formatRichNamedLink("https://github.com/Chatterino/chatterino2/"
"blob/master/docs/wip-plugins.md",
"look at the manual") +
".");
scaryLabel->setWordWrap(true);
scaryLabel->setOpenExternalLinks(true);
groupLayout->addRow(scaryLabel);

auto *description =
new QLabel("You can load plugins by putting them into " +
formatRichNamedLink(
Expand Down
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ option(CHATTERINO_TEST_USE_PUBLIC_HTTPBIN "Use public httpbin for testing networ
set(test_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/main.cpp
${CMAKE_CURRENT_LIST_DIR}/resources/test-resources.qrc
${CMAKE_CURRENT_LIST_DIR}/src/TestHelpers.hpp
${CMAKE_CURRENT_LIST_DIR}/src/Test.hpp
${CMAKE_CURRENT_LIST_DIR}/src/Test.cpp
${CMAKE_CURRENT_LIST_DIR}/src/ChannelChatters.cpp
${CMAKE_CURRENT_LIST_DIR}/src/AccessGuard.cpp
${CMAKE_CURRENT_LIST_DIR}/src/NetworkCommon.cpp
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docker run --network=host --detach ghcr.io/chatterino/twitch-pubsub-server-test:
docker run -p 9051:80 --detach kennethreitz/httpbin
```

If you're unable to use docker, you can use [httpbox](github.com/kevinastone/httpbox) (`httpbox --port 9051`) and [Chatterino/twitch-pubsub-server-test](https://github.com/Chatterino/twitch-pubsub-server-test/releases/latest) manually.
If you're unable to use docker, you can use [httpbox](https://github.com/kevinastone/httpbox) (`httpbox --port 9051`) and [Chatterino/twitch-pubsub-server-test](https://github.com/Chatterino/twitch-pubsub-server-test/releases/latest) manually.
2 changes: 1 addition & 1 deletion tests/src/AccessGuard.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "common/UniqueAccess.hpp"
#include "Test.hpp"

#include <gtest/gtest.h>
#include <QDebug>
#include <QString>

Expand Down
2 changes: 1 addition & 1 deletion tests/src/BasicPubSub.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "providers/liveupdates/BasicPubSubClient.hpp"
#include "providers/liveupdates/BasicPubSubManager.hpp"
#include "Test.hpp"

#include <gtest/gtest.h>
#include <QByteArray>
#include <QJsonDocument>
#include <QJsonObject>
Expand Down
3 changes: 2 additions & 1 deletion tests/src/BttvLiveUpdates.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "providers/bttv/BttvLiveUpdates.hpp"

#include <gtest/gtest.h>
#include "Test.hpp"

#include <QString>

#include <optional>
Expand Down
2 changes: 1 addition & 1 deletion tests/src/ChannelChatters.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "common/ChannelChatters.hpp"

#include "mocks/Channel.hpp"
#include "Test.hpp"

#include <gtest/gtest.h>
#include <QColor>
#include <QStringList>

Expand Down
3 changes: 2 additions & 1 deletion tests/src/ChatterSet.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "common/ChatterSet.hpp"

#include <gtest/gtest.h>
#include "Test.hpp"

#include <QStringList>

TEST(ChatterSet, insert)
Expand Down
3 changes: 1 addition & 2 deletions tests/src/Emojis.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "providers/emoji/Emojis.hpp"

#include "common/Literals.hpp"
#include "TestHelpers.hpp"
#include "Test.hpp"

#include <gtest/gtest.h>
#include <QDebug>
#include <QString>

Expand Down
2 changes: 1 addition & 1 deletion tests/src/ExponentialBackoff.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "util/ExponentialBackoff.hpp"

#include <gtest/gtest.h>
#include "Test.hpp"

using namespace chatterino;

Expand Down
43 changes: 19 additions & 24 deletions tests/src/Filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "providers/twitch/TwitchBadge.hpp"
#include "providers/twitch/TwitchMessageBuilder.hpp"
#include "singletons/Emotes.hpp"
#include "Test.hpp"

#include <gtest/gtest.h>
#include <QColor>
#include <QVariant>

Expand Down Expand Up @@ -101,7 +101,7 @@ namespace chatterino::filters {

std::ostream &operator<<(std::ostream &os, Type t)
{
os << qUtf8Printable(typeToString(t));
os << typeToString(t);
return os;
}

Expand Down Expand Up @@ -138,8 +138,8 @@ TEST(Filters, Validity)
auto filterResult = Filter::fromString(input);
bool isValid = std::holds_alternative<Filter>(filterResult);
EXPECT_EQ(isValid, expected)
<< "Filter::fromString( " << qUtf8Printable(input)
<< " ) should be " << (expected ? "valid" : "invalid");
<< "Filter::fromString( " << input << " ) should be "
<< (expected ? "valid" : "invalid");
}
}

Expand Down Expand Up @@ -168,15 +168,14 @@ TEST(Filters, TypeSynthesis)
{
auto filterResult = Filter::fromString(input);
bool isValid = std::holds_alternative<Filter>(filterResult);
ASSERT_TRUE(isValid) << "Filter::fromString( " << qUtf8Printable(input)
<< " ) is invalid";
ASSERT_TRUE(isValid)
<< "Filter::fromString( " << input << " ) is invalid";

auto filter = std::move(std::get<Filter>(filterResult));
T type = filter.returnType();
EXPECT_EQ(type, expected)
<< "Filter{ " << qUtf8Printable(input) << " } has type " << type
<< " instead of " << expected << ".\nDebug: "
<< qUtf8Printable(filter.debugString(typingContext));
<< "Filter{ " << input << " } has type " << type << " instead of "
<< expected << ".\nDebug: " << filter.debugString(typingContext);
}
}

Expand Down Expand Up @@ -244,17 +243,16 @@ TEST(Filters, Evaluation)
{
auto filterResult = Filter::fromString(input);
bool isValid = std::holds_alternative<Filter>(filterResult);
ASSERT_TRUE(isValid) << "Filter::fromString( " << qUtf8Printable(input)
<< " ) is invalid";
ASSERT_TRUE(isValid)
<< "Filter::fromString( " << input << " ) is invalid";

auto filter = std::move(std::get<Filter>(filterResult));
auto result = filter.execute(contextMap);

EXPECT_EQ(result, expected)
<< "Filter{ " << qUtf8Printable(input) << " } evaluated to "
<< qUtf8Printable(result.toString()) << " instead of "
<< qUtf8Printable(expected.toString()) << ".\nDebug: "
<< qUtf8Printable(filter.debugString(typingContext));
<< "Filter{ " << input << " } evaluated to " << result.toString()
<< " instead of " << expected.toString()
<< ".\nDebug: " << filter.debugString(typingContext);
}
}

Expand Down Expand Up @@ -354,20 +352,17 @@ TEST_F(FiltersF, ExpressionDebug)
{
const auto filterResult = Filter::fromString(input);
const auto *filter = std::get_if<Filter>(&filterResult);
EXPECT_NE(filter, nullptr)
<< "Filter::fromString(" << qUtf8Printable(input)
<< ") did not build a proper filter";
EXPECT_NE(filter, nullptr) << "Filter::fromString(" << input
<< ") did not build a proper filter";

const auto actualDebugString = filter->debugString(typingContext);
EXPECT_EQ(actualDebugString, debugString)
<< "filter->debugString() on '" << qUtf8Printable(input)
<< "' should be '" << qUtf8Printable(debugString) << "', but got '"
<< qUtf8Printable(actualDebugString) << "'";
<< "filter->debugString() on '" << input << "' should be '"
<< debugString << "', but got '" << actualDebugString << "'";

const auto actualFilterString = filter->filterString();
EXPECT_EQ(actualFilterString, filterString)
<< "filter->filterString() on '" << qUtf8Printable(input)
<< "' should be '" << qUtf8Printable(filterString) << "', but got '"
<< qUtf8Printable(actualFilterString) << "'";
<< "filter->filterString() on '" << input << "' should be '"
<< filterString << "', but got '" << actualFilterString << "'";
}
}
13 changes: 6 additions & 7 deletions tests/src/FormatTime.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "util/FormatTime.hpp"

#include <gtest/gtest.h>
#include "Test.hpp"

#include <chrono>

Expand Down Expand Up @@ -62,8 +62,8 @@ TEST(FormatTime, Int)
const auto actual = formatTime(input);

EXPECT_EQ(actual, expected)
<< qUtf8Printable(actual) << " (" << input
<< ") did not match expected value " << qUtf8Printable(expected);
<< actual << " (" << input << ") did not match expected value "
<< expected;
}
}

Expand Down Expand Up @@ -130,8 +130,8 @@ TEST(FormatTime, QString)
const auto actual = formatTime(input);

EXPECT_EQ(actual, expected)
<< qUtf8Printable(actual) << " (" << qUtf8Printable(input)
<< ") did not match expected value " << qUtf8Printable(expected);
<< actual << " (" << input << ") did not match expected value "
<< expected;
}
}

Expand Down Expand Up @@ -202,7 +202,6 @@ TEST(FormatTime, chrono)
const auto actual = formatTime(input);

EXPECT_EQ(actual, expected)
<< qUtf8Printable(actual) << " did not match expected value "
<< qUtf8Printable(expected);
<< actual << " did not match expected value " << expected;
}
}
Loading

0 comments on commit 0668f29

Please sign in to comment.