mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
!44 多线程下载前验证源的有效性
* readme: 修正 ubuntu 的编译说明 * download: 检查软件源的有效性/异步 * download: 检查软件源的有效性
This commit is contained in:
@@ -106,13 +106,19 @@ DownloadController::DownloadController(QObject *parent)
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.at(i).contains("镜像源 Download only") && i + 1 < list.size()) {
|
||||
for (int j = i + 1; j < list.size(); j++) {
|
||||
domains.append(list.at(j));
|
||||
system("curl -I -s --connect-timeout 5 " + list.at(j).toUtf8()
|
||||
+ "/dcs-repo.gpg-key.asc -w %{http_code} |tail -n1 > /tmp/spark-store/cdnStatus.txt");
|
||||
QFile cdnStatus("/tmp/spark-store/cdnStatus.txt");
|
||||
if(cdnStatus.open(QFile::ReadOnly) && QString(cdnStatus.readAll()).toUtf8()=="200"){
|
||||
qDebug() << list.at(j);
|
||||
domains.append(list.at(j));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
qDebug() << domains.size();
|
||||
qDebug() << domains << domains.size();
|
||||
|
||||
/*
|
||||
domains = {
|
||||
|
||||
@@ -46,7 +46,12 @@ Widget::Widget(DBlurEffectWidget *parent) :
|
||||
manager = new QNetworkAccessManager(this); // 下载管理
|
||||
|
||||
httpClient = new AeaQt::HttpClient;
|
||||
downloadController = new DownloadController(this); // 并发下载
|
||||
|
||||
QtConcurrent::run([=]()
|
||||
{
|
||||
downloadController = new DownloadController(this); // 并发下载
|
||||
});
|
||||
|
||||
|
||||
connect(ui->menu_main, &QPushButton::clicked, this, [=](){Widget::chooseLeftMenu(0);});
|
||||
connect(ui->menu_network, &QPushButton::clicked, this, [=](){Widget::chooseLeftMenu(1);});
|
||||
|
||||
Reference in New Issue
Block a user