add option to allow beta updates

This commit is contained in:
Nova 2025-08-15 13:39:59 +03:30
parent a897b75ef5
commit 0af30d53a2
5 changed files with 12 additions and 0 deletions

View File

@ -86,6 +86,7 @@ namespace Configs {
int stats_tab = 0; // either connection or log
int speed_test_mode = TestConfig::FULL;
QString simple_dl_url = "http://cachefly.cachefly.net/1mb.test";
bool allow_beta_update = false;
// Subscription
QString user_agent = ""; // set at main.cpp

View File

@ -208,6 +208,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="allow_beta">
<property name="text">
<string>Allow updating to beta versions</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -314,6 +314,7 @@ namespace Configs {
_add(new configItem("enable_tun_routing", &enable_tun_routing, itemType::boolean));
_add(new configItem("speed_test_mode", &speed_test_mode, itemType::integer));
_add(new configItem("use_mozilla_certs", &use_mozilla_certs, itemType::boolean));
_add(new configItem("allow_beta_update", &allow_beta_update, itemType::boolean));
}
void DataStore::UpdateStartedId(int id) {

View File

@ -2469,6 +2469,7 @@ void MainWindow::CheckUpdate() {
QJsonArray array = QString2QJsonArray(resp.data);
for (const QJsonValue value : array) {
QJsonObject release = value.toObject();
if (release["prerelease"].toBool() && !Configs::dataStore->allow_beta_update) continue;
for (const QJsonValue asset : release["assets"].toArray()) {
if (asset["name"].toString().contains(search) && asset["name"].toString().section('.', -1) == QString("zip")) {
note_pre_release = release["prerelease"].toBool() ? " (Pre-release)" : "";

View File

@ -37,6 +37,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
D_LOAD_BOOL(disable_tray)
ui->speedtest_mode->setCurrentIndex(Configs::dataStore->speed_test_mode);
ui->simple_down_url->setText(Configs::dataStore->simple_dl_url);
ui->allow_beta->setChecked(Configs::dataStore->allow_beta_update);
connect(ui->custom_inbound_edit, &QPushButton::clicked, this, [=,this] {
C_EDIT_JSON_ALLOW_EMPTY(custom_inbound)
@ -201,6 +202,7 @@ void DialogBasicSettings::accept() {
Configs::dataStore->proxy_scheme = ui->proxy_scheme->currentText().toLower();
Configs::dataStore->speed_test_mode = ui->speedtest_mode->currentIndex();
Configs::dataStore->simple_dl_url = ui->simple_down_url->text();
Configs::dataStore->allow_beta_update = ui->allow_beta->isChecked();
// Style