diff --git a/etc/anytype-publish-server.yml b/etc/anytype-publish-server.yml index 6d2410d..7527199 100644 --- a/etc/anytype-publish-server.yml +++ b/etc/anytype-publish-server.yml @@ -18,6 +18,13 @@ publish: uploadUrlPrefix: "http://127.0.0.1:8383/api/upload" httpApiAddr: ":8383" cleanupOn: true + # Limits and URL templates returned to clients. Defaults are used if omitted. + # membershipLimit: 6291456000 # 6000 MB in bytes + # defaultLimit: 10485760 # 10 MB in bytes + # baseUrlTemplate: "https://any.coop/%s" + # inviteLinkUrlTemplate: "https://invite.any.coop/%s#%s" + # memberUrlTemplate: "https://%s.org" + # indexFileName: "index.json.gz" gateway: addr: ":8380" publishFilesUrl: "https://anytype-gobackend-test.s3.eu-central-1.amazonaws.com" diff --git a/go.mod b/go.mod index b0a8d3a..0d271ad 100644 --- a/go.mod +++ b/go.mod @@ -9,11 +9,11 @@ require ( github.com/anyproto/any-sync v0.11.14 github.com/anyproto/anytype-publish-renderer v0.3.24 github.com/anyproto/anytype-publish-server/publishclient v0.0.0-20250716122732-cdcfe3a126bb - github.com/aws/aws-sdk-go-v2 v1.40.0 + github.com/aws/aws-sdk-go-v2 v1.41.5 github.com/aws/aws-sdk-go-v2/config v1.29.14 github.com/aws/aws-sdk-go-v2/credentials v1.17.67 - github.com/aws/aws-sdk-go-v2/service/s3 v1.71.0 - github.com/aws/smithy-go v1.23.2 + github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 + github.com/aws/smithy-go v1.24.2 github.com/golang/snappy v1.0.0 github.com/google/uuid v1.6.0 github.com/redis/go-redis/v9 v9.17.0 @@ -33,16 +33,16 @@ require ( github.com/anyproto/go-slip10 v1.0.1 // indirect github.com/anyproto/go-slip21 v1.0.0 // indirect github.com/anyproto/go-sqlite v1.4.2-any // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.30.5 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.10 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.41.2 // indirect diff --git a/go.sum b/go.sum index 3247c22..0291614 100644 --- a/go.sum +++ b/go.sum @@ -29,8 +29,12 @@ github.com/anyproto/go-sqlite v1.4.2-any h1:ZTIcq/u2mYYJ6rJB4I3Ds5QH/7IlONebMiG1 github.com/anyproto/go-sqlite v1.4.2-any/go.mod h1:nW7TvS+4bzPU2vNaPlPFNPYcejK5RdjH6qZY2kjT3Io= github.com/aws/aws-sdk-go-v2 v1.40.0 h1:/WMUA0kjhZExjOQN2z3oLALDREea1A7TobfuiBrKlwc= github.com/aws/aws-sdk-go-v2 v1.40.0/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE= +github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY= +github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 h1:DHctwEM8P8iTXFxC/QK0MRjwEpWQeM9yzidCRjldUz0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3/go.mod h1:xdCzcZEtnSTKVDOmUZs4l/j3pSV6rpo1WXl5ugNsL8Y= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI= github.com/aws/aws-sdk-go-v2/config v1.29.14 h1:f+eEi/2cKCg9pqKBoAIwRGzVb70MRKqWX4dg1BDcSJM= github.com/aws/aws-sdk-go-v2/config v1.29.14/go.mod h1:wVPHWcIFv3WO89w0rE10gzf17ZYy+UVS1Geq8Iei34g= github.com/aws/aws-sdk-go-v2/credentials v1.17.67 h1:9KxtdcIA/5xPNQyZRgUSpYOE6j9Bc4+D7nZua0KGYOM= @@ -39,22 +43,38 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 h1:WZVR5DbDgxzA0BJeudId89 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14/go.mod h1:Dadl9QO0kHgbrH1GRqGiZdYtW5w+IXXaBNCHTIaheM4= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 h1:PZHqQACxYb8mYgms4RZbhZG0a7dPW06xOjmaH0EJC/I= github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14/go.mod h1:VymhrMJUWs69D8u0/lZ7jSB6WgaG/NqHi3gX0aYf6U0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 h1:bOS19y6zlJwagBfHxs0ESzr1XCOU2KXJCWcq3E2vfjY= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14/go.mod h1:1ipeGBMAxZ0xcTm6y6paC2C/J6f6OO7LBODV9afuAyM= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14 h1:ITi7qiDSv/mSGDSWNpZ4k4Ve0DQR6Ug2SJQ8zEHoDXg= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.14/go.mod h1:k1xtME53H1b6YpZt74YmwlONMWf4ecM+lut1WQLAF/U= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 h1:rWyie/PxDRIdhNf4DzRk0lvjVOqFJuNnO8WwaIRVxzQ= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22/go.mod h1:zd/JsJ4P7oGfUhXn1VyLqaRZwPmZwg44Jf2dS84Dm3Y= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5 h1:Hjkh7kE6D81PgrHlE/m9gx+4TyyeLHuY8xJs7yXN5C4= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.5/go.mod h1:nPRXgyCfAurhyaTMoBMwRBYBhaHI4lNPAnJmjM0Tslc= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 h1:JRaIgADQS/U6uXDqlPiefP32yXTda7Kqfx+LgspooZM= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13/go.mod h1:CEuVn5WqOMilYl+tbccq8+N2ieCy0gVn3OtRb0vBNNM= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 h1:FIouAnCE46kyYqyhs0XEBDFFSREtdnr8HQuLPQPLCrY= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14/go.mod h1:UTwDc5COa5+guonQU8qBikJo1ZJ4ln2r1MkF7Dqag1E= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14 h1:FzQE21lNtUor0Fb7QNgnEyiRCBlolLTX/Z1j65S7teM= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.14/go.mod h1:s1ydyWG9pm3ZwmmYN21HKyG9WzAZhYVW85wMHs5FV6w= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 h1:ZlvrNcHSFFWURB8avufQq9gFsheUgjVD9536obIknfM= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21/go.mod h1:cv3TNhVrssKR0O/xxLJVRfd2oazSnZnkUeTf6ctUwfQ= github.com/aws/aws-sdk-go-v2/service/s3 v1.71.0 h1:nyuzXooUNJexRT0Oy0UQY6AhOzxPxhtt4DcBIHyCnmw= github.com/aws/aws-sdk-go-v2/service/s3 v1.71.0/go.mod h1:sT/iQz8JK3u/5gZkT+Hmr7GzVZehUMkRZpOaAwYXeGY= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 h1:HwxWTbTrIHm5qY+CAEur0s/figc3qwvLWsNkF4RPToo= +github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3/go.mod h1:uoA43SdFwacedBfSgfFSjjCvYe8aYBS7EnU5GZ/YKMM= github.com/aws/aws-sdk-go-v2/service/sso v1.30.5 h1:ksUT5KtgpZd3SAiFJNJ0AFEJVva3gjBmN7eXUZjzUwQ= github.com/aws/aws-sdk-go-v2/service/sso v1.30.5/go.mod h1:av+ArJpoYf3pgyrj6tcehSFW+y9/QvAY8kMooR9bZCw= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.10 h1:GtsxyiF3Nd3JahRBJbxLCCdYW9ltGQYrFWg8XdkGDd8= @@ -63,6 +83,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.41.2 h1:a5UTtD4mHBU3t0o6aHQZFJTNKVfx github.com/aws/aws-sdk-go-v2/service/sts v1.41.2/go.mod h1:6TxbXoDSgBQ225Qd8Q+MbxUxUh6TtNKwbRt/EPS9xso= github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM= github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= +github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= +github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= diff --git a/publish/config.go b/publish/config.go index 5a8b5e5..82819b9 100644 --- a/publish/config.go +++ b/publish/config.go @@ -4,8 +4,23 @@ type configGetter interface { GetPublish() Config } +const ( + DefaultMembershipLimit = int64(6000 << 20) + DefaultDefaultLimit = int64(10 << 20) + DefaultBaseUrlTemplate = "https://any.coop/%s" + DefaultInviteLinkUrlTemplate = "https://invite.any.coop/%s#%s" + DefaultMemberUrlTemplate = "https://%s.org" + DefaultIndexFileName = "index.json.gz" +) + type Config struct { - UploadUrlPrefix string `yaml:"uploadUrlPrefix"` - HttpApiAddr string `yaml:"httpApiAddr"` - CleanupOn bool `yaml:"cleanupOn"` + UploadUrlPrefix string `yaml:"uploadUrlPrefix"` + HttpApiAddr string `yaml:"httpApiAddr"` + CleanupOn bool `yaml:"cleanupOn"` + MembershipLimit int64 `yaml:"membershipLimit"` + DefaultLimit int64 `yaml:"defaultLimit"` + BaseUrlTemplate string `yaml:"baseUrlTemplate"` + InviteLinkUrlTemplate string `yaml:"inviteLinkUrlTemplate"` + MemberUrlTemplate string `yaml:"memberUrlTemplate"` + IndexFileName string `yaml:"indexFileName"` } diff --git a/publish/handler.go b/publish/handler.go index 7f892c0..f1f8ae7 100644 --- a/publish/handler.go +++ b/publish/handler.go @@ -17,6 +17,52 @@ import ( var _ publishapi.DRPCWebPublisherServer = (*rpcHandler)(nil) +func (r rpcHandler) GetConfig(ctx context.Context, _ *publishapi.GetConfigRequest) (resp *publishapi.GetConfigResponse, err error) { + st := time.Now() + defer func() { + r.s.metric.RequestLog(ctx, "publish.getConfig", + metric.TotalDur(time.Since(st)), + zap.String("addr", peer.CtxPeerAddr(ctx)), + zap.Error(err), + ) + }() + + cfg := r.s.config + membershipLimit := cfg.MembershipLimit + if membershipLimit == 0 { + membershipLimit = DefaultMembershipLimit + } + defaultLimit := cfg.DefaultLimit + if defaultLimit == 0 { + defaultLimit = DefaultDefaultLimit + } + baseUrlTemplate := cfg.BaseUrlTemplate + if baseUrlTemplate == "" { + baseUrlTemplate = DefaultBaseUrlTemplate + } + inviteLinkUrlTemplate := cfg.InviteLinkUrlTemplate + if inviteLinkUrlTemplate == "" { + inviteLinkUrlTemplate = DefaultInviteLinkUrlTemplate + } + memberUrlTemplate := cfg.MemberUrlTemplate + if memberUrlTemplate == "" { + memberUrlTemplate = DefaultMemberUrlTemplate + } + indexFileName := cfg.IndexFileName + if indexFileName == "" { + indexFileName = DefaultIndexFileName + } + + return &publishapi.GetConfigResponse{ + MembershipLimit: membershipLimit, + DefaultLimit: defaultLimit, + BaseUrlTemplate: baseUrlTemplate, + InviteLinkUrlTemplate: inviteLinkUrlTemplate, + MemberUrlTemplate: memberUrlTemplate, + IndexFileName: indexFileName, + }, nil +} + type rpcHandler struct { s *publishService } diff --git a/publishclient/client.go b/publishclient/client.go index bc36173..18ac6d0 100644 --- a/publishclient/client.go +++ b/publishclient/client.go @@ -10,6 +10,7 @@ import ( "path/filepath" "github.com/anyproto/any-sync/app" + "github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/net/peerservice" "github.com/anyproto/any-sync/net/pool" "github.com/anyproto/any-sync/net/rpc/rpcerr" @@ -19,6 +20,8 @@ import ( "github.com/anyproto/anytype-publish-server/publishclient/publishapi" ) +var log = logger.NewNamed(CName) + func New() Client { return new(publishClient) } @@ -28,6 +31,7 @@ const CName = "publish.client" type Client interface { app.Component ResolveUri(ctx context.Context, uri string) (publish *publishapi.Publish, err error) + GetPublishConfig(ctx context.Context, req *publishapi.GetConfigRequest) (resp *publishapi.GetConfigResponse, err error) GetPublishStatus(ctx context.Context, spaceId, objectId string) (publish *publishapi.Publish, err error) Publish(ctx context.Context, req *publishapi.PublishRequest) (uploadUrl string, err error) UnPublish(ctx context.Context, req *publishapi.UnPublishRequest) (err error) @@ -36,9 +40,10 @@ type Client interface { } type publishClient struct { - pool pool.Pool - peerService peerservice.PeerService - peerIds []string + pool pool.Pool + peerService peerservice.PeerService + peerIds []string + publishConfig *publishapi.GetConfigResponse } func (p *publishClient) Init(a *app.App) (err error) { @@ -56,6 +61,17 @@ func (p *publishClient) Name() (name string) { return CName } +func (p *publishClient) GetPublishConfig(ctx context.Context, req *publishapi.GetConfigRequest) (resp *publishapi.GetConfigResponse, err error) { + err = p.doClient(ctx, func(c publishapi.DRPCWebPublisherClient) (err error) { + resp, err = c.GetConfig(ctx, req) + if err != nil { + err = rpcerr.Unwrap(err) + } + return + }) + return +} + func (p *publishClient) ResolveUri(ctx context.Context, uri string) (publish *publishapi.Publish, err error) { var resp *publishapi.ResolveUriResponse err = p.doClient(ctx, func(c publishapi.DRPCWebPublisherClient) (err error) { diff --git a/publishclient/publishapi/protos/publisher.proto b/publishclient/publishapi/protos/publisher.proto index 0114f2f..8c95424 100644 --- a/publishclient/publishapi/protos/publisher.proto +++ b/publishclient/publishapi/protos/publisher.proto @@ -24,6 +24,7 @@ service WebPublisher { rpc Publish(PublishRequest) returns (PublishResponse); rpc UnPublish(UnPublishRequest) returns (Ok); rpc ListPublishes(ListPublishesRequest) returns (ListPublishesResponse); + rpc GetConfig(GetConfigRequest) returns (GetConfigResponse); } message ResolveUriRequest { @@ -78,3 +79,14 @@ message ListPublishesRequest { message ListPublishesResponse { repeated Publish publishes = 1; } + +message GetConfigRequest {} + +message GetConfigResponse { + int64 membershipLimit = 1; + int64 defaultLimit = 2; + string baseUrlTemplate = 3; + string inviteLinkUrlTemplate = 4; + string memberUrlTemplate = 5; + string indexFileName = 6; +} diff --git a/publishclient/publishapi/publisher.pb.go b/publishclient/publishapi/publisher.pb.go index fe6d6ed..64c2282 100644 --- a/publishclient/publishapi/publisher.pb.go +++ b/publishclient/publishapi/publisher.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.6 -// protoc v3.21.12 +// protoc-gen-go v1.36.11 +// protoc v7.34.1 // source: publishclient/publishapi/protos/publisher.proto package publishapi @@ -688,6 +688,126 @@ func (x *ListPublishesResponse) GetPublishes() []*Publish { return nil } +type GetConfigRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConfigRequest) Reset() { + *x = GetConfigRequest{} + mi := &file_publishclient_publishapi_protos_publisher_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigRequest) ProtoMessage() {} + +func (x *GetConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_publishclient_publishapi_protos_publisher_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConfigRequest.ProtoReflect.Descriptor instead. +func (*GetConfigRequest) Descriptor() ([]byte, []int) { + return file_publishclient_publishapi_protos_publisher_proto_rawDescGZIP(), []int{11} +} + +type GetConfigResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + MembershipLimit int64 `protobuf:"varint,1,opt,name=membershipLimit,proto3" json:"membershipLimit,omitempty"` + DefaultLimit int64 `protobuf:"varint,2,opt,name=defaultLimit,proto3" json:"defaultLimit,omitempty"` + BaseUrlTemplate string `protobuf:"bytes,3,opt,name=baseUrlTemplate,proto3" json:"baseUrlTemplate,omitempty"` + InviteLinkUrlTemplate string `protobuf:"bytes,4,opt,name=inviteLinkUrlTemplate,proto3" json:"inviteLinkUrlTemplate,omitempty"` + MemberUrlTemplate string `protobuf:"bytes,5,opt,name=memberUrlTemplate,proto3" json:"memberUrlTemplate,omitempty"` + IndexFileName string `protobuf:"bytes,6,opt,name=indexFileName,proto3" json:"indexFileName,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConfigResponse) Reset() { + *x = GetConfigResponse{} + mi := &file_publishclient_publishapi_protos_publisher_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConfigResponse) ProtoMessage() {} + +func (x *GetConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_publishclient_publishapi_protos_publisher_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConfigResponse.ProtoReflect.Descriptor instead. +func (*GetConfigResponse) Descriptor() ([]byte, []int) { + return file_publishclient_publishapi_protos_publisher_proto_rawDescGZIP(), []int{12} +} + +func (x *GetConfigResponse) GetMembershipLimit() int64 { + if x != nil { + return x.MembershipLimit + } + return 0 +} + +func (x *GetConfigResponse) GetDefaultLimit() int64 { + if x != nil { + return x.DefaultLimit + } + return 0 +} + +func (x *GetConfigResponse) GetBaseUrlTemplate() string { + if x != nil { + return x.BaseUrlTemplate + } + return "" +} + +func (x *GetConfigResponse) GetInviteLinkUrlTemplate() string { + if x != nil { + return x.InviteLinkUrlTemplate + } + return "" +} + +func (x *GetConfigResponse) GetMemberUrlTemplate() string { + if x != nil { + return x.MemberUrlTemplate + } + return "" +} + +func (x *GetConfigResponse) GetIndexFileName() string { + if x != nil { + return x.IndexFileName + } + return "" +} + var File_publishclient_publishapi_protos_publisher_proto protoreflect.FileDescriptor const file_publishclient_publishapi_protos_publisher_proto_rawDesc = "" + @@ -724,7 +844,15 @@ const file_publishclient_publishapi_protos_publisher_proto_rawDesc = "" + "\x14ListPublishesRequest\x12\x18\n" + "\aspaceId\x18\x01 \x01(\tR\aspaceId\"F\n" + "\x15ListPublishesResponse\x12-\n" + - "\tpublishes\x18\x01 \x03(\v2\x0f.client.PublishR\tpublishes*^\n" + + "\tpublishes\x18\x01 \x03(\v2\x0f.client.PublishR\tpublishes\"\x12\n" + + "\x10GetConfigRequest\"\x95\x02\n" + + "\x11GetConfigResponse\x12(\n" + + "\x0fmembershipLimit\x18\x01 \x01(\x03R\x0fmembershipLimit\x12\"\n" + + "\fdefaultLimit\x18\x02 \x01(\x03R\fdefaultLimit\x12(\n" + + "\x0fbaseUrlTemplate\x18\x03 \x01(\tR\x0fbaseUrlTemplate\x124\n" + + "\x15inviteLinkUrlTemplate\x18\x04 \x01(\tR\x15inviteLinkUrlTemplate\x12,\n" + + "\x11memberUrlTemplate\x18\x05 \x01(\tR\x11memberUrlTemplate\x12$\n" + + "\rindexFileName\x18\x06 \x01(\tR\rindexFileName*^\n" + "\bErrCodes\x12\x0e\n" + "\n" + "Unexpected\x10\x00\x12\f\n" + @@ -734,7 +862,7 @@ const file_publishclient_publishapi_protos_publisher_proto_rawDesc = "" + "\vErrorOffset\x10\xcc\b*E\n" + "\rPublishStatus\x12\x18\n" + "\x14PublishStatusCreated\x10\x00\x12\x1a\n" + - "\x16PublishStatusPublished\x10\x012\xe7\x02\n" + + "\x16PublishStatusPublished\x10\x012\xa9\x03\n" + "\fWebPublisher\x12C\n" + "\n" + "ResolveUri\x12\x19.client.ResolveUriRequest\x1a\x1a.client.ResolveUriResponse\x12U\n" + @@ -742,7 +870,8 @@ const file_publishclient_publishapi_protos_publisher_proto_rawDesc = "" + "\aPublish\x12\x16.client.PublishRequest\x1a\x17.client.PublishResponse\x121\n" + "\tUnPublish\x12\x18.client.UnPublishRequest\x1a\n" + ".client.Ok\x12L\n" + - "\rListPublishes\x12\x1c.client.ListPublishesRequest\x1a\x1d.client.ListPublishesResponseB\x1aZ\x18publishclient/publishapib\x06proto3" + "\rListPublishes\x12\x1c.client.ListPublishesRequest\x1a\x1d.client.ListPublishesResponse\x12@\n" + + "\tGetConfig\x12\x18.client.GetConfigRequest\x1a\x19.client.GetConfigResponseB\x1aZ\x18publishclient/publishapib\x06proto3" var ( file_publishclient_publishapi_protos_publisher_proto_rawDescOnce sync.Once @@ -757,7 +886,7 @@ func file_publishclient_publishapi_protos_publisher_proto_rawDescGZIP() []byte { } var file_publishclient_publishapi_protos_publisher_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_publishclient_publishapi_protos_publisher_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_publishclient_publishapi_protos_publisher_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_publishclient_publishapi_protos_publisher_proto_goTypes = []any{ (ErrCodes)(0), // 0: client.ErrCodes (PublishStatus)(0), // 1: client.PublishStatus @@ -772,6 +901,8 @@ var file_publishclient_publishapi_protos_publisher_proto_goTypes = []any{ (*UnPublishRequest)(nil), // 10: client.UnPublishRequest (*ListPublishesRequest)(nil), // 11: client.ListPublishesRequest (*ListPublishesResponse)(nil), // 12: client.ListPublishesResponse + (*GetConfigRequest)(nil), // 13: client.GetConfigRequest + (*GetConfigResponse)(nil), // 14: client.GetConfigResponse } var file_publishclient_publishapi_protos_publisher_proto_depIdxs = []int32{ 4, // 0: client.ResolveUriResponse.publish:type_name -> client.Publish @@ -783,13 +914,15 @@ var file_publishclient_publishapi_protos_publisher_proto_depIdxs = []int32{ 8, // 6: client.WebPublisher.Publish:input_type -> client.PublishRequest 10, // 7: client.WebPublisher.UnPublish:input_type -> client.UnPublishRequest 11, // 8: client.WebPublisher.ListPublishes:input_type -> client.ListPublishesRequest - 3, // 9: client.WebPublisher.ResolveUri:output_type -> client.ResolveUriResponse - 7, // 10: client.WebPublisher.GetPublishStatus:output_type -> client.GetPublishStatusResponse - 9, // 11: client.WebPublisher.Publish:output_type -> client.PublishResponse - 5, // 12: client.WebPublisher.UnPublish:output_type -> client.Ok - 12, // 13: client.WebPublisher.ListPublishes:output_type -> client.ListPublishesResponse - 9, // [9:14] is the sub-list for method output_type - 4, // [4:9] is the sub-list for method input_type + 13, // 9: client.WebPublisher.GetConfig:input_type -> client.GetConfigRequest + 3, // 10: client.WebPublisher.ResolveUri:output_type -> client.ResolveUriResponse + 7, // 11: client.WebPublisher.GetPublishStatus:output_type -> client.GetPublishStatusResponse + 9, // 12: client.WebPublisher.Publish:output_type -> client.PublishResponse + 5, // 13: client.WebPublisher.UnPublish:output_type -> client.Ok + 12, // 14: client.WebPublisher.ListPublishes:output_type -> client.ListPublishesResponse + 14, // 15: client.WebPublisher.GetConfig:output_type -> client.GetConfigResponse + 10, // [10:16] is the sub-list for method output_type + 4, // [4:10] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name @@ -806,7 +939,7 @@ func file_publishclient_publishapi_protos_publisher_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_publishclient_publishapi_protos_publisher_proto_rawDesc), len(file_publishclient_publishapi_protos_publisher_proto_rawDesc)), NumEnums: 2, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 1, }, diff --git a/publishclient/publishapi/publisher_drpc.pb.go b/publishclient/publishapi/publisher_drpc.pb.go index d3c2482..bf5c34d 100644 --- a/publishclient/publishapi/publisher_drpc.pb.go +++ b/publishclient/publishapi/publisher_drpc.pb.go @@ -38,6 +38,7 @@ type DRPCWebPublisherClient interface { Publish(ctx context.Context, in *PublishRequest) (*PublishResponse, error) UnPublish(ctx context.Context, in *UnPublishRequest) (*Ok, error) ListPublishes(ctx context.Context, in *ListPublishesRequest) (*ListPublishesResponse, error) + GetConfig(ctx context.Context, in *GetConfigRequest) (*GetConfigResponse, error) } type drpcWebPublisherClient struct { @@ -95,12 +96,22 @@ func (c *drpcWebPublisherClient) ListPublishes(ctx context.Context, in *ListPubl return out, nil } +func (c *drpcWebPublisherClient) GetConfig(ctx context.Context, in *GetConfigRequest) (*GetConfigResponse, error) { + out := new(GetConfigResponse) + err := c.cc.Invoke(ctx, "/client.WebPublisher/GetConfig", drpcEncoding_File_publishclient_publishapi_protos_publisher_proto{}, in, out) + if err != nil { + return nil, err + } + return out, nil +} + type DRPCWebPublisherServer interface { ResolveUri(context.Context, *ResolveUriRequest) (*ResolveUriResponse, error) GetPublishStatus(context.Context, *GetPublishStatusRequest) (*GetPublishStatusResponse, error) Publish(context.Context, *PublishRequest) (*PublishResponse, error) UnPublish(context.Context, *UnPublishRequest) (*Ok, error) ListPublishes(context.Context, *ListPublishesRequest) (*ListPublishesResponse, error) + GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error) } type DRPCWebPublisherUnimplementedServer struct{} @@ -125,9 +136,13 @@ func (s *DRPCWebPublisherUnimplementedServer) ListPublishes(context.Context, *Li return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) } +func (s *DRPCWebPublisherUnimplementedServer) GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error) { + return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) +} + type DRPCWebPublisherDescription struct{} -func (DRPCWebPublisherDescription) NumMethods() int { return 5 } +func (DRPCWebPublisherDescription) NumMethods() int { return 6 } func (DRPCWebPublisherDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { switch n { @@ -176,6 +191,15 @@ func (DRPCWebPublisherDescription) Method(n int) (string, drpc.Encoding, drpc.Re in1.(*ListPublishesRequest), ) }, DRPCWebPublisherServer.ListPublishes, true + case 5: + return "/client.WebPublisher/GetConfig", drpcEncoding_File_publishclient_publishapi_protos_publisher_proto{}, + func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { + return srv.(DRPCWebPublisherServer). + GetConfig( + ctx, + in1.(*GetConfigRequest), + ) + }, DRPCWebPublisherServer.GetConfig, true default: return "", nil, nil, nil, false } @@ -264,3 +288,19 @@ func (x *drpcWebPublisher_ListPublishesStream) SendAndClose(m *ListPublishesResp } return x.CloseSend() } + +type DRPCWebPublisher_GetConfigStream interface { + drpc.Stream + SendAndClose(*GetConfigResponse) error +} + +type drpcWebPublisher_GetConfigStream struct { + drpc.Stream +} + +func (x *drpcWebPublisher_GetConfigStream) SendAndClose(m *GetConfigResponse) error { + if err := x.MsgSend(m, drpcEncoding_File_publishclient_publishapi_protos_publisher_proto{}); err != nil { + return err + } + return x.CloseSend() +} diff --git a/publishclient/publishapi/publisher_vtproto.pb.go b/publishclient/publishapi/publisher_vtproto.pb.go index a7e6c66..10a38be 100644 --- a/publishclient/publishapi/publisher_vtproto.pb.go +++ b/publishclient/publishapi/publisher_vtproto.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 +// protoc-gen-go-vtproto version: v0.6.1-0.20250313105119-ba97887b0a25 // source: publishclient/publishapi/protos/publisher.proto package publishapi @@ -533,6 +533,110 @@ func (m *ListPublishesResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *GetConfigRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetConfigRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetConfigRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *GetConfigResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetConfigResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetConfigResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.IndexFileName) > 0 { + i -= len(m.IndexFileName) + copy(dAtA[i:], m.IndexFileName) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.IndexFileName))) + i-- + dAtA[i] = 0x32 + } + if len(m.MemberUrlTemplate) > 0 { + i -= len(m.MemberUrlTemplate) + copy(dAtA[i:], m.MemberUrlTemplate) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.MemberUrlTemplate))) + i-- + dAtA[i] = 0x2a + } + if len(m.InviteLinkUrlTemplate) > 0 { + i -= len(m.InviteLinkUrlTemplate) + copy(dAtA[i:], m.InviteLinkUrlTemplate) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.InviteLinkUrlTemplate))) + i-- + dAtA[i] = 0x22 + } + if len(m.BaseUrlTemplate) > 0 { + i -= len(m.BaseUrlTemplate) + copy(dAtA[i:], m.BaseUrlTemplate) + i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.BaseUrlTemplate))) + i-- + dAtA[i] = 0x1a + } + if m.DefaultLimit != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.DefaultLimit)) + i-- + dAtA[i] = 0x10 + } + if m.MembershipLimit != 0 { + i = protohelpers.EncodeVarint(dAtA, i, uint64(m.MembershipLimit)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *ResolveUriRequest) SizeVT() (n int) { if m == nil { return 0 @@ -726,6 +830,48 @@ func (m *ListPublishesResponse) SizeVT() (n int) { return n } +func (m *GetConfigRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *GetConfigResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MembershipLimit != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.MembershipLimit)) + } + if m.DefaultLimit != 0 { + n += 1 + protohelpers.SizeOfVarint(uint64(m.DefaultLimit)) + } + l = len(m.BaseUrlTemplate) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.InviteLinkUrlTemplate) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.MemberUrlTemplate) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + l = len(m.IndexFileName) + if l > 0 { + n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *ResolveUriRequest) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1930,3 +2076,271 @@ func (m *ListPublishesResponse) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *GetConfigRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetConfigRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetConfigRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetConfigResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MembershipLimit", wireType) + } + m.MembershipLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MembershipLimit |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultLimit", wireType) + } + m.DefaultLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DefaultLimit |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseUrlTemplate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseUrlTemplate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InviteLinkUrlTemplate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InviteLinkUrlTemplate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MemberUrlTemplate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MemberUrlTemplate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IndexFileName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protohelpers.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protohelpers.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protohelpers.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IndexFileName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protohelpers.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protohelpers.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +}