Merge remote-tracking branch 'origin/master' into zneix/enhancement/login-overhaul

This commit is contained in:
zneix 2021-07-25 04:02:52 +02:00
commit c735df53da
No known key found for this signature in database
GPG key ID: 911916E0523B22F6
10 changed files with 67 additions and 127 deletions

View file

@ -10,6 +10,8 @@
- Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010)
- Bugfix: Fixed comma appended to username completion when not at the beginning of the message. (#3060)
- Dev: Ubuntu packages are now available (#2936)
- Dev: Disabled update checker on Flatpak. (#3051)
- Dev: Add logging for HTTP requests (#2991)
## 2.3.3

View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="32mm"
height="32mm"
viewBox="0 0 32 32"
version="1.1"
id="svg8"
inkscape:export-filename="/home/pajlada/git/chatterino2/resources/buttons/trashcan2.png"
inkscape:export-xdpi="50.799999"
inkscape:export-ydpi="50.799999"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="trashcan.svg">
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient4536"
osb:paint="gradient">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop4532" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop4534" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6"
inkscape:cx="58.051498"
inkscape:cy="84.215087"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1529"
inkscape:window-height="1419"
inkscape:window-x="2160"
inkscape:window-y="2400"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid4818"
originx="-74.790005"
originy="-199.8473"
units="mm"
spacingx="1"
spacingy="1" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<cc:license
rdf:resource="" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-74.789996,-65.152683)">
<path
style="fill:none;stroke:#898395;stroke-width:3.5999999;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 82.789996,69.152684 v 25 h 16 v -25"
id="path4820"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
style="fill:none;stroke:#898395;stroke-width:3.6;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 102.79,69.152684 H 78.789994"
id="path4826"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc">
<title
id="title4970">Trashcan top</title>
</path>
<path
style="fill:none;stroke:#898395;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 87.789996,74.999984 v 14"
id="path4830"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#898395;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 93.789996,88.999984 v -14"
id="path4832"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<circle
style="fill:#898395;fill-opacity:1;stroke:none;stroke-width:6.75056219;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
id="path4974"
cx="90.789993"
cy="67.069061"
r="1.75" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Layer 2"
transform="translate(-74.789996,-65.152683)" />
</svg>

Before

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -15,7 +15,6 @@
<file>buttons/banRed.png</file>
<file>buttons/copyDark.png</file>
<file>buttons/copyDark.svg</file>
<file>buttons/copyDarkTheme.png</file>
<file>buttons/copyLight.png</file>
<file>buttons/copyLight.svg</file>
<file>buttons/emote.svg</file>

View file

@ -15,7 +15,6 @@ Resources2::Resources2()
this->buttons.ban = QPixmap(":/buttons/ban.png");
this->buttons.banRed = QPixmap(":/buttons/banRed.png");
this->buttons.copyDark = QPixmap(":/buttons/copyDark.png");
this->buttons.copyDarkTheme = QPixmap(":/buttons/copyDarkTheme.png");
this->buttons.copyLight = QPixmap(":/buttons/copyLight.png");
this->buttons.menuDark = QPixmap(":/buttons/menuDark.png");
this->buttons.menuLight = QPixmap(":/buttons/menuLight.png");

View file

@ -22,7 +22,6 @@ public:
QPixmap ban;
QPixmap banRed;
QPixmap copyDark;
QPixmap copyDarkTheme;
QPixmap copyLight;
QPixmap menuDark;
QPixmap menuLight;

View file

@ -24,6 +24,13 @@ enum class NetworkRequestType {
Delete,
Patch,
};
const static std::vector<QString> networkRequestTypes{
"GET", //
"POST", //
"PUT", //
"DELETE", //
"PATCH", //
};
// parseHeaderList takes a list of headers in string form,
// where each header pair is separated by semicolons (;) and the header name and value is divided by a colon (:)

View file

@ -145,6 +145,11 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
data->timer_, &QTimer::timeout, worker, [reply, data]() {
qCDebug(chatterinoCommon) << "Aborted!";
reply->abort();
qCDebug(chatterinoHTTP)
<< QString("%1 [timed out] %2")
.arg(networkRequestTypes.at(
int(data->requestType_)),
data->request_.url().toString());
if (data->onError_)
{
@ -181,6 +186,11 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
QNetworkReply::NetworkError::OperationCanceledError)
{
// Operation cancelled, most likely timed out
qCDebug(chatterinoHTTP)
<< QString("%1 [cancelled] %2")
.arg(networkRequestTypes.at(
int(data->requestType_)),
data->request_.url().toString());
return;
}
@ -188,6 +198,25 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
{
auto status = reply->attribute(
QNetworkRequest::HttpStatusCodeAttribute);
if (data->requestType_ == NetworkRequestType::Get)
{
qCDebug(chatterinoHTTP)
<< QString("%1 %2 %3")
.arg(networkRequestTypes.at(
int(data->requestType_)),
QString::number(status.toInt()),
data->request_.url().toString());
}
else
{
qCDebug(chatterinoHTTP)
<< QString("%1 %2 %3 %4")
.arg(networkRequestTypes.at(
int(data->requestType_)),
QString::number(status.toInt()),
data->request_.url().toString(),
QString(data->payload_));
}
// TODO: Should this always be run on the GUI thread?
postToThread([data, code = status.toInt()] {
data->onError_(NetworkResult({}, code));
@ -227,6 +256,23 @@ void loadUncached(const std::shared_ptr<NetworkData> &data)
reply->deleteLater();
if (data->requestType_ == NetworkRequestType::Get)
{
qCDebug(chatterinoHTTP)
<< QString("%1 %2 %3")
.arg(networkRequestTypes.at(int(data->requestType_)),
QString::number(status.toInt()),
data->request_.url().toString());
}
else
{
qCDebug(chatterinoHTTP)
<< QString("%1 %3 %2 %4")
.arg(networkRequestTypes.at(int(data->requestType_)),
data->request_.url().toString(),
QString::number(status.toInt()),
QString(data->payload_));
}
if (data->finally_)
{
if (data->executeConcurrently_)
@ -286,6 +332,10 @@ void loadCached(const std::shared_ptr<NetworkData> &data)
QByteArray bytes = cachedFile.readAll();
NetworkResult result(bytes, 200);
qCDebug(chatterinoHTTP)
<< QString("%1 [CACHED] 200 %2")
.arg(networkRequestTypes.at(int(data->requestType_)),
data->request_.url().toString());
if (data->onSuccess_)
{
if (data->executeConcurrently_ || isGuiThread())

View file

@ -15,6 +15,7 @@ Q_LOGGING_CATEGORY(chatterinoCommon, "chatterino.common", logThreshold);
Q_LOGGING_CATEGORY(chatterinoEmoji, "chatterino.emoji", logThreshold);
Q_LOGGING_CATEGORY(chatterinoFfzemotes, "chatterino.ffzemotes", logThreshold);
Q_LOGGING_CATEGORY(chatterinoHelper, "chatterino.helper", logThreshold);
Q_LOGGING_CATEGORY(chatterinoHTTP, "chatterino.http", logThreshold);
Q_LOGGING_CATEGORY(chatterinoImage, "chatterino.image", logThreshold);
Q_LOGGING_CATEGORY(chatterinoIrc, "chatterino.irc", logThreshold);
Q_LOGGING_CATEGORY(chatterinoIvr, "chatterino.ivr", logThreshold);

View file

@ -11,6 +11,7 @@ Q_DECLARE_LOGGING_CATEGORY(chatterinoCommon);
Q_DECLARE_LOGGING_CATEGORY(chatterinoEmoji);
Q_DECLARE_LOGGING_CATEGORY(chatterinoFfzemotes);
Q_DECLARE_LOGGING_CATEGORY(chatterinoHelper);
Q_DECLARE_LOGGING_CATEGORY(chatterinoHTTP);
Q_DECLARE_LOGGING_CATEGORY(chatterinoImage);
Q_DECLARE_LOGGING_CATEGORY(chatterinoIrc);
Q_DECLARE_LOGGING_CATEGORY(chatterinoIvr);

View file

@ -240,6 +240,12 @@ void Updates::checkForUpdates()
return;
}
// Disable updates on Flatpak
if (QFileInfo::exists("/.flatpak-info"))
{
return;
}
// Disable updates if on nightly
if (Modes::instance().isNightly)
{