From f96c42ba84fbcd16a03badff0b3e44873f488d1e Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Mon, 7 Mar 2022 14:15:39 +0300 Subject: [PATCH] Add Facebook and Twitter special proxy server --- config/config.sh | 5 ++++- generate-pac.sh | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/config/config.sh b/config/config.sh index e964003..4150c43 100755 --- a/config/config.sh +++ b/config/config.sh @@ -4,7 +4,10 @@ PACHTTPSHOST='proxy-ssl.antizapret.prostovpn.org:3143' # Regular proxy address -PACPROXYHOST='proxy-nossl.antizapret.prostovpn.org:29976' +PACPROXYHOST='proxy-nossl.antizapret.prostovpn.org:29976' + +# Facebook and Twitter proxy address +PACFBTWHOST='proxy-fbtw-ssl.antizapret.prostovpn.org:3143' PACFILE="result/proxy-host-ssl.pac" PACFILE_NOSSL="result/proxy-host-nossl.pac" diff --git a/generate-pac.sh b/generate-pac.sh index 4654bef..e4a25a1 100755 --- a/generate-pac.sh +++ b/generate-pac.sh @@ -73,8 +73,18 @@ echo " if (domains.length < 10) return \"DIRECT\"; // list is broken shost = host.replace(/(.+)\.([^.]+\.[^.]+$)/, \"\$2\"); // remove leading www - shost = shost.replace(/^www\.(.+)/, \"\$1\"); + shost = shost.replace(/^www\.(.+)/, \"\$1\");" >> "$PACFILE" +cp "$PACFILE" "$PACFILE_NOSSL" + +echo " + fbtw = ['twitter.com', 'twimg.com', 't.co', + 'facebook.com', 'fbcdn.net']; + if (fbtw.indexOf(shost) !== -1) { + return \"HTTPS ${PACFBTWHOST}; PROXY ${PACPROXYHOST}; DIRECT\"; + }" >> "$PACFILE" + +echo " var curdomain = shost.match(/(.*)\\.([^.]+\$)/); if (!curdomain || !curdomain[2]) {return \"DIRECT\";} var curhost = curdomain[1]; @@ -109,9 +119,8 @@ echo " if (domains.length < 10) return \"DIRECT\"; // list is broken // WARNING! WARNING! WARNING! // You should NOT use these proxy servers outside of PAC file! // DO NOT enter it manually in any program! - // By doing this, you harm the service!" >> "$PACFILE" + // By doing this, you harm the service!" | tee -a "$PACFILE" "$PACFILE_NOSSL" >/dev/null -cp "$PACFILE" "$PACFILE_NOSSL" echo " return \"HTTPS ${PACHTTPSHOST}; PROXY ${PACPROXYHOST}; DIRECT\";" >> "$PACFILE" echo " return \"PROXY ${PACPROXYHOST}; DIRECT\";" >> "$PACFILE_NOSSL"