diff --git a/.github/sync.py b/.github/sync.py index 514138b..07292d6 100644 --- a/.github/sync.py +++ b/.github/sync.py @@ -97,6 +97,12 @@ def sync_to_gitee(tag: str, body: str, files: slice): f"Request failed with status code {release_api_response.status_code}") print(f"Gitee release id: {release_id}") + + # 仅保留最新 Release 以防超出 Gitee 仓库配额 + try: + delete_gitee_releases(release_id, api_client, + release_api_uri, access_token) + asset_api_uri = f"{release_api_uri}/{release_id}/attach_files" for file_path in files: @@ -119,10 +125,6 @@ def sync_to_gitee(tag: str, body: str, files: slice): print( f"Request failed with status code {asset_api_response.status_code}") - # 仅保留最新 Release 以防超出 Gitee 仓库配额 - try: - delete_gitee_releases(release_id, api_client, - release_api_uri, access_token) except ValueError as e: print(e) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e01a2c2..df2ebb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: - uses: robinraju/release-downloader@v1 with: repository: nezhahq/user-frontend - tag: v1.0.12 + tag: v1.1.0 fileName: dist.zip latest: true extract: true diff --git a/proto/nezha.pb.go b/proto/nezha.pb.go index 63c3987..efc1411 100644 --- a/proto/nezha.pb.go +++ b/proto/nezha.pb.go @@ -566,7 +566,7 @@ func (x *Receipt) GetProced() bool { return false } -type Unit64Receipt struct { +type Uint64Receipt struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -574,8 +574,8 @@ type Unit64Receipt struct { Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"` } -func (x *Unit64Receipt) Reset() { - *x = Unit64Receipt{} +func (x *Uint64Receipt) Reset() { + *x = Uint64Receipt{} if protoimpl.UnsafeEnabled { mi := &file_proto_nezha_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -583,13 +583,13 @@ func (x *Unit64Receipt) Reset() { } } -func (x *Unit64Receipt) String() string { +func (x *Uint64Receipt) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Unit64Receipt) ProtoMessage() {} +func (*Uint64Receipt) ProtoMessage() {} -func (x *Unit64Receipt) ProtoReflect() protoreflect.Message { +func (x *Uint64Receipt) ProtoReflect() protoreflect.Message { mi := &file_proto_nezha_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -601,12 +601,12 @@ func (x *Unit64Receipt) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Unit64Receipt.ProtoReflect.Descriptor instead. -func (*Unit64Receipt) Descriptor() ([]byte, []int) { +// Deprecated: Use Uint64Receipt.ProtoReflect.Descriptor instead. +func (*Uint64Receipt) Descriptor() ([]byte, []int) { return file_proto_nezha_proto_rawDescGZIP(), []int{6} } -func (x *Unit64Receipt) GetData() uint64 { +func (x *Uint64Receipt) GetData() uint64 { if x != nil { return x.Data } @@ -856,7 +856,7 @@ var file_proto_nezha_proto_rawDesc = []byte{ 0x66, 0x75, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x66, 0x75, 0x6c, 0x22, 0x21, 0x0a, 0x07, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x22, 0x23, 0x0a, 0x0d, 0x55, 0x6e, 0x69, 0x74, + 0x52, 0x06, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x22, 0x23, 0x0a, 0x0d, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x22, 0x0a, 0x0c, 0x49, 0x4f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, @@ -890,7 +890,7 @@ var file_proto_nezha_proto_rawDesc = []byte{ 0x6f, 0x49, 0x50, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x32, 0x12, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x55, 0x6e, 0x69, 0x74, 0x36, 0x34, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00, 0x42, + 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -915,7 +915,7 @@ var file_proto_nezha_proto_goTypes = []any{ (*Task)(nil), // 3: proto.Task (*TaskResult)(nil), // 4: proto.TaskResult (*Receipt)(nil), // 5: proto.Receipt - (*Unit64Receipt)(nil), // 6: proto.Unit64Receipt + (*Uint64Receipt)(nil), // 6: proto.Uint64Receipt (*IOStreamData)(nil), // 7: proto.IOStreamData (*GeoIP)(nil), // 8: proto.GeoIP (*IP)(nil), // 9: proto.IP @@ -934,7 +934,7 @@ var file_proto_nezha_proto_depIdxs = []int32{ 3, // 10: proto.NezhaService.RequestTask:output_type -> proto.Task 7, // 11: proto.NezhaService.IOStream:output_type -> proto.IOStreamData 8, // 12: proto.NezhaService.ReportGeoIP:output_type -> proto.GeoIP - 6, // 13: proto.NezhaService.ReportSystemInfo2:output_type -> proto.Unit64Receipt + 6, // 13: proto.NezhaService.ReportSystemInfo2:output_type -> proto.Uint64Receipt 8, // [8:14] is the sub-list for method output_type 2, // [2:8] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name @@ -1021,7 +1021,7 @@ func file_proto_nezha_proto_init() { } } file_proto_nezha_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*Unit64Receipt); i { + switch v := v.(*Uint64Receipt); i { case 0: return &v.state case 1: diff --git a/proto/nezha.proto b/proto/nezha.proto index 8401bc1..ad0cbf4 100644 --- a/proto/nezha.proto +++ b/proto/nezha.proto @@ -9,7 +9,7 @@ service NezhaService { rpc RequestTask(stream TaskResult) returns (stream Task) {} rpc IOStream(stream IOStreamData) returns (stream IOStreamData) {} rpc ReportGeoIP(GeoIP) returns (GeoIP) {} - rpc ReportSystemInfo2(Host) returns (Unit64Receipt) {} + rpc ReportSystemInfo2(Host) returns (Uint64Receipt) {} } message Host { @@ -67,7 +67,7 @@ message TaskResult { message Receipt { bool proced = 1; } -message Unit64Receipt { uint64 data = 1; } +message Uint64Receipt { uint64 data = 1; } message IOStreamData { bytes data = 1; } diff --git a/proto/nezha_grpc.pb.go b/proto/nezha_grpc.pb.go index bda7c77..4007588 100644 --- a/proto/nezha_grpc.pb.go +++ b/proto/nezha_grpc.pb.go @@ -36,7 +36,7 @@ type NezhaServiceClient interface { RequestTask(ctx context.Context, opts ...grpc.CallOption) (NezhaService_RequestTaskClient, error) IOStream(ctx context.Context, opts ...grpc.CallOption) (NezhaService_IOStreamClient, error) ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, error) - ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Unit64Receipt, error) + ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) } type nezhaServiceClient struct { @@ -158,8 +158,8 @@ func (c *nezhaServiceClient) ReportGeoIP(ctx context.Context, in *GeoIP, opts .. return out, nil } -func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Unit64Receipt, error) { - out := new(Unit64Receipt) +func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) { + out := new(Uint64Receipt) err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -176,7 +176,7 @@ type NezhaServiceServer interface { RequestTask(NezhaService_RequestTaskServer) error IOStream(NezhaService_IOStreamServer) error ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) - ReportSystemInfo2(context.Context, *Host) (*Unit64Receipt, error) + ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error) } // UnimplementedNezhaServiceServer should be embedded to have forward compatible implementations. @@ -198,7 +198,7 @@ func (UnimplementedNezhaServiceServer) IOStream(NezhaService_IOStreamServer) err func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportGeoIP not implemented") } -func (UnimplementedNezhaServiceServer) ReportSystemInfo2(context.Context, *Host) (*Unit64Receipt, error) { +func (UnimplementedNezhaServiceServer) ReportSystemInfo2(context.Context, *Host) (*Uint64Receipt, error) { return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo2 not implemented") } diff --git a/service/rpc/nezha.go b/service/rpc/nezha.go index 17c5749..5c98fcb 100644 --- a/service/rpc/nezha.go +++ b/service/rpc/nezha.go @@ -145,9 +145,9 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece return &pb.Receipt{Proced: true}, nil } -func (s *NezhaHandler) ReportSystemInfo2(c context.Context, r *pb.Host) (*pb.Unit64Receipt, error) { +func (s *NezhaHandler) ReportSystemInfo2(c context.Context, r *pb.Host) (*pb.Uint64Receipt, error) { s.onReportSystemInfo(c, r) - return &pb.Unit64Receipt{Data: singleton.DashboardBootTime}, nil + return &pb.Uint64Receipt{Data: singleton.DashboardBootTime}, nil } func (s *NezhaHandler) IOStream(stream pb.NezhaService_IOStreamServer) error {