Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize t.me proxy qr codes #5895

Merged
merged 6 commits into from
Aug 23, 2024
Merged

recognize t.me proxy qr codes #5895

merged 6 commits into from
Aug 23, 2024

Conversation

r10s
Copy link
Member

@r10s r10s commented Aug 19, 2024

this PR adds the type DC_QR_SOCKS5_PROXY to dc_check_qr() for supporting telegram proxy QR codes. if returned, the UI should ask the user if they want to us the proxy and call dc_set_config_from_qr(); afterwards (plus maybe dc_configure()).

idea is to improve our proxy story, follow ups may be:

  • in UI, - move proxy out of "Account & Password", as a separate "Proxy Activity" (it should stay in "Advanced" for now, however, below "Server", which might be moved up)

  • allow opening the "Proxy Activity" from the welcome screens three-dot-menu (that would also solve a long standing issue that entering the email address bypasses the proxy

  • show proxy usage in the "Connectivity View" and/or add an icon to the main chatlist screen (beside three-dot menu) in case some proxy is in use; tapping this icon will open the "Proxy Activity"

  • the the new "Proxy Activity", add a share / show proxy QR code button. that would generate invite links in the form https://i.delta.chat/socks#... - so that tapping then opens the app. support for these links need to be added to core then.

  • handle a list of proxies in core, offer selection in UI. the list could be one for all profiles and could be filled eg. by normal invite links or other channels

@r10s r10s force-pushed the r10s/scan-proxy-qr-code branch 2 times, most recently from 07e07f0 to ef92fef Compare August 19, 2024 15:00
@r10s r10s requested review from link2xt and adbenitez August 19, 2024 15:01
@r10s r10s marked this pull request as ready for review August 19, 2024 15:01
@r10s r10s force-pushed the r10s/scan-proxy-qr-code branch from ef92fef to d54932c Compare August 19, 2024 15:05
src/qr.rs Show resolved Hide resolved
src/qr.rs Outdated Show resolved Hide resolved
src/qr.rs Outdated Show resolved Hide resolved
src/qr.rs Show resolved Hide resolved
src/qr.rs Outdated
Comment on lines 687 to 724
// disable proxy before changing settings to not use a combination of old and new
context
.set_config_bool(Config::Socks5Enabled, false)
.await?;

context.set_config(Config::Socks5Host, Some(&host)).await?;
context
.set_config_u32(Config::Socks5Port, u32::from(port))
.await?;
context.set_config(Config::Socks5User, None).await?;
context.set_config(Config::Socks5Password, None).await?;
context.set_config_bool(Config::Socks5Enabled, true).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the following "solution" for now, to not complicate the code with transactions or so. Anyway, this is minor.

Suggested change
// disable proxy before changing settings to not use a combination of old and new
context
.set_config_bool(Config::Socks5Enabled, false)
.await?;
context.set_config(Config::Socks5Host, Some(&host)).await?;
context
.set_config_u32(Config::Socks5Port, u32::from(port))
.await?;
context.set_config(Config::Socks5User, None).await?;
context.set_config(Config::Socks5Password, None).await?;
context.set_config_bool(Config::Socks5Enabled, true).await?;
// invalidate proxy before changing settings to not use a combination of old and new
context.set_config(Config::Socks5Host, None).await?;
context
.set_config_u32(Config::Socks5Port, u32::from(port))
.await?;
context.set_config(Config::Socks5User, None).await?;
context.set_config(Config::Socks5Password, None).await?;
context.set_config(Config::Socks5Host, Some(&host)).await?;
context.set_config_bool(Config::Socks5Enabled, true).await?;

@r10s r10s force-pushed the r10s/scan-proxy-qr-code branch from c446f42 to 4346de0 Compare August 22, 2024 20:29
@r10s
Copy link
Member Author

r10s commented Aug 22, 2024

i added a commit to support the parameters &user= and &pass in t.me/socks urls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants