PageSourceSearch

https://rqstradio.pages.dev/js/net.js?v=71.0-exp-a02

js rqstradio.pages.dev collected 2026-10-03 05:54:37 UTC 2,175 bytes, 75 lines download raw bytes

1(function () {
2  const DEFAULT_TIMEOUT_MS = 7000;
3
4  function cfg() {
5    return window.RQST_CONFIG || {};
6  }
7
8  function timeoutSignal(ms) {
9    const controller = new AbortController();
10    const timer = setTimeout(() => controller.abort(), ms || DEFAULT_TIMEOUT_MS);
11    return { controller, timer };
12  }
13
14  async function fetchWithTimeout(url, options = {}) {
15    const { timeoutMs = DEFAULT_TIMEOUT_MS, ...fetchOptions } = options;
16    const { controller, timer } = timeoutSignal(timeoutMs);
17
18    try {
19      const res = await fetch(url, { ...fetchOptions, signal: controller.signal });
20      if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}`);
21      return res;
22    } finally {
23      clearTimeout(timer);
24    }
25  }
26
27  function buildProxyUrl(proxy, targetUrl) {
28    if (!proxy || proxy === 'direct') return targetUrl;
29    return proxy + encodeURIComponent(targetUrl);
30  }
31
32  function metadataCandidates(targetUrl) {
33    const list = cfg().metadataProxyCandidates || [];
34    if (list.length) return list.map(proxy => buildProxyUrl(proxy, targetUrl));
35
36    // Orden conservador: primero directo; luego proxy heredado si existe.
37    // En hosting real, lo ideal es reemplazar esto por proxy propio.
38    const out = [targetUrl];
39    if (cfg().proxy) out.push(buildProxyUrl(cfg().proxy, targetUrl));
40    return out;
41  }
42
43  async function fetchArrayBufferThroughCandidates(targetUrl, options = {}) {
44    const candidates = metadataCandidates(targetUrl);
45    const errors = [];
46
47    for (const url of candidates) {
48      try {
49        const res = await fetchWithTimeout(url, options);
50        return {
51          buffer: await res.arrayBuffer(),
52          sourceUrl: url,
53          ok: true
54        };
55      } catch (err) {
56        errors.push({ url, message: err?.message || String(err) });
57      }
58    }
59
60    const error = new Error('No metadata candidate responded');
61    error.details = errors;
62    throw error;
63  }
64
65  async function fetchJson(url, options = {}) {
66    const res = await fetchWithTimeout(url, options);
67    return res.json();
68  }
69
70  window.RQST_NET = {
71    fetchWithTimeout,
72    fetchArrayBufferThroughCandidates,
73    fetchJson
74  };
75})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.