joshdick / miniProxy

🚨⚠️ UNMAINTAINED! ⚠️🚨 A simple PHP web proxy.
http://joshdick.github.io/miniProxy
GNU General Public License v3.0
860 stars 544 forks source link

Added support for loading plugins per domain #73

Closed BelleNottelling closed 7 years ago

BelleNottelling commented 7 years ago

Also added a plugin to allow getting onto FaceBook :) Oh, and this also includes basic cookies, plus the option to toggle them. You don't have to include the plugins folder for MiniProxy to continue to work, without them it will function as normal so MiniProxy can still be just as mini if the user would like :)


This change is Reviewable

BelleNottelling commented 7 years ago

Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions.


plugins/facebook.com.php, line 2 at r1 (raw file):

<?php
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Forwarded-For: $ip"));

This line attempts to report the uses real IP to fix facebook's security message as, code source https://stackoverflow.com/a/35819168


plugins/m.facebook.com.php, line 2 at r1 (raw file):

<?php
curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-Forwarded-For: $ip"));

This line attempts to report the uses real IP to fix facebook's security message as, code source https://stackoverflow.com/a/35819168


Comments from Reviewable

BelleNottelling commented 7 years ago

I just noticed that the cookies are using my​ modified code as your didn't work on my server, I'm thinking I'll​ reformat my code, clean it up, and also delete the cookie function? Or should I make a PR into the cookies fork? I'm thinking it wouldn't make much sense to delete the cookies from this as the Facebook needs them so it would leave my plugin useless :)

joshdick commented 7 years ago

Thanks for your PR.

As I said in #71:

The plugin idea is simple enough that a sufficiently advanced user could figure out how to implement a mechanism on their own just like you did, but I feel that miniProxy itself, at least in its current state, itself doesn't expose enough integration points to allow for a sufficient variety of useful plugins to exist.

I still stand by that statement.

This PR is useful in that it helps make Facebook work with miniProxy, but I think you've implemented a plugin mechanism that is most useful in one very specific case (changing cURL options), so I don't think it makes sense to merge it in/treat it as a generic plugin mechanism.

BelleNottelling commented 7 years ago

@joshdick Okay, so should I close this PR or keep it open? Also yes, I do believe that this PR is best used for changing cURL options, but it means that a user can have domain specific settings without adding to the initial file (miniProxy.php), and if they wanted to keep miniProxy mini they can still do that as the plugin system only adds a few extra lines of code, the else statement is also unnecessary so it can add as few as 4 lines of code, still mini if you ask me and an external file is a cleaner solution than adding to the main .php file and would make it easier to go back and edit it again. This is all that is necessary to load a plugin.

$domain = str_ireplace('www.', '', parse_url($url, PHP_URL_HOST)); //Get the domain for the URL(such as google.com rather than google.com/something/)
   if (file_exists(realpath("plugins/$domain.php"))) {   
         include realpath("plugins/$domain.php");//If it exists load the plug-in file for the selected website.              
     }
BelleNottelling commented 7 years ago

closed because cookies aren't ready and the plugins have been renamed to config in PR #74