add security

This commit is contained in:
2026-07-27 22:13:19 +07:00
parent 8b56aa7096
commit 10b3d450e9
4 changed files with 52 additions and 9 deletions
+3 -1
View File
@@ -806,6 +806,7 @@ message GiveTeamApplicationsRsp {
message GetTeamActionsReq { message GetTeamActionsReq {
int64 id = 1; int64 id = 1;
string password = 2;
} }
message GetTeamActionsRsp { message GetTeamActionsRsp {
@@ -815,7 +816,8 @@ message GetTeamActionsRsp {
message AddTeamActionReq { message AddTeamActionReq {
int64 id = 1; int64 id = 1;
string code = 2; string password = 2;
string code = 3;
} }
message AddTeamActionRsp { message AddTeamActionRsp {
@@ -927,6 +927,12 @@
"required": true, "required": true,
"type": "string", "type": "string",
"format": "int64" "format": "int64"
},
{
"name": "password",
"in": "query",
"required": false,
"type": "string"
} }
], ],
"tags": [ "tags": [
@@ -1280,6 +1286,9 @@
"EveningDetectiveServerAddTeamActionBody": { "EveningDetectiveServerAddTeamActionBody": {
"type": "object", "type": "object",
"properties": { "properties": {
"password": {
"type": "string"
},
"code": { "code": {
"type": "string" "type": "string"
} }
+24 -6
View File
@@ -3860,6 +3860,7 @@ func (x *GiveTeamApplicationsRsp) GetError() string {
type GetTeamActionsReq struct { type GetTeamActionsReq struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -3901,6 +3902,13 @@ func (x *GetTeamActionsReq) GetId() int64 {
return 0 return 0
} }
func (x *GetTeamActionsReq) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
type GetTeamActionsRsp struct { type GetTeamActionsRsp struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
@@ -3956,7 +3964,8 @@ func (x *GetTeamActionsRsp) GetPlaces() []*Place {
type AddTeamActionReq struct { type AddTeamActionReq struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@@ -3998,6 +4007,13 @@ func (x *AddTeamActionReq) GetId() int64 {
return 0 return 0
} }
func (x *AddTeamActionReq) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *AddTeamActionReq) GetCode() string { func (x *AddTeamActionReq) GetCode() string {
if x != nil { if x != nil {
return x.Code return x.Code
@@ -4284,15 +4300,17 @@ const file_main_proto_rawDesc = "" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\"/\n" + "\x04name\x18\x02 \x01(\tR\x04name\"/\n" +
"\x17GiveTeamApplicationsRsp\x12\x14\n" + "\x17GiveTeamApplicationsRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error\"#\n" + "\x05error\x18\x01 \x01(\tR\x05error\"?\n" +
"\x11GetTeamActionsReq\x12\x0e\n" + "\x11GetTeamActionsReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\"h\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\bpassword\x18\x02 \x01(\tR\bpassword\"h\n" +
"\x11GetTeamActionsRsp\x12\x14\n" + "\x11GetTeamActionsRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error\x12=\n" + "\x05error\x18\x01 \x01(\tR\x05error\x12=\n" +
"\x06places\x18\x02 \x03(\v2%.crabs.evening_detective_server.PlaceR\x06places\"6\n" + "\x06places\x18\x02 \x03(\v2%.crabs.evening_detective_server.PlaceR\x06places\"R\n" +
"\x10AddTeamActionReq\x12\x0e\n" + "\x10AddTeamActionReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1a\n" +
"\x04code\x18\x02 \x01(\tR\x04code\"(\n" + "\bpassword\x18\x02 \x01(\tR\bpassword\x12\x12\n" +
"\x04code\x18\x03 \x01(\tR\x04code\"(\n" +
"\x10AddTeamActionRsp\x12\x14\n" + "\x10AddTeamActionRsp\x12\x14\n" +
"\x05error\x18\x01 \x01(\tR\x05error2\x98<\n" + "\x05error\x18\x01 \x01(\tR\x05error2\x98<\n" +
"\x16EveningDetectiveServer\x12\xa6\x01\n" + "\x16EveningDetectiveServer\x12\xa6\x01\n" +
+14
View File
@@ -1266,6 +1266,8 @@ func local_request_EveningDetectiveServer_GiveTeamApplications_0(ctx context.Con
return msg, metadata, err return msg, metadata, err
} }
var filter_EveningDetectiveServer_GetTeamActions_0 = &utilities.DoubleArray{Encoding: map[string]int{"id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
func request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var ( var (
protoReq GetTeamActionsReq protoReq GetTeamActionsReq
@@ -1283,6 +1285,12 @@ func request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context, marsha
if err != nil { if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
} }
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamActions_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.GetTeamActions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.GetTeamActions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
@@ -1301,6 +1309,12 @@ func local_request_EveningDetectiveServer_GetTeamActions_0(ctx context.Context,
if err != nil { if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err)
} }
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_EveningDetectiveServer_GetTeamActions_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.GetTeamActions(ctx, &protoReq) msg, err := server.GetTeamActions(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }