Skip to content

Commit

Permalink
Move the code of producing regex in command line into its own js file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhuor authored Jun 29, 2022
1 parent d274252 commit dac2abf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
9 changes: 9 additions & 0 deletions shared/produce_regex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const shared_urls = require('../shared/urls');

const chrome_regex_list = shared_urls.produce_squid_regex_list(/* for_pac_server= */ false);
const chrome_regex_text = chrome_regex_list.join('\n') + '\n';
console.log(chrome_regex_text);

process.exit(0);
20 changes: 0 additions & 20 deletions shared/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,23 +592,3 @@ exports.pac_urls = unblock_youku.pac_proxy_urls;
exports.pac_bypass_urls = unblock_youku.pac_proxy_bypass_urls;

exports.produce_squid_regex_list = produce_squid_regex_list;


(function () {
'use strict';

// http://stackoverflow.com/a/5197219
// http://stackoverflow.com/a/6398335
if (typeof module !== 'undefined' && module.exports && require.main === module) {
var squid_regex_list;
if (typeof process !== 'undefined' && process.argv[2] === 'PAC') {
squid_regex_list = produce_squid_regex_list(true /* for PAC service */);
} else {
squid_regex_list = produce_squid_regex_list(false /* for Chrome proxy */);
}

for (var i = 0; i < squid_regex_list.length; i++) {
console.log(squid_regex_list[i]);
}
}
}());

0 comments on commit dac2abf

Please sign in to comment.