Skip to content

Commit

Permalink
Minor adjustments regarding the registration of the connection method
Browse files Browse the repository at this point in the history
Improved execution flow of the controller to prevent connection to Iranian IPs in the Go method, specifically when the user has switched from the Warp method to Go without disconnecting
  • Loading branch information
ircfspace committed Jan 4, 2025
1 parent 649531e commit f30a1dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/renderer/pages/Landing/useLanding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ const useLanding = () => {
statusText,
setStatusText,
proxyStatus,
setProxyStatus
setProxyStatus,
proxyMethod,
setProxyMethod
} = useStore();
const [ipInfo, setIpInfo] = useState<IpConfig>({
countryCode: false,
Expand Down Expand Up @@ -101,6 +103,7 @@ const useLanding = () => {
ip: ''
});
setProxyStatus(proxyMode);
setProxyMethod(method);
ipcRenderer.sendMessage('wp-start');
setIsLoading(true);
setPing(0);
Expand Down Expand Up @@ -201,6 +204,7 @@ const useLanding = () => {
ip: ''
});
setProxyStatus(proxyMode);
setProxyMethod(method);
ipcRenderer.sendMessage('wp-start');
setIsLoading(true);
setPing(0);
Expand Down Expand Up @@ -384,7 +388,7 @@ const useLanding = () => {
if (typeof ipInfo?.countryCode != 'string') return;
if (method === '' && ipInfo?.countryCode === 'ir') {
ipToast();
} else if (method === 'gool' && ipInfo?.countryCode === 'ir') {
} else if (proxyMethod === 'gool' && ipInfo?.countryCode === 'ir') {
ipcRenderer.sendMessage('wp-end', 'stop-from-gool');
setIsLoading(true);
loadingToast(appLang.status.keep_trying);
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface IStore {
setStatusText: (status: string) => void;
proxyStatus: string;
setProxyStatus: (status: string) => void;
proxyMethod: string;
setProxyMethod: (method: string) => void;
}

const appLang = getTranslate('en');
Expand All @@ -21,5 +23,7 @@ export const useStore = create<IStore>((set) => ({
statusText: appLang.status.disconnected,
setStatusText: (status: string) => set(() => ({ statusText: status })),
proxyStatus: '',
setProxyStatus: (status: string) => set(() => ({ proxyStatus: status }))
setProxyStatus: (status: string) => set(() => ({ proxyStatus: status })),
proxyMethod: '',
setProxyMethod: (method: string) => set(() => ({ proxyMethod: method }))
}));

0 comments on commit f30a1dc

Please sign in to comment.