-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathpac
More file actions
119 lines (113 loc) · 2.55 KB
/
pac
File metadata and controls
119 lines (113 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var domains = {
"apkmirror.com": 1,
"appledaily.com": 1,
"artstation.com": 1,
"bbc.com": 1,
"disqus.com": 1,
"dropbox.com": 1,
"dropboxapi.com": 1,
"dropbox-dns.com": 1,
"dw.com": 1,
"e-hentai.org": 1,
"epochtimes.com": 1,
"euronews.com": 1,
"exhentai.org": 1,
"github.com": 1,
"greasyfork.org": 1,
"imgur.com": 1,
"instagram.com": 1,
"kobo.com": 1,
"mega.io": 1,
"mega.nz": 1,
"nicovideo.jp": 1,
"nyaa.si": 1,
"nytimes.com": 1,
"nyt.com": 1,
"phncdn.com": 1,
"pinterest.com": 1,
"pixiv.net": 1,
"fanbox.cc": 1,
"quora.com": 1,
"redd.it": 1,
"reddit.com": 1,
"redditmedia.com": 1,
"startpage.com": 1,
"steamcommunity.com": 1,
"thetvdb.com": 1,
"uptodown.com": 1,
"vimeo.com": 1,
"wenxuecity.com": 1,
"wikipedia.org": 1,
"wikimedia.org": 1,
"mediawiki.org": 1,
"wikiquote.org": 1,
"wikinews.org": 1,
"wikiversity.org": 1,
"wiktionary.org": 1,
"wikibooks.org": 1,
"wikivoyage.org": 1,
"wikisource.org": 1,
"wikidata.org": 1,
"singlelogin.re": 1,
"1lib.sk": 1,
"archive.org": 1,
"amazon.co.jp": 1,
"discord.com": 1,
"discordapp.com": 1,
"discord.gg": 1,
"duckduckgo.com": 1,
"v2ex.com": 1,
"twitch.tv": 1,
"scratch.mit.edu": 1,
"bandcamp.com": 1,
"mastodon.social": 1,
"onedrive.live.com": 1,
"deviantart.com": 1,
"wixmp.com": 1,
"deviantart.net": 1
};
var shexps = {
"*://*.bbc.co.uk/*": 1,
"*://*.bbci.co.uk/*": 1,
"*://*.japantimes.co.jp/*": 1,
"*://search.yahoo.co.jp/*": 1,
"*://*.cna.com.tw/*": 1,
"*://media.discordapp.net/*": 1,
"*://i.pximg.net/*": 1,
"*://*.pixivsketch.net/*": 1,
"*://*.githubassets.com/*": 1,
"*://*.githubusercontent.com/*": 1,
"*://*.redditstatic.com/*": 1
};
var proxy = "PROXY {{host}}:{{port}};";
var direct = 'DIRECT;';
var hasOwnProperty = Object.hasOwnProperty;
function shExpMatchs(str, shexps) {
for (shexp in shexps) {
if (shExpMatch(str, shexp)) {
return true;
}
}
return false;
}
function FindProxyForURL(url, host) {
var suffix;
var pos = host.lastIndexOf('.');
pos = host.lastIndexOf('.', pos - 1);
while(1) {
if (pos <= 0) {
if (hasOwnProperty.call(domains, host)) {
return proxy;
} else if (shExpMatchs(url, shexps)) {
return proxy;
} else {
return direct;
}
}
suffix = host.substring(pos + 1);
if (hasOwnProperty.call(domains, suffix)) {
return proxy;
}
pos = host.lastIndexOf('.', pos - 1);
}
}