Compare commits

..

10 Commits

Author SHA1 Message Date
5220b886de !81 重新发布3152
* update debian/changelog.
* update debian/spark-store.postinst.
2022-08-18 08:44:13 +00:00
5be7923e60 !80 http2下curl容易报错导致pubkey错误
* update debian/spark-store.postinst.
2022-08-18 08:39:36 +00:00
6ca6f63b1f !79 changelog和版本号
Merge pull request !79 from shenmo/auto-4915358-master-ca4f1682
2022-08-18 01:12:49 +00:00
bda0426a3b changelog和版本号 2022-08-18 09:12:10 +08:00
a75b7b1e57 Merge branch 'master' of https://gitee.com/deepin-community-store/spark-store 2022-08-18 09:10:51 +08:00
8054f85ada !78 fix: 不再使用http头请求文件大小
Merge pull request !78 from Pluto/dev
2022-08-17 15:15:19 +00:00
bc6584eacc Merge branch 'master' of https://gitee.com/deepin-community-store/spark-store 2022-08-17 19:41:50 +08:00
c9e01d10fe !77 修改uos的更新策略,先下载到/var/cache/apt/archives再更新
* 修改uos的更新策略,先下载到/var/cache/apt/archives再更新
2022-08-17 02:59:05 +00:00
c3b9763aa8 Merge branch 'master' of https://gitee.com/deepin-community-store/spark-store 2022-08-15 22:59:12 +08:00
e6d3b035db 修改: debian/spark-store.prerm
新文件:   tool/apt-fast-conf/sources.list.d/.keep
	删除:     tool/apt-fast-conf/sources.list.d/sparkstore.list
2022-08-09 19:26:59 +08:00
5 changed files with 37 additions and 48 deletions

16
debian/changelog vendored
View File

@@ -1,3 +1,19 @@
spark-store (3.1.5-2) stable; urgency=medium
* 下载软件时跳过获取大小,修复部分软件无法下载的问题
* 修复 获取key时出错指定使用http1.1
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
spark-store (3.1.5-1) stable; urgency=medium
* 改变更新策略UOS也下载加速但是安装不加速
-- shenmo <shenmo@spark-app.store> Fri, 30 Jan 2022 00:00:00 +0800
spark-store (3.1.5) stable; urgency=medium spark-store (3.1.5) stable; urgency=medium
* 改变更新策略,现在支持应用在更新时引入新依赖 * 改变更新策略,现在支持应用在更新时引入新依赖

View File

@@ -16,7 +16,7 @@ case "$1" in
# Download and install key # Download and install key
curl --progress-bar -o /tmp/spark-store-install/spark-store.asc https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc curl --http1.1 --progress-bar -o /tmp/spark-store-install/spark-store.asc https://d.store.deepinos.org.cn/dcs-repo.gpg-key.asc
gpg --dearmor /tmp/spark-store-install/spark-store.asc gpg --dearmor /tmp/spark-store-install/spark-store.asc
cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg cp -f /tmp/spark-store-install/spark-store.asc.gpg /etc/apt/trusted.gpg.d/spark-store.gpg

View File

@@ -1,14 +1,8 @@
#include "downloadworker.h" #include "downloadworker.h"
#include <QEventLoop> #include <QEventLoop>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QThread>
#include <QProcess> #include <QProcess>
#include <QRegularExpression> #include <QRegularExpression>
#include <QFileInfo>
#include <QDir> #include <QDir>
#include <QElapsedTimer>
#include <QtConcurrent> #include <QtConcurrent>
DownloadController::DownloadController(QObject *parent) DownloadController::DownloadController(QObject *parent)
@@ -36,13 +30,6 @@ void DownloadController::setFilename(QString filename)
this->filename = filename; this->filename = filename;
} }
void timeSleeper(int time)
{
QElapsedTimer t1;
t1.start();
while(t1.elapsed()<time);
return;
}
bool checkMeatlink(QString metaUrl) bool checkMeatlink(QString metaUrl)
{ {
@@ -156,11 +143,9 @@ void DownloadController::startDownload(const QString &url)
[&]() [&]()
{ {
//通过读取输出计算下载速度 //通过读取输出计算下载速度
QFileInfo info(tmpdir.absoluteFilePath(filename));
QString message = cmd->readAllStandardOutput().data(); QString message = cmd->readAllStandardOutput().data();
//qDebug() << message; // qDebug() << message;
message = message.replace(" ", "").replace("\n", "").replace("-", ""); message = message.replace(" ", "");
message = message.replace("*", "").replace("=", "");
QStringList list; QStringList list;
qint64 downloadSize = 0; qint64 downloadSize = 0;
int downloadSizePlace1 = message.indexOf("("); int downloadSizePlace1 = message.indexOf("(");
@@ -174,10 +159,10 @@ void DownloadController::startDownload(const QString &url)
{ {
int percentInfoNumber = percentInfo.toUInt(); int percentInfoNumber = percentInfo.toUInt();
downloadSize = (percentInfoNumber + 1) * fileSize / 100; downloadSize = percentInfoNumber * fileSize / 100;
} }
} }
if (speedPlace1 != -1 && speedPlace2 != -1) if (speedPlace1 != -1 && speedPlace2 != -1 && speedPlace2 - speedPlace1 <= 15)
{ {
speedInfo = message.mid(speedPlace1 + 3, speedPlace2 - speedPlace1 - 3); speedInfo = message.mid(speedPlace1 + 3, speedPlace2 - speedPlace1 - 3);
speedInfo += "/s"; speedInfo += "/s";
@@ -227,30 +212,8 @@ void DownloadController::stopDownload()
qint64 DownloadController::getFileSize(const QString &url) qint64 DownloadController::getFileSize(const QString &url)
{ {
QEventLoop event; // 已经无需使用 qtnetwork 再获取 filesize完全交给 aria2 来计算进度。 为保证兼容性,故保留此函数。
QNetworkAccessManager requestManager; qint64 fileSize = 10000;
QNetworkRequest request;
request.setUrl(QUrl(url));
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
QNetworkReply *reply = requestManager.head(request);
connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),
[this, reply](QNetworkReply::NetworkError error)
{
if (error != QNetworkReply::NoError)
{
emit errorOccur(reply->errorString());
}
});
connect(reply, &QNetworkReply::finished, &event, &QEventLoop::quit);
event.exec();
qint64 fileSize = 0;
if (reply->rawHeader("Accept-Ranges") == QByteArrayLiteral("bytes") && reply->hasRawHeader(QString("Content-Length").toLocal8Bit()))
{
fileSize = reply->header(QNetworkRequest::ContentLengthHeader).toUInt();
}
qDebug() << "文件大小为:" << fileSize;
reply->deleteLater();
return fileSize; return fileSize;
} }

View File

@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
DAboutDialog dialog; DAboutDialog dialog;
a.setAboutDialog(&dialog); a.setAboutDialog(&dialog);
dialog.setLicense(QObject::tr("We publish this program under GPL V3")); dialog.setLicense(QObject::tr("We publish this program under GPL V3"));
dialog.setVersion(DApplication::buildVersion("Version 3.1.5")); dialog.setVersion(DApplication::buildVersion("Version 3.1.5-2"));
dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo dialog.setProductIcon(QIcon::fromTheme("spark-store")); // 设置Logo
dialog.setProductName(QLabel::tr("Spark Store")); dialog.setProductName(QLabel::tr("Spark Store"));
dialog.setDescription( dialog.setDescription(
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
a.setOrganizationName("spark-union"); a.setOrganizationName("spark-union");
a.setOrganizationDomain("https://www.deepinos.org/"); a.setOrganizationDomain("https://www.deepinos.org/");
a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文 a.setApplicationName("Spark Store"); //不需要翻译,否则 ~/.local/share/ 下文件夹名称也被翻译为中文
a.setApplicationVersion(DApplication::buildVersion("3.1.5")); a.setApplicationVersion(DApplication::buildVersion("3.1.5-2"));
a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store"); a.setApplicationAcknowledgementPage("https://gitee.com/deepin-community-store/spark-store");
a.setApplicationDescription( a.setApplicationDescription(
QObject::tr( QObject::tr(

View File

@@ -9,9 +9,17 @@ PKG_LIST="$(bwrap --dev-bind / / --bind '/opt/durapps/spark-store/bin/apt-fast-c
isuos=`cat /etc/os-release | grep UnionTech` isuos=`cat /etc/os-release | grep UnionTech`
if [ "$isuos" != "" ]; then ###这是确定是否为UOS if [ "$isuos" != "" ]; then ###这是确定是否为UOS 如果是
echo "UOS中系统依赖无法使用第三方下载工具放弃使用apt-fast" echo "UOS中系统依赖无法使用第三方下载工具使用apt-fast下载本体"
cd /var/cache/apt/archives
for PKG_NAME in $PKG_LIST;
do
echo "$PKG_NAME 正在下载..."
sudo /usr/local/bin/ss-apt-fast download "$PKG_NAME" -y >/dev/null 2>&1;
done
echo "----开始安装"
for PKG_NAME in $PKG_LIST; for PKG_NAME in $PKG_LIST;
do do
echo "$PKG_NAME 正在准备更新..." echo "$PKG_NAME 正在准备更新..."
@@ -23,6 +31,8 @@ echo "UOS中系统依赖无法使用第三方下载工具放弃使用apt-fast
fi fi
done done
else ###这是确定是否为UOS else ###这是确定是否为UOS
for PKG_NAME in $PKG_LIST; for PKG_NAME in $PKG_LIST;