build-apple-cdn.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. const path = require('path');
  2. const { compareAndWriteFile } = require('./lib/string-array-compare');
  3. const { withBannerArray } = require('./lib/with-banner');
  4. const { parseFelixDnsmasq } = require('./lib/parse-dnsmasq');
  5. (async () => {
  6. console.time('Total Time - build-apple-cdn-conf');
  7. const res = await parseFelixDnsmasq('https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf');
  8. await Promise.all([
  9. compareAndWriteFile(
  10. withBannerArray(
  11. 'Sukka\'s Surge Rules - Apple CDN',
  12. [
  13. 'License: AGPL 3.0',
  14. 'Homepage: https://ruleset.skk.moe',
  15. 'GitHub: https://github.com/SukkaW/Surge',
  16. '',
  17. 'This file contains Apple\'s domains using their China mainland CDN servers.',
  18. '',
  19. 'Data from:',
  20. ' - https://github.com/felixonmars/dnsmasq-china-list'
  21. ],
  22. new Date(),
  23. res.map(domain => `DOMAIN-SUFFIX,${domain}`)
  24. ),
  25. path.resolve(__dirname, '../List/non_ip/apple_cdn.conf')
  26. ),
  27. compareAndWriteFile(
  28. withBannerArray(
  29. 'Sukka\'s Surge Rules - Apple CDN',
  30. [
  31. 'License: AGPL 3.0',
  32. 'Homepage: https://ruleset.skk.moe',
  33. 'GitHub: https://github.com/SukkaW/Surge',
  34. '',
  35. 'This file contains Apple\'s domains using their China mainland CDN servers.',
  36. '',
  37. 'Data from:',
  38. ' - https://github.com/felixonmars/dnsmasq-china-list'
  39. ],
  40. new Date(),
  41. res.map(i => `.${i}`)
  42. ),
  43. path.resolve(__dirname, '../List/domainset/apple_cdn.conf')
  44. )
  45. ]);
  46. console.timeEnd('Total Time - build-apple-cdn-conf');
  47. })();