feat: upgrade frontend

This commit is contained in:
naiba 2024-12-07 12:19:48 +08:00
parent 5b5e006b97
commit fb387060a2
6 changed files with 30 additions and 28 deletions

10
.github/sync.py vendored
View File

@ -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}") f"Request failed with status code {release_api_response.status_code}")
print(f"Gitee release id: {release_id}") 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" asset_api_uri = f"{release_api_uri}/{release_id}/attach_files"
for file_path in files: for file_path in files:
@ -119,10 +125,6 @@ def sync_to_gitee(tag: str, body: str, files: slice):
print( print(
f"Request failed with status code {asset_api_response.status_code}") 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: except ValueError as e:
print(e) print(e)

View File

@ -48,7 +48,7 @@ jobs:
- uses: robinraju/release-downloader@v1 - uses: robinraju/release-downloader@v1
with: with:
repository: nezhahq/user-frontend repository: nezhahq/user-frontend
tag: v1.0.12 tag: v1.1.0
fileName: dist.zip fileName: dist.zip
latest: true latest: true
extract: true extract: true

View File

@ -566,7 +566,7 @@ func (x *Receipt) GetProced() bool {
return false return false
} }
type Unit64Receipt struct { type Uint64Receipt struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -574,8 +574,8 @@ type Unit64Receipt struct {
Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"` Data uint64 `protobuf:"varint,1,opt,name=data,proto3" json:"data,omitempty"`
} }
func (x *Unit64Receipt) Reset() { func (x *Uint64Receipt) Reset() {
*x = Unit64Receipt{} *x = Uint64Receipt{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_proto_nezha_proto_msgTypes[6] mi := &file_proto_nezha_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 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) 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] mi := &file_proto_nezha_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -601,12 +601,12 @@ func (x *Unit64Receipt) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use Unit64Receipt.ProtoReflect.Descriptor instead. // Deprecated: Use Uint64Receipt.ProtoReflect.Descriptor instead.
func (*Unit64Receipt) Descriptor() ([]byte, []int) { func (*Uint64Receipt) Descriptor() ([]byte, []int) {
return file_proto_nezha_proto_rawDescGZIP(), []int{6} return file_proto_nezha_proto_rawDescGZIP(), []int{6}
} }
func (x *Unit64Receipt) GetData() uint64 { func (x *Uint64Receipt) GetData() uint64 {
if x != nil { if x != nil {
return x.Data 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33, 0x6f, 0x33,
} }
@ -915,7 +915,7 @@ var file_proto_nezha_proto_goTypes = []any{
(*Task)(nil), // 3: proto.Task (*Task)(nil), // 3: proto.Task
(*TaskResult)(nil), // 4: proto.TaskResult (*TaskResult)(nil), // 4: proto.TaskResult
(*Receipt)(nil), // 5: proto.Receipt (*Receipt)(nil), // 5: proto.Receipt
(*Unit64Receipt)(nil), // 6: proto.Unit64Receipt (*Uint64Receipt)(nil), // 6: proto.Uint64Receipt
(*IOStreamData)(nil), // 7: proto.IOStreamData (*IOStreamData)(nil), // 7: proto.IOStreamData
(*GeoIP)(nil), // 8: proto.GeoIP (*GeoIP)(nil), // 8: proto.GeoIP
(*IP)(nil), // 9: proto.IP (*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 3, // 10: proto.NezhaService.RequestTask:output_type -> proto.Task
7, // 11: proto.NezhaService.IOStream:output_type -> proto.IOStreamData 7, // 11: proto.NezhaService.IOStream:output_type -> proto.IOStreamData
8, // 12: proto.NezhaService.ReportGeoIP:output_type -> proto.GeoIP 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 8, // [8:14] is the sub-list for method output_type
2, // [2:8] is the sub-list for method input_type 2, // [2:8] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name 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 { 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: case 0:
return &v.state return &v.state
case 1: case 1:

View File

@ -9,7 +9,7 @@ service NezhaService {
rpc RequestTask(stream TaskResult) returns (stream Task) {} rpc RequestTask(stream TaskResult) returns (stream Task) {}
rpc IOStream(stream IOStreamData) returns (stream IOStreamData) {} rpc IOStream(stream IOStreamData) returns (stream IOStreamData) {}
rpc ReportGeoIP(GeoIP) returns (GeoIP) {} rpc ReportGeoIP(GeoIP) returns (GeoIP) {}
rpc ReportSystemInfo2(Host) returns (Unit64Receipt) {} rpc ReportSystemInfo2(Host) returns (Uint64Receipt) {}
} }
message Host { message Host {
@ -67,7 +67,7 @@ message TaskResult {
message Receipt { bool proced = 1; } message Receipt { bool proced = 1; }
message Unit64Receipt { uint64 data = 1; } message Uint64Receipt { uint64 data = 1; }
message IOStreamData { bytes data = 1; } message IOStreamData { bytes data = 1; }

View File

@ -36,7 +36,7 @@ type NezhaServiceClient interface {
RequestTask(ctx context.Context, opts ...grpc.CallOption) (NezhaService_RequestTaskClient, error) RequestTask(ctx context.Context, opts ...grpc.CallOption) (NezhaService_RequestTaskClient, error)
IOStream(ctx context.Context, opts ...grpc.CallOption) (NezhaService_IOStreamClient, error) IOStream(ctx context.Context, opts ...grpc.CallOption) (NezhaService_IOStreamClient, error)
ReportGeoIP(ctx context.Context, in *GeoIP, opts ...grpc.CallOption) (*GeoIP, 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 { type nezhaServiceClient struct {
@ -158,8 +158,8 @@ func (c *nezhaServiceClient) ReportGeoIP(ctx context.Context, in *GeoIP, opts ..
return out, nil return out, nil
} }
func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Unit64Receipt, error) { func (c *nezhaServiceClient) ReportSystemInfo2(ctx context.Context, in *Host, opts ...grpc.CallOption) (*Uint64Receipt, error) {
out := new(Unit64Receipt) out := new(Uint64Receipt)
err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, NezhaService_ReportSystemInfo2_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -176,7 +176,7 @@ type NezhaServiceServer interface {
RequestTask(NezhaService_RequestTaskServer) error RequestTask(NezhaService_RequestTaskServer) error
IOStream(NezhaService_IOStreamServer) error IOStream(NezhaService_IOStreamServer) error
ReportGeoIP(context.Context, *GeoIP) (*GeoIP, 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. // 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) { func (UnimplementedNezhaServiceServer) ReportGeoIP(context.Context, *GeoIP) (*GeoIP, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReportGeoIP not implemented") 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") return nil, status.Errorf(codes.Unimplemented, "method ReportSystemInfo2 not implemented")
} }

View File

@ -145,9 +145,9 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
return &pb.Receipt{Proced: true}, nil 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) 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 { func (s *NezhaHandler) IOStream(stream pb.NezhaService_IOStreamServer) error {