Repository: louislam/uptime-kuma
File: src/pages/EditMonitor.vue (Vue)

Code before:
            return this.$t(name);
        },
        remoteBrowsersOptions() {
            return this.$root.remoteBrowserList.map(browser => {
                return {
                    label: browser.name,
                    value: browser.id,
                };
            });
        },
        remoteBrowsersToggle: {
            get() {
                return this.remoteBrowsersEnabled || this.monitor.remote_browser != null;
            },
            set(value) {
                if (value) {
                    this.remoteBrowsersEnabled = true;
                    if (this.monitor.remote_browser == null && this.$root.remoteBrowserList.length > 0) {
                        // set a default remote browser if there is one. Otherwise, the user will have to select one manually.
                        this.monitor.remote_browser = this.$root.remoteBrowserList[0].id;
                    }
                } else {
                    this.remoteBrowsersEnabled = false;
                    this.monitor.remote_browser = null;
                }
            }
        },
        isAdd() {
            return this.$route.path === "/add";
        },

        isClone() {
            return this.$route.path.startsWith("/clone");
        },

        isEdit() {
            return this.$route.path.startsWith("/edit");
        },

        pushURL() {
            return this.$root.baseURL + "/api/push/" + this.monitor.pushToken + "?status=up&msg=OK&ping=";
        },

        protoServicePlaceholder() {
            return this.$t("Example:", [ "Health" ]);
        },

        protoMethodPlaceholder() {
            return this.$t("Example:", [ "check" ]);
        },


Review comment (bug):
Could you also add the other auth options here?

- `--ntlm`
- `--oauth2-bearer` (if equivalent, otherwise mark it as not currently suported)
- https://stackoverflow.com/questions/55561615/curl-with-mutual-authentication

Code after:
            } else if (this.monitor.authmethod === "mtls") {
                command.push("--cacert", `'${this.monitor.tlsCa}'`, "\\\n", "--key", `'${this.monitor.tlsKey}'`, "\\\n", "--cert", `'${this.monitor.tlsCert}'`, "\\\n");
            } else if (this.monitor.authMethod === "ntlm") {
                command.push("--user", `'${this.monitor.authDomain ? `${this.monitor.authDomain}/` : ""}${this.monitor.basic_auth_user}:${this.monitor.basic_auth_pass}'`, "--ntlm", "\\\n");
            }
            if (this.monitor.body && this.monitor.httpBodyEncoding === "json") {
                let json = "";
                try {
                    // trying to parse the supplied data as json to trim whitespace
                    json = JSON.stringify(JSON.parse(this.monitor.body));
                } catch (e) {
                    json = this.monitor.body;
                }
                command.push("--header", "'Content-Type: application/json'", "\\\n", "--data", `'${json}'`, "\\\n");
            } else if (this.monitor.body && this.monitor.httpBodyEncoding === "xml") {
                command.push("--headers", "'Content-Type: application/xml'", "\\\n", "--data", `'${this.monitor.body}'`, "\\\n");
            }
            if (this.monitor.maxredirects) {
                command.push("--location", "--max-redirs", this.monitor.maxredirects, "\\\n");
            }
            if (this.monitor.timeout) {
                command.push("--max-time", this.monitor.timeout, "\\\n");
            }
            if (this.monitor.maxretries) {
                command.push("--retry", this.monitor.maxretries, "\\\n");
            }
            command.push("--url", this.monitor.url);
            return command.join(" ");
        },

        ipRegex() {

            // Allow to test with simple dns server with port (127.0.0.1:5300)
            if (! isDev) {
                return this.ipRegexPattern;
            }
            return null;
        },

        pageName() {
            let name = "Add New Monitor";
            if (this.isClone) {
                name = "Clone Monitor";
            } else if (this.isEdit) {
                name = "Edit";
            }
            return this.$t(name);
        },
        remoteBrowsersOptions() {
            return this.$root.remoteBrowserList.map(browser => {
                return {