Skip to content

Instantly share code, notes, and snippets.

@RC1140
Created January 30, 2013 20:27
Show Gist options
  • Save RC1140/4676624 to your computer and use it in GitHub Desktop.
Save RC1140/4676624 to your computer and use it in GitHub Desktop.
Hola patch to remove remote calls and lower permissions requirements.
diff --cc manifest.json
index 984792c,06d9aad..0000000
--- a/manifest.json
+++ b/manifest.json
@@@ -5,9 -5,7 +5,13 @@@
"proxy",
"webRequest",
"webRequestBlocking",
++<<<<<<< HEAD
+ "<all_urls>",
+ "storage",
+ "tabs"
++=======
+ "storage"
++>>>>>>> 28aee2ce350ef60ae71f5b0bd3c6dea4efc7222f
],
"version" : "1.0.159",
"background" : {
diff --cc scripts/background.js
index 2be7d75,12c0a8a..0000000
--- a/scripts/background.js
+++ b/scripts/background.js
@@@ -160,7 -160,6 +160,10 @@@ function set_state(state
update_ui();
if (state=="on" || state=="off")
{
++<<<<<<< HEAD
+ clog("enable_"+state);
++=======
++>>>>>>> 28aee2ce350ef60ae71f5b0bd3c6dea4efc7222f
chrome.storage.local.set({state: state});
}
}
@@@ -217,29 -216,12 +220,38 @@@ function log(s
console.log(s);
}
++<<<<<<< HEAD
+function clog(id, info)
+{
+ $.get(pac_url_base, {
+ uuid: uuid,
+ id: id,
+ info: info || "",
+ clog: 1
+ });
+}
+
+function handle_install(details)
+{
+ if (!details)
+ clog("up");
+ else if (details.reason==="install")
+ {
+ window.open("installed/installed.html");
+ clog("install");
+ }
+ else if (details.reason==="update")
+ clog("update", "from v"+details.previousVersion);
+ else
+ clog("up", details.reason);
++=======
+ function handle_install(details)
+ {
+ if (details.reason==="install")
+ {
+ window.open("installed/installed.html");
+ }
++>>>>>>> 28aee2ce350ef60ae71f5b0bd3c6dea4efc7222f
}
chrome.browserAction.setPopup({popup: "popup/popup.html"});
@@@ -259,34 -241,34 +271,66 @@@ els
});
chrome.storage.sync.get("uuid", function(items)
{
++<<<<<<< HEAD
+ if (!(uuid = items.uuid))
+ {
+ uuid = "";
+ var buf = new Uint8Array(16);
+ window.crypto.getRandomValues(buf);
+ for (var i=0; i<buf.length; i++)
+ uuid += (buf[i]<=0xf ? "0" : "")+buf[i].toString(16);
+ chrome.storage.sync.set({uuid: uuid});
+ }
+ handle_install(install_details);
+ /* proxy is password protected to make it harder for port scaners */
+ chrome.webRequest.onAuthRequired.addListener(handle_auth_req,
+ {urls: ["<all_urls>"]}, ["blocking"]);
+ chrome.extension.isAllowedIncognitoAccess(function(is_allowed)
+ {
+ settings_scope = is_allowed ? "regular" : "regular_only";
+ chrome.storage.local.get("sites", function(items)
+ {
+ enabled_sites = items.sites ||
+ Object.keys(supported_sites).join("+");
+ chrome.browserAction.setPopup({popup: "popup/popup.html"});
+ set_saved_state();
+ check_client();
+ chrome.windows.onFocusChanged.addListener(function()
+ {
+ check_client();
+ });
+ });
+ });
++=======
+ if (!(uuid = items.uuid))
+ {
+ uuid = "";
+ var buf = new Uint8Array(16);
+ window.crypto.getRandomValues(buf);
+ for (var i=0; i<buf.length; i++)
+ uuid += (buf[i]<=0xf ? "0" : "")+buf[i].toString(16);
+ chrome.storage.sync.set({uuid: uuid});
+ }
+ handle_install(install_details);
+ /* proxy is password protected to make it harder for port scaners */
+ chrome.webRequest.onAuthRequired.addListener(handle_auth_req,
+ {urls: ["<all_urls>"]}, ["blocking"]);
+ chrome.extension.isAllowedIncognitoAccess(function(is_allowed)
+ {
+ settings_scope = is_allowed ? "regular" : "regular_only";
+ chrome.storage.local.get("sites", function(items)
+ {
+ enabled_sites = items.sites ||
+ Object.keys(supported_sites).join("+");
+ chrome.browserAction.setPopup({popup: "popup/popup.html"});
+ set_saved_state();
+ check_client();
+ chrome.windows.onFocusChanged.addListener(function()
+ {
+ check_client();
+ });
+ });
+ });
++>>>>>>> 28aee2ce350ef60ae71f5b0bd3c6dea4efc7222f
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment