2022-03-30 01:49:45 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h4 class="mt-4">Cloudflare Tunnel</h4>
|
|
|
|
|
|
|
|
<div class="my-3">
|
|
|
|
<div>
|
|
|
|
cloudflared:
|
|
|
|
<span v-if="installed === true" class="text-primary">{{ $t("Installed") }}</span>
|
|
|
|
<span v-else-if="installed === false" class="text-danger">{{ $t("Not installed") }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
{{ $t("Status") }}:
|
|
|
|
<span v-if="running" class="text-primary">{{ $t("Running") }}</span>
|
|
|
|
<span v-else-if="!running" class="text-danger">{{ $t("Not running") }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="false">
|
|
|
|
{{ message }}
|
|
|
|
</div>
|
|
|
|
|
2022-03-30 11:59:49 +08:00
|
|
|
<div v-if="errorMessage" class="mt-3">
|
2022-03-30 01:49:45 +08:00
|
|
|
Message:
|
|
|
|
<textarea v-model="errorMessage" class="form-control" readonly></textarea>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p v-if="installed === false">(Download cloudflared from <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/">Cloudflare Website</a>)</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- If installed show token input -->
|
|
|
|
<div v-if="installed" class="mb-2">
|
|
|
|
<div class="mb-4">
|
|
|
|
<label class="form-label" for="cloudflareTunnelToken">
|
|
|
|
Cloudflare Tunnel {{ $t("Token") }}
|
|
|
|
</label>
|
|
|
|
<HiddenInput
|
|
|
|
id="cloudflareTunnelToken"
|
|
|
|
v-model="cloudflareTunnelToken"
|
|
|
|
autocomplete="one-time-code"
|
2022-03-30 11:59:49 +08:00
|
|
|
:readonly="running"
|
2022-03-30 01:49:45 +08:00
|
|
|
/>
|
|
|
|
<div class="form-text">
|
2022-03-30 11:59:49 +08:00
|
|
|
<div v-if="cloudflareTunnelToken" class="mb-3">
|
|
|
|
<span v-if="!running" class="remove-token" @click="removeToken">{{ $t("Remove Token") }}</span>
|
|
|
|
</div>
|
|
|
|
|
2022-03-30 01:49:45 +08:00
|
|
|
Don't know how to get the token? Please read the guide:<br />
|
|
|
|
<a href="https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy-with-Cloudflare-Tunnel" target="_blank">
|
|
|
|
https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy-with-Cloudflare-Tunnel
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<button v-if="!running" class="btn btn-primary" type="submit" @click="start">
|
|
|
|
{{ $t("Start") }} cloudflared
|
|
|
|
</button>
|
|
|
|
|
2022-03-30 11:59:49 +08:00
|
|
|
<button v-if="running" class="btn btn-danger" type="submit" @click="$refs.confirmStop.show();">
|
2022-03-30 01:49:45 +08:00
|
|
|
{{ $t("Stop") }} cloudflared
|
|
|
|
</button>
|
2022-03-30 11:59:49 +08:00
|
|
|
|
|
|
|
<Confirm ref="confirmStop" btn-style="btn-danger" :yes-text="$t('Stop') + ' cloudflared'" :no-text="$t('Cancel')" @yes="stop">
|
2022-03-30 18:52:10 +08:00
|
|
|
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.
|
2022-03-30 11:59:49 +08:00
|
|
|
|
|
|
|
<div class="mt-3">
|
|
|
|
<label for="current-password2" class="form-label">
|
|
|
|
{{ $t("Current Password") }}
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
id="current-password2"
|
|
|
|
v-model="currentPassword"
|
|
|
|
type="password"
|
|
|
|
class="form-control"
|
|
|
|
required
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</Confirm>
|
2022-03-30 01:49:45 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h4 class="mt-4">Other Software</h4>
|
|
|
|
<div>
|
|
|
|
For example: nginx, Apache and Traefik. <br />
|
|
|
|
Please read <a href="https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy" target="_blank">https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy</a>.
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import HiddenInput from "../../components/HiddenInput.vue";
|
2022-03-30 11:59:49 +08:00
|
|
|
import Confirm from "../Confirm.vue";
|
2022-03-30 01:49:45 +08:00
|
|
|
|
|
|
|
const prefix = "cloudflared_";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
HiddenInput,
|
2022-03-30 11:59:49 +08:00
|
|
|
Confirm
|
2022-03-30 01:49:45 +08:00
|
|
|
},
|
|
|
|
data() {
|
2022-03-30 11:59:49 +08:00
|
|
|
// See /src/mixins/socket.js
|
2022-03-30 01:49:45 +08:00
|
|
|
return this.$root.cloudflared;
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
|
|
|
|
},
|
2022-03-30 11:59:49 +08:00
|
|
|
created() {
|
2022-03-30 01:49:45 +08:00
|
|
|
this.$root.getSocket().emit(prefix + "join");
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
this.$root.getSocket().emit(prefix + "leave");
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
start() {
|
|
|
|
this.$root.getSocket().emit(prefix + "start", this.cloudflareTunnelToken);
|
|
|
|
},
|
|
|
|
stop() {
|
2022-03-30 11:59:49 +08:00
|
|
|
this.$root.getSocket().emit(prefix + "stop", this.currentPassword, (res) => {
|
|
|
|
this.$root.toastRes(res);
|
|
|
|
});
|
2022-03-30 01:49:45 +08:00
|
|
|
},
|
2022-03-30 11:59:49 +08:00
|
|
|
removeToken() {
|
|
|
|
this.$root.getSocket().emit(prefix + "removeToken");
|
|
|
|
this.cloudflareTunnelToken = "";
|
|
|
|
}
|
2022-03-30 01:49:45 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2022-03-30 11:59:49 +08:00
|
|
|
.remove-token {
|
|
|
|
text-decoration: underline;
|
|
|
|
cursor: pointer;
|
2022-03-30 01:49:45 +08:00
|
|
|
}
|
|
|
|
</style>
|