mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-16 10:32:21 +08:00
fix: 校验 serverlist 有效性
This commit is contained in:
parent
30b65350ca
commit
e344b16aa0
@ -9,6 +9,7 @@
|
||||
|
||||
#define TMP_PATH "/tmp/spark-store"
|
||||
#define DEFAULT_SERVER_URL "https://cdn.d.store.deepinos.org.cn/"
|
||||
#define DEFAULT_CHECK_DOMAIN "deepinos"
|
||||
|
||||
bool SettingsPage::isdownload = false;
|
||||
|
||||
@ -55,7 +56,11 @@ void SettingsPage::readServerList()
|
||||
|
||||
// 创建 QTextStream 对象
|
||||
QTextStream textStream(&file);
|
||||
|
||||
if (!textStream.readAll().contains(DEFAULT_CHECK_DOMAIN)) // 校验配置文件有效性
|
||||
{
|
||||
return;
|
||||
}
|
||||
textStream.seek(0); // 回到开头
|
||||
QString lineData = textStream.readLine(); // 读取文件的第一行
|
||||
ui->comboBox_server->addItem(lineData);
|
||||
while (!lineData.isNull())
|
||||
@ -106,11 +111,23 @@ void SettingsPage::on_pushButton_updateServer_clicked()
|
||||
QtConcurrent::run([=]()
|
||||
{
|
||||
ui->pushButton_updateServer->setEnabled(false);
|
||||
ui->comboBox_server->clear();
|
||||
|
||||
|
||||
QFile::remove(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list");
|
||||
system("curl -o " + QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toUtf8() + "/server.list https://d.store.deepinos.org.cn/store/server-and-mirror.list");
|
||||
|
||||
auto updateSuccess = system("curl -o " + QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toUtf8() + "/server.list https://d.store.deepinos.org.cn/store/server-and-mirror.list");
|
||||
qDebug() << "Update serverlist status:" << updateSuccess;
|
||||
if (updateSuccess != 0) // 更新失败不换服务器配置
|
||||
{
|
||||
QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/server.list");
|
||||
if (file.exists())
|
||||
{
|
||||
file.remove();
|
||||
}
|
||||
// FIXME: 向用户提示更新失败
|
||||
ui->pushButton_updateServer->setEnabled(true);
|
||||
return;
|
||||
}
|
||||
ui->comboBox_server->clear();
|
||||
ui->pushButton_updateServer->setEnabled(true);
|
||||
readServerList();
|
||||
ui->comboBox_server->setCurrentIndex(0); });
|
||||
|
@ -441,32 +441,32 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="44"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<source>Submit App</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<source>Submit App with client(Recommanded)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="48"/>
|
||||
<source>APP Upgrade and Install Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="160"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="162"/>
|
||||
<source>Search or enter spk://</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -476,7 +476,7 @@
|
||||
<message>
|
||||
<location filename="../src/application.cpp" line="26"/>
|
||||
<location filename="../src/application.cpp" line="27"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="21"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="22"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -584,17 +584,17 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="196"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="213"/>
|
||||
<source>Updating, please wait...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Temporary cache was cleaned</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -441,32 +441,32 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="44"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<source>Submit App</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<source>Submit App with client(Recommanded)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="48"/>
|
||||
<source>APP Upgrade and Install Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="160"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="162"/>
|
||||
<source>Search or enter spk://</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -476,7 +476,7 @@
|
||||
<message>
|
||||
<location filename="../src/application.cpp" line="26"/>
|
||||
<location filename="../src/application.cpp" line="27"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="21"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="22"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -584,17 +584,17 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="196"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="213"/>
|
||||
<source>Updating, please wait...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Spark Store</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Temporary cache was cleaned</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -441,32 +441,32 @@
|
||||
<translation>更新</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="44"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<source>Submit App</source>
|
||||
<translation>投递应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="45"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<source>Submit App with client(Recommanded)</source>
|
||||
<translation>使用本地投稿器投递应用(推荐)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="46"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<source>Settings</source>
|
||||
<translation>设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="47"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="48"/>
|
||||
<source>APP Upgrade and Install Settings</source>
|
||||
<translation>应用更新和安装设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="160"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<source>Spark Store</source>
|
||||
<translation>星火应用商店</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="161"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="162"/>
|
||||
<source>Search or enter spk://</source>
|
||||
<translation>搜索或打开链接</translation>
|
||||
</message>
|
||||
@ -476,7 +476,7 @@
|
||||
<message>
|
||||
<location filename="../src/application.cpp" line="26"/>
|
||||
<location filename="../src/application.cpp" line="27"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="21"/>
|
||||
<location filename="../src/mainwindow-dtk.cpp" line="22"/>
|
||||
<source>Spark Store</source>
|
||||
<translation>星火应用商店</translation>
|
||||
</message>
|
||||
@ -584,17 +584,17 @@
|
||||
<translation><html><head/><body><p>我们并<span style=" font-weight:600;">不是</span>官方团队,和你一样,我们也只是众多Linux/deepin系统爱好者和用户之中的一员,我们开发并且运营这个“Spark应用商店”,是为了让社区的朋友们一起分享好用的软件,或者一起参与开发,让大家都用到最新的,最优秀的软件。</p><p>我们并没有因此盈利,所有开发和维护人员都不会获得报酬,我们的主要支出大部分依赖于社区对我们的捐助,很感谢大家,这部分捐助让我们并不需要耗费太多精力去担心资金问题。</p><p>我们的服务和开发的软件都是免费供给大家使用,交流,学习的,但是在您的使用过程中一定要遵守当地的法律法规,否则出现任何问题和我们无关。</p><p>如果商店中任何一部分有侵犯您权益的行为,请告知我们 &lt;jifengshenmo@outlook.com&gt; ,我们会第一时间删除侵权内容。</p><p>如果你也想参与我们,不管是参与开发,设计,投递还是投稿作品,我们都欢迎你的加入。</p><p>在 Spark IM 联系我们:<a href="https://chat.shenmo.tech"><span style=" text-decoration: underline; color:#0000ff;">https://chat.shenmo.tech<br/></span></a>QQ 群:872690351</p></body></html></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="196"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="213"/>
|
||||
<source>Updating, please wait...</source>
|
||||
<translation>正在更新,请稍候……</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Spark Store</source>
|
||||
<translation>星火应用商店</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/pages/settingspage.cpp" line="218"/>
|
||||
<location filename="../src/pages/settingspage.cpp" line="235"/>
|
||||
<source>Temporary cache was cleaned</source>
|
||||
<translation>缓存目录已清空</translation>
|
||||
</message>
|
||||
|
Loading…
x
Reference in New Issue
Block a user