diff --git a/api/webdav/webdav.pb.go b/api/webdav/webdav.pb.go new file mode 100644 index 0000000..4b65be4 --- /dev/null +++ b/api/webdav/webdav.pb.go @@ -0,0 +1,981 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.1 +// protoc v5.26.1 +// source: webdav/webdav.proto + +package webdav + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Empty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Empty) Reset() { + *x = Empty{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{0} +} + +type FsTestReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *FsTestReq) Reset() { + *x = FsTestReq{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsTestReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsTestReq) ProtoMessage() {} + +func (x *FsTestReq) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsTestReq.ProtoReflect.Descriptor instead. +func (*FsTestReq) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{1} +} + +func (x *FsTestReq) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *FsTestReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *FsTestReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type FsGetReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *FsGetReq) Reset() { + *x = FsGetReq{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsGetReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsGetReq) ProtoMessage() {} + +func (x *FsGetReq) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsGetReq.ProtoReflect.Descriptor instead. +func (*FsGetReq) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{2} +} + +func (x *FsGetReq) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *FsGetReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *FsGetReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *FsGetReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type FsGetResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + IsDir bool `protobuf:"varint,3,opt,name=isDir,proto3" json:"isDir,omitempty"` + Modified int64 `protobuf:"varint,4,opt,name=modified,proto3" json:"modified,omitempty"` +} + +func (x *FsGetResp) Reset() { + *x = FsGetResp{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsGetResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsGetResp) ProtoMessage() {} + +func (x *FsGetResp) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsGetResp.ProtoReflect.Descriptor instead. +func (*FsGetResp) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{3} +} + +func (x *FsGetResp) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FsGetResp) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *FsGetResp) GetIsDir() bool { + if x != nil { + return x.IsDir + } + return false +} + +func (x *FsGetResp) GetModified() int64 { + if x != nil { + return x.Modified + } + return 0 +} + +type FsListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Page uint64 `protobuf:"varint,5,opt,name=page,proto3" json:"page,omitempty"` + PerPage uint64 `protobuf:"varint,6,opt,name=perPage,proto3" json:"perPage,omitempty"` +} + +func (x *FsListReq) Reset() { + *x = FsListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsListReq) ProtoMessage() {} + +func (x *FsListReq) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsListReq.ProtoReflect.Descriptor instead. +func (*FsListReq) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{4} +} + +func (x *FsListReq) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *FsListReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *FsListReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *FsListReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *FsListReq) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *FsListReq) GetPerPage() uint64 { + if x != nil { + return x.PerPage + } + return 0 +} + +type FsListResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content []*FsListResp_FsListContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` + Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *FsListResp) Reset() { + *x = FsListResp{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsListResp) ProtoMessage() {} + +func (x *FsListResp) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsListResp.ProtoReflect.Descriptor instead. +func (*FsListResp) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{5} +} + +func (x *FsListResp) GetContent() []*FsListResp_FsListContent { + if x != nil { + return x.Content + } + return nil +} + +func (x *FsListResp) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +type FsSearchReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + Keywords string `protobuf:"bytes,5,opt,name=keywords,proto3" json:"keywords,omitempty"` + Page uint64 `protobuf:"varint,6,opt,name=page,proto3" json:"page,omitempty"` + PerPage uint64 `protobuf:"varint,7,opt,name=perPage,proto3" json:"perPage,omitempty"` +} + +func (x *FsSearchReq) Reset() { + *x = FsSearchReq{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsSearchReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsSearchReq) ProtoMessage() {} + +func (x *FsSearchReq) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsSearchReq.ProtoReflect.Descriptor instead. +func (*FsSearchReq) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{6} +} + +func (x *FsSearchReq) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *FsSearchReq) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *FsSearchReq) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *FsSearchReq) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +func (x *FsSearchReq) GetKeywords() string { + if x != nil { + return x.Keywords + } + return "" +} + +func (x *FsSearchReq) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *FsSearchReq) GetPerPage() uint64 { + if x != nil { + return x.PerPage + } + return 0 +} + +type FsSearchResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content []*FsSearchResp_FsSearchContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` + Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` +} + +func (x *FsSearchResp) Reset() { + *x = FsSearchResp{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsSearchResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsSearchResp) ProtoMessage() {} + +func (x *FsSearchResp) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsSearchResp.ProtoReflect.Descriptor instead. +func (*FsSearchResp) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{7} +} + +func (x *FsSearchResp) GetContent() []*FsSearchResp_FsSearchContent { + if x != nil { + return x.Content + } + return nil +} + +func (x *FsSearchResp) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +type FsListResp_FsListContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + IsDir bool `protobuf:"varint,3,opt,name=isDir,proto3" json:"isDir,omitempty"` + Modified int64 `protobuf:"varint,4,opt,name=modified,proto3" json:"modified,omitempty"` +} + +func (x *FsListResp_FsListContent) Reset() { + *x = FsListResp_FsListContent{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsListResp_FsListContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsListResp_FsListContent) ProtoMessage() {} + +func (x *FsListResp_FsListContent) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsListResp_FsListContent.ProtoReflect.Descriptor instead. +func (*FsListResp_FsListContent) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *FsListResp_FsListContent) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FsListResp_FsListContent) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +func (x *FsListResp_FsListContent) GetIsDir() bool { + if x != nil { + return x.IsDir + } + return false +} + +func (x *FsListResp_FsListContent) GetModified() int64 { + if x != nil { + return x.Modified + } + return 0 +} + +type FsSearchResp_FsSearchContent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + IsDir bool `protobuf:"varint,2,opt,name=isDir,proto3" json:"isDir,omitempty"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *FsSearchResp_FsSearchContent) Reset() { + *x = FsSearchResp_FsSearchContent{} + if protoimpl.UnsafeEnabled { + mi := &file_webdav_webdav_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FsSearchResp_FsSearchContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FsSearchResp_FsSearchContent) ProtoMessage() {} + +func (x *FsSearchResp_FsSearchContent) ProtoReflect() protoreflect.Message { + mi := &file_webdav_webdav_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FsSearchResp_FsSearchContent.ProtoReflect.Descriptor instead. +func (*FsSearchResp_FsSearchContent) Descriptor() ([]byte, []int) { + return file_webdav_webdav_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *FsSearchResp_FsSearchContent) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FsSearchResp_FsSearchContent) GetIsDir() bool { + if x != nil { + return x.IsDir + } + return false +} + +func (x *FsSearchResp_FsSearchContent) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +var File_webdav_webdav_proto protoreflect.FileDescriptor + +var file_webdav_webdav_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2f, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, + 0x76, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x57, 0x0a, 0x09, 0x46, 0x73, 0x54, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, + 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, + 0x64, 0x22, 0x6a, 0x0a, 0x08, 0x46, 0x73, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, + 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, + 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0x65, 0x0a, + 0x09, 0x46, 0x73, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x44, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x69, 0x73, 0x44, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x22, 0x99, 0x01, 0x0a, 0x09, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x65, 0x72, 0x50, 0x61, 0x67, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x70, 0x65, 0x72, 0x50, 0x61, 0x67, 0x65, + 0x22, 0xcd, 0x01, 0x0a, 0x0a, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, + 0x3e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x1a, 0x69, 0x0a, 0x0d, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x69, 0x73, 0x44, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, + 0x73, 0x44, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x22, 0xb7, 0x01, 0x0a, 0x0b, 0x46, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, + 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x70, 0x65, 0x72, 0x50, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x07, 0x70, 0x65, 0x72, 0x50, 0x61, 0x67, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x0c, 0x46, + 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x07, 0x63, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, 0x53, 0x65, 0x61, 0x72, + 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x46, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x1a, 0x4f, 0x0a, 0x0f, 0x46, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, + 0x69, 0x73, 0x44, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x44, + 0x69, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x32, 0xbf, 0x02, 0x0a, 0x06, 0x57, 0x65, 0x62, 0x64, 0x61, + 0x76, 0x12, 0x48, 0x0a, 0x05, 0x46, 0x73, 0x47, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x3a, + 0x01, 0x2a, 0x22, 0x07, 0x2f, 0x66, 0x73, 0x2f, 0x67, 0x65, 0x74, 0x12, 0x4c, 0x0a, 0x06, 0x46, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, + 0x61, 0x76, 0x2e, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x16, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x3a, 0x01, 0x2a, 0x22, + 0x08, 0x2f, 0x66, 0x73, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x54, 0x0a, 0x08, 0x46, 0x73, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, + 0x61, 0x76, 0x2e, 0x46, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x18, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, + 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x66, 0x73, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, + 0x47, 0x0a, 0x06, 0x46, 0x73, 0x54, 0x65, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x46, 0x73, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x1a, 0x11, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x3a, 0x01, 0x2a, 0x22, 0x08, + 0x2f, 0x66, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x42, 0x3f, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x2e, + 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x74, 0x76, 0x2d, 0x6f, 0x72, 0x67, 0x2f, + 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x77, 0x65, 0x62, 0x64, + 0x61, 0x76, 0x3b, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_webdav_webdav_proto_rawDescOnce sync.Once + file_webdav_webdav_proto_rawDescData = file_webdav_webdav_proto_rawDesc +) + +func file_webdav_webdav_proto_rawDescGZIP() []byte { + file_webdav_webdav_proto_rawDescOnce.Do(func() { + file_webdav_webdav_proto_rawDescData = protoimpl.X.CompressGZIP(file_webdav_webdav_proto_rawDescData) + }) + return file_webdav_webdav_proto_rawDescData +} + +var file_webdav_webdav_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_webdav_webdav_proto_goTypes = []interface{}{ + (*Empty)(nil), // 0: api.webdav.Empty + (*FsTestReq)(nil), // 1: api.webdav.FsTestReq + (*FsGetReq)(nil), // 2: api.webdav.FsGetReq + (*FsGetResp)(nil), // 3: api.webdav.FsGetResp + (*FsListReq)(nil), // 4: api.webdav.FsListReq + (*FsListResp)(nil), // 5: api.webdav.FsListResp + (*FsSearchReq)(nil), // 6: api.webdav.FsSearchReq + (*FsSearchResp)(nil), // 7: api.webdav.FsSearchResp + (*FsListResp_FsListContent)(nil), // 8: api.webdav.FsListResp.FsListContent + (*FsSearchResp_FsSearchContent)(nil), // 9: api.webdav.FsSearchResp.FsSearchContent +} +var file_webdav_webdav_proto_depIdxs = []int32{ + 8, // 0: api.webdav.FsListResp.content:type_name -> api.webdav.FsListResp.FsListContent + 9, // 1: api.webdav.FsSearchResp.content:type_name -> api.webdav.FsSearchResp.FsSearchContent + 2, // 2: api.webdav.Webdav.FsGet:input_type -> api.webdav.FsGetReq + 4, // 3: api.webdav.Webdav.FsList:input_type -> api.webdav.FsListReq + 6, // 4: api.webdav.Webdav.FsSearch:input_type -> api.webdav.FsSearchReq + 1, // 5: api.webdav.Webdav.FsTest:input_type -> api.webdav.FsTestReq + 3, // 6: api.webdav.Webdav.FsGet:output_type -> api.webdav.FsGetResp + 5, // 7: api.webdav.Webdav.FsList:output_type -> api.webdav.FsListResp + 7, // 8: api.webdav.Webdav.FsSearch:output_type -> api.webdav.FsSearchResp + 0, // 9: api.webdav.Webdav.FsTest:output_type -> api.webdav.Empty + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] 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 extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_webdav_webdav_proto_init() } +func file_webdav_webdav_proto_init() { + if File_webdav_webdav_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_webdav_webdav_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Empty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsTestReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsGetReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsGetResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsListResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsSearchReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsSearchResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsListResp_FsListContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webdav_webdav_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FsSearchResp_FsSearchContent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_webdav_webdav_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_webdav_webdav_proto_goTypes, + DependencyIndexes: file_webdav_webdav_proto_depIdxs, + MessageInfos: file_webdav_webdav_proto_msgTypes, + }.Build() + File_webdav_webdav_proto = out.File + file_webdav_webdav_proto_rawDesc = nil + file_webdav_webdav_proto_goTypes = nil + file_webdav_webdav_proto_depIdxs = nil +} diff --git a/api/webdav/webdav.proto b/api/webdav/webdav.proto new file mode 100644 index 0000000..4ba160e --- /dev/null +++ b/api/webdav/webdav.proto @@ -0,0 +1,98 @@ +syntax = "proto3"; + +package api.webdav; + +option go_package = "github.com/synctv-org/vendors/api/webdav;webdav"; +option java_multiple_files = true; +option java_package = "api.webdav"; + +import "google/api/annotations.proto"; + +service Webdav { + rpc FsGet(FsGetReq) returns (FsGetResp) { + option (google.api.http) = { + post : "/fs/get" + body : "*" + }; + }; + rpc FsList(FsListReq) returns (FsListResp) { + option (google.api.http) = { + post : "/fs/list" + body : "*" + }; + }; + rpc FsSearch(FsSearchReq) returns (FsSearchResp) { + option (google.api.http) = { + post : "/fs/search" + body : "*" + }; + }; + rpc FsTest(FsTestReq) returns (Empty) { + option (google.api.http) = { + post : "/fs/test" + body : "*" + }; + }; +} + +message Empty {} + +message FsTestReq { + string host = 1; + string username = 2; + string password = 3; +} + +message FsGetReq { + string host = 1; + string username = 2; + string password = 3; + string path = 4; +} + +message FsGetResp { + string name = 1; + int64 size = 2; + bool isDir = 3; + int64 modified = 4; +} + +message FsListReq { + string host = 1; + string username = 2; + string password = 3; + string path = 4; + uint64 page = 5; + uint64 perPage = 6; +} + +message FsListResp { + message FsListContent { + string name = 1; + int64 size = 2; + bool isDir = 3; + int64 modified = 4; + } + repeated FsListContent content = 1; + uint64 total = 2; +} + +message FsSearchReq { + string host = 1; + string username = 2; + string password = 3; + string path = 4; + string keywords = 5; + uint64 page = 6; + uint64 perPage = 7; +} + +message FsSearchResp { + message FsSearchContent { + string name = 1; + bool isDir = 2; + int64 size = 3; + } + repeated FsSearchContent content = 1; + uint64 total = 2; +} \ No newline at end of file diff --git a/api/webdav/webdav_grpc.pb.go b/api/webdav/webdav_grpc.pb.go new file mode 100644 index 0000000..3761175 --- /dev/null +++ b/api/webdav/webdav_grpc.pb.go @@ -0,0 +1,220 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v5.26.1 +// source: webdav/webdav.proto + +package webdav + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Webdav_FsGet_FullMethodName = "/api.webdav.Webdav/FsGet" + Webdav_FsList_FullMethodName = "/api.webdav.Webdav/FsList" + Webdav_FsSearch_FullMethodName = "/api.webdav.Webdav/FsSearch" + Webdav_FsTest_FullMethodName = "/api.webdav.Webdav/FsTest" +) + +// WebdavClient is the client API for Webdav service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WebdavClient interface { + FsGet(ctx context.Context, in *FsGetReq, opts ...grpc.CallOption) (*FsGetResp, error) + FsList(ctx context.Context, in *FsListReq, opts ...grpc.CallOption) (*FsListResp, error) + FsSearch(ctx context.Context, in *FsSearchReq, opts ...grpc.CallOption) (*FsSearchResp, error) + FsTest(ctx context.Context, in *FsTestReq, opts ...grpc.CallOption) (*Empty, error) +} + +type webdavClient struct { + cc grpc.ClientConnInterface +} + +func NewWebdavClient(cc grpc.ClientConnInterface) WebdavClient { + return &webdavClient{cc} +} + +func (c *webdavClient) FsGet(ctx context.Context, in *FsGetReq, opts ...grpc.CallOption) (*FsGetResp, error) { + out := new(FsGetResp) + err := c.cc.Invoke(ctx, Webdav_FsGet_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *webdavClient) FsList(ctx context.Context, in *FsListReq, opts ...grpc.CallOption) (*FsListResp, error) { + out := new(FsListResp) + err := c.cc.Invoke(ctx, Webdav_FsList_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *webdavClient) FsSearch(ctx context.Context, in *FsSearchReq, opts ...grpc.CallOption) (*FsSearchResp, error) { + out := new(FsSearchResp) + err := c.cc.Invoke(ctx, Webdav_FsSearch_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *webdavClient) FsTest(ctx context.Context, in *FsTestReq, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := c.cc.Invoke(ctx, Webdav_FsTest_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WebdavServer is the server API for Webdav service. +// All implementations must embed UnimplementedWebdavServer +// for forward compatibility +type WebdavServer interface { + FsGet(context.Context, *FsGetReq) (*FsGetResp, error) + FsList(context.Context, *FsListReq) (*FsListResp, error) + FsSearch(context.Context, *FsSearchReq) (*FsSearchResp, error) + FsTest(context.Context, *FsTestReq) (*Empty, error) + mustEmbedUnimplementedWebdavServer() +} + +// UnimplementedWebdavServer must be embedded to have forward compatible implementations. +type UnimplementedWebdavServer struct { +} + +func (UnimplementedWebdavServer) FsGet(context.Context, *FsGetReq) (*FsGetResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method FsGet not implemented") +} +func (UnimplementedWebdavServer) FsList(context.Context, *FsListReq) (*FsListResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method FsList not implemented") +} +func (UnimplementedWebdavServer) FsSearch(context.Context, *FsSearchReq) (*FsSearchResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method FsSearch not implemented") +} +func (UnimplementedWebdavServer) FsTest(context.Context, *FsTestReq) (*Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method FsTest not implemented") +} +func (UnimplementedWebdavServer) mustEmbedUnimplementedWebdavServer() {} + +// UnsafeWebdavServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WebdavServer will +// result in compilation errors. +type UnsafeWebdavServer interface { + mustEmbedUnimplementedWebdavServer() +} + +func RegisterWebdavServer(s grpc.ServiceRegistrar, srv WebdavServer) { + s.RegisterService(&Webdav_ServiceDesc, srv) +} + +func _Webdav_FsGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FsGetReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebdavServer).FsGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Webdav_FsGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebdavServer).FsGet(ctx, req.(*FsGetReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Webdav_FsList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FsListReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebdavServer).FsList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Webdav_FsList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebdavServer).FsList(ctx, req.(*FsListReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Webdav_FsSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FsSearchReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebdavServer).FsSearch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Webdav_FsSearch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebdavServer).FsSearch(ctx, req.(*FsSearchReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Webdav_FsTest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FsTestReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WebdavServer).FsTest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Webdav_FsTest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WebdavServer).FsTest(ctx, req.(*FsTestReq)) + } + return interceptor(ctx, in, info, handler) +} + +// Webdav_ServiceDesc is the grpc.ServiceDesc for Webdav service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Webdav_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "api.webdav.Webdav", + HandlerType: (*WebdavServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FsGet", + Handler: _Webdav_FsGet_Handler, + }, + { + MethodName: "FsList", + Handler: _Webdav_FsList_Handler, + }, + { + MethodName: "FsSearch", + Handler: _Webdav_FsSearch_Handler, + }, + { + MethodName: "FsTest", + Handler: _Webdav_FsTest_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "webdav/webdav.proto", +} diff --git a/api/webdav/webdav_http.pb.go b/api/webdav/webdav_http.pb.go new file mode 100644 index 0000000..aa284f2 --- /dev/null +++ b/api/webdav/webdav_http.pb.go @@ -0,0 +1,195 @@ +// Code generated by protoc-gen-go-http. DO NOT EDIT. +// versions: +// - protoc-gen-go-http v2.7.1 +// - protoc v5.26.1 +// source: webdav/webdav.proto + +package webdav + +import ( + context "context" + http "github.com/go-kratos/kratos/v2/transport/http" + binding "github.com/go-kratos/kratos/v2/transport/http/binding" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the kratos package it is being compiled against. +var _ = new(context.Context) +var _ = binding.EncodeURL + +const _ = http.SupportPackageIsVersion1 + +const OperationWebdavFsGet = "/api.webdav.Webdav/FsGet" +const OperationWebdavFsList = "/api.webdav.Webdav/FsList" +const OperationWebdavFsSearch = "/api.webdav.Webdav/FsSearch" +const OperationWebdavFsTest = "/api.webdav.Webdav/FsTest" + +type WebdavHTTPServer interface { + FsGet(context.Context, *FsGetReq) (*FsGetResp, error) + FsList(context.Context, *FsListReq) (*FsListResp, error) + FsSearch(context.Context, *FsSearchReq) (*FsSearchResp, error) + FsTest(context.Context, *FsTestReq) (*Empty, error) +} + +func RegisterWebdavHTTPServer(s *http.Server, srv WebdavHTTPServer) { + r := s.Route("/") + r.POST("/fs/get", _Webdav_FsGet1_HTTP_Handler(srv)) + r.POST("/fs/list", _Webdav_FsList2_HTTP_Handler(srv)) + r.POST("/fs/search", _Webdav_FsSearch1_HTTP_Handler(srv)) + r.POST("/fs/test", _Webdav_FsTest0_HTTP_Handler(srv)) +} + +func _Webdav_FsGet1_HTTP_Handler(srv WebdavHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in FsGetReq + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationWebdavFsGet) + h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.FsGet(ctx, req.(*FsGetReq)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*FsGetResp) + return ctx.Result(200, reply) + } +} + +func _Webdav_FsList2_HTTP_Handler(srv WebdavHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in FsListReq + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationWebdavFsList) + h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.FsList(ctx, req.(*FsListReq)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*FsListResp) + return ctx.Result(200, reply) + } +} + +func _Webdav_FsSearch1_HTTP_Handler(srv WebdavHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in FsSearchReq + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationWebdavFsSearch) + h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.FsSearch(ctx, req.(*FsSearchReq)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*FsSearchResp) + return ctx.Result(200, reply) + } +} + +func _Webdav_FsTest0_HTTP_Handler(srv WebdavHTTPServer) func(ctx http.Context) error { + return func(ctx http.Context) error { + var in FsTestReq + if err := ctx.Bind(&in); err != nil { + return err + } + if err := ctx.BindQuery(&in); err != nil { + return err + } + http.SetOperation(ctx, OperationWebdavFsTest) + h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.FsTest(ctx, req.(*FsTestReq)) + }) + out, err := h(ctx, &in) + if err != nil { + return err + } + reply := out.(*Empty) + return ctx.Result(200, reply) + } +} + +type WebdavHTTPClient interface { + FsGet(ctx context.Context, req *FsGetReq, opts ...http.CallOption) (rsp *FsGetResp, err error) + FsList(ctx context.Context, req *FsListReq, opts ...http.CallOption) (rsp *FsListResp, err error) + FsSearch(ctx context.Context, req *FsSearchReq, opts ...http.CallOption) (rsp *FsSearchResp, err error) + FsTest(ctx context.Context, req *FsTestReq, opts ...http.CallOption) (rsp *Empty, err error) +} + +type WebdavHTTPClientImpl struct { + cc *http.Client +} + +func NewWebdavHTTPClient(client *http.Client) WebdavHTTPClient { + return &WebdavHTTPClientImpl{client} +} + +func (c *WebdavHTTPClientImpl) FsGet(ctx context.Context, in *FsGetReq, opts ...http.CallOption) (*FsGetResp, error) { + var out FsGetResp + pattern := "/fs/get" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationWebdavFsGet)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *WebdavHTTPClientImpl) FsList(ctx context.Context, in *FsListReq, opts ...http.CallOption) (*FsListResp, error) { + var out FsListResp + pattern := "/fs/list" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationWebdavFsList)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *WebdavHTTPClientImpl) FsSearch(ctx context.Context, in *FsSearchReq, opts ...http.CallOption) (*FsSearchResp, error) { + var out FsSearchResp + pattern := "/fs/search" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationWebdavFsSearch)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} + +func (c *WebdavHTTPClientImpl) FsTest(ctx context.Context, in *FsTestReq, opts ...http.CallOption) (*Empty, error) { + var out Empty + pattern := "/fs/test" + path := binding.EncodeURL(pattern, in, false) + opts = append(opts, http.Operation(OperationWebdavFsTest)) + opts = append(opts, http.PathTemplate(pattern)) + err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...) + if err != nil { + return nil, err + } + return &out, err +} diff --git a/cmd/server/main.go b/cmd/server/main.go index 32cc44e..255b23e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -89,7 +89,7 @@ func Server(cmd *cobra.Command, args []string) { "span.id", tracing.SpanID(), ) - app, cleanup, err := wireApp(bc.Server, bc.Registry, bc.Alist, bc.Bilibili, bc.Emby, logger) + app, cleanup, err := wireApp(bc.Server, bc.Registry, bc.Alist, bc.Bilibili, bc.Emby, bc.Webdav, logger) if err != nil { panic(err) } diff --git a/cmd/server/wire.go b/cmd/server/wire.go index 7f218cc..596ffcb 100644 --- a/cmd/server/wire.go +++ b/cmd/server/wire.go @@ -16,6 +16,6 @@ import ( "github.com/google/wire" ) -func wireApp(*conf.Server, *conf.Registry, *conf.AlistConfig, *conf.BilibiliConfig, *conf.EmbyConfig, log.Logger) (*kratos.App, func(), error) { +func wireApp(*conf.GrpcServer, *conf.Registry, *conf.AlistConfig, *conf.BilibiliConfig, *conf.EmbyConfig, *conf.WebdavConfig, log.Logger) (*kratos.App, func(), error) { panic(wire.Build(server.ProviderSet, service.ProviderSet, reg.ProviderSet, newApp)) } diff --git a/cmd/server/wire_gen.go b/cmd/server/wire_gen.go index 0bdbf1b..e1d88ee 100644 --- a/cmd/server/wire_gen.go +++ b/cmd/server/wire_gen.go @@ -1,6 +1,6 @@ // Code generated by Wire. DO NOT EDIT. -//go:generate go run github.com/google/wire/cmd/wire +//go:generate go run -mod=mod github.com/google/wire/cmd/wire //go:build !wireinject // +build !wireinject @@ -15,6 +15,7 @@ import ( "github.com/synctv-org/vendors/service/alist" "github.com/synctv-org/vendors/service/bilibili" "github.com/synctv-org/vendors/service/emby" + "github.com/synctv-org/vendors/service/webdav" ) import ( @@ -23,11 +24,12 @@ import ( // Injectors from wire.go: -func wireApp(confServer *conf.GrpcServer, confRegistry *conf.Registry, alistConfig *conf.AlistConfig, bilibiliConfig *conf.BilibiliConfig, embyConfig *conf.EmbyConfig, logger log.Logger) (*kratos.App, func(), error) { +func wireApp(grpcServer *conf.GrpcServer, confRegistry *conf.Registry, alistConfig *conf.AlistConfig, bilibiliConfig *conf.BilibiliConfig, embyConfig *conf.EmbyConfig, webdavConfig *conf.WebdavConfig, logger log.Logger) (*kratos.App, func(), error) { bilibiliService := bilibili.NewBilibiliService(bilibiliConfig) alistService := alist.NewAlistService(alistConfig) embyService := emby.NewEmbyService(embyConfig) - grpcGatewayServer := server.NewGRPCServer(confServer, bilibiliService, alistService, embyService) + webdavService := webdav.NewWebdavService(webdavConfig) + grpcGatewayServer := server.NewGRPCServer(grpcServer, bilibiliService, alistService, embyService, webdavService) registrar := registry.NewRegistry(confRegistry) app := newApp(logger, grpcGatewayServer, registrar) return app, func() { diff --git a/conf/conf.pb.go b/conf/conf.pb.go index 820751f..7c1aed3 100644 --- a/conf/conf.pb.go +++ b/conf/conf.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.34.1 +// protoc v5.26.1 // source: conf.proto package conf @@ -348,6 +348,44 @@ func (*EmbyConfig) Descriptor() ([]byte, []int) { return file_conf_proto_rawDescGZIP(), []int{5} } +type WebdavConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *WebdavConfig) Reset() { + *x = WebdavConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_conf_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebdavConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebdavConfig) ProtoMessage() {} + +func (x *WebdavConfig) ProtoReflect() protoreflect.Message { + mi := &file_conf_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WebdavConfig.ProtoReflect.Descriptor instead. +func (*WebdavConfig) Descriptor() ([]byte, []int) { + return file_conf_proto_rawDescGZIP(), []int{6} +} + type AllServer struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -358,12 +396,13 @@ type AllServer struct { Bilibili *BilibiliConfig `protobuf:"bytes,3,opt,name=bilibili,proto3" json:"bilibili,omitempty"` Alist *AlistConfig `protobuf:"bytes,4,opt,name=alist,proto3" json:"alist,omitempty"` Emby *EmbyConfig `protobuf:"bytes,5,opt,name=emby,proto3" json:"emby,omitempty"` + Webdav *WebdavConfig `protobuf:"bytes,6,opt,name=webdav,proto3" json:"webdav,omitempty"` } func (x *AllServer) Reset() { *x = AllServer{} if protoimpl.UnsafeEnabled { - mi := &file_conf_proto_msgTypes[6] + mi := &file_conf_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -376,7 +415,7 @@ func (x *AllServer) String() string { func (*AllServer) ProtoMessage() {} func (x *AllServer) ProtoReflect() protoreflect.Message { - mi := &file_conf_proto_msgTypes[6] + mi := &file_conf_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -389,7 +428,7 @@ func (x *AllServer) ProtoReflect() protoreflect.Message { // Deprecated: Use AllServer.ProtoReflect.Descriptor instead. func (*AllServer) Descriptor() ([]byte, []int) { - return file_conf_proto_rawDescGZIP(), []int{6} + return file_conf_proto_rawDescGZIP(), []int{7} } func (x *AllServer) GetServer() *GrpcServer { @@ -427,6 +466,13 @@ func (x *AllServer) GetEmby() *EmbyConfig { return nil } +func (x *AllServer) GetWebdav() *WebdavConfig { + if x != nil { + return x.Webdav + } + return nil +} + type Registry_Consul struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -441,7 +487,7 @@ type Registry_Consul struct { func (x *Registry_Consul) Reset() { *x = Registry_Consul{} if protoimpl.UnsafeEnabled { - mi := &file_conf_proto_msgTypes[7] + mi := &file_conf_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -454,7 +500,7 @@ func (x *Registry_Consul) String() string { func (*Registry_Consul) ProtoMessage() {} func (x *Registry_Consul) ProtoReflect() protoreflect.Message { - mi := &file_conf_proto_msgTypes[7] + mi := &file_conf_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -512,7 +558,7 @@ type Registry_Etcd struct { func (x *Registry_Etcd) Reset() { *x = Registry_Etcd{} if protoimpl.UnsafeEnabled { - mi := &file_conf_proto_msgTypes[8] + mi := &file_conf_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -525,7 +571,7 @@ func (x *Registry_Etcd) String() string { func (*Registry_Etcd) ProtoMessage() {} func (x *Registry_Etcd) ProtoReflect() protoreflect.Message { - mi := &file_conf_proto_msgTypes[8] + mi := &file_conf_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +628,7 @@ type WebServer_TLS struct { func (x *WebServer_TLS) Reset() { *x = WebServer_TLS{} if protoimpl.UnsafeEnabled { - mi := &file_conf_proto_msgTypes[9] + mi := &file_conf_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -595,7 +641,7 @@ func (x *WebServer_TLS) String() string { func (*WebServer_TLS) ProtoMessage() {} func (x *WebServer_TLS) ProtoReflect() protoreflect.Message { - mi := &file_conf_proto_msgTypes[9] + mi := &file_conf_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -645,7 +691,7 @@ type GrpcServer_TLS struct { func (x *GrpcServer_TLS) Reset() { *x = GrpcServer_TLS{} if protoimpl.UnsafeEnabled { - mi := &file_conf_proto_msgTypes[10] + mi := &file_conf_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -658,7 +704,7 @@ func (x *GrpcServer_TLS) String() string { func (*GrpcServer_TLS) ProtoMessage() {} func (x *GrpcServer_TLS) ProtoReflect() protoreflect.Message { - mi := &file_conf_proto_msgTypes[10] + mi := &file_conf_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -764,7 +810,8 @@ var file_conf_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x42, 0x69, 0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x0d, 0x0a, 0x0b, 0x41, 0x6c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x0c, 0x0a, 0x0a, - 0x45, 0x6d, 0x62, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x80, 0x02, 0x0a, 0x09, 0x41, + 0x45, 0x6d, 0x62, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x0e, 0x0a, 0x0c, 0x57, 0x65, + 0x62, 0x64, 0x61, 0x76, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0xb2, 0x02, 0x0a, 0x09, 0x41, 0x6c, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, @@ -780,10 +827,13 @@ var file_conf_proto_rawDesc = []byte{ 0x6c, 0x69, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x65, 0x6d, 0x62, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6d, 0x62, - 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x04, 0x65, 0x6d, 0x62, 0x79, 0x42, 0x1c, 0x5a, - 0x1a, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x04, 0x65, 0x6d, 0x62, 0x79, 0x12, 0x30, 0x0a, + 0x06, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x57, 0x65, 0x62, 0x64, 0x61, + 0x76, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x77, 0x65, 0x62, 0x64, 0x61, 0x76, 0x42, + 0x1c, 0x5a, 0x1a, 0x76, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -798,7 +848,7 @@ func file_conf_proto_rawDescGZIP() []byte { return file_conf_proto_rawDescData } -var file_conf_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_conf_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_conf_proto_goTypes = []interface{}{ (*Registry)(nil), // 0: kratos.api.Registry (*WebServer)(nil), // 1: kratos.api.WebServer @@ -806,31 +856,33 @@ var file_conf_proto_goTypes = []interface{}{ (*BilibiliConfig)(nil), // 3: kratos.api.BilibiliConfig (*AlistConfig)(nil), // 4: kratos.api.AlistConfig (*EmbyConfig)(nil), // 5: kratos.api.EmbyConfig - (*AllServer)(nil), // 6: kratos.api.AllServer - (*Registry_Consul)(nil), // 7: kratos.api.Registry.Consul - (*Registry_Etcd)(nil), // 8: kratos.api.Registry.Etcd - (*WebServer_TLS)(nil), // 9: kratos.api.WebServer.TLS - (*GrpcServer_TLS)(nil), // 10: kratos.api.GrpcServer.TLS - (*durationpb.Duration)(nil), // 11: google.protobuf.Duration + (*WebdavConfig)(nil), // 6: kratos.api.WebdavConfig + (*AllServer)(nil), // 7: kratos.api.AllServer + (*Registry_Consul)(nil), // 8: kratos.api.Registry.Consul + (*Registry_Etcd)(nil), // 9: kratos.api.Registry.Etcd + (*WebServer_TLS)(nil), // 10: kratos.api.WebServer.TLS + (*GrpcServer_TLS)(nil), // 11: kratos.api.GrpcServer.TLS + (*durationpb.Duration)(nil), // 12: google.protobuf.Duration } var file_conf_proto_depIdxs = []int32{ - 7, // 0: kratos.api.Registry.consul:type_name -> kratos.api.Registry.Consul - 8, // 1: kratos.api.Registry.etcd:type_name -> kratos.api.Registry.Etcd - 9, // 2: kratos.api.WebServer.tls:type_name -> kratos.api.WebServer.TLS - 10, // 3: kratos.api.GrpcServer.tls:type_name -> kratos.api.GrpcServer.TLS - 11, // 4: kratos.api.GrpcServer.timeout:type_name -> google.protobuf.Duration + 8, // 0: kratos.api.Registry.consul:type_name -> kratos.api.Registry.Consul + 9, // 1: kratos.api.Registry.etcd:type_name -> kratos.api.Registry.Etcd + 10, // 2: kratos.api.WebServer.tls:type_name -> kratos.api.WebServer.TLS + 11, // 3: kratos.api.GrpcServer.tls:type_name -> kratos.api.GrpcServer.TLS + 12, // 4: kratos.api.GrpcServer.timeout:type_name -> google.protobuf.Duration 2, // 5: kratos.api.AllServer.server:type_name -> kratos.api.GrpcServer 0, // 6: kratos.api.AllServer.registry:type_name -> kratos.api.Registry 3, // 7: kratos.api.AllServer.bilibili:type_name -> kratos.api.BilibiliConfig 4, // 8: kratos.api.AllServer.alist:type_name -> kratos.api.AlistConfig 5, // 9: kratos.api.AllServer.emby:type_name -> kratos.api.EmbyConfig - 11, // 10: kratos.api.Registry.Consul.timeout:type_name -> google.protobuf.Duration - 11, // 11: kratos.api.Registry.Etcd.timeout:type_name -> google.protobuf.Duration - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 6, // 10: kratos.api.AllServer.webdav:type_name -> kratos.api.WebdavConfig + 12, // 11: kratos.api.Registry.Consul.timeout:type_name -> google.protobuf.Duration + 12, // 12: kratos.api.Registry.Etcd.timeout:type_name -> google.protobuf.Duration + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_conf_proto_init() } @@ -912,7 +964,7 @@ func file_conf_proto_init() { } } file_conf_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllServer); i { + switch v := v.(*WebdavConfig); i { case 0: return &v.state case 1: @@ -924,7 +976,7 @@ func file_conf_proto_init() { } } file_conf_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Registry_Consul); i { + switch v := v.(*AllServer); i { case 0: return &v.state case 1: @@ -936,7 +988,7 @@ func file_conf_proto_init() { } } file_conf_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Registry_Etcd); i { + switch v := v.(*Registry_Consul); i { case 0: return &v.state case 1: @@ -948,7 +1000,7 @@ func file_conf_proto_init() { } } file_conf_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebServer_TLS); i { + switch v := v.(*Registry_Etcd); i { case 0: return &v.state case 1: @@ -960,6 +1012,18 @@ func file_conf_proto_init() { } } file_conf_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebServer_TLS); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_conf_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GrpcServer_TLS); i { case 0: return &v.state @@ -978,7 +1042,7 @@ func file_conf_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_conf_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 12, NumExtensions: 0, NumServices: 0, }, diff --git a/conf/conf.proto b/conf/conf.proto index 0122942..540af2d 100644 --- a/conf/conf.proto +++ b/conf/conf.proto @@ -54,10 +54,13 @@ message AlistConfig {} message EmbyConfig {} +message WebdavConfig {} + message AllServer { GrpcServer server = 1; Registry registry = 2; BilibiliConfig bilibili = 3; AlistConfig alist = 4; EmbyConfig emby = 5; -} \ No newline at end of file + WebdavConfig webdav = 6; +} diff --git a/go.mod b/go.mod index 0b81b4e..a803581 100644 --- a/go.mod +++ b/go.mod @@ -4,8 +4,8 @@ go 1.21 require ( github.com/caarlos0/env/v9 v9.0.0 - github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240416123913-75711092ab26 - github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240416123913-75711092ab26 + github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8 + github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240504101732-d0d5761f9ca8 github.com/go-kratos/kratos/v2 v2.7.3 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/uuid v1.6.0 @@ -15,23 +15,24 @@ require ( github.com/json-iterator/go v1.1.12 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 + github.com/studio-b12/gowebdav v0.9.0 github.com/zencoder/go-dash/v3 v3.0.3 - github.com/zijiren233/gencontainer v0.0.0-20240331174346-b5e420773df7 + github.com/zijiren233/gencontainer v0.0.0-20240507135401-7a9c8355bb2c github.com/zijiren233/go-colorable v0.0.0-20230930131441-997304c961cb - github.com/zijiren233/go-uhc v0.2.3 + github.com/zijiren233/go-uhc v0.2.4 go.etcd.io/etcd/client/v3 v3.5.13 go.uber.org/automaxprocs v1.5.3 - golang.org/x/net v0.24.0 + golang.org/x/net v0.25.0 golang.org/x/oauth2 v0.17.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be + google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae google.golang.org/grpc v1.63.2 - google.golang.org/protobuf v1.33.0 + google.golang.org/protobuf v1.34.1 ) require ( github.com/andybalholm/brotli v1.1.0 // indirect github.com/armon/go-metrics v0.4.1 // indirect - github.com/cloudflare/circl v1.3.7 // indirect + github.com/cloudflare/circl v1.3.8 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/fatih/color v1.16.0 // indirect @@ -61,21 +62,21 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/refraction-networking/utls v1.6.4 // indirect + github.com/refraction-networking/utls v1.6.6 // indirect github.com/spf13/pflag v1.0.5 // indirect go.etcd.io/etcd/api/v3 v3.5.13 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.13 // indirect - go.opentelemetry.io/otel v1.25.0 // indirect - go.opentelemetry.io/otel/metric v1.25.0 // indirect - go.opentelemetry.io/otel/trace v1.25.0 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/metric v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240506185236-b8a5c65736ae // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 06f963d..6ce5c75 100644 --- a/go.sum +++ b/go.sum @@ -22,8 +22,8 @@ github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91 github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= +github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= @@ -50,14 +50,10 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kratos/aegis v0.2.0 h1:dObzCDWn3XVjUkgxyBp6ZeWtx/do0DPZ7LY3yNSJLUQ= github.com/go-kratos/aegis v0.2.0/go.mod h1:v0R2m73WgEEYB3XYu6aE2WcMwsZkJ/Rzuf5eVccm7bI= -github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240401040316-f715eb0bd808 h1:pwDJqw1LpGgnI3eeqcksdmcSAlfReDMb+cNdGCPlHsU= -github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240401040316-f715eb0bd808/go.mod h1:2dO01eHwztTovqoaig4CT368XQHks2ubQ6YwuR8moIc= -github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240416123913-75711092ab26 h1:1TLneqRRhT5zX27e/yoPZYcK5JOWmNo7Ns8+CGnbw+Y= -github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240416123913-75711092ab26/go.mod h1:2dO01eHwztTovqoaig4CT368XQHks2ubQ6YwuR8moIc= -github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240401040316-f715eb0bd808 h1:ySWd70Z7xy1IluuoqTp7TKkttAtBwQr4tAHOsnQCt7E= -github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240401040316-f715eb0bd808/go.mod h1:KEK+2OefNnaAriQQCdMYE8mlIYeDfcwqZfeuAV3mnOA= -github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240416123913-75711092ab26 h1:5t2DwY966qSeoieRbR1q31D6UsbZM+/JHt7YChjgvJU= -github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240416123913-75711092ab26/go.mod h1:KEK+2OefNnaAriQQCdMYE8mlIYeDfcwqZfeuAV3mnOA= +github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8 h1:uTpt/+092FZ0q0JeqGjim5ZConxuZHfTgSxMCuFp4k8= +github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20240504101732-d0d5761f9ca8/go.mod h1:2dO01eHwztTovqoaig4CT368XQHks2ubQ6YwuR8moIc= +github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240504101732-d0d5761f9ca8 h1:foOQBACCFqetrWK+GTw/du/ELNAuClYyXFCd6rZYWzQ= +github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20240504101732-d0d5761f9ca8/go.mod h1:6r/KzM6PQBKGZ8Fyq6eWCRDK46PEU96aFNloCwP57kA= github.com/go-kratos/kratos/v2 v2.7.3 h1:T9MS69qk4/HkVUuHw5GS9PDVnOfzn+kxyF0CL5StqxA= github.com/go-kratos/kratos/v2 v2.7.3/go.mod h1:CQZ7V0qyVPwrotIpS5VNNUJNzEbcyRUl5pRtxLOIvn4= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -229,8 +225,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/refraction-networking/utls v1.6.4 h1:aeynTroaYn7y+mFtqv8D0bQ4bw0y9nJHneGxJ7lvRDM= -github.com/refraction-networking/utls v1.6.4/go.mod h1:2VL2xfiqgFAZtJKeUTlf+PSYFs3Eu7km0gCtXJ3m8zs= +github.com/refraction-networking/utls v1.6.6 h1:igFsYBUJPYM8Rno9xUuDoM5GQrVEqY4llzEXOkL43Ig= +github.com/refraction-networking/utls v1.6.6/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -256,32 +252,34 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/studio-b12/gowebdav v0.9.0 h1:1j1sc9gQnNxbXXM4M/CebPOX4aXYtr7MojAVcN4dHjU= +github.com/studio-b12/gowebdav v0.9.0/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zencoder/go-dash/v3 v3.0.3 h1:xqwGJ2fJCSArwONGx6sY26Z1lxQ7zTURoxdRjCpuodM= github.com/zencoder/go-dash/v3 v3.0.3/go.mod h1:30R5bKy1aUYY45yesjtZ9l8trNc2TwNqbS17WVQmCzk= -github.com/zijiren233/gencontainer v0.0.0-20240331174346-b5e420773df7 h1:ymsEhM4NrTiZx/nyJb5CQRVOmdgZm6L6hHcRUErXYVQ= -github.com/zijiren233/gencontainer v0.0.0-20240331174346-b5e420773df7/go.mod h1:V5oL7PrZxgisuLCblFWd89Jg99O8vM1n58llcxZ2hDY= +github.com/zijiren233/gencontainer v0.0.0-20240507135401-7a9c8355bb2c h1:xpQLguenF4bPTrbtCz+kMHpDtUDFIn/iZKd4VRfxe3Y= +github.com/zijiren233/gencontainer v0.0.0-20240507135401-7a9c8355bb2c/go.mod h1:V5oL7PrZxgisuLCblFWd89Jg99O8vM1n58llcxZ2hDY= github.com/zijiren233/go-colorable v0.0.0-20230930131441-997304c961cb h1:0DyOxf/TbbGodHhOVHNoPk+7v/YBJACs22gKpKlatWw= github.com/zijiren233/go-colorable v0.0.0-20230930131441-997304c961cb/go.mod h1:6TCzjDiQ8+5gWZiwsC3pnA5M0vUy2jV2Y7ciHJh729g= -github.com/zijiren233/go-uhc v0.2.3 h1:mBtTqLpdFzGSmeSYYUn+y0w1J+qolVd8UoS6h6ROyUs= -github.com/zijiren233/go-uhc v0.2.3/go.mod h1:l2dNnc7TIB/P9aReV+rl+BsIH8H7SuN20jNm6g8ja0E= +github.com/zijiren233/go-uhc v0.2.4 h1:CrdLbnDXcqNaifiVBVbtMYwMGm9h4POwPfpBgKjyAPc= +github.com/zijiren233/go-uhc v0.2.4/go.mod h1:3c/6Vu2LoUFlyrKWkZgNEGCd04OjbehTIIkzg5KW4EE= go.etcd.io/etcd/api/v3 v3.5.13 h1:8WXU2/NBge6AUF1K1gOexB6e07NgsN1hXK0rSTtgSp4= go.etcd.io/etcd/api/v3 v3.5.13/go.mod h1:gBqlqkcMMZMVTMm4NDZloEVJzxQOQIls8splbqBDa0c= go.etcd.io/etcd/client/pkg/v3 v3.5.13 h1:RVZSAnWWWiI5IrYAXjQorajncORbS0zI48LQlE2kQWg= go.etcd.io/etcd/client/pkg/v3 v3.5.13/go.mod h1:XxHT4u1qU12E2+po+UVPrEeL94Um6zL58ppuJWXSAB8= go.etcd.io/etcd/client/v3 v3.5.13 h1:o0fHTNJLeO0MyVbc7I3fsCf6nrOqn5d+diSarKnB2js= go.etcd.io/etcd/client/v3 v3.5.13/go.mod h1:cqiAeY8b5DEEcpxvgWKsbLIWNM/8Wy2xJSDMtioMcoI= -go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k= -go.opentelemetry.io/otel v1.25.0/go.mod h1:Wa2ds5NOXEMkCmUou1WA7ZBfLTHWIsp034OVD7AO+Vg= -go.opentelemetry.io/otel/metric v1.25.0 h1:LUKbS7ArpFL/I2jJHdJcqMGxkRdxpPHE0VU/D4NuEwA= -go.opentelemetry.io/otel/metric v1.25.0/go.mod h1:rkDLUSd2lC5lq2dFNrX9LGAbINP5B7WBkC78RXCpH5s= +go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= +go.opentelemetry.io/otel v1.26.0/go.mod h1:UmLkJHUAidDval2EICqBMbnAd0/m2vmpf/dAM+fvFs4= +go.opentelemetry.io/otel/metric v1.26.0 h1:7S39CLuY5Jgg9CrnA9HHiEjGMF/X2VHvoXGgSllRz30= +go.opentelemetry.io/otel/metric v1.26.0/go.mod h1:SY+rHOI4cEawI9a7N1A4nIg/nTQXe1ccCNWYOJUrpX4= go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= -go.opentelemetry.io/otel/trace v1.25.0 h1:tqukZGLwQYRIFtSQM2u2+yfMVTgGVeqRLPUYx1Dq6RM= -go.opentelemetry.io/otel/trace v1.25.0/go.mod h1:hCCs70XM/ljO+BeQkyFnbK28SBIJ/Emuha+ccrCRT7I= +go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2LP5sQA= +go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -298,12 +296,10 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -324,8 +320,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -371,8 +367,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -388,8 +384,9 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -405,20 +402,16 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/api v0.0.0-20240412170617-26222e5d3d56 h1:KuFzeG+qPmpT8KpJXcrKAyeHhn64dgEICWlccP9qp0U= -google.golang.org/genproto/googleapis/api v0.0.0-20240412170617-26222e5d3d56/go.mod h1:wTHjrkbcS8AoQbb/0v9bFIPItZQPAsyVfgG9YPUhjAM= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= -google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240412170617-26222e5d3d56 h1:zviK8GX4VlMstrK3JkexM5UHjH1VOkRebH9y3jhSBGk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240412170617-26222e5d3d56/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= +google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae h1:AH34z6WAGVNkllnKs5raNq3yRq93VnjBG6rpfub/jYk= +google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae/go.mod h1:FfiGhwUm6CJviekPrc0oJ+7h29e+DmWU6UtjX0ZvI7Y= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240506185236-b8a5c65736ae h1:c55+MER4zkBS14uJhSZMGGmya0yJx5iHV4x/fpOSNRk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240506185236-b8a5c65736ae/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM= google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/server/all.go b/internal/server/all.go index 6ea4956..423480a 100644 --- a/internal/server/all.go +++ b/internal/server/all.go @@ -4,10 +4,12 @@ import ( alistApi "github.com/synctv-org/vendors/api/alist" bilibiliApi "github.com/synctv-org/vendors/api/bilibili" embyApi "github.com/synctv-org/vendors/api/emby" + webdavApi "github.com/synctv-org/vendors/api/webdav" "github.com/synctv-org/vendors/conf" "github.com/synctv-org/vendors/service/alist" "github.com/synctv-org/vendors/service/bilibili" "github.com/synctv-org/vendors/service/emby" + "github.com/synctv-org/vendors/service/webdav" "github.com/synctv-org/vendors/utils" ) @@ -16,6 +18,7 @@ func NewGRPCServer( bilibili *bilibili.BilibiliService, alist *alist.AlistService, emby *emby.EmbyService, + webdav *webdav.WebdavService, ) *utils.GrpcGatewayServer { ggs := utils.NewGrpcGatewayServer(config) gr := ggs.GrpcRegistrar() @@ -26,5 +29,7 @@ func NewGRPCServer( bilibiliApi.RegisterBilibiliHTTPServer(hr, bilibili) embyApi.RegisterEmbyServer(gr, emby) embyApi.RegisterEmbyHTTPServer(hr, emby) + webdavApi.RegisterWebdavServer(gr, webdav) + webdavApi.RegisterWebdavHTTPServer(hr, webdav) return ggs } diff --git a/openapi.yaml b/openapi.yaml index fd9caa4..8752ede 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -471,13 +471,13 @@ paths: /fs/get: post: tags: - - Alist - operationId: Alist_FsGet + - Webdav + operationId: Webdav_FsGet requestBody: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsGetReq' + $ref: '#/components/schemas/api.webdav.FsGetReq' required: true responses: "200": @@ -485,17 +485,17 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsGetResp' + $ref: '#/components/schemas/api.webdav.FsGetResp' /fs/list: post: tags: - - Alist - operationId: Alist_FsList + - Webdav + operationId: Webdav_FsList requestBody: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsListReq' + $ref: '#/components/schemas/api.webdav.FsListReq' required: true responses: "200": @@ -503,7 +503,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsListResp' + $ref: '#/components/schemas/api.webdav.FsListResp' /fs/other: post: tags: @@ -525,13 +525,13 @@ paths: /fs/search: post: tags: - - Alist - operationId: Alist_FsSearch + - Webdav + operationId: Webdav_FsSearch requestBody: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsSearchReq' + $ref: '#/components/schemas/api.webdav.FsSearchReq' required: true responses: "200": @@ -539,7 +539,25 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/api.alist.FsSearchResp' + $ref: '#/components/schemas/api.webdav.FsSearchResp' + /fs/test: + post: + tags: + - Webdav + operationId: Webdav_FsTest + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/api.webdav.FsTestReq' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/api.webdav.Empty' /me: get: tags: @@ -1376,7 +1394,112 @@ components: type: string id: type: string + api.webdav.Empty: + type: object + properties: {} + api.webdav.FsGetReq: + type: object + properties: + host: + type: string + username: + type: string + password: + type: string + path: + type: string + api.webdav.FsGetResp: + type: object + properties: + name: + type: string + size: + type: string + isDir: + type: boolean + modified: + type: string + api.webdav.FsListReq: + type: object + properties: + host: + type: string + username: + type: string + password: + type: string + path: + type: string + page: + type: string + perPage: + type: string + api.webdav.FsListResp: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/api.webdav.FsListResp_FsListContent' + total: + type: string + api.webdav.FsListResp_FsListContent: + type: object + properties: + name: + type: string + size: + type: string + isDir: + type: boolean + modified: + type: string + api.webdav.FsSearchReq: + type: object + properties: + host: + type: string + username: + type: string + password: + type: string + path: + type: string + keywords: + type: string + page: + type: string + perPage: + type: string + api.webdav.FsSearchResp: + type: object + properties: + content: + type: array + items: + $ref: '#/components/schemas/api.webdav.FsSearchResp_FsSearchContent' + total: + type: string + api.webdav.FsSearchResp_FsSearchContent: + type: object + properties: + name: + type: string + isDir: + type: boolean + size: + type: string + api.webdav.FsTestReq: + type: object + properties: + host: + type: string + username: + type: string + password: + type: string tags: - name: Alist - name: Bilibili - name: Emby + - name: Webdav diff --git a/service/all.go b/service/all.go index 66a99f9..acb90ac 100644 --- a/service/all.go +++ b/service/all.go @@ -5,7 +5,13 @@ import ( "github.com/synctv-org/vendors/service/alist" "github.com/synctv-org/vendors/service/bilibili" "github.com/synctv-org/vendors/service/emby" + "github.com/synctv-org/vendors/service/webdav" ) // ProviderSet is service providers. -var ProviderSet = wire.NewSet(bilibili.NewBilibiliService, alist.NewAlistService, emby.NewEmbyService) +var ProviderSet = wire.NewSet( + bilibili.NewBilibiliService, + alist.NewAlistService, + emby.NewEmbyService, + webdav.NewWebdavService, +) diff --git a/service/webdav/service.go b/service/webdav/service.go new file mode 100644 index 0000000..372fff7 --- /dev/null +++ b/service/webdav/service.go @@ -0,0 +1,6 @@ +package webdav + +import "github.com/google/wire" + +// ProviderSet is service providers. +var ProviderSet = wire.NewSet(NewWebdavService) diff --git a/service/webdav/webdav.go b/service/webdav/webdav.go new file mode 100644 index 0000000..3fbafb8 --- /dev/null +++ b/service/webdav/webdav.go @@ -0,0 +1,74 @@ +package webdav + +import ( + "context" + "errors" + + "github.com/studio-b12/gowebdav" + pb "github.com/synctv-org/vendors/api/webdav" + "github.com/synctv-org/vendors/conf" + "github.com/zijiren233/go-uhc" +) + +type WebdavService struct { + pb.UnimplementedWebdavServer +} + +func NewWebdavService(c *conf.WebdavConfig) *WebdavService { + return &WebdavService{} +} + +func (a *WebdavService) FsTest(ctx context.Context, req *pb.FsTestReq) (*pb.Empty, error) { + cli := gowebdav.NewClient(req.Host, req.Username, req.Password) + cli.SetTransport(uhc.DefaultTransport) + return nil, cli.Connect() +} + +func (a *WebdavService) FsGet(ctx context.Context, req *pb.FsGetReq) (*pb.FsGetResp, error) { + cli := gowebdav.NewClient(req.Host, req.Username, req.Password) + cli.SetTransport(uhc.DefaultTransport) + info, err := cli.Stat(req.Path) + if err != nil { + return nil, err + } + return &pb.FsGetResp{ + Name: info.Name(), + Size: info.Size(), + IsDir: info.IsDir(), + Modified: info.ModTime().UnixMilli(), + }, nil +} + +func (a *WebdavService) FsList(ctx context.Context, req *pb.FsListReq) (*pb.FsListResp, error) { + cli := gowebdav.NewClient(req.Host, req.Username, req.Password) + cli.SetTransport(uhc.DefaultTransport) + infos, err := cli.ReadDir(req.Path) + if err != nil { + return nil, err + } + var items []*pb.FsListResp_FsListContent = make([]*pb.FsListResp_FsListContent, 0, req.PerPage) + var low, high int + low, high = int(req.Page-1)*int(req.PerPage), int(req.Page)*int(req.PerPage) + if low > len(infos) { + low = len(infos) + } + if high > len(infos) { + high = len(infos) + } + for _, info := range infos[low:high] { + items = append(items, &pb.FsListResp_FsListContent{ + Name: info.Name(), + Size: info.Size(), + IsDir: info.IsDir(), + Modified: info.ModTime().UnixMilli(), + }) + } + return &pb.FsListResp{ + Content: items, + Total: uint64(len(infos)), + }, nil +} + +func (a *WebdavService) FsSearch(ctx context.Context, req *pb.FsSearchReq) (*pb.FsSearchResp, error) { + return nil, errors.New("not implemented") +}