Skip to content

Commit

Permalink
bugfix for issue #12 - accept urls without protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
zumoshi committed Aug 2, 2016
1 parent 77d9048 commit 2916053
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 21 deletions.
1 change: 1 addition & 0 deletions BrowserSelect/BrowserSelect.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<ItemGroup>
<Content Include="bs.ico" />
<Content Include="License.txt" />
<None Include="Resources\bitcoin.png" />
<None Include="Resources\Button-help-icon.png" />
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions BrowserSelect/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private void center_me()
var top = wa.Height / 2 + wa.Top - Height / 2;

this.Location = new Point(left, top);
this.Activate();
}

private void btn_help_Click(object sender, EventArgs e)
Expand Down
6 changes: 5 additions & 1 deletion BrowserSelect/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ static void Main(string[] args)
{
//check to see if auto select rules match
url = args[0];
//add http:// to url if it is missing a protocol
var uri = new UriBuilder(url).Uri;
url = uri.ToString();

foreach (var sr in Settings.Default.AutoBrowser.Cast<string>()
// maybe i should use a better way to split the pattern and browser name ?
.Select(x=>x.Split(new[] { "[#!][$~][?_]" }, StringSplitOptions.None))
Expand All @@ -39,7 +43,7 @@ static void Main(string[] args)
var browser = sr[1];

// matching the domain to pattern
if (DoesDomainMatchPattern(new Uri(url).Host, pattern))
if (DoesDomainMatchPattern(uri.Host, pattern))
{
// ignore the display browser select entry to prevent app running itself
if (browser != "display BrowserSelect")
Expand Down
4 changes: 2 additions & 2 deletions BrowserSelect/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyVersion("1.3.3.0")]
[assembly: AssemblyFileVersion("1.3.3.0")]
10 changes: 10 additions & 0 deletions BrowserSelect/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions BrowserSelect/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="bitcoin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bitcoin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Button-help-icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Button-help-icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
Binary file added BrowserSelect/Resources/bitcoin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 111 additions & 9 deletions BrowserSelect/frm_About.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 29 additions & 6 deletions BrowserSelect/frm_About.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@
using System.Text;
using System.Windows.Forms;

namespace BrowserSelect {
public partial class frm_About : Form {
public frm_About() {
namespace BrowserSelect
{
public partial class frm_About : Form
{
public frm_About()
{
InitializeComponent();
}

private void frm_About_Load(object sender, EventArgs e) {
private void frm_About_Load(object sender, EventArgs e)
{
pictureBox1.Image = IconExtractor.fromFile(Application.ExecutablePath).ToBitmap();
var v = Application.ProductVersion;
lab_ver.Text = "v" + v.Remove(v.Length - 2);
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("Mailto:[email protected]");
}

private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(((LinkLabel)sender).Text);
}

Expand All @@ -30,5 +38,20 @@ private void frm_About_KeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Escape)
Close();
}

private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("bitcoin:1BA5Ndo24jtRgTEsvmGkrqRWTaJS4F3zNh");
}

private void btn_close_Click(object sender, EventArgs e)
{
Close();
}

private void btn_bitcoin_copy_Click(object sender, EventArgs e)
{
Clipboard.SetText("1BA5Ndo24jtRgTEsvmGkrqRWTaJS4F3zNh");
}
}
}
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,54 @@ it has been tested on windows 7, windows 8.1 and windows 10. requires **.net fra

# Download

you can download browser select here : [Browser select v1.3.2 (198KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.3.2/BrowserSelect.exe)


you can download browser select here : [Browser select v1.3.3 (200KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.3.3/BrowserSelect.exe)

[![100% safe Award from softpedia](http://s1.softpedia-static.com/_img/sp100free.png?1)](http://www.softpedia.com/get/Internet/Browsers/Browser-Select.shtml#status)


# Related links

http://alternativeto.net/software/browser-select/

http://www.snapfiles.com/get/browserselect.html

http://www.softpedia.com/get/Internet/Browsers/Browser-Select.shtml

# ToDo

just a list of some ideas that can be integrated into BrowserSelect.
- [ ] Make Settings persist across updates
- [ ] Shift-Click to open link in incognito/private mode
- [ ] Option to display running browsers only
- [ ] More Auto-Select rule options
- [ ] based on source application
- [ ] based on file extension
- [ ] based on URL path
- [ ] based on keywords
- [ ] ignoring the URL as an option
- [ ] custom flags to browsers as an option (e.g. incognito mode or disable CSRF)
- [ ] export/import for rules/settings
- [ ] Sorting browsers on the list
- [ ] Custom Shortcuts
- [ ] Ignoring the rules if Alt key is held down when clicking a link
- [ ] an API to invoke BrowserSelect
- [ ] Bugfix for when Browser was launched with Maximize window state (browser select will launch maximized)
- [ ] A browser extension to launch the correct browser based on the rules even if link is clicked inside a browser
- [ ] support for portable browsers (adding browsers using a browse button rather than registry)
- [ ] support for non-browser apps as an option (e.g. download managers)
- [ ] themes ? or at least an optional transparent Aero glass mode
- [ ] ability to choose custom icons for browsers
- [ ] display the unshortened version of adf.ly or goo.gl links when selecting the browser
- [ ] Localization
- [ ] handling of other link types (e.g. `mail:` in case you have both outlook and thunderbird installed [or maybe as a sister app])
- [ ] update checker (not as a popup or messagebox, a tiny icon somewhere on the main form that appears when you don't have the last version)

# Changelog

v1.3.3
- fixed a crash on malformed (without protocol) url's
- added donate button in about page

v1.3.2
- bugfix to bring IE to foreground if it is already open

Expand Down

0 comments on commit 2916053

Please sign in to comment.