@rhyster/wow-casc-dbc 2.14.4 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { mapLimit, retry } from 'async';
4
4
  import cliProgress from 'cli-progress';
5
5
  import zlib from 'node:zlib';
6
6
  import fs from 'node:fs/promises';
7
- import http from 'node:http';
7
+ import https from 'node:https';
8
8
  import path from 'node:path';
9
9
 
10
10
  const ADB_MAGIC = 1481004104;
@@ -365,7 +365,7 @@ const requestData = async (url, {
365
365
  Range: partialOffset !== void 0 && partialLength !== void 0 ? `bytes=${partialOffset.toString()}-${(partialOffset + partialLength - 1).toString()}` : "bytes=0-"
366
366
  }
367
367
  };
368
- http.get(url, options, (res) => {
368
+ https.get(url, options, (res) => {
369
369
  if (res.statusCode === 301 || res.statusCode === 302) {
370
370
  if (res.headers.location !== void 0) {
371
371
  requestData(res.headers.location, { partialOffset, partialLength, showProgress }).then(resolve).catch((err) => {
@@ -468,14 +468,14 @@ const getConfigFile = async (prefixes, key, {
468
468
  return downloadBuffer.toString("utf-8");
469
469
  };
470
470
  const getProductVersions = async (region, product) => {
471
- const url = `http://${region}.patch.battle.net:1119/${product}/versions`;
471
+ const url = region !== "cn" ? `https://${region}.version.battle.net/v2/products/${product}/versions` : `https://cn.version.battlenet.com.cn/v2/products/${product}/versions`;
472
472
  const headers = new Headers();
473
473
  headers.set("User-Agent", USER_AGENT);
474
474
  const res = await fetch(url, { headers });
475
475
  return res.text();
476
476
  };
477
477
  const getProductCDNs = async (region, product) => {
478
- const url = `http://${region}.patch.battle.net:1119/${product}/cdns`;
478
+ const url = region !== "cn" ? `https://${region}.version.battle.net/v2/products/${product}/cdns` : `https://cn.version.battlenet.com.cn/v2/products/${product}/cdns`;
479
479
  const headers = new Headers();
480
480
  headers.set("User-Agent", USER_AGENT);
481
481
  const res = await fetch(url, { headers });
@@ -1054,7 +1054,7 @@ const resolveCDNHost = async (hosts, path) => {
1054
1054
  const latencies = await Promise.allSettled(
1055
1055
  hosts.map(async (host) => {
1056
1056
  const start = Date.now();
1057
- await fetch(`http://${host}/`);
1057
+ await fetch(`https://${host}/`);
1058
1058
  const end = Date.now();
1059
1059
  return {
1060
1060
  host,
@@ -1063,7 +1063,7 @@ const resolveCDNHost = async (hosts, path) => {
1063
1063
  })
1064
1064
  );
1065
1065
  const resolved = latencies.filter((result) => result.status === "fulfilled").map((result) => result.value).sort((a, b) => a.latency - b.latency);
1066
- return resolved.map((result) => `http://${result.host}/${path}`);
1066
+ return resolved.map((result) => `https://${result.host}/${path}`);
1067
1067
  };
1068
1068
 
1069
1069
  const WDC5_MAGIC = 1464091445;