@farm.js/create-app 0.1.0-beta.91 → 0.1.0-beta.93
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 +3 -3
package/dist/index.js
CHANGED
|
@@ -2671,18 +2671,21 @@ function isInteractive() {
|
|
|
2671
2671
|
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
2672
2672
|
}
|
|
2673
2673
|
function getEndpoint() {
|
|
2674
|
-
|
|
2674
|
+
return process.env.FARM_TELEMETRY_ENDPOINT || DEFAULT_TELEMETRY_ENDPOINT;
|
|
2675
|
+
}
|
|
2676
|
+
function resolveTelemetryEndpoint(candidate) {
|
|
2675
2677
|
try {
|
|
2676
2678
|
const url = new URL(candidate);
|
|
2679
|
+
const hostname = url.hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
2677
2680
|
const isLocal = [
|
|
2678
2681
|
"localhost",
|
|
2679
2682
|
"127.0.0.1",
|
|
2680
2683
|
"::1"
|
|
2681
|
-
].includes(
|
|
2682
|
-
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal)) return
|
|
2683
|
-
return url
|
|
2684
|
+
].includes(hostname);
|
|
2685
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && isLocal)) return;
|
|
2686
|
+
return url;
|
|
2684
2687
|
} catch {
|
|
2685
|
-
return
|
|
2688
|
+
return;
|
|
2686
2689
|
}
|
|
2687
2690
|
}
|
|
2688
2691
|
async function resolveState() {
|
|
@@ -2810,18 +2813,12 @@ async function send(payload) {
|
|
|
2810
2813
|
debug("delivery failed after retries");
|
|
2811
2814
|
}
|
|
2812
2815
|
async function sendOnce(payload) {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
endpoint
|
|
2816
|
-
} catch {
|
|
2817
|
-
debug("invalid endpoint URL");
|
|
2816
|
+
const endpoint = resolveTelemetryEndpoint(getEndpoint());
|
|
2817
|
+
if (!endpoint) {
|
|
2818
|
+
debug("invalid or insecure telemetry endpoint; event skipped");
|
|
2818
2819
|
return "rejected";
|
|
2819
2820
|
}
|
|
2820
2821
|
const requestTransport = endpoint.protocol === "http:" ? node_http.request : node_https.request;
|
|
2821
|
-
if (endpoint.protocol !== "http:" && endpoint.protocol !== "https:") {
|
|
2822
|
-
debug(`unsupported endpoint protocol ${endpoint.protocol}`);
|
|
2823
|
-
return "rejected";
|
|
2824
|
-
}
|
|
2825
2822
|
const body = JSON.stringify(payload);
|
|
2826
2823
|
return new Promise((resolve) => {
|
|
2827
2824
|
let settled = false;
|