diff --git a/src/components/SubmitFlag.vue b/src/components/SubmitFlag.vue index 5d5a199..548f753 100644 --- a/src/components/SubmitFlag.vue +++ b/src/components/SubmitFlag.vue @@ -27,9 +27,7 @@

- curl - -X POST {{baseURL}}/api/flag -H 'Authorization: {{info.Token}}' -d '{ "flag": "your_flag_here" - }' + {{getCurlCommand()}}

@@ -44,7 +42,6 @@ data: () => ({ info: null, inputFlag: '', - baseURL: window.location.origin, message: '', snackBarVisible: false, @@ -78,6 +75,13 @@ this.snackBarColor = 'error' this.snackBarVisible = true }); + }, + getCurlCommand() { + // The curl command is different in windows and *nix os. + if ((navigator.platform === "Win32") || (navigator.platform === "Windows")) { + return `curl -X POST ${window.location.origin}/api/flag -H "Authorization: ${this.info.Token}" -d "{ \\"flag\\": \\"your_flag_here\\" }"` + } + return `curl -X POST ${window.location.origin}/api/flag -H 'Authorization: ${this.info.Token}' -d '{ "flag": "your_flag_here" }'` } } }