From 30d7465d2fa03b54c07169992cc11d3edbc2aceb Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Mon, 7 Jun 2021 13:23:26 +0200 Subject: [PATCH 1/7] addchallenge stream message added Signed-off-by: Ahmet Turkmen --- client/daemon_grpc_web_pb.js | 69 +++++++ client/daemon_pb.js | 345 +++++++++++++++++++++++++++++++++++ proto/daemon.proto | 13 ++ 3 files changed, 427 insertions(+) diff --git a/client/daemon_grpc_web_pb.js b/client/daemon_grpc_web_pb.js index 01c6d4d7..1846591a 100644 --- a/client/daemon_grpc_web_pb.js +++ b/client/daemon_grpc_web_pb.js @@ -1250,6 +1250,75 @@ proto.daemon.DaemonPromiseClient.prototype.solveChallenge = }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.daemon.AddChallengeRequest, + * !proto.daemon.AddChallengeResponse>} + */ +const methodDescriptor_Daemon_AddChallenge = new grpc.web.MethodDescriptor( + '/daemon.Daemon/AddChallenge', + grpc.web.MethodType.SERVER_STREAMING, + proto.daemon.AddChallengeRequest, + proto.daemon.AddChallengeResponse, + /** @param {!proto.daemon.AddChallengeRequest} request */ + function(request) { + return request.serializeBinary(); + }, + proto.daemon.AddChallengeResponse.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.daemon.AddChallengeRequest, + * !proto.daemon.AddChallengeResponse>} + */ +const methodInfo_Daemon_AddChallenge = new grpc.web.AbstractClientBase.MethodInfo( + proto.daemon.AddChallengeResponse, + /** @param {!proto.daemon.AddChallengeRequest} request */ + function(request) { + return request.serializeBinary(); + }, + proto.daemon.AddChallengeResponse.deserializeBinary +); + + +/** + * @param {!proto.daemon.AddChallengeRequest} request The request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.daemon.DaemonClient.prototype.addChallenge = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/daemon.Daemon/AddChallenge', + request, + metadata || {}, + methodDescriptor_Daemon_AddChallenge); +}; + + +/** + * @param {!proto.daemon.AddChallengeRequest} request The request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!grpc.web.ClientReadableStream} + * The XHR Node Readable Stream + */ +proto.daemon.DaemonPromiseClient.prototype.addChallenge = + function(request, metadata) { + return this.client_.serverStreaming(this.hostname_ + + '/daemon.Daemon/AddChallenge', + request, + metadata || {}, + methodDescriptor_Daemon_AddChallenge); +}; + + /** * @const * @type {!grpc.web.MethodDescriptor< diff --git a/client/daemon_pb.js b/client/daemon_pb.js index 12d56e48..f641a57a 100644 --- a/client/daemon_pb.js +++ b/client/daemon_pb.js @@ -11,6 +11,8 @@ var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); +goog.exportSymbol('proto.daemon.AddChallengeRequest', null, global); +goog.exportSymbol('proto.daemon.AddChallengeResponse', null, global); goog.exportSymbol('proto.daemon.CreateEventRequest', null, global); goog.exportSymbol('proto.daemon.CredsResponse', null, global); goog.exportSymbol('proto.daemon.DeleteTeamRequest', null, global); @@ -66,6 +68,48 @@ goog.exportSymbol('proto.daemon.UpdatePasswdResponse', null, global); goog.exportSymbol('proto.daemon.UpdateTeamPassRequest', null, global); goog.exportSymbol('proto.daemon.UpdateTeamPassResponse', null, global); goog.exportSymbol('proto.daemon.VersionResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.daemon.AddChallengeRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.daemon.AddChallengeRequest.repeatedFields_, null); +}; +goog.inherits(proto.daemon.AddChallengeRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.daemon.AddChallengeRequest.displayName = 'proto.daemon.AddChallengeRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.daemon.AddChallengeResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.daemon.AddChallengeResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.daemon.AddChallengeResponse.displayName = 'proto.daemon.AddChallengeResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1222,6 +1266,307 @@ if (goog.DEBUG && !COMPILED) { proto.daemon.GetTeamInfoResponse.Instance.displayName = 'proto.daemon.GetTeamInfoResponse.Instance'; } +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.daemon.AddChallengeRequest.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.daemon.AddChallengeRequest.prototype.toObject = function(opt_includeInstance) { + return proto.daemon.AddChallengeRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.daemon.AddChallengeRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddChallengeRequest.toObject = function(includeInstance, msg) { + var f, obj = { + eventtag: jspb.Message.getFieldWithDefault(msg, 1, ""), + challengetagList: jspb.Message.getRepeatedField(msg, 2) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.daemon.AddChallengeRequest} + */ +proto.daemon.AddChallengeRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.daemon.AddChallengeRequest; + return proto.daemon.AddChallengeRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.daemon.AddChallengeRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.daemon.AddChallengeRequest} + */ +proto.daemon.AddChallengeRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEventtag(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addChallengetag(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.daemon.AddChallengeRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.daemon.AddChallengeRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.daemon.AddChallengeRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddChallengeRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEventtag(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getChallengetagList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * optional string eventTag = 1; + * @return {string} + */ +proto.daemon.AddChallengeRequest.prototype.getEventtag = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.daemon.AddChallengeRequest.prototype.setEventtag = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated string challengeTag = 2; + * @return {!Array} + */ +proto.daemon.AddChallengeRequest.prototype.getChallengetagList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** @param {!Array} value */ +proto.daemon.AddChallengeRequest.prototype.setChallengetagList = function(value) { + jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + */ +proto.daemon.AddChallengeRequest.prototype.addChallengetag = function(value, opt_index) { + jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.daemon.AddChallengeRequest.prototype.clearChallengetagList = function() { + this.setChallengetagList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.daemon.AddChallengeResponse.prototype.toObject = function(opt_includeInstance) { + return proto.daemon.AddChallengeResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.daemon.AddChallengeResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddChallengeResponse.toObject = function(includeInstance, msg) { + var f, obj = { + message: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.daemon.AddChallengeResponse} + */ +proto.daemon.AddChallengeResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.daemon.AddChallengeResponse; + return proto.daemon.AddChallengeResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.daemon.AddChallengeResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.daemon.AddChallengeResponse} + */ +proto.daemon.AddChallengeResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.daemon.AddChallengeResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.daemon.AddChallengeResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.daemon.AddChallengeResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddChallengeResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.daemon.AddChallengeResponse.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.daemon.AddChallengeResponse.prototype.setMessage = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + /** * List of repeated fields within this message type. * @private {!Array} diff --git a/proto/daemon.proto b/proto/daemon.proto index 7ea821af..9eb1a509 100644 --- a/proto/daemon.proto +++ b/proto/daemon.proto @@ -19,6 +19,9 @@ service Daemon { rpc RestartTeamLab (RestartTeamLabRequest) returns (stream EventStatus) {} rpc SolveChallenge (SolveChallengeRequest) returns (SolveChallengeResponse) {} + rpc AddChallenge(AddChallengeRequest) returns (stream AddChallengeResponse) {} + + rpc DeleteTeam(DeleteTeamRequest) returns (stream DeleteTeamResponse) {} rpc GetTeamChals(GetTeamInfoRequest) returns (TeamChalsInfo) {} @@ -37,6 +40,16 @@ service Daemon { rpc Version (Empty) returns (VersionResponse) {} } +message AddChallengeRequest { + string eventTag = 1; + repeated string challengeTag = 2; +} + + +message AddChallengeResponse { + string message = 1; +} + message GetExsByTagsReq { repeated string tags = 1; } From 9a911433a76ec55ea1da8bec544b9cbf54223b2d Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Mon, 7 Jun 2021 13:23:50 +0200 Subject: [PATCH 2/7] add addchallenge button Signed-off-by: Ahmet Turkmen --- client/src/Pages/Home.vue | 55 ++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/client/src/Pages/Home.vue b/client/src/Pages/Home.vue index 7b8d244b..419ab179 100644 --- a/client/src/Pages/Home.vue +++ b/client/src/Pages/Home.vue @@ -3,13 +3,14 @@
-
-

Events List

-
-
- Create Event +

Events List

+
-
+
+
+ + +
- +
+ + \ No newline at end of file From 0008046acd557563722c73a3f41fc71b99f64311 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Fri, 11 Jun 2021 16:11:13 +0200 Subject: [PATCH 5/7] announcement grpc message added Signed-off-by: Ahmet Turkmen --- client/daemon_grpc_web_pb.js | 74 ++++++++ client/daemon_pb.js | 323 +++++++++++++++++++++++++++++++++++ proto/daemon.proto | 12 +- 3 files changed, 408 insertions(+), 1 deletion(-) diff --git a/client/daemon_grpc_web_pb.js b/client/daemon_grpc_web_pb.js index 1846591a..90073ab1 100644 --- a/client/daemon_grpc_web_pb.js +++ b/client/daemon_grpc_web_pb.js @@ -1319,6 +1319,80 @@ proto.daemon.DaemonPromiseClient.prototype.addChallenge = }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.daemon.AddNotificationRequest, + * !proto.daemon.AddNotificationResponse>} + */ +const methodDescriptor_Daemon_AddNotification = new grpc.web.MethodDescriptor( + '/daemon.Daemon/AddNotification', + grpc.web.MethodType.UNARY, + proto.daemon.AddNotificationRequest, + proto.daemon.AddNotificationResponse, + /** @param {!proto.daemon.AddNotificationRequest} request */ + function(request) { + return request.serializeBinary(); + }, + proto.daemon.AddNotificationResponse.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.daemon.AddNotificationRequest, + * !proto.daemon.AddNotificationResponse>} + */ +const methodInfo_Daemon_AddNotification = new grpc.web.AbstractClientBase.MethodInfo( + proto.daemon.AddNotificationResponse, + /** @param {!proto.daemon.AddNotificationRequest} request */ + function(request) { + return request.serializeBinary(); + }, + proto.daemon.AddNotificationResponse.deserializeBinary +); + + +/** + * @param {!proto.daemon.AddNotificationRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.daemon.AddNotificationResponse)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.daemon.DaemonClient.prototype.addNotification = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/daemon.Daemon/AddNotification', + request, + metadata || {}, + methodDescriptor_Daemon_AddNotification, + callback); +}; + + +/** + * @param {!proto.daemon.AddNotificationRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.daemon.DaemonPromiseClient.prototype.addNotification = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/daemon.Daemon/AddNotification', + request, + metadata || {}, + methodDescriptor_Daemon_AddNotification); +}; + + /** * @const * @type {!grpc.web.MethodDescriptor< diff --git a/client/daemon_pb.js b/client/daemon_pb.js index f641a57a..0551da64 100644 --- a/client/daemon_pb.js +++ b/client/daemon_pb.js @@ -13,6 +13,8 @@ var global = Function('return this')(); goog.exportSymbol('proto.daemon.AddChallengeRequest', null, global); goog.exportSymbol('proto.daemon.AddChallengeResponse', null, global); +goog.exportSymbol('proto.daemon.AddNotificationRequest', null, global); +goog.exportSymbol('proto.daemon.AddNotificationResponse', null, global); goog.exportSymbol('proto.daemon.CreateEventRequest', null, global); goog.exportSymbol('proto.daemon.CredsResponse', null, global); goog.exportSymbol('proto.daemon.DeleteTeamRequest', null, global); @@ -68,6 +70,48 @@ goog.exportSymbol('proto.daemon.UpdatePasswdResponse', null, global); goog.exportSymbol('proto.daemon.UpdateTeamPassRequest', null, global); goog.exportSymbol('proto.daemon.UpdateTeamPassResponse', null, global); goog.exportSymbol('proto.daemon.VersionResponse', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.daemon.AddNotificationRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.daemon.AddNotificationRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.daemon.AddNotificationRequest.displayName = 'proto.daemon.AddNotificationRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.daemon.AddNotificationResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.daemon.AddNotificationResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.daemon.AddNotificationResponse.displayName = 'proto.daemon.AddNotificationResponse'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -1266,6 +1310,285 @@ if (goog.DEBUG && !COMPILED) { proto.daemon.GetTeamInfoResponse.Instance.displayName = 'proto.daemon.GetTeamInfoResponse.Instance'; } + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.daemon.AddNotificationRequest.prototype.toObject = function(opt_includeInstance) { + return proto.daemon.AddNotificationRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.daemon.AddNotificationRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddNotificationRequest.toObject = function(includeInstance, msg) { + var f, obj = { + message: jspb.Message.getFieldWithDefault(msg, 1, ""), + loggedusers: jspb.Message.getFieldWithDefault(msg, 2, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.daemon.AddNotificationRequest} + */ +proto.daemon.AddNotificationRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.daemon.AddNotificationRequest; + return proto.daemon.AddNotificationRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.daemon.AddNotificationRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.daemon.AddNotificationRequest} + */ +proto.daemon.AddNotificationRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMessage(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setLoggedusers(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.daemon.AddNotificationRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.daemon.AddNotificationRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.daemon.AddNotificationRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddNotificationRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMessage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getLoggedusers(); + if (f) { + writer.writeBool( + 2, + f + ); + } +}; + + +/** + * optional string message = 1; + * @return {string} + */ +proto.daemon.AddNotificationRequest.prototype.getMessage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.daemon.AddNotificationRequest.prototype.setMessage = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional bool loggedUsers = 2; + * Note that Boolean fields may be set to 0/1 when serialized from a Java server. + * You should avoid comparisons like {@code val === true/false} in those cases. + * @return {boolean} + */ +proto.daemon.AddNotificationRequest.prototype.getLoggedusers = function() { + return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 2, false)); +}; + + +/** @param {boolean} value */ +proto.daemon.AddNotificationRequest.prototype.setLoggedusers = function(value) { + jspb.Message.setProto3BooleanField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.daemon.AddNotificationResponse.prototype.toObject = function(opt_includeInstance) { + return proto.daemon.AddNotificationResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.daemon.AddNotificationResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddNotificationResponse.toObject = function(includeInstance, msg) { + var f, obj = { + response: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.daemon.AddNotificationResponse} + */ +proto.daemon.AddNotificationResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.daemon.AddNotificationResponse; + return proto.daemon.AddNotificationResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.daemon.AddNotificationResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.daemon.AddNotificationResponse} + */ +proto.daemon.AddNotificationResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setResponse(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.daemon.AddNotificationResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.daemon.AddNotificationResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.daemon.AddNotificationResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.daemon.AddNotificationResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResponse(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string response = 1; + * @return {string} + */ +proto.daemon.AddNotificationResponse.prototype.getResponse = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.daemon.AddNotificationResponse.prototype.setResponse = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + /** * List of repeated fields within this message type. * @private {!Array} diff --git a/proto/daemon.proto b/proto/daemon.proto index 9eb1a509..1ecf3f91 100644 --- a/proto/daemon.proto +++ b/proto/daemon.proto @@ -20,7 +20,7 @@ service Daemon { rpc SolveChallenge (SolveChallengeRequest) returns (SolveChallengeResponse) {} rpc AddChallenge(AddChallengeRequest) returns (stream AddChallengeResponse) {} - + rpc AddNotification(AddNotificationRequest) returns (AddNotificationResponse) {} rpc DeleteTeam(DeleteTeamRequest) returns (stream DeleteTeamResponse) {} @@ -40,6 +40,16 @@ service Daemon { rpc Version (Empty) returns (VersionResponse) {} } + +message AddNotificationRequest { + string message = 1; + bool loggedUsers = 2; +} + +message AddNotificationResponse { + string response = 1; +} + message AddChallengeRequest { string eventTag = 1; repeated string challengeTag = 2; From 88275ee8a6eaf5be62138ee463d145b622426025 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Fri, 11 Jun 2021 16:11:34 +0200 Subject: [PATCH 6/7] announcement modal added Signed-off-by: Ahmet Turkmen --- client/src/Pages/Home.vue | 74 +++++++------ client/src/components/AnnounceModal.vue | 133 ++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 29 deletions(-) create mode 100644 client/src/components/AnnounceModal.vue diff --git a/client/src/Pages/Home.vue b/client/src/Pages/Home.vue index 419ab179..624d3fb0 100644 --- a/client/src/Pages/Home.vue +++ b/client/src/Pages/Home.vue @@ -9,7 +9,9 @@
- + + +
@@ -129,10 +132,11 @@ import { daemonclient } from "../App"; import EventModal from "../components/EventModal"; import ChalModal from "../components/ChalModal"; + import AnnounceModal from "../components/AnnounceModal"; export default { name: "Home", - components: {ChalModal, EventModal, Footer, Navbar}, + components: {ChalModal, EventModal, AnnounceModal, Footer, Navbar}, data: function () { return { //isInviteUserSuperUser: false, @@ -188,6 +192,10 @@ showChallengeModal: function (){ this.$bvModal.show('add-challenge-modal') }, + showAnnounceModal: function (){ + this.$bvModal.show('add-announcement-modal') + } + , listEvent: function (status) { let getRequest = new ListEventsRequest(); getRequest.setStatus(status) @@ -203,33 +211,41 @@ }); }, - addChallenge: function (request) { - const that = this - that.loaderIsActive = true - that.loader_status = "Adding challenges to event ... " - this.$bvModal.hide('add-challenge-modal') - const call = daemonclient.addChallenge(request, {Token: localStorage.getItem("user")}); - call.on('data', function (response) { - that.loader_status = response.getMessage() - // window.console.log(response) - }); - call.on('error', function (error) { - that.loaderIsActive = false; - that.error = error - // window.console.log(error['message']) - }); - call.on('end', function () { - that.loaderIsActive = false - if (that.error === null) { - that.success = "Challenges are added to event successfully !" - } - window.console.log("enddd") - }) - call.on('status', function () { - that.loaderIsActive = false; - }); - }, - + addChallenge: function (request) { + const that = this + that.loaderIsActive = true + that.loader_status = "Adding challenges to event ... " + this.$bvModal.hide('add-challenge-modal') + const call = daemonclient.addChallenge(request, {Token: localStorage.getItem("user")}); + call.on('data', function (response) { + that.loader_status = response.getMessage() + // window.console.log(response) + }); + call.on('error', function (error) { + that.loaderIsActive = false; + that.error = error + // window.console.log(error['message']) + }); + call.on('end', function () { + that.loaderIsActive = false + if (that.error === null) { + that.success = "Challenges are added to event successfully !" + } + window.console.log("enddd") + }) + call.on('status', function () { + that.loaderIsActive = false; + }); + }, + addAnnouncement: function (request) { + this.$bvModal.hide('add-announcement-modal') + daemonclient.addNotification(request,{Token: localStorage.getItem("user")}, (err, response) => { + if (err != null) { + this.error = err + } + this.success = response.getResponse() + }); + }, createEvent: function (request) { const that = this diff --git a/client/src/components/AnnounceModal.vue b/client/src/components/AnnounceModal.vue new file mode 100644 index 00000000..3e31f0a2 --- /dev/null +++ b/client/src/components/AnnounceModal.vue @@ -0,0 +1,133 @@ + + + + + \ No newline at end of file From d697db5235a1bad794d4f9ee202001ac1f5b57b2 Mon Sep 17 00:00:00 2001 From: Ahmet Turkmen Date: Fri, 13 Aug 2021 14:33:15 +0200 Subject: [PATCH 7/7] update chalmodal with new category and descriptions Signed-off-by: Ahmet Turkmen --- client/src/components/ChalModal.vue | 226 ++++++++++++++++++++++++++-- 1 file changed, 212 insertions(+), 14 deletions(-) diff --git a/client/src/components/ChalModal.vue b/client/src/components/ChalModal.vue index e7084d6a..70e04ad9 100644 --- a/client/src/components/ChalModal.vue +++ b/client/src/components/ChalModal.vue @@ -16,6 +16,7 @@
+ +
+ +
+
+ + {{ text.text }} + +
+
+
+ +
+
+ +
+ > +
+
+ + {{ text.text }} + +
+
+
+
+
+
+ > +
+
+ + {{ text.text }} + +
+
+
+
+
+
+ > +
+
+ + {{ text.text }} + +
+
+
+
+
+
+ > +
+
+ + {{ text.text }} + +
+
+
+
+
+
+ > +
+
+ + {{ text.text }} + +
+
+
+
+
+
@@ -134,6 +263,7 @@ export default { challengesRE: [], challengesTextRE: [], challengesC: [], challengesTextC: [], challengesS: [], challengesTextS: [], + challengeCS: [], challengesTextCS:[], cat: '', childrenChallenges: '', isDisabled: false, } }, @@ -147,6 +277,7 @@ export default { .concat(this.challengesF) .concat(this.challengesRE) .concat(this.challengesS) + .concat(this.challengeCS) .concat(this.challengesC): [] }, encodeHTML: function(s) { @@ -187,7 +318,8 @@ export default { let taglist = element.getTagsList(); let name = element.getName(); - let parentChallenge = { text: name + that.childrenChallenges, value: taglist[0] }; + let orgDesc = element.getOrgdescription() + let parentChallenge = { text: name + that.childrenChallenges, value: taglist[0], orgDesc: orgDesc, isInfoShown: false }; switch (that.cat) { case "Web exploitation": that.challengesTextWE.push(parentChallenge); @@ -212,6 +344,11 @@ export default { case "Starters": that.challengesTextS.push(parentChallenge); that.challengesS.push(taglist[0]) + break; + case "Cybermesterskaberne": + that.challengesTextCS.push(parentChallenge); + that.challengesCS.push(taglist[0]); + break; } }) }); @@ -260,6 +397,67 @@ export default { border: 1px solid #ced4da; border-radius: .35rem; } + + +.info-icon { + position: relative; + top: 1px; + left: -515px; + width: 16px; + padding: 0px; + margin: 0px; + z-index: 99999; +} +.chalInfo{ + background-color: #221d52; + color: #ffffff; + position: relative; + margin: auto; + padding-left: 10px; + padding-right: 10px; + width: 500px; + max-height: 0; + overflow: hidden; + transition: all .5s ease-in-out; + visibility: hidden; +} +.chalInfo.visible { + max-height: 200px; + /*transform-origin: top-center;*/ + transition: all .5s ease-in-out; + padding: 10px; + overflow-y: auto; + box-shadow: 5px 5px 5px rgba(73, 80, 87, 0.83); + visibility: visible; +} + +.checkbox-container { + display: flex; +} + +.custom-control{ + width: 100%; +} + +.chalInfo::-webkit-scrollbar { + background-color: #221d52; + width: 5px; +} + +.chalInfo::-webkit-scrollbar-track { + background-color: #221d52; +} + +/* scrollbar itself */ +.chalInfo::-webkit-scrollbar-thumb { + background-color: #babac0; + border-radius: 16px; +} + +/* set button(top and bottom of the scrollbar) */ +.chalInfo::-webkit-scrollbar-button { + display:none; +} .my-is-invalid{ border: 2px solid rgba(220,53,69,0.9); box-shadow: 1px 1px 2px rgba(220,53,69,0.7);