diff --git a/chrome/config.js b/chrome/config.js index 5f598151..1b74b546 100644 --- a/chrome/config.js +++ b/chrome/config.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify @@ -27,8 +26,9 @@ var unblock_youku = unblock_youku || {}; // namespace // only for redirect mode -unblock_youku.default_server = 'www.yōukù.com/proxy.php'; -unblock_youku.backup_server = 'bak.yōukù.com/proxy.php'; +unblock_youku.default_server = 'www.yōukù.com/proxy'; +// unblock_youku.default_server = '127.0.0.1:8888/proxy'; +unblock_youku.backup_server = 'bak.yōukù.com/proxy'; unblock_youku.normal_url_list = unblock_youku.common_urls.concat(unblock_youku.chrome_extra_urls); unblock_youku.redirect_url_list = unblock_youku.common_urls; diff --git a/chrome/content/links.js b/chrome/content/links.js index cfb29bf8..f62b768d 100644 --- a/chrome/content/links.js +++ b/chrome/content/links.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/content/play.baidu.css b/chrome/content/play.baidu.css index 13a2bd3e..9e762f33 100644 --- a/chrome/content/play.baidu.css +++ b/chrome/content/play.baidu.css @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/content/play.baidu.js b/chrome/content/play.baidu.js index 469d90a0..1008191c 100644 --- a/chrome/content/play.baidu.js +++ b/chrome/content/play.baidu.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/content/tudou.js b/chrome/content/tudou.js index 3d35f6d8..a7432886 100644 --- a/chrome/content/tudou.js +++ b/chrome/content/tudou.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/header.js b/chrome/header.js index 17a850f3..b01fb57a 100644 --- a/chrome/header.js +++ b/chrome/header.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/pages/css/popup.css b/chrome/pages/css/popup.css index a2e869e4..b1707e18 100644 --- a/chrome/pages/css/popup.css +++ b/chrome/pages/css/popup.css @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/pages/js/analytics.js b/chrome/pages/js/analytics.js index 4cecbb04..d442c152 100644 --- a/chrome/pages/js/analytics.js +++ b/chrome/pages/js/analytics.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/pages/js/options.js b/chrome/pages/js/options.js index a38b8864..1d3ab92c 100644 --- a/chrome/pages/js/options.js +++ b/chrome/pages/js/options.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/pages/js/popup.js b/chrome/pages/js/popup.js index 83d1f571..357e1b26 100644 --- a/chrome/pages/js/popup.js +++ b/chrome/pages/js/popup.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/proxy.js b/chrome/proxy.js index 3f3311bb..a1537b84 100644 --- a/chrome/proxy.js +++ b/chrome/proxy.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/chrome/redirect.js b/chrome/redirect.js index 9d2fcc95..925647fd 100644 --- a/chrome/redirect.js +++ b/chrome/redirect.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify @@ -18,15 +17,10 @@ /*jslint browser: true */ /*global chrome: false, unblock_youku: false, btoa: false */ -/*global ga_report_error */ +/*global ga_report_error: false, string_starts_with: false */ "use strict"; -function urlsafe_b64encode(str) { - return btoa(str).replace('+', '-').replace('/', '_'); -} - - function http_redirector(details) { console.log('original url: ' + details.url); if (details.url.slice(-15) === 'crossdomain.xml') { @@ -59,7 +53,11 @@ function http_redirector(details) { } //var redirect_url = 'http://127.0.0.1.xip.io:8080/?url=' + urlsafe_b64encode(details.url); - redirect_url = 'http://' + backend_server + '?url=' + urlsafe_b64encode(details.url); + if (string_starts_with(details.url, 'http://')) { + redirect_url = 'http://' + backend_server + '/http/' + details.url.substring('http://'.length); + } else if (string_starts_with(details.url, 'https://')) { + redirect_url = 'http://' + backend_server + '/https/' + details.url.substring('https://'.length); + } console.log('redirect url: ' + redirect_url); if (redirect_url !== null) { @@ -79,7 +77,7 @@ function check_redirect_server(server_addr, success_callback, failure_callback) failure_callback('Timeout'); }, 10000); // 10s - xhr.open('GET', 'http://' + server_addr.match(/^(.[^:\/]+)/)[1] + '/status', true); + xhr.open('GET', 'http://' + server_addr.match(/^(.[^\/]+)/)[1] + '/status', true); xhr.timeout = 12000; // 12s xhr.onreadystatechange = function() { if (xhr.readyState === 4) { diff --git a/chrome/storage.js b/chrome/storage.js index 628df062..ad332f22 100644 --- a/chrome/storage.js +++ b/chrome/storage.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/server/server.js b/server/server.js index 9ec692f0..1a069166 100755 --- a/server/server.js +++ b/server/server.js @@ -247,7 +247,7 @@ if (cluster.isMaster) { console.log(('Using the backup proxy: ' + opts.bak_proxy).green); } if (opts.pac_proxy) { - console.log(('The PAC file uses the proxy: ' + opts.bak_proxy).green); + console.log(('The PAC file uses the proxy: ' + opts.pac_proxy).green); } } else if (cluster.isWorker) { diff --git a/server/utils.js b/server/utils.js index a286e6d0..3fdda1f8 100644 --- a/server/utils.js +++ b/server/utils.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/shared/tools.js b/shared/tools.js index 0e756509..f1043384 100644 --- a/shared/tools.js +++ b/shared/tools.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2014 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify diff --git a/shared/urls.js b/shared/urls.js index ee803206..647da839 100644 --- a/shared/urls.js +++ b/shared/urls.js @@ -1,5 +1,4 @@ /* - * Allow you smoothly surf on many websites blocking non-mainland visitors. * Copyright (C) 2012 - 2013 Bo Zhu http://zhuzhu.org * * This program is free software: you can redistribute it and/or modify