Allow IPv6 in Proxy settings and moving validation out from the UI into the model/ interface #430

Manually merged
pablomartin4btc merged 1 commit from qml-ipaddress-allow-ipv6 into main 2025-02-03 10:12:18 +00:00 AGit
pablomartin4btc commented 2024-11-01 14:34:19 +00:00 (Migrated from github.com)

The main purposes of this PR are:

  • Allow configure proxy server with IPv6 (after testing exhaustively in current bitcoin-qt repo and bitcoind - e.g. IPv6 on Qt; IP validation in Qt)
  • More importantly: moving the validation logic out from the UI (component/ control/ widget) into the back-end (model/ interfaces). It seemed currently in Qt all this logic (validation, network classes) was coupled to the UI since the beginning (more than 12y ago) instead of using interfaces (introduced much later) that would be the correct thing to do.

Feedback and suggestions are very welcome and will help establish a foundation for leaving business logic out of the UI going forward.


In order to test it, if it's the first time you run ./src/qt/bitcoin-qt you need to go thru the on-boarding flow (start->next->next->next->next->connection settings->Proxy settings) otherwise you need to go to the settings (top right gear icon) then Connection->Proxy settings.

image

Before this change, only IPv4 address were allow in the value input, now also IPv6 can be entered.


There are some look and feel kind of issues that will be handled on follow-ups (issues: #437 and #438).

The main purposes of this PR are: - Allow configure proxy server with IPv6 (after testing exhaustively in current `bitcoin-qt` [repo](https://github.com/bitcoin-core/gui/) and `bitcoind` - e.g. [IPv6 on Qt](https://github.com/bitcoin-core/gui/pull/836#issue-2527108426); [IP validation in Qt](https://github.com/bitcoin-core/gui/pull/813)) - More importantly: moving the validation logic out from the UI (component/ control/ widget) into the back-end (model/ interfaces). It seemed currently in [Qt](https://github.com/bitcoin-core/gui/) all this logic (validation, network classes) was coupled to the UI since the beginning (more than [12y ago](https://github.com/bitcoin-core/gui/blame/c4443c2be141e5f45bb10376056f3083e97cde50/src/qt/optionsmodel.cpp)) instead of using interfaces (introduced much later) that would be the correct thing to do. Feedback and suggestions are very welcome and will help establish a foundation for leaving business logic out of the UI going forward. --- <details> <summary>In order to test it, if it's the first time you run <code>./src/qt/bitcoin-qt</code> you need to go thru the on-boarding flow (<i>start->next->next->next->next->connection settings->Proxy settings</i>) otherwise you need to go to the settings (top right gear icon) then <i>Connection->Proxy settings</i>.</summary> ![image](https://git.fish.foo/attachments/d9a30f5f-1af2-4437-9f1a-d1ce9d3888d9) </details> Before this change, only IPv4 address were allow in the value input, now also IPv6 can be entered. --- There are some [look and feel kind of issues](https://github.com/bitcoin-core/gui-qml/pull/430#issuecomment-2498871269) that will be handled on follow-ups (issues: #437 and #438).
vasild (Migrated from github.com) reviewed 2024-11-02 10:23:19 +00:00
vasild (Migrated from github.com) left a comment

Concept ACK

Concept ACK
vasild (Migrated from github.com) commented 2024-11-02 09:05:11 +00:00

Pass the string as a const reference to avoid copying:

    virtual bool validateProxyAddress(const std::string& ipAddress) = 0;
Pass the string as a const reference to avoid copying: ```suggestion virtual bool validateProxyAddress(const std::string& ipAddress) = 0; ```
vasild (Migrated from github.com) commented 2024-11-02 09:06:39 +00:00

Would be good to document what this expects as input. That is - is the argument supposed to contain :port? If yes, then maybe change ipAddress to something like addr_port.

Would be good to document what this expects as input. That is - is the argument supposed to contain `:port`? If yes, then maybe change `ipAddress` to something like `addr_port`.
Lines 275-276
vasild (Migrated from github.com) commented 2024-11-02 09:02:33 +00:00

Up there, around line 130, is getProxy(). Maybe move those two next to it.

Up there, around line 130, is `getProxy()`. Maybe move those two next to it.
vasild (Migrated from github.com) commented 2024-11-02 10:22:44 +00:00

For consistency it would be best if the same rules apply to the -proxy= config and the text that is accepted via the GUI. For the former the validation is happening here:

github.com/bitcoin/bitcoin@f1bcf3edc5/src/init.cpp (L1140-L1168)

and here

github.com/bitcoin/bitcoin@f1bcf3edc5/src/init.cpp (L1513-L1526)

I am not sure how relevant the first check is for the proxy because the second check ends up calling SplitHostPort() as well. Maybe ignore the first, move the second to a new function and call this new function from the GUI and from init.cpp?

For consistency it would be best if the same rules apply to the `-proxy=` config and the text that is accepted via the GUI. For the former the validation is happening here: https://github.com/bitcoin/bitcoin/blob/f1bcf3edc5027b501616670db33d8be1f2cb5a11/src/init.cpp#L1140-L1168 and here https://github.com/bitcoin/bitcoin/blob/f1bcf3edc5027b501616670db33d8be1f2cb5a11/src/init.cpp#L1513-L1526 I am not sure how relevant the first check is for the proxy because the second check ends up calling `SplitHostPort()` as well. Maybe ignore the first, move the second to a new function and call this new function from the GUI and from `init.cpp`?
Lines 408-410
vasild (Migrated from github.com) commented 2024-11-02 09:15:32 +00:00

I think this warrants some comments on what is the intention. LookupNumeric() already calls SplitHostPort() internally (via Lookup()), can we avoid the call to SplitHostPort() here?

I think this warrants some comments on what is the intention. `LookupNumeric()` already calls `SplitHostPort()` internally (via `Lookup()`), can we avoid the call to `SplitHostPort()` here?
vasild (Migrated from github.com) commented 2024-11-02 09:16:05 +00:00

What about unix:/path/to/sock?

What about `unix:/path/to/sock`?
vasild (Migrated from github.com) commented 2024-11-02 09:19:32 +00:00

I think that the example was useful:

    property string invalidIpError: qsTr("Invalid IP address or port format. Use '255.255.255.255:65535' or '[ffff::]:65535'")
I think that the example was useful: ```suggestion property string invalidIpError: qsTr("Invalid IP address or port format. Use '255.255.255.255:65535' or '[ffff::]:65535'") ```
vasild (Migrated from github.com) commented 2024-11-02 10:09:47 +00:00

Could have been negative and still considered as valid: 1.2.-3.4

Could have been negative and still considered as valid: `1.2.-3.4`
vasild (Migrated from github.com) commented 2024-11-02 10:02:23 +00:00

I read https://doc.qt.io/qt-5/qml-qtquick-regexpvalidator.html but it is unclear whether the framework would prefix the regexp with ^ and suffix it with $. If it does not then we need to add it ourselves, because [0-9.:]* matches anything, e.g.:

$ echo xyz |grep -E '[0-9.:]*'
xyz

(this is because by default there is a match if the input contains a matching pattern and [0-9.:]* denotes 0 or more chars, so "xyz" contains 0 of those chars followed by "xyz")

In the examples from the doc they add an explicit $ at the end but not ^ at the front, hmm?

In a bracket expression \ looses its special meaning. So the above closes the bracket expression at the first ]: [0-9A-Fa-f.:\[\] followed by a literal ]. Probably the regex should be something like ^[][0-9A-Fa-f.:]*$, but is this even needed, given that there is a validation function?

I read https://doc.qt.io/qt-5/qml-qtquick-regexpvalidator.html but it is unclear whether the framework would prefix the regexp with `^` and suffix it with `$`. If it does not then we need to add it ourselves, because `[0-9.:]*` matches anything, e.g.: ```sh $ echo xyz |grep -E '[0-9.:]*' xyz ``` (this is because by default there is a match if the input _contains_ a matching pattern and `[0-9.:]*` denotes 0 or more chars, so "xyz" contains 0 of those chars followed by "xyz") In the examples from the doc they add an explicit `$` at the end but not `^` at the front, hmm? In a bracket expression `\` looses its special meaning. So the above closes the bracket expression at the first `]`: `[0-9A-Fa-f.:\[\]` followed by a literal `]`. Probably the regex should be something like `^[][0-9A-Fa-f.:]*$`, but is this even needed, given that there is a validation function?
vasild (Migrated from github.com) commented 2024-11-02 10:12:24 +00:00

Variable names should use snake_case, so ip_address, but maybe addr_port or even just proxy or proxy_str is a better name, especially if unix:/path/to/socket is to be accepted.

Variable names should use snake_case, so `ip_address`, but maybe `addr_port` or even just `proxy` or `proxy_str` is a better name, especially if `unix:/path/to/socket` is to be accepted.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:21:46 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:21:46 +00:00

Yes, I had it that way, somehow I lost it with testing, I'll add it back.

Yes, I had it that way, somehow I lost it with testing, I'll add it back.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:22:00 +00:00
Lines 275-276
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:22:00 +00:00

Ok, will do.

Ok, will do.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:55:18 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:55:18 +00:00

I agree, ok.

I agree, ok.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:57:07 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:57:07 +00:00

Ok, I thought it was too long.

Ok, I thought it was too long.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:57:43 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:57:43 +00:00

Yeah, all that will be gone anyways.

Yeah, all that will be gone anyways.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-04 22:59:08 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-04 22:59:08 +00:00

True, ok.

True, ok.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-05 14:32:54 +00:00
Lines 408-410
pablomartin4btc (Migrated from github.com) commented 2024-11-05 14:32:54 +00:00

Ok, it would make sense to remove the call SplitHostPort() then, also because we are not returning what the cause of the invalid address is. I'll also add comments on the intention of this logic.

Ok, it would make sense to remove the call `SplitHostPort()` then, also because we are not returning what the cause of the invalid address is. I'll also add comments on the intention of this logic.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-05 14:50:32 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-05 14:50:32 +00:00

but is this even needed, given that there is a validation function?

It's a first landing and it will avoid the user to enter invalid symbols or chars, intentionally or not.

> but is this even needed, given that there is a validation function? It's a first landing and it will avoid the user to enter invalid symbols or chars, intentionally or not.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-05 14:59:42 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-05 14:59:42 +00:00

Ok, let me do some testing on this. Thanks!

Ok, let me do some testing on this. Thanks!
pablomartin4btc (Migrated from github.com) reviewed 2024-11-05 15:19:10 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-05 15:19:10 +00:00

As discussed offline, in the upstream repo, support to unix sockets was added (https://github.com/bitcoin/bitcoin/pull/27375) already but as this repo is not refreshed and updated yet, I've created https://github.com/bitcoin-core/gui-qml/issues/431 and will do a follow-up on this PR once we get the feature added here.

As discussed offline, in the upstream repo, support to unix sockets was added (https://github.com/bitcoin/bitcoin/pull/27375) already but as this repo is not refreshed and updated yet, I've created https://github.com/bitcoin-core/gui-qml/issues/431 and will do a follow-up on this PR once we get the feature added here.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-06 03:28:42 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-06 03:28:42 +00:00

In a bracket expression \ looses its special meaning... Probably the regex should be something like ^[][0-9A-Fa-f.:]*$

That's true for the terminal, but it seems regular expressions are handled a bit differently in QML.

In the terminal, grep interprets [ and ] differently and doesn’t use the same escaping rules as some programming environments (like QML). When using grep, we need to adjust the syntax to avoid issues with special characters and escaping but QML uses JavaScript-based regex syntax (similar to ECMAScript). I can use your suggestion as it works in both environments and the one I was adding was only working in QML.

Anyways, the idea of having this regex validator (in fact looking at the doc ref you provided above I also realised that class is deprecated and should use RegularExpressionValidator now) is intended to ensure that an input contains only characters that are valid in IPv4 and IPv6 addresses, not to validate the format (as it would do the logic added into the node interface), it's purely esthetic. I've tried other alternatives like inputMask: (horrible UX) and classes like QHostAddress or QNetworkAddressEntry but the regex validator seems very practical and simplest.

> In a bracket expression \ looses its special meaning... Probably the regex should be something like ^[][0-9A-Fa-f.:]*$ That's true for the terminal, but it seems regular expressions are handled a bit differently in QML. In the terminal, `grep` interprets `[` and `]` differently and doesn’t use the same escaping rules as some programming environments (like QML). When using grep, we need to adjust the syntax to avoid issues with special characters and escaping but QML uses JavaScript-based regex syntax (similar to ECMAScript). I can use your suggestion as it works in both environments and the one I was adding was only working in QML. Anyways, the idea of having this regex validator (in fact looking at the doc ref you provided [above](https://doc.qt.io/qt-5/qml-qtquick-regexpvalidator.html) I also realised that class is deprecated and should use `RegularExpressionValidator` now) is intended to ensure that an input contains only characters that are valid in IPv4 and IPv6 addresses, not to validate the format (as it would do the logic added into the node interface), it's purely esthetic. I've tried other alternatives like `inputMask:` (horrible UX) and classes like `QHostAddress` or `QNetworkAddressEntry` but the regex validator seems very practical and simplest.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-06 03:33:06 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-06 03:33:06 +00:00

especially if unix:/path/to/socket is to be accepted.

As explained above, unix sockets support will be addressed in a follow-up once the feature is ready in this repo.

> especially if unix:/path/to/socket is to be accepted. As explained [above](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1829543225), unix sockets support will be addressed in a follow-up once the feature is ready in this repo.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-06 03:52:53 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-06 03:52:53 +00:00

I'm planning to refactor the init.cpp file after adding the persistence for the proxy setting, so the logic aligns with how the value is read and parsed from the settings.json file.

I'm planning to refactor the `init.cpp` file after adding the persistence for the proxy setting, so the logic aligns with how the value is read and parsed from the `settings.json` file.
pablomartin4btc commented 2024-11-06 04:53:16 +00:00 (Migrated from github.com)

Updates:

  • Addressed @vasild's feedback; next follow-ups:
    • init.cpp refactoring will be done when the setting persistence is added in a separate PR.
    • unix socket support related changes will be added in a separate PR once the feature is refreshed from the upstream repo.
<ins>_Updates_</ins>: - Addressed @vasild's feedback; next follow-ups: - `init.cpp` [refactoring](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1826541696) will be done when the setting persistence is added in a separate PR. - unix socket support [related changes](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1829543225) will be added in a separate PR once the feature is refreshed from the upstream repo.
pablomartin4btc commented 2024-11-10 01:08:23 +00:00 (Migrated from github.com)

Just to clarify:

  • this PR is ready for further review as the follow-ups mentioned in the previous updates are going to be implemented after this one is merged.
<ins>_Just to clarify_</ins>: - this PR is ready for further review as the follow-ups mentioned in the previous [updates](https://github.com/bitcoin-core/gui-qml/pull/430#issuecomment-2458722893) are going to be implemented after this one is merged.
vasild (Migrated from github.com) reviewed 2024-11-11 12:55:02 +00:00
vasild (Migrated from github.com) commented 2024-11-11 12:55:02 +00:00

After playing with this a bit and reading https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#non-v-mode_character_class I think it should be:

/^[\][0-9a-f.:]*$/i
#!/usr/bin/env node

if ("[A]:2.3b".match(/^[\][0-9a-f.:]*$/i)) {
    console.log("match");
} else {
    console.log("no match");
}

Do we want to accept the empty string as valid? If no, then change the * to +.

After playing with this a bit and reading https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#non-v-mode_character_class I think it should be: ```sh /^[\][0-9a-f.:]*$/i ``` ```js #!/usr/bin/env node if ("[A]:2.3b".match(/^[\][0-9a-f.:]*$/i)) { console.log("match"); } else { console.log("no match"); } ``` Do we want to accept the empty string as valid? If no, then change the `*` to `+`.
vasild (Migrated from github.com) reviewed 2024-11-11 13:05:32 +00:00
vasild (Migrated from github.com) left a comment

Approach ACK 3cb348bce27cfb8010dab89b645918f5583da9a9

Approach ACK 3cb348bce27cfb8010dab89b645918f5583da9a9
vasild (Migrated from github.com) commented 2024-11-11 13:00:11 +00:00

[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:65123 has length of 47.

`[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:65123` has length of 47.
pablomartin4btc (Migrated from github.com) reviewed 2024-11-11 13:52:00 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-11 13:52:00 +00:00

I'll correct it. Thanks!

I'll correct it. Thanks!
pablomartin4btc (Migrated from github.com) reviewed 2024-11-11 14:28:42 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-11 14:28:42 +00:00

Ok, let me check that again. Thanks!

Ok, let me check that again. Thanks!
pablomartin4btc (Migrated from github.com) reviewed 2024-11-11 21:30:24 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-11 21:30:24 +00:00

As commented to you offline, current implementation of the regex works as expected and doesn't allow spaces, it also works on a terminal with grep.

But I tried both current and your suggestion on https://jsconsole.com/, current implementation doesn't work well there but your does so I'm deciding to use yours (which includes i flag that allows case-insensitive); regarding * and +, it doesn't matter as the validation is being triggered anyways but for consistency and since it works in the jsconsole, I'll use + too.

As commented to you offline, current implementation of the regex works as expected and doesn't allow spaces, it also works on a terminal with grep. But I tried both current and your suggestion on https://jsconsole.com/, current implementation doesn't work well there but your does so I'm deciding to use yours (which includes `i` flag that allows case-insensitive); regarding `*` and `+`, it doesn't matter as the validation is being triggered anyways but for consistency and since it works in the `jsconsole`, I'll use `+` too.
pablomartin4btc commented 2024-11-11 23:08:29 +00:00 (Migrated from github.com)

Updates:

  • Addressed @vasild's latest feedback:
  • Updated top description with test instructions suggested offline by @jarolrod.
<ins>_Updates_</ins>: - Addressed @vasild's latest feedback: - Corrected max length of the IP input as [suggested](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1836636887). - Updated regex more [in accordance](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1837230383) with JS. - Updated top description with test instructions suggested offline by @jarolrod.
vasild (Migrated from github.com) approved these changes 2024-11-12 12:26:48 +00:00
vasild (Migrated from github.com) left a comment

ACK ebabe49eeb48d7579d4465d0f709839f0efe9fff

I am not very familiar with the QML side of things, but this change looks ok to me.

Good to have in a followup: unify the checks for valid proxy from init.cpp and from the GUI: https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1826541696

ACK ebabe49eeb48d7579d4465d0f709839f0efe9fff I am not very familiar with the QML side of things, but this change looks ok to me. Good to have in a followup: unify the checks for valid proxy from `init.cpp` and from the GUI: https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1826541696
pablomartin4btc commented 2024-11-12 16:30:30 +00:00 (Migrated from github.com)

Good to have in a followup: unify the checks for valid proxy from init.cpp and from the GUI: #430 (comment)

Thanks @vasild for taking the time to review this PR! I'm working already on the next PR which will have both the persistence logic of the proxy and the refactoring of the init.cpp you suggested.

> Good to have in a followup: unify the checks for valid proxy from `init.cpp` and from the GUI: [#430 (comment)](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1826541696) Thanks @vasild for taking the time to review this PR! I'm working already on the next PR which will have both the persistence logic of the proxy and the refactoring of the `init.cpp` you suggested.
D33r-Gee (Migrated from github.com) reviewed 2024-11-12 19:19:26 +00:00
D33r-Gee (Migrated from github.com) left a comment

tACK ebabe49 works as expected on WSL Ubuntu 22.04

tACK [ebabe49](https://github.com/bitcoin-core/gui-qml/commit/ebabe49eeb48d7579d4465d0f709839f0efe9fff) works as expected on WSL Ubuntu 22.04
pablomartin4btc (Migrated from github.com) reviewed 2024-11-14 17:54:03 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-14 17:54:03 +00:00

I am not sure how relevant the first check is for the proxy because the second check ends up calling SplitHostPort() as wel

I’ll restore the call to SplitHostPort() as advised offline. This is necessary because, without it, LookupNumeric would apply a default port if none is provided, making an address entered without a port (like 127) appear valid. I discovered this while testing the persistence of values in settings.json (a separate PR, which is nearly finished and will be pushed ASAP). For example, if a user enters 127 in the UI, it’s stored in the file without a port. While adding a default port could work, it might not be transparent for the user.

Another point we could discuss, if necessary, in the "setting persistence" PR (coming soon today) is why an IP like 127 remains valid even when a port is specified. This is because, as discussed with @vasil during his review of https://github.com/bitcoin-core/gui/pull/836, the IP validation is left to the OS (thru CService. For example, $ ping 127 results in PING 127 (0.0.0.127) 56(84) bytes of data, and this behavior aligns with how Qt and bitcoind currently handle IPs.

> I am not sure how relevant the first check is for the proxy because the second check ends up calling SplitHostPort() as wel I’ll restore the call to `SplitHostPort()` as advised offline. This is necessary because, without it, `LookupNumeric` would apply a default port if none is provided, making an address entered without a port (like `127`) appear valid. I discovered this while testing the persistence of values in `settings.json` (a separate PR, which is nearly finished and will be pushed ASAP). For example, if a user enters `127` in the UI, it’s stored in the file without a port. While adding a default port could work, it might not be transparent for the user. Another point we could discuss, if necessary, in the "setting persistence" PR (coming soon today) is why an IP like 127 remains valid even when a port is specified. This is because, as discussed with @vasil during his review of https://github.com/bitcoin-core/gui/pull/836, the IP validation is left to the OS (thru CService. For example, `$ ping 127` results in `PING 127 (0.0.0.127) 56(84) bytes of data`, and this behavior aligns with how Qt and `bitcoind` currently handle IPs.
pablomartin4btc commented 2024-11-14 18:43:04 +00:00 (Migrated from github.com)

Updates:

  • Restored the call to SplitHostPort() within validateProxyAddress as explained above. This was previously removed in ebabe49 - same comments thread.
    • In order to test it: for example 127 was a correct value in the previous commit while now the UI will indicate it's not due to incorrect format unless user adds the port (+ :65535).
<ins>_Updates_</ins>: - Restored the call to `SplitHostPort()` within `validateProxyAddress` as [explained above](https://github.com/bitcoin-core/gui-qml/pull/430#discussion_r1842663333). This was previously [removed](https://github.com/bitcoin-core/gui-qml/pull/430#issuecomment-2458722893) in ebabe49 - same comments thread. - <ins>_In order to test it_</ins>: for example 127 was a correct value in the previous commit while now the UI will indicate it's not due to incorrect format unless user adds the port (+ `:65535`).
vasild (Migrated from github.com) reviewed 2024-11-15 08:25:25 +00:00
vasild (Migrated from github.com) commented 2024-11-15 08:25:25 +00:00

Simplification idea: always require a port, from the GUI and from the command line and from the config file. Edit: the optional :port part is making it more difficult for developers while (probably) providing near 0 benefit to the users.

Simplification idea: always require a port, from the GUI and from the command line and from the config file. Edit: the optional `:port` part is making it more difficult for developers while (probably) providing near 0 benefit to the users.
vasild (Migrated from github.com) approved these changes 2024-11-15 08:28:58 +00:00
vasild (Migrated from github.com) left a comment
ACK 4dea7c91a537710f3582d57b44f8908767ebb944
pablomartin4btc (Migrated from github.com) reviewed 2024-11-15 15:34:54 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-11-15 15:34:54 +00:00

I agree.

I agree.
MarnixCroes (Migrated from github.com) reviewed 2024-11-25 09:32:42 +00:00
MarnixCroes (Migrated from github.com) left a comment

4dea7c91a5

the layout breaks when you paste when the default value (127.0.0.1:9050) is still present:
Screenshot from 2024-11-25 10-24-25

this doesn't happen when first removing the default value and then pasting.

Maybe add scroll functionality to this page?
If you're not on full screen and paste and get the invalid message, the bottom of the page cannot be accessed anymore as you can't scroll down.
On desktop switching to full screen works, but it might be a bigger problem on mobile.
So simple scroll functionality is good to add to the proxy settings page.

4dea7c91a537710f3582d57b44f8908767ebb944 the layout breaks when you paste when the default value (127.0.0.1:9050) is still present: ![Screenshot from 2024-11-25 10-24-25](https://git.fish.foo/attachments/73dc57fa-0793-4e3c-bd0d-643d2dc5e9ab) this doesn't happen when first removing the default value and then pasting. Maybe add scroll functionality to this page? If you're not on full screen and paste and get the invalid message, the bottom of the page cannot be accessed anymore as you can't scroll down. On desktop switching to full screen works, but it might be a bigger problem on mobile. So simple scroll functionality is good to add to the proxy settings page.
pablomartin4btc commented 2024-11-25 19:33:56 +00:00 (Migrated from github.com)

Thanks @MarnixCroes.

As discussed in our call among the team, both the overlapping (#437) and when the validation occurs (#438 - reverting onTextChanged into onEditingFinished would need a "done" button at the top - opposed to the "<back" button - as @GBKS proposed) will be done on follow-ups.

image

Thanks @MarnixCroes. As discussed in our call among the team, both the overlapping (#437) and when the validation occurs (#438 - reverting `onTextChanged` into `onEditingFinished` would need a "done" button at the top - _opposed to the "<back" button_ - as @GBKS proposed) will be done on follow-ups. ![image](https://git.fish.foo/attachments/c4c8a9dc-2153-4a14-9ce8-060e023cdb55)
GBKS commented 2024-12-03 15:33:27 +00:00 (Migrated from github.com)

Check out the updated web prototype to see for a proposal of how this logic could work out.

Check out the [updated web prototype](https://lively-kashata-cfde7e.netlify.app/screen/proxy-settings) to see for a proposal of how this logic could work out.
pablomartin4btc commented 2024-12-03 18:33:55 +00:00 (Migrated from github.com)

Check out the updated web prototype to see for a proposal of how this logic could work out.

I really like it, also the fact that the default is greyed out and it disappears when the user starts typing instead of having to delete it (I think it behaves like that currently) . Many thanks!

> Check out the [updated web prototype](https://lively-kashata-cfde7e.netlify.app/screen/proxy-settings) to see for a proposal of how this logic could work out. I really like it, also the fact that the default is greyed out and it disappears when the user starts typing instead of having to delete it (I think it behaves like that currently) . Many thanks!
johnny9 (Migrated from github.com) reviewed 2024-12-04 03:10:57 +00:00
johnny9 (Migrated from github.com) commented 2024-12-04 03:10:33 +00:00

Are these actually default settings values or just values presented to the user? If they are just hints, they can be left as strings in the QML.

Are these actually default settings values or just values presented to the user? If they are just hints, they can be left as strings in the QML.
johnny9 (Migrated from github.com) commented 2024-12-04 03:10:11 +00:00

I don't believe this should return a string. I think it should be an in/out Proxy&.

I don't believe this should return a string. I think it should be an in/out Proxy&.
johnny9 (Migrated from github.com) commented 2024-12-04 03:08:12 +00:00

validateProxyAddress shouldn't be in this module. It should exist in the nodemodel or possibly in netbase.

validateProxyAddress shouldn't be in this module. It should exist in the nodemodel or possibly in netbase.
GBKS commented 2024-12-04 08:10:00 +00:00 (Migrated from github.com)

also the fact that the default is greyed out and it disappears when the user starts typing instead of having to delete it

In the prototype, the light grey text is a placeholder, not the default. We could still treat it that way if we want.

> also the fact that the default is greyed out and it disappears when the user starts typing instead of having to delete it In the prototype, the light grey text is a [placeholder](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder), not the default. We could still treat it that way if we want.
D33r-Gee commented 2024-12-04 17:21:24 +00:00 (Migrated from github.com)

tACK 4dea7c9 on Ubuntu 20.04 works as expected.

Ubuntu 20.04 screenshot

Screenshot 2024-12-04 091711

tACK [4dea7c9](https://github.com/bitcoin-core/gui-qml/commit/4dea7c91a537710f3582d57b44f8908767ebb944) on Ubuntu 20.04 works as expected. <details> <summary>Ubuntu 20.04 screenshot</summary> ![Screenshot 2024-12-04 091711](https://git.fish.foo/attachments/e2a14852-993e-4533-b1d2-fdc8609a318e) </details>
pablomartin4btc (Migrated from github.com) reviewed 2024-12-05 11:59:16 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-12-05 11:59:16 +00:00

These are proper default values. I would leave them here for now, but maybe they can be moved into the netbase later.

These are proper default values. I would leave them here for now, but maybe they can be moved into the netbase later.
pablomartin4btc (Migrated from github.com) reviewed 2024-12-05 12:30:13 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-12-05 12:30:13 +00:00

This is just for display purposes, it doesn't make sense to build the object which also involves CService and so on, just to come back with eg ipv4.proxy.ToStringAddrPort();, I'd leave it as it is but can be done on a follow-up if more ppl think the change is required.

This is just for display purposes, it doesn't make sense to build the object which also involves `CService` and so on, just to come back with eg `ipv4.proxy.ToStringAddrPort();`, I'd leave it as it is but can be done on a follow-up if more ppl think the change is required.
pablomartin4btc (Migrated from github.com) reviewed 2024-12-05 12:40:37 +00:00
pablomartin4btc (Migrated from github.com) commented 2024-12-05 12:40:37 +00:00

I agree, maybe it could be moved deeper into de netbase but I didn't what to touch that at this stage, it can be done later once we update the interfaces upstream.

I agree, maybe it could be moved deeper into de netbase but I didn't what to touch that at this stage, it can be done later once we update the interfaces upstream.
johnny9 (Migrated from github.com) approved these changes 2025-02-02 18:18:46 +00:00
johnny9 (Migrated from github.com) left a comment
ACK 4dea7c91a537710f3582d57b44f8908767ebb944
GBKS commented 2025-02-03 09:53:41 +00:00 (Migrated from github.com)

Is my ACK needed on this? Looks more like a code task to me than a UI one.

Is my ACK needed on this? Looks more like a code task to me than a UI one.
Sign in to join this conversation.
No description provided.