fix: fixed warnings and added pre-commit hook

This commit is contained in:
Qv2ray-dev 2020-05-11 09:35:45 +08:00
parent cb9ea94f14
commit b51fa558a1
5 changed files with 26 additions and 14 deletions

12
hooks/pre-commit Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
STAGE_FILES=$(git diff --cached --name-only --diff-filter=ACM -- 'makespec/BUILDVERSION')
#echo $STAGE_FILES
if test ${#STAGE_FILES} -gt 0
then
echo 'BUILDVERSION already changed, not touching'
else
echo 'Increasing BUILDVERSION'
expr $(cat ./makespec/BUILDVERSION) + 1 > ./makespec/BUILDVERSION
cat ./makespec/BUILDVERSION
git add ./makespec/BUILDVERSION
fi

View File

@ -1 +1 @@
5380
5384

View File

@ -56,7 +56,7 @@ namespace Qv2ray::common
}
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true);
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true);
auto ua = GlobalConfig.networkConfig.userAgent;
ua.replace("$VERSION", QV2RAY_VERSION_STRING);
request.setHeader(QNetworkRequest::KnownHeaders::UserAgentHeader, ua);
@ -88,7 +88,7 @@ namespace Qv2ray::common
void QvHttpRequestHelper::onRequestFinished_p()
{
if (reply->attribute(QNetworkRequest::HTTP2WasUsedAttribute).toBool())
if (reply->attribute(QNetworkRequest::Http2WasUsedAttribute).toBool())
{
DEBUG(MODULE_NETWORK, "HTTP/2 was used.")
}

View File

@ -184,16 +184,16 @@ namespace Qv2ray::components::autolaunch
QTextStream ts(&iniFile);
ts.setCodec("UTF-8");
ts << QLatin1String("[Desktop Entry]") << endl
<< QLatin1String("Name=") << QApplication::applicationName() << endl
<< QLatin1String("GenericName=") << QLatin1String("V2ray Frontend") << endl
<< QLatin1String("Exec=") << binPath << endl
<< QLatin1String("Terminal=") << "false" << endl
<< QLatin1String("Icon=") << "qv2ray" << endl // always use lowercase for icons
<< QLatin1String("Categories=") << "Network" << endl
<< QLatin1String("Type=") << "Application" << endl
<< QLatin1String("StartupNotify=") << "false" << endl
<< QLatin1String("X-GNOME-Autostart-enabled=") << "true" << endl;
ts << QLatin1String("[Desktop Entry]") << Qt::endl
<< QLatin1String("Name=") << QApplication::applicationName() + QApplication::arguments().join(" ") << Qt::endl
<< QLatin1String("GenericName=") << QLatin1String("V2ray Frontend") << Qt::endl
<< QLatin1String("Exec=") << binPath << Qt::endl
<< QLatin1String("Terminal=") << "false" << Qt::endl
<< QLatin1String("Icon=") << "qv2ray" << Qt::endl // always use lowercase for icons
<< QLatin1String("Categories=") << "Network" << Qt::endl
<< QLatin1String("Type=") << "Application" << Qt::endl
<< QLatin1String("StartupNotify=") << "false" << Qt::endl
<< QLatin1String("X-GNOME-Autostart-enabled=") << "true" << Qt::endl;
}
else
{

View File

@ -209,7 +209,7 @@ namespace Qv2ray::core::connection::Serialization
OUTBOUNDS outbounds;
outbounds.append(GenerateOutboundEntry("shadowsocks", GenerateShadowSocksOUT({ ssObject }), {}));
JADD(outbounds)
serverList.insertMulti(totalName, root);
serverList.insert(totalName, root);
}
// returns the current result