lencx / ChatGPT

🔮 ChatGPT Desktop Application (Mac, Windows and Linux)
https://nofwl.com
51.74k stars 5.81k forks source link

[Feature] Proxy support #574

Open distrair opened 1 year ago

distrair commented 1 year ago

Feature description

Add a support to set a proxy server

Motivation

If you try to enter a website from other country, it shows that I don't have access to the website image

Alternatives

Use a VPN

Additional context

No response

lencx commented 1 year ago

This project is built on tauri, which does not support proxy, so this functionality is not possible.

distrair commented 1 year ago

will nofwl get proxy support or its also made on tauri?

JustTestCode commented 1 year ago

The WindowBuilder (https://docs.rs/tauri/latest/tauri/window/struct.WindowBuilder.html) has/will have a additional_browser_args() method

(https://docs.rs/wry/latest/x86_64-pc-windows-msvc/wry/webview/trait.WebViewBuilderExtWindows.html#tymethod.with_additional_browser_args)

may be , you can use it. i don't know rust , so I don't know how to use it

if can use, add --proxy-server=127.0.0.1:7890 the webview2 can use proxy

distrair commented 1 year ago

如果通过api密钥登录,其实可以解决这个问题,当遇到访问1小时限制,访问解决,IP限制的情况时。可以通过自己api密钥去直接访问ChatGPT。

不幸的是,我的帐户没有任何积分,我不能用我的卡来支付它,所以它应该是一个网络应用程序

distrair commented 1 year ago

The WindowBuilder (https://docs.rs/tauri/latest/tauri/window/struct.WindowBuilder.html) has/will have a additional_browser_args() method

(https://docs.rs/wry/latest/x86_64-pc-windows-msvc/wry/webview/trait.WebViewBuilderExtWindows.html#tymethod.with_additional_browser_args)

may be , you can use it.

i don't know rust , so I don't know how to use it

if can use, add --proxy-server=127.0.0.1:7890 the webview2 can use proxy

When I'm gonna get home, I'll try this

JustTestCode commented 1 year ago

change file at C:\Users\xxx\.cargo\registry\src\github.com-1ecc6299db9ec823\wry-0.24.1\src\webview\webview2\mod.rs 130 line "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection --proxy-server=127.0.0.1:7890".to_string()

build, you can use proxy

ChatGPT.zip

change default port 7890

with open("ChatGPT.exe", "rb+") as f:
    data = f.read()
    data = data.replace(b"127.0.0.1:7890", b"127.0.0.1:1080")
    f.seek(0)
    f.write(data)
    f.truncate()
yoohooyoo commented 1 year ago

change file at C:\Users\xxx\.cargo\registry\src\github.com-1ecc6299db9ec823\wry-0.24.1\src\webview\webview2\mod.rs 130 line "--disable-features=msWebOOUI,msPdfOOUI,msSmartScreenProtection --proxy-server=127.0.0.1:7890".to_string()

build, you can use proxy

ChatGPT.zip

change default port 7890

with open("ChatGPT.exe", "rb+") as f:
    data = f.read()
    data = data.replace(b"127.0.0.1:7890", b"127.0.0.1:1080")
    f.seek(0)
    f.write(data)
    f.truncate()

It is recommended to submit a PR. This method works.

xsa-dev commented 1 year ago

The WindowBuilder (https://docs.rs/tauri/latest/tauri/window/struct.WindowBuilder.html) has/will have a additional_browser_args() method

(https://docs.rs/wry/latest/x86_64-pc-windows-msvc/wry/webview/trait.WebViewBuilderExtWindows.html#tymethod.with_additional_browser_args)

may be , you can use it.

i don't know rust , so I don't know how to use it

if can use, add --proxy-server=127.0.0.1:7890 the webview2 can use proxy

When I'm gonna get home, I'll try this

Does this works?

--proxy-server=127.0.0.1:7890
edsky commented 1 year ago

The latest version of Tauri supports setting proxies, and if dependencies can be updated, users can choose to configure proxies themselves.

xsa-dev commented 1 year ago

The latest version of Tauri supports setting proxies, and if dependencies can be updated, users can choose to configure proxies themselves.

I couldn't find any information about it. I updated the packages, what's next?

edsky commented 1 year ago

The latest version of Tauri supports setting proxies, and if dependencies can be updated, users can choose to configure proxies themselves.

I couldn't find any information about it. I updated the packages, what's next?

You can refer to this commit https://github.com/tauri-apps/tauri/commit/3dc38b150ea8c59c8ba67fd586f921016928f47c First of all, the version of Tauri should be 2.0 instead of 1.0. If you have upgraded, you can then set the startup command line and configure a proxy.

https://github.com/lencx/ChatGPT/blob/main/src-tauri/src/app/setup.rs#L70

xsa-dev commented 1 year ago

I created a topic in the Discord chat about this feature, but I couldn't solve it myself. I'm waiting for Mac OS support here.

dickeylth commented 1 year ago

The latest version of Tauri supports setting proxies, and if dependencies can be updated, users can choose to configure proxies themselves.

I couldn't find any information about it. I updated the packages, what's next?

You can refer to this commit tauri-apps/tauri@3dc38b1 First of all, the version of Tauri should be 2.0 instead of 1.0. If you have upgraded, you can then set the startup command line and configure a proxy.

https://github.com/lencx/ChatGPT/blob/main/src-tauri/src/app/setup.rs#L70

Seems that latest v1.3.0 has merged the commit: https://github.com/tauri-apps/tauri/releases/tag/tauri-v1.3.0

xsa-dev commented 1 year ago

You can refer to this commit tauri-apps/tauri@3dc38b1 First of all, the version of Tauri should be 2.0 instead of 1.0. If you have upgraded, you can then set the startup command line and configure a proxy.

Waiting for MacOS.

scruel commented 1 year ago

Is this issue been solved or not?

xsa-dev commented 1 year ago

Is this issue been solved or not? No

snowman commented 5 months ago

this feature still unsupported, uninstalled!