From addd25e2aba04d66924d8b5b708db7d507d6027f Mon Sep 17 00:00:00 2001 From: zer0x64 Date: Thu, 19 Mar 2026 18:16:59 -0400 Subject: [PATCH 1/2] add support for multiflag triggers --- ctf/templates/init/schemas/post.json | 97 ++++++++++++++++++++++++++-- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/ctf/templates/init/schemas/post.json b/ctf/templates/init/schemas/post.json index f548068..c6630d0 100644 --- a/ctf/templates/init/schemas/post.json +++ b/ctf/templates/init/schemas/post.json @@ -25,7 +25,10 @@ "description": "Type of trigger: use `flag` to post after a given flag is submitted (the value of the flag should be set in the `tag` property.)", "type": "string", "enum": [ - "flag" + "flag", + "multiFlag", + "score", + "timer" ] }, "tag": { @@ -35,9 +38,95 @@ } }, "required": [ - "type", - "tag" - ] + "type" + ], + "if": { + "properties": { + "type": { + "const": "flag" + } + } + }, + "then": { + "properties": { + "tag": { + "description": "Discourse tag of the flag to trigger on.", + "type": "string", + "minLength": 1 + } + }, + "required": [ + "type", + "tag" + ] + }, + "else": { + "if": { + "properties": { + "type": { + "const": "multiFlag" + } + } + }, + "then": { + "properties": { + "tags": { + "description": "List of discourse tags of relevant flags.", + "type": "array", + "items": { + "type": "string", + "minLength": 1 + } + }, + "threshold": { + "description": "Number of relevant flags required for the multiFlag trigger. Ex: If this is set to 2, the trigger will only fire if 2 or more of the tags in the `tags` list are present.", + "type": "number" + } + }, + "required": [ + "type", + "tags" + ] + }, + "else": { + "if": { + "properties": { + "type": { + "const": "score" + } + } + }, + "then": { + "value": { + "description": "Value of the score trigger. Ex: If this is set to 10, the trigger will only fire if the user's score is 10 or more.", + "type": "number" + }, + "required": [ + "type", + "value" + ] + }, + "else": { + "if": { + "properties": { + "type": { + "const": "timer" + } + } + }, + "then": { + "after": { + "description": "Time at which to trigger. The layout of this string is \"2006/01/02 15:04\"", + "type": "string" + }, + "required": [ + "type", + "after" + ] + } + } + } + } }, "api": { "type": "object", From 49771bb51cd67308be7c0f1f959472442a966f5f Mon Sep 17 00:00:00 2001 From: zer0x64 Date: Sun, 5 Apr 2026 13:18:17 -0400 Subject: [PATCH 2/2] merge flag and multiFlag triggers --- ctf/templates/init/schemas/post.json | 67 +++++++++------------------- 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/ctf/templates/init/schemas/post.json b/ctf/templates/init/schemas/post.json index c6630d0..a4134f8 100644 --- a/ctf/templates/init/schemas/post.json +++ b/ctf/templates/init/schemas/post.json @@ -26,15 +26,9 @@ "type": "string", "enum": [ "flag", - "multiFlag", "score", "timer" ] - }, - "tag": { - "description": "Value of the trigger. For a flag trigger, this is the flag value.", - "type": "string", - "minLength": 1 } }, "required": [ @@ -50,9 +44,17 @@ "then": { "properties": { "tag": { - "description": "Discourse tag of the flag to trigger on.", - "type": "string", + "description": "Discourse tags of the flags to trigger on.", + "type": ["string", "array"], + "items": { + "type": "string", + "minLength": 1 + }, "minLength": 1 + }, + "threshold": { + "description": "Number of relevant flags required for the multiFlag trigger. Ex: If this is set to 2, the trigger will only fire if 2 or more of the tags in the `tags` list are present.", + "type": "number" } }, "required": [ @@ -64,66 +66,37 @@ "if": { "properties": { "type": { - "const": "multiFlag" + "const": "score" } } }, "then": { - "properties": { - "tags": { - "description": "List of discourse tags of relevant flags.", - "type": "array", - "items": { - "type": "string", - "minLength": 1 - } - }, - "threshold": { - "description": "Number of relevant flags required for the multiFlag trigger. Ex: If this is set to 2, the trigger will only fire if 2 or more of the tags in the `tags` list are present.", - "type": "number" - } + "value": { + "description": "Value of the score trigger. Ex: If this is set to 10, the trigger will only fire if the user's score is 10 or more.", + "type": "number" }, "required": [ "type", - "tags" + "value" ] }, "else": { "if": { "properties": { "type": { - "const": "score" + "const": "timer" } } }, "then": { - "value": { - "description": "Value of the score trigger. Ex: If this is set to 10, the trigger will only fire if the user's score is 10 or more.", - "type": "number" + "after": { + "description": "Time at which to trigger. The layout of this string is \"2006/01/02 15:04\"", + "type": "string" }, "required": [ "type", - "value" + "after" ] - }, - "else": { - "if": { - "properties": { - "type": { - "const": "timer" - } - } - }, - "then": { - "after": { - "description": "Time at which to trigger. The layout of this string is \"2006/01/02 15:04\"", - "type": "string" - }, - "required": [ - "type", - "after" - ] - } } } }