@farm.js/create-app 0.1.0-beta.91 → 0.1.0-beta.92
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.js +11 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/_renderers/preact/package.json +2 -2
- package/templates/_renderers/solid/package.json +2 -2
- package/templates/_renderers/svelte/package.json +2 -2
- package/templates/_renderers/vue/package.json +2 -2
- package/templates/auth/package.json +3 -3
- package/templates/basic/package.json +2 -2
- package/templates/better-auth/package.json +3 -3
- package/templates/react-compiler/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2664,18 +2664,21 @@ function isInteractive() {
|
|
|
2664
2664
|
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
2665
2665
|
}
|
|
2666
2666
|
function getEndpoint() {
|
|
2667
|
-
|
|
2667
|
+
return process.env.FARM_TELEMETRY_ENDPOINT || DEFAULT_TELEMETRY_ENDPOINT;
|
|
2668
|
+
}
|
|
2669
|
+
function resolveTelemetryEndpoint(candidate) {
|
|
2668
2670
|
try {
|
|
2669
2671
|
const url = new URL(candidate);
|
|
2672
|
+
const hostname = url.hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
2670
2673
|
const isLocal = [
|
|
2671
2674
|
"localhost",
|
|
2672
2675
|
"127.0.0.1",
|
|
2673
2676
|
"::1"
|
|
2674
|
-
].includes(
|
|
2675
|
-
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal)) return
|
|
2676
|
-
return url
|
|
2677
|
+
].includes(hostname);
|
|
2678
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal)) return;
|
|
2679
|
+
return url;
|
|
2677
2680
|
} catch {
|
|
2678
|
-
return
|
|
2681
|
+
return;
|
|
2679
2682
|
}
|
|
2680
2683
|
}
|
|
2681
2684
|
async function resolveState() {
|
|
@@ -2803,18 +2806,12 @@ async function send(payload) {
|
|
|
2803
2806
|
debug("delivery failed after retries");
|
|
2804
2807
|
}
|
|
2805
2808
|
async function sendOnce(payload) {
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
endpoint
|
|
2809
|
-
} catch {
|
|
2810
|
-
debug("invalid endpoint URL");
|
|
2809
|
+
const endpoint = resolveTelemetryEndpoint(getEndpoint());
|
|
2810
|
+
if (!endpoint) {
|
|
2811
|
+
debug("invalid or insecure telemetry endpoint; event skipped");
|
|
2811
2812
|
return "rejected";
|
|
2812
2813
|
}
|
|
2813
2814
|
const requestTransport = endpoint.protocol === "http:" ? request : request$1;
|
|
2814
|
-
if (endpoint.protocol !== "http:" && endpoint.protocol !== "https:") {
|
|
2815
|
-
debug(`unsupported endpoint protocol ${endpoint.protocol}`);
|
|
2816
|
-
return "rejected";
|
|
2817
|
-
}
|
|
2818
2815
|
const body = JSON.stringify(payload);
|
|
2819
2816
|
return new Promise((resolve) => {
|
|
2820
2817
|
let settled = false;
|