FelisCatus / switchysharp

Automatically exported from code.google.com/p/switchysharp
GNU General Public License v3.0
140 stars 50 forks source link

Bulk Proxy Import #887

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What enhancement do you suggest?

A bulk proxy import.  I get a list of 30 proxies a week and I would like a way 
to import 30 different proxy.ip:port via text file and have them available in 
switchysharp.  Thanks! 

Do you urgently need this enhancement?
Urgency: High

Do you think this enhancement is important to the project?
Importance: High

Original issue reported on code.google.com by stlpro...@gmail.com on 8 Mar 2014 at 6:05

GoogleCodeExporter commented 9 years ago
Oh, really? But even if you could import them, you cannot use them all at once. 
There is not even polling or fallback support.

And the popup menu could become fairly tall with 30 profiles on it. Are you 
sure you want to do that?

Original comment by shyc2...@gmail.com on 9 Mar 2014 at 4:09

GoogleCodeExporter commented 9 years ago
Yes, I would just filter through them with the one click after import and after 
I set up the one click for them all. If 30 are too many, I can work with 15-20. 
Thanks for the quick reply. 

Original comment by stlpro...@gmail.com on 9 Mar 2014 at 4:22

GoogleCodeExporter commented 9 years ago
I would not patch SwitchySharp for such uncommon use case. However, I can 
provide a small snippet like this:

(function(Settings){var p = Settings.getObject('profiles'); var t = 
p['template']; window.prompt().split(';').forEach(function(proxy) { 
p[proxy]=jQuery.extend({}, t, {id:proxy,name:proxy,proxyHttp:proxy}); }); 
Settings.setObject('profiles', p); history.go(0) 
})(chrome.extension.getBackgroundPage().Settings)

To run this snippet, please press F12 on the options page. Then select the 
"Console" tab and paste the above snippet there. After you press enter, a 
little prompt window will popup. Please enter all your proxies there seperated 
by semi-colon (like 127.0.0.1:1234;127.0.0.1:5678 and so on). You may want to 
copy & paste since it would be a very long string. Press enter and your proxies 
would be there.

Please let me know if this helps.

Original comment by shyc2...@gmail.com on 9 Mar 2014 at 8:24

GoogleCodeExporter commented 9 years ago
Note: After running the snippet, please press "Save" on the options page. The 
snippet can also accept a template profile which is named "template". The name 
can be changed on the first line of the snippet to use any of your existing 
profiles as a template.

Original comment by shyc2...@gmail.com on 9 Mar 2014 at 8:27

GoogleCodeExporter commented 9 years ago
Wow, thank you so much!! I will give this a try today and let you know how it 
works!

Original comment by stlpro...@gmail.com on 9 Mar 2014 at 5:04

GoogleCodeExporter commented 9 years ago
Works great! One question though, is there a quick way to delete all profiles?  
This would be handy when I need to refresh the ips with new ones every week.

One other sidenote that would be handy.  Is there a way to have it create the 
30 profiles with a generic name and numbered 1-30 next to it.  Like say name em 
all proxy1, proxy2, proxy3, all the way to proxy30.  That way I can more easily 
recognize when I switched to a new ip.  This is not terribly important, but I 
figured I'd ask in case it was easy to integrate into the snippet.

Thanks so much!

Original comment by stlpro...@gmail.com on 9 Mar 2014 at 6:26

GoogleCodeExporter commented 9 years ago
If you want to delete or the profiles, just do an options reset or import a 
previously exported backup. A modified version of the script, which name the 
profiles like ProfileN, follows.

(function(Settings){var p = Settings.getObject('profiles'); var t = 
p['template']; var i = 0; window.prompt().split(';').forEach(function(proxy) { 
var n = "Proxy" + (++i); p[proxy]=jQuery.extend({}, t, 
{id:n,name:n,proxyHttp:proxy}); }); Settings.setObject('profiles', p); 
history.go(0) })(chrome.extension.getBackgroundPage().Settings)

Original comment by shyc2...@gmail.com on 10 Mar 2014 at 9:58

GoogleCodeExporter commented 9 years ago
I'm trying to switch from Firefox to Chrome and having some way to import my 
current list of proxies is critical as I've got 75 in my list.  Thankfully the 
above code (in response #3) helped me get this done.  Thanks so much for this!

I would suggest that the ability to easily import a list of proxies is more 
common than you think.  I'd encourage you to either formally add the feature or 
switch the backup formatting from base64 to plain text so people could use that 
to "restore" a new proxy list.

Original comment by hende...@gmail.com on 12 Mar 2014 at 5:19

GoogleCodeExporter commented 9 years ago
Thanks so much for this functionality! I am now using 50 ips a month with this 
import tool and I do have another question.  I noticed now the main time 
consuming piece is after importing, under general tab checking "quick switch" 
and then dragging all of the 50 profiles to the top to be cycled through.  Is 
there a magic snippet that will accomplish this or a way to add all profiles to 
the "cycled profiles" list?

Thanks! 

Original comment by stlpro...@gmail.com on 1 Apr 2014 at 6:30

GoogleCodeExporter commented 9 years ago
Here we go:

(function (Settings) { var profiles = Settings.getObject('profiles'), list = 
[]; for (var p in profiles) { list.push(profiles[p].id); } 
Settings.setObject('quickSwitchProfiles', list); history.go(0); 
})(chrome.extension.getBackgroundPage().Settings)

The script above adds all profiles to the cycled profiles list.

Personally I don't love magic. However, adding batch import functionality will 
end up adding batch operations for everything as shown in reply #9. So for 
@henderpa, no, I will not formally add the feature.

A new backup format based on JSON is already implemented in version 2.0, which 
is still in its alpha stage now. You can try it now if you like. But please be 
aware that all the magic snippets are for version 1.x only and will not 
continue to work after the upgrade.
https://github.com/FelisCatus/SwitchyOmega/releases

Original comment by shyc2...@gmail.com on 3 Apr 2014 at 6:33

GoogleCodeExporter commented 9 years ago
Issue 1019 has been merged into this issue.

Original comment by shyc2...@gmail.com on 30 Sep 2014 at 9:09

GoogleCodeExporter commented 9 years ago
Issue 1019 has been merged into this issue.

Original comment by shyc2...@gmail.com on 1 Oct 2014 at 5:10

GoogleCodeExporter commented 9 years ago
Issue 1019 has been merged into this issue.

Original comment by shyc2...@gmail.com on 1 Oct 2014 at 6:26

GoogleCodeExporter commented 9 years ago
Issue 1019 has been merged into this issue.

Original comment by shyc2...@gmail.com on 1 Oct 2014 at 10:11

GoogleCodeExporter commented 9 years ago
In case someone needs it, the solution for SwitchyOmega (2.x) is here for your 
reference: 
https://github.com/FelisCatus/SwitchyOmega/issues/235

Original comment by shyc2...@gmail.com on 27 Jan 2015 at 9:21

jokoss commented 6 years ago

Thank you so much