Merge branch 'master' of https://github.com/fourtf/chatterino2
This commit is contained in:
@@ -17,3 +17,6 @@
|
|||||||
path = lib/websocketpp
|
path = lib/websocketpp
|
||||||
url = https://github.com/zaphoyd/websocketpp.git
|
url = https://github.com/zaphoyd/websocketpp.git
|
||||||
branch = develop
|
branch = develop
|
||||||
|
[submodule "lib/qBreakpad"]
|
||||||
|
path = lib/qBreakpad
|
||||||
|
url = https://github.com/jiakuan/qBreakpad.git
|
||||||
|
|||||||
@@ -32,6 +32,11 @@
|
|||||||
2. Under Tools:
|
2. Under Tools:
|
||||||
- Select Qt Creator, and Qt Creator CDB Debugger Support
|
- Select Qt Creator, and Qt Creator CDB Debugger Support
|
||||||
|
|
||||||
|
### Compile with Breakpad support (Optional)
|
||||||
|
1. Open up lib/qBreakpad/handler/handler.pro
|
||||||
|
2. Build it in whichever mode you wanna build Chatterino (Debug/Profile/Release)
|
||||||
|
3. Copy the newly built qBreakpad.lib to a folder you create: `lib/qBreakpad/build/handler`
|
||||||
|
|
||||||
# Windows (Using MSYS2, not recommended)
|
# Windows (Using MSYS2, not recommended)
|
||||||
Note: This guide is currently out of date and will not work as is.
|
Note: This guide is currently out of date and will not work as is.
|
||||||
Note: This build will have some features missing from the build.
|
Note: This build will have some features missing from the build.
|
||||||
|
|||||||
+10
-2
@@ -17,6 +17,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
PRECOMPILED_HEADER = src/PrecompiledHeader.hpp
|
PRECOMPILED_HEADER = src/PrecompiledHeader.hpp
|
||||||
CONFIG += precompile_header
|
CONFIG += precompile_header
|
||||||
|
|
||||||
|
useBreakpad {
|
||||||
|
LIBS += -L$$PWD/lib/qBreakpad/handler/build
|
||||||
|
include(lib/qBreakpad/qBreakpad.pri)
|
||||||
|
DEFINES += C_USE_BREAKPAD
|
||||||
|
}
|
||||||
|
|
||||||
# https://bugreports.qt.io/browse/QTBUG-27018
|
# https://bugreports.qt.io/browse/QTBUG-27018
|
||||||
equals(QMAKE_CXX, "clang++")|equals(QMAKE_CXX, "g++") {
|
equals(QMAKE_CXX, "clang++")|equals(QMAKE_CXX, "g++") {
|
||||||
TARGET = bin/chatterino
|
TARGET = bin/chatterino
|
||||||
@@ -216,7 +222,8 @@ SOURCES += \
|
|||||||
src/widgets/splits/SplitOverlay.cpp \
|
src/widgets/splits/SplitOverlay.cpp \
|
||||||
src/widgets/StreamView.cpp \
|
src/widgets/StreamView.cpp \
|
||||||
src/widgets/TooltipWidget.cpp \
|
src/widgets/TooltipWidget.cpp \
|
||||||
src/widgets/Window.cpp
|
src/widgets/Window.cpp \
|
||||||
|
src/common/LinkParser.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/Application.hpp \
|
src/Application.hpp \
|
||||||
@@ -384,7 +391,8 @@ HEADERS += \
|
|||||||
src/widgets/TooltipWidget.hpp \
|
src/widgets/TooltipWidget.hpp \
|
||||||
src/widgets/Window.hpp \
|
src/widgets/Window.hpp \
|
||||||
src/providers/twitch/TwitchCommon.hpp \
|
src/providers/twitch/TwitchCommon.hpp \
|
||||||
src/util/IsBigEndian.hpp
|
src/util/IsBigEndian.hpp \
|
||||||
|
src/common/LinkParser.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc \
|
resources/resources.qrc \
|
||||||
|
|||||||
Submodule
+1
Submodule lib/qBreakpad added at a4626c12e9
@@ -66,6 +66,7 @@
|
|||||||
<file>images/buttons/unban.png</file>
|
<file>images/buttons/unban.png</file>
|
||||||
<file>images/buttons/unmod.png</file>
|
<file>images/buttons/unmod.png</file>
|
||||||
<file>images/emote_dark.svg</file>
|
<file>images/emote_dark.svg</file>
|
||||||
|
<file>tlds.txt</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/qt/etc">
|
<qresource prefix="/qt/etc">
|
||||||
<file>qt.conf</file>
|
<file>qt.conf</file>
|
||||||
|
|||||||
+1693
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
|||||||
|
#include "common/LinkParser.hpp"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QString>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
LinkParser::LinkParser(const QString &unparsedString)
|
||||||
|
{
|
||||||
|
static QRegularExpression linkRegex = [] {
|
||||||
|
QFile tldFile(":/tlds.txt");
|
||||||
|
tldFile.open(QFile::ReadOnly);
|
||||||
|
|
||||||
|
QTextStream t1(&tldFile);
|
||||||
|
t1.setCodec("UTF-8");
|
||||||
|
|
||||||
|
// Read the TLDs in and replace the newlines with pipes
|
||||||
|
QString tldData = t1.readAll().replace("\n", "|");
|
||||||
|
|
||||||
|
const QString urlRegExp =
|
||||||
|
"^"
|
||||||
|
// protocol identifier
|
||||||
|
"(?:(?:https?|ftps?)://)?"
|
||||||
|
// user:pass authentication
|
||||||
|
"(?:\\S+(?::\\S*)?@)?"
|
||||||
|
"(?:"
|
||||||
|
// IP address dotted notation octets
|
||||||
|
// excludes loopback network 0.0.0.0
|
||||||
|
// excludes reserved space >= 224.0.0.0
|
||||||
|
// excludes network & broacast addresses
|
||||||
|
// (first & last IP address of each class)
|
||||||
|
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])"
|
||||||
|
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}"
|
||||||
|
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))"
|
||||||
|
"|"
|
||||||
|
// host name
|
||||||
|
"(?:(?:[_a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)"
|
||||||
|
// domain name
|
||||||
|
"(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}0-9]-*)*[a-z\\x{00a1}-\\x{ffff}0-9]+)*"
|
||||||
|
// TLD identifier
|
||||||
|
//"(?:\\.(?:[a-z\\x{00a1}-\\x{ffff}]{2,}))"
|
||||||
|
"(?:[\\.](?:" +
|
||||||
|
tldData +
|
||||||
|
"))"
|
||||||
|
"\\.?"
|
||||||
|
")"
|
||||||
|
// port number
|
||||||
|
"(?::\\d{2,5})?"
|
||||||
|
// resource path
|
||||||
|
"(?:[/?#]\\S*)?"
|
||||||
|
"$";
|
||||||
|
|
||||||
|
return QRegularExpression(urlRegExp, QRegularExpression::CaseInsensitiveOption);
|
||||||
|
}();
|
||||||
|
|
||||||
|
this->match_ = linkRegex.match(unparsedString);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace chatterino
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QRegularExpressionMatch>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
|
||||||
|
class LinkParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit LinkParser(const QString &unparsedString);
|
||||||
|
|
||||||
|
bool hasMatch() const
|
||||||
|
{
|
||||||
|
return this->match_.hasMatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getCaptured() const
|
||||||
|
{
|
||||||
|
return this->match_.captured();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRegularExpressionMatch match_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace chatterino
|
||||||
+9
-1
@@ -23,6 +23,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef C_USE_BREAKPAD
|
||||||
|
#include <QBreakpadHandler.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int runGui(QApplication &a, int argc, char *argv[]);
|
int runGui(QApplication &a, int argc, char *argv[]);
|
||||||
void runNativeMessagingHost();
|
void runNativeMessagingHost();
|
||||||
void installCustomPalette();
|
void installCustomPalette();
|
||||||
@@ -83,12 +87,16 @@ int runGui(QApplication &a, int argc, char *argv[])
|
|||||||
|
|
||||||
app->construct();
|
app->construct();
|
||||||
|
|
||||||
|
#ifdef C_USE_BREAKPAD
|
||||||
|
QBreakpadInstance.setDumpPath(app->paths->settingsFolderPath + "/Crashes");
|
||||||
|
#endif
|
||||||
|
|
||||||
auto &pathMan = *app->paths;
|
auto &pathMan = *app->paths;
|
||||||
// Running file
|
// Running file
|
||||||
auto runningPath = pathMan.miscDirectory + "/running_" + pathMan.applicationFilePathHash;
|
auto runningPath = pathMan.miscDirectory + "/running_" + pathMan.applicationFilePathHash;
|
||||||
|
|
||||||
if (QFile::exists(runningPath)) {
|
if (QFile::exists(runningPath)) {
|
||||||
#ifndef DISABLE_CRASH_DIALOG
|
#ifndef C_DISABLE_CRASH_DIALOG
|
||||||
chatterino::LastRunCrashDialog dialog;
|
chatterino::LastRunCrashDialog dialog;
|
||||||
|
|
||||||
switch (dialog.exec()) {
|
switch (dialog.exec()) {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
#include "MessageBuilder.hpp"
|
#include "MessageBuilder.hpp"
|
||||||
|
|
||||||
|
#include "common/LinkParser.hpp"
|
||||||
#include "singletons/EmoteManager.hpp"
|
#include "singletons/EmoteManager.hpp"
|
||||||
#include "singletons/ResourceManager.hpp"
|
#include "singletons/ResourceManager.hpp"
|
||||||
#include "singletons/ThemeManager.hpp"
|
#include "singletons/ThemeManager.hpp"
|
||||||
@@ -43,19 +45,21 @@ void MessageBuilder::appendTimestamp(const QTime &time)
|
|||||||
|
|
||||||
QString MessageBuilder::matchLink(const QString &string)
|
QString MessageBuilder::matchLink(const QString &string)
|
||||||
{
|
{
|
||||||
static QRegularExpression linkRegex("[[:ascii:]]*\\.[a-zA-Z]+\\/?[[:ascii:]]*");
|
LinkParser linkParser(string);
|
||||||
|
|
||||||
static QRegularExpression httpRegex("\\bhttps?://");
|
static QRegularExpression httpRegex("\\bhttps?://");
|
||||||
|
static QRegularExpression ftpRegex("\\bftps?://");
|
||||||
|
|
||||||
auto match = linkRegex.match(string);
|
if (!linkParser.hasMatch()) {
|
||||||
|
|
||||||
if (!match.hasMatch()) {
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString captured = match.captured();
|
QString captured = linkParser.getCaptured();
|
||||||
|
|
||||||
if (!captured.contains(httpRegex)) {
|
if (!captured.contains(httpRegex)) {
|
||||||
captured.insert(0, "http://");
|
if (!captured.contains(ftpRegex)) {
|
||||||
|
captured.insert(0, "http://");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return captured;
|
return captured;
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd ../lib/qBreakpad
|
||||||
|
|
||||||
|
echo "Updating qBreakpad's breakpad dependency version"
|
||||||
|
cd third_party/breakpad
|
||||||
|
git checkout 7b3afa9258e58a57ffbeb395d445811f92616ae9
|
||||||
|
cd ../../
|
||||||
|
|
||||||
|
cd handler
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
qmake ..
|
||||||
|
echo "Building handler"
|
||||||
|
make -j8 && "Successfully built qBreakpad"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#Download the official list of active TLDs from IANA
|
||||||
|
#Remove the first line that contains data not needed.
|
||||||
|
#Put everything that can be into lowercase.
|
||||||
|
#Output the result to a file.
|
||||||
|
curl -s 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt' | sed -e '1d' -e 's/\(.*\)/\L\1/' > tlds.txt
|
||||||
|
|
||||||
|
#Get the TLDs in punycode format.
|
||||||
|
#Convert the punycode to Unicode.
|
||||||
|
#Append the results to the current file.
|
||||||
|
sed -n -e '/^xn--/p' tlds.txt | idn2 -d >> tlds.txt
|
||||||
|
mv tlds.txt ../resources/tlds.txt
|
||||||
Reference in New Issue
Block a user