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

matching on urls rather than domains only #67

Open
JaspalX opened this issue Jun 21, 2020 · 6 comments
Open

matching on urls rather than domains only #67

JaspalX opened this issue Jun 21, 2020 · 6 comments

Comments

@JaspalX
Copy link
Contributor

JaspalX commented Jun 21, 2020

I've had a look at the code but as I mentioned - unfamiliar with c# - if you can help me log/debug the url matching code I reckon I could work it out - at the moment I can't 'see' what parameters are being passed into the regex check in DoesWildcardMatch (and DoesDomainMatchPattern) even when I break drop the scheme from the uri (uri.host+uri.pathandquery+uri.fragment) - I guess there may be some escaping but not sure :(

same domain but different url

That is unrelated to this issue, please open a new one. But in short, the wildcard is already supported, (e.g. *.whatever.com), You just need to include the path in the string the rules are checked against. Somewhere around here. Check the Uri Class documentation for properties other than Host to check. The tricky part would be to make sure it won't break domain-only rules if say the domain name existed somewhere in the url's path. (e.g. something.com/link/somethingelse.com/ )

Originally posted by @zumoshi in #61 (comment)

@zumoshi
Copy link
Owner

zumoshi commented Jun 21, 2020

uri.host+uri.pathandquery+uri.fragment

image

Keep in mind that the method only checks for exact matches, as in nothing that isn't wildcarded shouldn't be left or it won't match:
image

Hence why I said it might be tricky to add this feature without breaking existing domain-only rules or changing the UI to allow different rule types to be added.

may be some escaping

Only for non-ASCII characters or spaces.
e.g. a.com/what ever => a.com/what%20ever
a.com/متن-غیر-انگلیسی => a.com/%D9%85%D8%AA%D9%86-%D8%BA%DB%8C%D8%B1-%D8%A7%D9%86%DA%AF%D9%84%DB%8C%D8%B3%DB%8C

help me log/debug the url

Best way is to set some breakpoints and step through the code.

@JaspalX
Copy link
Contributor Author

JaspalX commented Jun 21, 2020

Thanks.
I get Settings.Default.AutoBrowser is null when launching to debug with an argument - is that a bug?

@zumoshi
Copy link
Owner

zumoshi commented Jun 21, 2020

Settings.Default.AutoBrowser is null

Did you make any rules? Debug mode settings may be stored separately from the installed version. Try adding some rules when launching as debug then restarting the app and checking its value.

@JaspalX
Copy link
Contributor Author

JaspalX commented Jun 25, 2020 via email

@zumoshi
Copy link
Owner

zumoshi commented Jun 25, 2020

I don't run files individually, if you open BrowserSelect.sln in Visual Studio it should recognize the project and allow you to debug the whole thing. Depending on what IDE you use you may be able to load BrowserSelect.csproj instead, which is an XML file including a list of all the dependencies and files required for the project to function.

Alternatively, you can manually verify if the options are saved or not by looking at the path it should save them in. You can find this path programmatically by running:

var path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;

(you may need some imports/references for it to work)

On my system that path is:

C:\Users\Bor\AppData\Local\BrowserSelect\BrowserSelect.exe_Url_1aa1pcucfjv1jpsasunq3pmxflnpikth\1.4.1.0\user.config

The hash-style part may be different for you, but it should stay the same between builds using the same system/ide. Try checking the file's content or manually copying your normal config overwriting the one debug instance uses.
Sometimes when debugging the first part may be BrowserSelect.vshost.exe instead of BrowserSelect.exe.

image
Example of Settings.Default.AutoBrowser getting its value from the config file.

Hope this helps.

@JaspalX
Copy link
Contributor Author

JaspalX commented Jun 25, 2020 via email

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

No branches or pull requests

2 participants