Skip to content

Commit

Permalink
update test hub
Browse files Browse the repository at this point in the history
  • Loading branch information
lindongchen committed Nov 29, 2024
1 parent 1b27375 commit 6fd56a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gui/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_APP_MODE=base
VITE_APP_API_PORT=7777
VITE_APP_PUB_HUB=https://hub02.flomesh.io:7779
VITE_APP_PUB_HUB_CN=https://hub-cn.icurl.io:7779
VITE_APP_PUB_HUB_US=https://hub-us.icurl.io:7779
19 changes: 17 additions & 2 deletions gui/src/service/ZtmService.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,23 @@ import {

import { getItem as getKeychainItem, saveItem as saveKeychainItem } from 'tauri-plugin-keychain';

const VITE_APP_PUB_HUB = import.meta.env.VITE_APP_PUB_HUB;

const VITE_APP_PUB_HUB_CN = import.meta.env.VITE_APP_PUB_HUB_CN;
const VITE_APP_PUB_HUB_US = import.meta.env.VITE_APP_PUB_HUB_US;

export default class ZtmService {
getPubHub() {
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (timeZone === "Asia/Shanghai" || timeZone === "Asia/Chongqing" || timeZone === "Asia/Hong_Kong") {
return VITE_APP_PUB_HUB_CN;
} else if (timeZone === "Asia/Macau") {
return VITE_APP_PUB_HUB_US;
} else if (timeZone.startsWith("Asia")) {
return VITE_APP_PUB_HUB_US;
} else {
return VITE_APP_PUB_HUB_US;
}
}
login(user, password) {
return request('/api/login', "POST", {
user, password
Expand Down Expand Up @@ -146,7 +161,7 @@ export default class ZtmService {
return request(`/api/meshes/${name}`);
}
getPermit(PublicKey, UserName) {
return request(`${VITE_APP_PUB_HUB}/permit`,"POST",{PublicKey, UserName});
return request(`${this.getPubHub()}/permit`,"POST",{PublicKey, UserName});
}
joinMesh(name, config) {
if(config.bootstraps){
Expand Down

0 comments on commit 6fd56a5

Please sign in to comment.