diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a3240a..59bef55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -159,6 +159,7 @@ jobs: export CMAKE_PREFIX_PATH=$PWD/qt6/build/lib/cmake mkdir build cd build + curl -fLso srslist.h "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h" cmake -GNinja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_BUILD_TYPE=Debug .. ninja -j2 cd .. @@ -175,6 +176,7 @@ jobs: export OPENSSL_ROOT_DIR=$PWD/openssl mkdir build cd build + curl -fLso srslist.h "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h" cmake -GNinja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_BUILD_TYPE=Debug .. ninja -j2 cd .. @@ -193,6 +195,7 @@ jobs: sudo apt update && sudo apt upgrade -y mkdir build cd build + curl -fLso srslist.h "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h" cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" .. ninja cd .. @@ -203,6 +206,7 @@ jobs: run: | mkdir build cd build + curl -fLso srslist.h "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h" cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_OSX_ARCHITECTURES=${{ matrix.target }} .. ninja cd .. diff --git a/script/deploy_linux64.sh b/script/deploy_linux64.sh index 61785e2..3256fa0 100755 --- a/script/deploy_linux64.sh +++ b/script/deploy_linux64.sh @@ -20,9 +20,6 @@ cp $BUILD/Throne $DEST #### copy Throne.png #### cp ./res/public/Throne.png $DEST -#### download srslist #### -curl -fLso $DEST/srslist "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/list" - cd download-artifact cd *linux-$ARCH tar xvzf artifacts.tgz -C ../../ diff --git a/script/deploy_macos.sh b/script/deploy_macos.sh index 99ca11a..03805dc 100755 --- a/script/deploy_macos.sh +++ b/script/deploy_macos.sh @@ -20,9 +20,6 @@ cd ../.. mv deployment/macos-$ARCH/* $BUILD/Throne.app/Contents/MacOS -#### download srslist #### -curl -fLso $BUILD/Throne.app/Contents/MacOS/srslist "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/list" - #### deploy qt & DLL runtime => .app #### pushd $BUILD macdeployqt Throne.app -verbose=3 diff --git a/script/deploy_windows.sh b/script/deploy_windows.sh index 6444570..554cb41 100755 --- a/script/deploy_windows.sh +++ b/script/deploy_windows.sh @@ -28,9 +28,6 @@ cd .. rm tmp.exe mv Throne.pdb $DEST -#### download srslist #### -curl -fLso $DEST/srslist "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/list" - #### copy exe #### cp $BUILD/Throne.exe $DEST diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 23ac6c0..47d5b47 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -57,6 +57,8 @@ #include "include/sys/macos/MacOS.h" +#include + void UI_InitMainWindow() { mainwindow = new MainWindow; } @@ -426,36 +428,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi } }); - auto srslist = QFile(QApplication::applicationDirPath() + "/srslist"); - if (srslist.exists()) { - if (srslist.open(QIODevice::ReadOnly)) { - QByteArray byteArray = srslist.readAll(); - srslist.close(); - std::vector srsvec; - srsvec.assign(byteArray.begin(), byteArray.end()); - ruleSetMap = spb::pb::deserialize(srsvec).items; - } - } else { - auto getRuleSet = [=,this] - { - QString err; - for(int retry = 0; retry < 5; retry++) { - auto resp = NetworkRequestHelper::HttpGet(Configs::get_jsdelivr_link("https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/list")); - if (resp.error.isEmpty()) { - std::vector respvec; - respvec.assign(resp.data.begin(), resp.data.end()); - auto reply = spb::pb::deserialize(respvec); - ruleSetMap = reply.items; - return; - } - else - err = resp.error; - QThread::sleep(30); - } - MW_show_log(QObject::tr("Requesting rule-set list error: %1").arg(err)); - }; - runOnNewThread(getRuleSet); - } + std::vector srsvec(std::begin(srslist), std::end(srslist)); + ruleSetMap = spb::pb::deserialize(srsvec).items; auto getRemoteRouteProfiles = [=,this] {