diff --git a/src/backend/sparkapi.cpp b/src/backend/sparkapi.cpp
index b7ce22a..eb30947 100644
--- a/src/backend/sparkapi.cpp
+++ b/src/backend/sparkapi.cpp
@@ -5,6 +5,11 @@
#include <QDebug>
QString SparkAPI::serverUrl = "";
+#ifdef __x86_64__
+ QString SparkAPI::serverUrlDir = "store";
+#elif __aarch64__
+ QString SparkAPI::serverUrlDir = "aarch64-store";
+#endif
SparkAPI::SparkAPI(QObject *parent) : QObject(parent)
{
@@ -54,7 +59,7 @@ void SparkAPI::getRAW(QUrl url)
void SparkAPI::getAppList(QString type)
{
- get(QUrl(getServerUrl() + "aarch64-store/" + type + "/applist.json"));
+ get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + "/" + type + "/applist.json"));
}
void SparkAPI::getSearchList(QString keyword)
@@ -64,12 +69,17 @@ void SparkAPI::getSearchList(QString keyword)
void SparkAPI::getAppInfo(QUrl spk)
{
- get(QUrl(getServerUrl() + "aarch64-store" + spk.path().replace("+", "%2B") + "/app.json"));
+ get(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/app.json"));
+}
+
+QString SparkAPI::getArchDir()
+{
+ return SparkAPI::serverUrlDir;
}
void SparkAPI::getAppDownloadTimes(QUrl spk)
{
- getRAW(QUrl(getServerUrl() + "aarch64-store" + spk.path().replace("+", "%2B") + "/download-times.txt"));
+ getRAW(QUrl(getServerUrl() + SparkAPI::serverUrlDir + spk.path().replace("+", "%2B") + "/download-times.txt"));
}
QString SparkAPI::getServerUrl()
diff --git a/src/backend/sparkapi.h b/src/backend/sparkapi.h
index 56451b2..e27e4c3 100644
--- a/src/backend/sparkapi.h
+++ b/src/backend/sparkapi.h
@@ -25,6 +25,7 @@ public:
void getRAW(QUrl url);
void getAppList(QString type);
void getAppInfo(QUrl spk);
+ QString getArchDir();
signals:
void finished(QJsonArray);
@@ -33,6 +34,7 @@ signals:
private:
static QString serverUrl;
+ static QString serverUrlDir;
};
#endif // SPARKAPI_H
diff --git a/src/pages/applistpage.cpp b/src/pages/applistpage.cpp
index 800da41..3e0ee4e 100644
--- a/src/pages/applistpage.cpp
+++ b/src/pages/applistpage.cpp
@@ -1,6 +1,8 @@
#include "applistpage.h"
#include "ui_applistpage.h"
+
+
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
ui(new Ui::AppListPage)
{
@@ -37,19 +39,31 @@ void AppListPage::getAppList(QString type)
QString theme;
if (isDark)
{
+ theme = "theme=dark";
+ #ifdef __aarch64__
theme = "dark";
+ #endif
}
else
{
+ theme = "theme=light";
+ #ifdef __aarch64__
theme = "";
+ #endif
}
if (type == "")
{
+ url = api->getServerUrl() + "store/#/flamescion/?" + theme;
+ #ifdef __aarch64__
url = api->getServerUrl() + "aarch64-store/#/"+ theme;
+ #endif
}
else
{
+ url = api->getServerUrl() + "store/#/flamescion/applist?type=" + type + "&" + theme;
+ #ifdef __aarch64__
url = api->getServerUrl() + "aarch64-store/#/"+ theme + type;
+ #endif
}
ui->webEngineView->setUrl(url);
@@ -83,14 +97,16 @@ AppListPage::~AppListPage()
void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1)
{
+ SparkAPI *api = new SparkAPI(this);
if (arg1.path().right(8) == "app.json")
{
QString url = arg1.toString();
- url = url.mid(url.indexOf("/aarch64-store/"));
+ url = url.mid(url.indexOf("/" + api->getArchDir() + "/"));
url = "spk:/" + url;
url = url.mid(0, url.indexOf("/app.json"));
qDebug() << "程序跳转链接地址:" << url;
ui->webEngineView->back();
emit clicked(url);
}
+ delete api;
}