Skip to content

Commit

Permalink
feat: include Pre-release when checking update
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Aug 27, 2022
1 parent b48583a commit 7330692
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 213 deletions.
153 changes: 87 additions & 66 deletions go/gen/libcore.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions go/gen/libcore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ enum UpdateAction {

message UpdateReq {
UpdateAction action = 1;
bool check_pre_release = 2;
}

message UpdateResp {
Expand All @@ -89,6 +90,7 @@ message UpdateResp {
string download_url = 3;
string release_url = 4;
string release_note = 5;
bool is_pre_release = 6;
}

message ListV2rayConnectionsResp {
Expand Down
4 changes: 1 addition & 3 deletions go/gen/libcore_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion go/grpc_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp
return ret, nil // No update
}
if strings.Contains(asset.Name, search) {
if release.Prerelease {
if release.Prerelease && !in.CheckPreRelease {
continue
}
update_download_url = asset.BrowserDownloadUrl
ret.AssetsName = asset.Name
ret.DownloadUrl = asset.BrowserDownloadUrl
ret.ReleaseUrl = release.HtmlUrl
ret.ReleaseNote = release.Body
ret.IsPreRelease = release.Prerelease
return ret, nil // update
}
}
Expand Down
2 changes: 2 additions & 0 deletions main/GuiUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ inline QMenu *CreateMenu(QWidget *parent, const QList<QString> &texts, const std
#define D_SAVE_INT(a) NekoRay::dataStore->a = ui->a->text().toInt();
#define P_LOAD_COMBO(a) ui->a->setCurrentText(bean->a);
#define P_SAVE_COMBO(a) bean->a = ui->a->currentText();
#define D_LOAD_BOOL(a) ui->a->setChecked(NekoRay::dataStore->a);
#define D_SAVE_BOOL(a) NekoRay::dataStore->a = ui->a->isChecked();

#define D_LOAD_INT_ENABLE(i, e) \
if (NekoRay::dataStore->i > 0) { \
Expand Down
1 change: 1 addition & 0 deletions main/NekoRay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace NekoRay {
_add(new configItem("vpn_impl", &vpn_implementation, itemType::integer));
_add(new configItem("vpn_mtu", &vpn_mtu, itemType::integer));
_add(new configItem("vpn_ipv6", &vpn_ipv6, itemType::boolean));
_add(new configItem("check_include_pre", &check_include_pre, itemType::boolean));
}

void DataStore::UpdateStartedId(int id) {
Expand Down
1 change: 1 addition & 0 deletions main/NekoRay_DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace NekoRay {
QString v2ray_asset_dir = "";
int language = 0;
QString mw_size = "";
bool check_include_pre = false;

// Security
bool insecure_hint = true;
Expand Down
4 changes: 4 additions & 0 deletions translations/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@
<source>Minimize to tray icon on startup</source>
<translation>启动时最小化到托盘图标</translation>
</message>
<message>
<source>Include Pre-release when checking update</source>
<translation>检查更新时包括 Pre-release</translation>
</message>
</context>
<context>
<name>DialogEditGroup</name>
Expand Down
Loading

0 comments on commit 7330692

Please sign in to comment.