diff --git a/backend/src/endpoint/user.rs b/backend/src/endpoint/user.rs index b8efe38..329f921 100644 --- a/backend/src/endpoint/user.rs +++ b/backend/src/endpoint/user.rs @@ -13,7 +13,6 @@ impl<'a> From> for UserFullInfo { let model = value.1; let writable = Entity::writable(&model, value.0); UserFullInfo { - hashed_pwd: model.password.clone(), info: model.into(), writable, } diff --git a/backend/src/server/mod.rs b/backend/src/server/mod.rs index 0224bd8..8eaa573 100644 --- a/backend/src/server/mod.rs +++ b/backend/src/server/mod.rs @@ -27,7 +27,7 @@ use tonic_web::GrpcWebLayer; use tower_http::cors::{AllowOrigin, Any, CorsLayer}; use tracing::Instrument; -const MAX_FRAME_SIZE: u32 = 1024 * 1024 * 8; +const MAX_TESTCASE_CODEX_SIZE: usize = 1024 * 1024 * 16; // from https://docs.rs/tonic-web/0.11.0/src/tonic_web/lib.rs.html#140 const DEFAULT_EXPOSED_HEADERS: [&str; 3] = @@ -143,13 +143,16 @@ impl Server { server .layer(cors) .layer(GrpcWebLayer::new()) - .max_frame_size(Some(MAX_FRAME_SIZE)) .add_service(ProblemServer::new(self_.clone())) .add_service(EducationServer::new(self_.clone())) .add_service(UserServer::new(self_.clone())) .add_service(TokenServer::new(self_.clone())) .add_service(ContestServer::new(self_.clone())) - .add_service(TestcaseServer::new(self_.clone())) + .add_service( + TestcaseServer::new(self_.clone()) + .max_decoding_message_size(MAX_TESTCASE_CODEX_SIZE) + .max_encoding_message_size(MAX_TESTCASE_CODEX_SIZE), + ) .add_service(SubmitServer::new(self_.clone())) .add_service(ChatServer::new(self_.clone())) .add_service(AnnouncementServer::new(self_.clone())) diff --git a/grpc/proto/backend.proto b/grpc/proto/backend.proto index 69b53d8..a1a1d22 100644 --- a/grpc/proto/backend.proto +++ b/grpc/proto/backend.proto @@ -609,6 +609,13 @@ message ListContestResponse { message CreateContestRequest { message Info { required string title = 1; + // if begin is set, the contest will be open automatically even if contest is private + // + // try to close contest when it's open bacause of time reached will result in end being set to current time + // + // if contest was made public after end, both begin and end timer would be cancel and contest would be immediately visible to anyone + // + // if contest end before it begin, the contest would be public required google.protobuf.Timestamp begin = 2; required google.protobuf.Timestamp end = 3; required string tags = 6; @@ -697,6 +704,7 @@ service Contest { rpc Update(UpdateContestRequest) returns (google.protobuf.Empty); rpc Remove(RemoveRequest) returns (google.protobuf.Empty); + // public means the contest itself is visible, it may be guarded by password or so rpc Publish(PublishRequest) returns (google.protobuf.Empty); rpc Unpublish(PublishRequest) returns (google.protobuf.Empty); @@ -711,8 +719,8 @@ message UserInfo { message UserFullInfo { required UserInfo info = 1; - required bytes hashed_pwd = 2; required bool writable = 3; + // require string description = 4; } message ListUserResponse { @@ -726,6 +734,7 @@ message CreateUserRequest { required string username = 1; required string password = 2; required Role role = 4; + // required string description = 5; } required Info info = 1; // can prevent duplicate request. @@ -739,6 +748,7 @@ message UpdateUserRequest { optional string username = 1; optional string password = 2; optional Role role = 3; + // optional string description = 4; } required Info info = 1; required int32 id = 2;