From c3f96735923cea56b4ab93655566c3c93619a104 Mon Sep 17 00:00:00 2001
From: Peng Peng
Date: Wed, 8 May 2024 21:27:02 +0800
Subject: [PATCH 1/2] Use Cloudflare tunnel as default reverse proxy
Polish wording
Update build_frontend.yml
feat: Change to cloudflare tunnel
---
.github/workflows/build_frontend.yml | 2 +-
.../frontend/src/pages/step/Step2Page.vue | 3 +--
.../frontend/src/pages/step/Step3Page.vue | 27 +++++++------------
.../src/pages/step/status/CheckNetwork.vue | 13 +--------
packages/frontend/src/stores/token.ts | 5 ++--
packages/frontend/src/types/index.ts | 7 +++--
6 files changed, 17 insertions(+), 40 deletions(-)
diff --git a/.github/workflows/build_frontend.yml b/.github/workflows/build_frontend.yml
index 992c774..7466980 100644
--- a/.github/workflows/build_frontend.yml
+++ b/.github/workflows/build_frontend.yml
@@ -7,7 +7,7 @@ on:
branches:
- "main"
tags:
- - 'v*'
+ - '*'
jobs:
diff --git a/packages/frontend/src/pages/step/Step2Page.vue b/packages/frontend/src/pages/step/Step2Page.vue
index 21f2039..4f956b3 100644
--- a/packages/frontend/src/pages/step/Step2Page.vue
+++ b/packages/frontend/src/pages/step/Step2Page.vue
@@ -54,8 +54,7 @@ const click = async (): Promise => {
if (tokenStore.user.selfhosted) {
tokenStore.setStep(3);
} else {
- tokenStore.wizard.network.use_frps = false;
- tokenStore.wizard.network.frps_region = '';
+ tokenStore.wizard.network.enable_tunnel = false;
tokenStore.setStep(4);
}
diff --git a/packages/frontend/src/pages/step/Step3Page.vue b/packages/frontend/src/pages/step/Step3Page.vue
index 4c39250..9cd5aeb 100644
--- a/packages/frontend/src/pages/step/Step3Page.vue
+++ b/packages/frontend/src/pages/step/Step3Page.vue
@@ -57,24 +57,16 @@ const $q = useQuasar();
const options = [
{
label: 'Not using a reverse proxy',
- value: ''
+ value: true
},
{
- label: 'Virginia',
- value: 'Virginia'
- },
- {
- label: 'Singapore',
- value: 'Singapore'
- },
- {
- label: 'Hong Kong',
- value: 'Hong Kong'
+ label: 'Use Cloudflare Tunnel',
+ value: false
}
];
const tokenStore = useTokenStore();
-const regionMode = ref('');
+const regionMode = ref(false);
let hasExternalIp = false;
const origin = window.location.origin;
@@ -86,20 +78,19 @@ if (tokenStore.user.selfhosted && origin.indexOf('30180') > -1) {
}
if (hasExternalIp) {
- regionMode.value = '';
+ regionMode.value = true;
} else {
- regionMode.value = tokenStore.wizard.network.frps_region || 'Virginia';
+ regionMode.value = false;
}
const click = () => {
- tokenStore.wizard.network.frps_region = regionMode.value;
if (regionMode.value) {
- tokenStore.wizard.network.use_frps = true;
+ tokenStore.wizard.network.enable_tunnel = true;
} else {
- tokenStore.wizard.network.use_frps = false;
+ tokenStore.wizard.network.enable_tunnel = false;
}
- if (tokenStore.wizard.network.use_frps === true) {
+ if (tokenStore.wizard.network.enable_tunnel === true) {
if (hasExternalIp) {
$q.dialog({
component: NotNeedFrpDialog
diff --git a/packages/frontend/src/pages/step/status/CheckNetwork.vue b/packages/frontend/src/pages/step/status/CheckNetwork.vue
index d4288f8..b9da665 100644
--- a/packages/frontend/src/pages/step/status/CheckNetwork.vue
+++ b/packages/frontend/src/pages/step/status/CheckNetwork.vue
@@ -18,17 +18,6 @@
{{ t('network_content') }}
-
-
- {{
- tokenStore.wizard.network.use_frps
- ? 'Utilizing the FRP Service in the ' +
- tokenStore.wizard.network.frps_region +
- ' Region'
- : ''
- }}
-
-
State {{ state }}
@@ -102,7 +91,7 @@ export default defineComponent({
state.value = 'ConfigureIngressHTTPs';
request_https_certificate.value = true;
} else if (data.state == 9) {
- state.value = 'CheckHTTPs';
+ state.value = 'CheckTunnel';
request_https_certificate.value = true;
} else if (data.state == 3) {
state.value = 'Failed';
diff --git a/packages/frontend/src/stores/token.ts b/packages/frontend/src/stores/token.ts
index fd7abcd..3ff8c17 100644
--- a/packages/frontend/src/stores/token.ts
+++ b/packages/frontend/src/stores/token.ts
@@ -193,9 +193,8 @@ export const useTokenStore = defineStore('token', {
location: 'Singapore'
},
network: {
- use_frps: false,
- external_ip: null,
- frps_region: ''
+ enable_tunnel: false,
+ external_ip: null
}
});
},
diff --git a/packages/frontend/src/types/index.ts b/packages/frontend/src/types/index.ts
index 69f2e8e..7733f55 100644
--- a/packages/frontend/src/types/index.ts
+++ b/packages/frontend/src/types/index.ts
@@ -9,9 +9,8 @@ export interface SystemOption {
language: string;
}
-export interface NetworkOption {
- use_frps: boolean;
- frps_region: string;
+export interface CloudflareNetworkOption {
+ enable_tunnel: boolean;
external_ip: string | null;
}
@@ -28,7 +27,7 @@ export interface WizardInfo {
//did: string | null;
system: SystemOption;
- network: NetworkOption;
+ network: CloudflareNetworkOption;
}
export type RootState = {
From f090b57cbfa03f15bd8d4a92c0ac662e972fadbc Mon Sep 17 00:00:00 2001
From: Peng Peng
Date: Thu, 9 May 2024 14:49:07 +0800
Subject: [PATCH 2/2] Fix logic error
---
packages/frontend/src/components/NotNeedFrpDialog.vue | 3 ++-
packages/frontend/src/pages/step/Step3Page.vue | 10 +++++-----
.../frontend/src/pages/step/status/CheckNetwork.vue | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/packages/frontend/src/components/NotNeedFrpDialog.vue b/packages/frontend/src/components/NotNeedFrpDialog.vue
index 1767a9d..762cd7a 100644
--- a/packages/frontend/src/components/NotNeedFrpDialog.vue
+++ b/packages/frontend/src/components/NotNeedFrpDialog.vue
@@ -9,7 +9,8 @@
/>
- If you have a fixed IP, using FRP may reduce the access speed.
+ If you have a fixed IP, using Cloudflare Tunnel may reduce the access
+ speed.
-1) {
}
if (hasExternalIp) {
- regionMode.value = true;
-} else {
regionMode.value = false;
+} else {
+ regionMode.value = true;
}
const click = () => {
diff --git a/packages/frontend/src/pages/step/status/CheckNetwork.vue b/packages/frontend/src/pages/step/status/CheckNetwork.vue
index b9da665..eaaffbe 100644
--- a/packages/frontend/src/pages/step/status/CheckNetwork.vue
+++ b/packages/frontend/src/pages/step/status/CheckNetwork.vue
@@ -82,7 +82,7 @@ export default defineComponent({
state.value = 'CheckL4Proxy';
request_https_certificate.value = true;
} else if (data.state == 6) {
- state.value = 'CheckFrpAgent';
+ state.value = 'CheckAgent';
request_https_certificate.value = true;
} else if (data.state == 7) {
state.value = 'GenerateCert';