Skip to content

Commit

Permalink
Merge pull request #1 from beclab/feat-changeToCloudFlareTunnel
Browse files Browse the repository at this point in the history
feat: Change to cloudflare tunnel
  • Loading branch information
pengpeng authored May 9, 2024
2 parents 2fcee27 + f090b57 commit a0ec706
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches:
- "main"
tags:
- 'v*'
- '*'


jobs:
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/NotNeedFrpDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
/>

<div class="dialog-desc" style="textalign: left">
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.
</div>

<terminus-dialog-footer
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/pages/step/Step2Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ const click = async (): Promise<boolean> => {
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);
}
Expand Down
27 changes: 9 additions & 18 deletions packages/frontend/src/pages/step/Step3Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,16 @@ const $q = useQuasar();
const options = [
{
label: 'Not using a reverse proxy',
value: ''
value: false
},
{
label: 'Virginia',
value: 'Virginia'
},
{
label: 'Singapore',
value: 'Singapore'
},
{
label: 'Hong Kong',
value: 'Hong Kong'
label: 'Use Cloudflare Tunnel',
value: true
}
];
const tokenStore = useTokenStore();
const regionMode = ref('');
const regionMode = ref(true);
let hasExternalIp = false;
const origin = window.location.origin;
Expand All @@ -86,20 +78,19 @@ if (tokenStore.user.selfhosted && origin.indexOf('30180') > -1) {
}
if (hasExternalIp) {
regionMode.value = '';
regionMode.value = false;
} else {
regionMode.value = tokenStore.wizard.network.frps_region || 'Virginia';
regionMode.value = true;
}
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
Expand Down
15 changes: 2 additions & 13 deletions packages/frontend/src/pages/step/status/CheckNetwork.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
{{ t('network_content') }}
</p>
</div>
<div>
<p class="account_please_text please_text">
{{
tokenStore.wizard.network.use_frps
? 'Utilizing the FRP Service in the ' +
tokenStore.wizard.network.frps_region +
' Region'
: ''
}}
</p>
</div>
<template v-if="state">
<p class="State_text">State {{ state }}</p>
</template>
Expand Down Expand Up @@ -93,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';
Expand All @@ -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';
Expand Down
5 changes: 2 additions & 3 deletions packages/frontend/src/stores/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
},
Expand Down
7 changes: 3 additions & 4 deletions packages/frontend/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -28,7 +27,7 @@ export interface WizardInfo {
//did: string | null;

system: SystemOption;
network: NetworkOption;
network: CloudflareNetworkOption;
}

export type RootState = {
Expand Down

0 comments on commit a0ec706

Please sign in to comment.