Fix cloudflared cannot be stopped in No Auth mode due to password checking

This commit is contained in:
Louis Lam 2022-06-18 19:06:03 +08:00
parent d65abe5b8c
commit b97019eea8
3 changed files with 11 additions and 3 deletions

View File

@ -63,7 +63,10 @@ module.exports.cloudflaredSocketHandler = (socket) => {
socket.on(prefix + "stop", async (currentPassword, callback) => { socket.on(prefix + "stop", async (currentPassword, callback) => {
try { try {
checkLogin(socket); checkLogin(socket);
await doubleCheckPassword(socket, currentPassword); const disabledAuth = await setting("disableAuth");
if (!disabledAuth) {
await doubleCheckPassword(socket, currentPassword);
}
cloudflared.stop(); cloudflared.stop();
} catch (error) { } catch (error) {
callback({ callback({

View File

@ -68,7 +68,9 @@
<Confirm ref="confirmStop" btn-style="btn-danger" :yes-text="$t('Stop') + ' cloudflared'" :no-text="$t('Cancel')" @yes="stop"> <Confirm ref="confirmStop" btn-style="btn-danger" :yes-text="$t('Stop') + ' cloudflared'" :no-text="$t('Cancel')" @yes="stop">
{{ $t("The current connection may be lost if you are currently connecting via Cloudflare Tunnel. Are you sure want to stop it? Type your current password to confirm it.") }} {{ $t("The current connection may be lost if you are currently connecting via Cloudflare Tunnel. Are you sure want to stop it? Type your current password to confirm it.") }}
<div class="mt-3"> <p class="mt-2">{{ $t("disableCloudflaredNoAuthMsg") }}</p>
<div v-if="!settings.disableAuth" class="mt-3">
<label for="current-password2" class="form-label"> <label for="current-password2" class="form-label">
{{ $t("Current Password") }} {{ $t("Current Password") }}
</label> </label>
@ -108,7 +110,9 @@ export default {
return this.$root.cloudflared; return this.$root.cloudflared;
}, },
computed: { computed: {
settings() {
return this.$parent.$parent.$parent.settings;
},
}, },
watch: { watch: {

View File

@ -535,4 +535,5 @@ export default {
"ntfy Topic": "ntfy Topic", "ntfy Topic": "ntfy Topic",
"Domain": "Domain", "Domain": "Domain",
"Workstation": "Workstation", "Workstation": "Workstation",
disableCloudflaredNoAuthMsg: "You are in No Auth mode, password is not require.",
}; };