From 73306929d1a6409d0954cd5c61cbcfa64fabe611 Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Sat, 27 Aug 2022 12:25:57 +0800 Subject: [PATCH] feat: include Pre-release when checking update --- go/gen/libcore.pb.go | 153 ++++++++++++--------- go/gen/libcore.proto | 2 + go/gen/libcore_grpc.pb.go | 4 +- go/grpc_update.go | 3 +- main/GuiUtils.hpp | 2 + main/NekoRay.cpp | 1 + main/NekoRay_DataStore.hpp | 1 + translations/zh_CN.ts | 4 + ui/dialog_basic_settings.cpp | 62 ++++----- ui/dialog_basic_settings.ui | 253 ++++++++++++++++++++--------------- ui/mainwindow_grpc.cpp | 6 +- 11 files changed, 278 insertions(+), 213 deletions(-) diff --git a/go/gen/libcore.pb.go b/go/gen/libcore.pb.go index 9dfbd2675..f1460633f 100644 --- a/go/gen/libcore.pb.go +++ b/go/gen/libcore.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.27.1 -// protoc v3.21.4 +// protoc-gen-go v1.28.0 +// protoc v3.21.5 // source: libcore.proto package gen @@ -664,7 +664,8 @@ type UpdateReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=libcore.UpdateAction" json:"action,omitempty"` + Action UpdateAction `protobuf:"varint,1,opt,name=action,proto3,enum=libcore.UpdateAction" json:"action,omitempty"` + CheckPreRelease bool `protobuf:"varint,2,opt,name=check_pre_release,json=checkPreRelease,proto3" json:"check_pre_release,omitempty"` } func (x *UpdateReq) Reset() { @@ -706,16 +707,24 @@ func (x *UpdateReq) GetAction() UpdateAction { return UpdateAction_Check } +func (x *UpdateReq) GetCheckPreRelease() bool { + if x != nil { + return x.CheckPreRelease + } + return false +} + type UpdateResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` - AssetsName string `protobuf:"bytes,2,opt,name=assets_name,json=assetsName,proto3" json:"assets_name,omitempty"` - DownloadUrl string `protobuf:"bytes,3,opt,name=download_url,json=downloadUrl,proto3" json:"download_url,omitempty"` - ReleaseUrl string `protobuf:"bytes,4,opt,name=release_url,json=releaseUrl,proto3" json:"release_url,omitempty"` - ReleaseNote string `protobuf:"bytes,5,opt,name=release_note,json=releaseNote,proto3" json:"release_note,omitempty"` + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` + AssetsName string `protobuf:"bytes,2,opt,name=assets_name,json=assetsName,proto3" json:"assets_name,omitempty"` + DownloadUrl string `protobuf:"bytes,3,opt,name=download_url,json=downloadUrl,proto3" json:"download_url,omitempty"` + ReleaseUrl string `protobuf:"bytes,4,opt,name=release_url,json=releaseUrl,proto3" json:"release_url,omitempty"` + ReleaseNote string `protobuf:"bytes,5,opt,name=release_note,json=releaseNote,proto3" json:"release_note,omitempty"` + IsPreRelease bool `protobuf:"varint,6,opt,name=is_pre_release,json=isPreRelease,proto3" json:"is_pre_release,omitempty"` } func (x *UpdateResp) Reset() { @@ -785,6 +794,13 @@ func (x *UpdateResp) GetReleaseNote() string { return "" } +func (x *UpdateResp) GetIsPreRelease() bool { + if x != nil { + return x.IsPreRelease + } + return false +} + type ListV2RayConnectionsResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -886,67 +902,72 @@ var file_libcore_proto_rawDesc = []byte{ 0x06, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x22, 0x2a, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x72, 0x61, 0x66, - 0x66, 0x69, 0x63, 0x22, 0x3a, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x66, 0x69, 0x63, 0x22, 0x66, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x2d, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xaa, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, - 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x6f, 0x74, 0x65, 0x22, 0x54, 0x0a, 0x18, - 0x4c, 0x69, 0x73, 0x74, 0x56, 0x32, 0x72, 0x61, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x18, 0x6d, 0x61, 0x74, 0x73, - 0x75, 0x72, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, - 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x6d, 0x61, 0x74, 0x73, - 0x75, 0x72, 0x69, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x4a, 0x73, - 0x6f, 0x6e, 0x2a, 0x32, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0b, - 0x0a, 0x07, 0x54, 0x63, 0x70, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x55, - 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x75, 0x6c, 0x6c, - 0x54, 0x65, 0x73, 0x74, 0x10, 0x02, 0x2a, 0x27, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x10, - 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, 0x01, 0x32, - 0x88, 0x04, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, - 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, - 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, - 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x35, - 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x1a, - 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x54, 0x75, 0x6e, 0x12, - 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x54, 0x75, 0x6e, - 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x53, 0x74, 0x6f, - 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x04, 0x54, 0x65, - 0x73, 0x74, 0x12, 0x10, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, - 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x1a, - 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x14, 0x4c, 0x69, - 0x73, 0x74, 0x56, 0x32, 0x72, 0x61, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x2a, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x50, 0x72, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x0a, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, + 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, + 0x64, 0x55, 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, + 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x5f, 0x6e, 0x6f, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x4e, 0x6f, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x69, 0x73, 0x5f, 0x70, + 0x72, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0c, 0x69, 0x73, 0x50, 0x72, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x22, 0x54, + 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x32, 0x72, 0x61, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x18, 0x6d, 0x61, + 0x74, 0x73, 0x75, 0x72, 0x69, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x6d, 0x61, + 0x74, 0x73, 0x75, 0x72, 0x69, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x4a, 0x73, 0x6f, 0x6e, 0x2a, 0x32, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x54, 0x63, 0x70, 0x50, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x55, 0x72, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x75, + 0x6c, 0x6c, 0x54, 0x65, 0x73, 0x74, 0x10, 0x02, 0x2a, 0x27, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x10, + 0x01, 0x32, 0x88, 0x04, 0x0a, 0x0e, 0x4c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x45, 0x78, 0x69, 0x74, 0x12, 0x11, 0x2e, 0x6c, + 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, + 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, + 0x76, 0x65, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, 0x70, + 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x06, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x6c, 0x69, 0x62, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, + 0x12, 0x35, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x72, 0x72, 0x6f, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x06, 0x53, 0x65, 0x74, 0x54, 0x75, + 0x6e, 0x12, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x54, + 0x75, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x04, 0x53, + 0x74, 0x6f, 0x70, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x04, + 0x54, 0x65, 0x73, 0x74, 0x12, 0x10, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x54, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x0a, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x69, 0x62, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x1a, 0x17, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x32, 0x72, 0x61, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x6e, 0x65, - 0x6b, 0x6f, 0x72, 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x67, 0x65, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x11, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x6c, 0x69, 0x62, 0x63, 0x6f, 0x72, + 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x32, 0x72, 0x61, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, + 0x6e, 0x65, 0x6b, 0x6f, 0x72, 0x61, 0x79, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x67, 0x65, 0x6e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go/gen/libcore.proto b/go/gen/libcore.proto index e22f1be82..215562617 100644 --- a/go/gen/libcore.proto +++ b/go/gen/libcore.proto @@ -81,6 +81,7 @@ enum UpdateAction { message UpdateReq { UpdateAction action = 1; + bool check_pre_release = 2; } message UpdateResp { @@ -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 { diff --git a/go/gen/libcore_grpc.pb.go b/go/gen/libcore_grpc.pb.go index 92c3843a6..74a2a6b6a 100644 --- a/go/gen/libcore_grpc.pb.go +++ b/go/gen/libcore_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.4 +// - protoc v3.21.5 // source: libcore.proto package gen @@ -25,7 +25,6 @@ type LibcoreServiceClient interface { Exit(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*EmptyResp, error) KeepAlive(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*EmptyResp, error) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*UpdateResp, error) - // Start(ctx context.Context, in *LoadConfigReq, opts ...grpc.CallOption) (*ErrorResp, error) SetTun(ctx context.Context, in *SetTunReq, opts ...grpc.CallOption) (*ErrorResp, error) Stop(ctx context.Context, in *EmptyReq, opts ...grpc.CallOption) (*ErrorResp, error) @@ -130,7 +129,6 @@ type LibcoreServiceServer interface { Exit(context.Context, *EmptyReq) (*EmptyResp, error) KeepAlive(context.Context, *EmptyReq) (*EmptyResp, error) Update(context.Context, *UpdateReq) (*UpdateResp, error) - // Start(context.Context, *LoadConfigReq) (*ErrorResp, error) SetTun(context.Context, *SetTunReq) (*ErrorResp, error) Stop(context.Context, *EmptyReq) (*ErrorResp, error) diff --git a/go/grpc_update.go b/go/grpc_update.go index f572dabc4..5e23e36d2 100644 --- a/go/grpc_update.go +++ b/go/grpc_update.go @@ -98,7 +98,7 @@ 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 @@ -106,6 +106,7 @@ func (s *server) Update(ctx context.Context, in *gen.UpdateReq) (*gen.UpdateResp ret.DownloadUrl = asset.BrowserDownloadUrl ret.ReleaseUrl = release.HtmlUrl ret.ReleaseNote = release.Body + ret.IsPreRelease = release.Prerelease return ret, nil // update } } diff --git a/main/GuiUtils.hpp b/main/GuiUtils.hpp index d4bc784cc..2f913e487 100644 --- a/main/GuiUtils.hpp +++ b/main/GuiUtils.hpp @@ -64,6 +64,8 @@ inline QMenu *CreateMenu(QWidget *parent, const QList &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) { \ diff --git a/main/NekoRay.cpp b/main/NekoRay.cpp index 0f3e97ea5..b01c3337f 100644 --- a/main/NekoRay.cpp +++ b/main/NekoRay.cpp @@ -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) { diff --git a/main/NekoRay_DataStore.hpp b/main/NekoRay_DataStore.hpp index 7061f2d2a..94ef76453 100644 --- a/main/NekoRay_DataStore.hpp +++ b/main/NekoRay_DataStore.hpp @@ -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; diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 6e3a56da0..593330e12 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -155,6 +155,10 @@ Minimize to tray icon on startup 启动时最小化到托盘图标 + + Include Pre-release when checking update + 检查更新时包括 Pre-release + DialogEditGroup diff --git a/ui/dialog_basic_settings.cpp b/ui/dialog_basic_settings.cpp index 10cc67298..3d9e23f81 100644 --- a/ui/dialog_basic_settings.cpp +++ b/ui/dialog_basic_settings.cpp @@ -56,17 +56,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) ui->socks_ip->setText(NekoRay::dataStore->inbound_address); ui->log_level->setCurrentText(NekoRay::dataStore->log_level); - ui->connection_statistics->setChecked(NekoRay::dataStore->connection_statistics); CACHE.custom_inbound = NekoRay::dataStore->custom_inbound; - - if (NekoRay::dataStore->traffic_loop_interval == 500) { - ui->rfsh_r->setCurrentIndex(0); - } else if (NekoRay::dataStore->traffic_loop_interval == 1000) { - ui->rfsh_r->setCurrentIndex(1); - } else { - ui->rfsh_r->setCurrentIndex(2); - } - D_LOAD_INT(inbound_socks_port) D_LOAD_INT_ENABLE(inbound_http_port, http_enable) D_LOAD_INT_ENABLE(mux_cool, mux_cool_enable) @@ -79,12 +69,24 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) // Style + // + D_LOAD_BOOL(start_minimal) + D_LOAD_BOOL(check_include_pre) + D_LOAD_BOOL(connection_statistics) + // + if (NekoRay::dataStore->traffic_loop_interval == 500) { + ui->rfsh_r->setCurrentIndex(0); + } else if (NekoRay::dataStore->traffic_loop_interval == 1000) { + ui->rfsh_r->setCurrentIndex(1); + } else { + ui->rfsh_r->setCurrentIndex(2); + } + // ui->language->setCurrentIndex(NekoRay::dataStore->language); connect(ui->language, QOverload::of(&QComboBox::currentIndexChanged), this, [=](int index) { CACHE.needRestart = true; }); - ui->start_minimal->setChecked(NekoRay::dataStore->start_minimal); - + // int built_in_len = ui->theme->count(); ui->theme->addItems(QStyleFactory::keys()); // @@ -112,7 +114,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) // Subscription ui->user_agent->setText(NekoRay::dataStore->user_agent); - ui->sub_use_proxy->setChecked(NekoRay::dataStore->sub_use_proxy); + D_LOAD_BOOL(sub_use_proxy) // Core @@ -126,7 +128,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) for (const auto &s: CACHE.extraCore.keys()) { extra_core_layout->addWidget(new ExtraCoreWidget(&CACHE.extraCore, s)); } - + // connect(ui->core_v2ray_asset, &QLineEdit::textChanged, this, [=] { CACHE.needRestart = true; }); @@ -166,8 +168,8 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent) // Security - ui->insecure_hint->setChecked(NekoRay::dataStore->insecure_hint); - ui->skip_cert->setChecked(NekoRay::dataStore->skip_cert); + D_LOAD_BOOL(insecure_hint) + D_LOAD_BOOL(skip_cert) } DialogBasicSettings::~DialogBasicSettings() { @@ -181,17 +183,7 @@ void DialogBasicSettings::accept() { NekoRay::dataStore->inbound_address = ui->socks_ip->text(); NekoRay::dataStore->log_level = ui->log_level->currentText(); - NekoRay::dataStore->connection_statistics = ui->connection_statistics->isChecked(); NekoRay::dataStore->custom_inbound = CACHE.custom_inbound; - - if (ui->rfsh_r->currentIndex() == 0) { - NekoRay::dataStore->traffic_loop_interval = 500; - } else if (ui->rfsh_r->currentIndex() == 1) { - NekoRay::dataStore->traffic_loop_interval = 1000; - } else { - NekoRay::dataStore->traffic_loop_interval = 0; - } - D_SAVE_INT(inbound_socks_port) D_SAVE_INT_ENABLE(inbound_http_port, http_enable) D_SAVE_INT_ENABLE(mux_cool, mux_cool_enable) @@ -201,12 +193,22 @@ void DialogBasicSettings::accept() { // Style NekoRay::dataStore->language = ui->language->currentIndex(); - NekoRay::dataStore->start_minimal = ui->start_minimal->isChecked(); + D_SAVE_BOOL(start_minimal) + D_SAVE_BOOL(connection_statistics) + D_SAVE_BOOL(check_include_pre) + + if (ui->rfsh_r->currentIndex() == 0) { + NekoRay::dataStore->traffic_loop_interval = 500; + } else if (ui->rfsh_r->currentIndex() == 1) { + NekoRay::dataStore->traffic_loop_interval = 1000; + } else { + NekoRay::dataStore->traffic_loop_interval = 0; + } // Subscription NekoRay::dataStore->user_agent = ui->user_agent->text(); - NekoRay::dataStore->sub_use_proxy = ui->sub_use_proxy->isChecked(); + D_SAVE_BOOL(sub_use_proxy) // Core @@ -215,8 +217,8 @@ void DialogBasicSettings::accept() { // Security - NekoRay::dataStore->insecure_hint = ui->insecure_hint->isChecked(); - NekoRay::dataStore->skip_cert = ui->skip_cert->isChecked(); + D_SAVE_BOOL(insecure_hint) + D_SAVE_BOOL(skip_cert) dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore"); QDialog::accept(); diff --git a/ui/dialog_basic_settings.ui b/ui/dialog_basic_settings.ui index 25ee2f676..0193aa0e6 100644 --- a/ui/dialog_basic_settings.ui +++ b/ui/dialog_basic_settings.ui @@ -221,6 +221,88 @@ + + + + + + Include Pre-release when checking update + + + + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + Style + + + + + + + + + + 0 + 0 + + + + Language + + + + + + + + System + + + + + English + + + + + 简体中文 + + + + + + + + @@ -276,124 +358,65 @@ - - - - - 0 - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - Style - - - - - - - - 0 - 0 - - - - Theme - - - - - - - - System - - - - - flatgray - - - - - lightblue + + + + + + + 0 + 0 + - - - blacksoft + Theme - - - - + + + + + + + System + + + + + flatgray + + + + + lightblue + + + + + blacksoft + + + + + + - - - - - - - 0 - 0 - - - - Language - - - - - - - - System - - - - - English - - - + + + + + - 简体中文 + Minimize to tray icon on startup - - - - - - - - - Minimize to tray icon on startup - + + + - + Subscription @@ -417,13 +440,19 @@ - + Core + + + 0 + 0 + + V2Ray @@ -505,7 +534,7 @@ - + Security @@ -549,10 +578,12 @@ log_level mux_cool_enable mux_cool - rfsh_r - connection_statistics + check_include_pre theme language + rfsh_r + connection_statistics + start_minimal user_agent sub_use_proxy core_v2ray_asset diff --git a/ui/mainwindow_grpc.cpp b/ui/mainwindow_grpc.cpp index 3314d2eef..345d72c3e 100644 --- a/ui/mainwindow_grpc.cpp +++ b/ui/mainwindow_grpc.cpp @@ -302,6 +302,7 @@ void MainWindow::CheckUpdate() { bool ok; libcore::UpdateReq request; request.set_action(libcore::UpdateAction::Check); + request.set_check_pre_release(NekoRay::dataStore->check_include_pre); auto response = NekoRay::rpc::defaultClient->Update(&ok, request); if (!ok) return; @@ -321,10 +322,11 @@ void MainWindow::CheckUpdate() { } runOnUiThread([=] { - QMessageBox box(QMessageBox::Question, QObject::tr("Update"), + auto note_pre_release = response.is_pre_release() ? " (Pre-release)" : ""; + QMessageBox box(QMessageBox::Question, QObject::tr("Update") + note_pre_release, QObject::tr("Update found: %1\nRelease note:\n%2") .arg(response.assets_name().c_str(), response.release_note().c_str())); - QAbstractButton *btn1; + QAbstractButton *btn1 = nullptr; if (!NekoRay::dataStore->flag_use_appdata) { btn1 = box.addButton(QObject::tr("Update"), QMessageBox::AcceptRole); }