@camstack/addon-cloudflare 1.2.25 → 1.2.27
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/{dist-bN2ruooH.js → dist-B3KpK67G.js} +367 -29
- package/dist/{dist-C55lXXNr.mjs → dist-BgYOkp3_.mjs} +367 -29
- package/dist/tunnel/cloudflare-tunnel.addon.js +29 -3
- package/dist/tunnel/cloudflare-tunnel.addon.mjs +29 -3
- package/dist/turn/cloudflare-turn.addon.js +1 -1
- package/dist/turn/cloudflare-turn.addon.mjs +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_dist = require("../dist-
|
|
24
|
+
const require_dist = require("../dist-B3KpK67G.js");
|
|
25
25
|
let node_crypto = require("node:crypto");
|
|
26
26
|
let node_path = require("node:path");
|
|
27
27
|
node_path = __toESM(node_path);
|
|
@@ -758,6 +758,24 @@ var cloudflareTunnelActions = require_dist.defineCustomActions({
|
|
|
758
758
|
})).readonly() }))
|
|
759
759
|
});
|
|
760
760
|
//#endregion
|
|
761
|
+
//#region src/tunnel/auto-start.ts
|
|
762
|
+
/**
|
|
763
|
+
* Whether cloudflare-tunnel may spawn `cloudflared` at boot / config-reload.
|
|
764
|
+
*
|
|
765
|
+
* Constructor defaults are `mode: 'quick'`. A settings store that has not
|
|
766
|
+
* answered therefore looks exactly like "the operator wants a trycloudflare
|
|
767
|
+
* URL". Auto-starting that is how a named hostname (the one the notification
|
|
768
|
+
* centre still mints) went Cloudflare 530: the named tunnel never connected.
|
|
769
|
+
*
|
|
770
|
+
* An empty store that DID answer is a real choice — a fresh install still
|
|
771
|
+
* auto-starts quick. Only "never answered" is refused.
|
|
772
|
+
*/
|
|
773
|
+
function shouldAutoStartTunnel(input) {
|
|
774
|
+
if (!input.settingsStoreReady) return false;
|
|
775
|
+
if (input.mode === "quick") return true;
|
|
776
|
+
return input.hasCustomToken && input.hasCustomHostname;
|
|
777
|
+
}
|
|
778
|
+
//#endregion
|
|
761
779
|
//#region src/tunnel/cloudflare-tunnel.addon.ts
|
|
762
780
|
/**
|
|
763
781
|
* Cloudflare Tunnel — exposes CamStack via Cloudflare's network.
|
|
@@ -882,6 +900,10 @@ var CloudflareTunnelAddon = class extends require_dist.BaseAddon {
|
|
|
882
900
|
}
|
|
883
901
|
});
|
|
884
902
|
});
|
|
903
|
+
else if (!this.settingsStoreReady) this.ctx.logger.warn("boot auto-start skipped — settings store did not answer; defaults are not an operator choice", { tags: {
|
|
904
|
+
topic: "tunnel",
|
|
905
|
+
phase: "auto-start-skipped"
|
|
906
|
+
} });
|
|
885
907
|
return {
|
|
886
908
|
providers: [{
|
|
887
909
|
capability: require_dist.networkAccessCapability,
|
|
@@ -903,8 +925,12 @@ var CloudflareTunnelAddon = class extends require_dist.BaseAddon {
|
|
|
903
925
|
* auto-start and by `onConfigChanged` to decide whether a change
|
|
904
926
|
* warrants a respawn even when no instance was previously running. */
|
|
905
927
|
isRunCapable() {
|
|
906
|
-
|
|
907
|
-
|
|
928
|
+
return shouldAutoStartTunnel({
|
|
929
|
+
settingsStoreReady: this.settingsStoreReady,
|
|
930
|
+
mode: this.config.mode,
|
|
931
|
+
hasCustomToken: !!this.config.customTunnelToken,
|
|
932
|
+
hasCustomHostname: !!this.config.customHostname
|
|
933
|
+
});
|
|
908
934
|
}
|
|
909
935
|
async onShutdown() {
|
|
910
936
|
if (this.service) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-
|
|
1
|
+
import { a as BaseAddon, c as boolean, d as number, f as object, m as EventCategory, n as defineCustomActions, o as _enum, p as string, r as networkAccessCapability, s as array, t as customAction, u as literal } from "../dist-BgYOkp3_.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
@@ -731,6 +731,24 @@ var cloudflareTunnelActions = defineCustomActions({
|
|
|
731
731
|
})).readonly() }))
|
|
732
732
|
});
|
|
733
733
|
//#endregion
|
|
734
|
+
//#region src/tunnel/auto-start.ts
|
|
735
|
+
/**
|
|
736
|
+
* Whether cloudflare-tunnel may spawn `cloudflared` at boot / config-reload.
|
|
737
|
+
*
|
|
738
|
+
* Constructor defaults are `mode: 'quick'`. A settings store that has not
|
|
739
|
+
* answered therefore looks exactly like "the operator wants a trycloudflare
|
|
740
|
+
* URL". Auto-starting that is how a named hostname (the one the notification
|
|
741
|
+
* centre still mints) went Cloudflare 530: the named tunnel never connected.
|
|
742
|
+
*
|
|
743
|
+
* An empty store that DID answer is a real choice — a fresh install still
|
|
744
|
+
* auto-starts quick. Only "never answered" is refused.
|
|
745
|
+
*/
|
|
746
|
+
function shouldAutoStartTunnel(input) {
|
|
747
|
+
if (!input.settingsStoreReady) return false;
|
|
748
|
+
if (input.mode === "quick") return true;
|
|
749
|
+
return input.hasCustomToken && input.hasCustomHostname;
|
|
750
|
+
}
|
|
751
|
+
//#endregion
|
|
734
752
|
//#region src/tunnel/cloudflare-tunnel.addon.ts
|
|
735
753
|
/**
|
|
736
754
|
* Cloudflare Tunnel — exposes CamStack via Cloudflare's network.
|
|
@@ -855,6 +873,10 @@ var CloudflareTunnelAddon = class extends BaseAddon {
|
|
|
855
873
|
}
|
|
856
874
|
});
|
|
857
875
|
});
|
|
876
|
+
else if (!this.settingsStoreReady) this.ctx.logger.warn("boot auto-start skipped — settings store did not answer; defaults are not an operator choice", { tags: {
|
|
877
|
+
topic: "tunnel",
|
|
878
|
+
phase: "auto-start-skipped"
|
|
879
|
+
} });
|
|
858
880
|
return {
|
|
859
881
|
providers: [{
|
|
860
882
|
capability: networkAccessCapability,
|
|
@@ -876,8 +898,12 @@ var CloudflareTunnelAddon = class extends BaseAddon {
|
|
|
876
898
|
* auto-start and by `onConfigChanged` to decide whether a change
|
|
877
899
|
* warrants a respawn even when no instance was previously running. */
|
|
878
900
|
isRunCapable() {
|
|
879
|
-
|
|
880
|
-
|
|
901
|
+
return shouldAutoStartTunnel({
|
|
902
|
+
settingsStoreReady: this.settingsStoreReady,
|
|
903
|
+
mode: this.config.mode,
|
|
904
|
+
hasCustomToken: !!this.config.customTunnelToken,
|
|
905
|
+
hasCustomHostname: !!this.config.customHostname
|
|
906
|
+
});
|
|
881
907
|
}
|
|
882
908
|
async onShutdown() {
|
|
883
909
|
if (this.service) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dist = require("../dist-
|
|
2
|
+
const require_dist = require("../dist-B3KpK67G.js");
|
|
3
3
|
//#region src/turn/cloudflare-turn.ts
|
|
4
4
|
/**
|
|
5
5
|
* Cloudflare returns ICE servers in several flavours depending on which
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-
|
|
1
|
+
import { a as BaseAddon, c as boolean, d as number, f as object, i as turnProviderCapability, l as discriminatedUnion, n as defineCustomActions, p as string, t as customAction, u as literal } from "../dist-BgYOkp3_.mjs";
|
|
2
2
|
//#region src/turn/cloudflare-turn.ts
|
|
3
3
|
/**
|
|
4
4
|
* Cloudflare returns ICE servers in several flavours depending on which
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-cloudflare",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27",
|
|
4
4
|
"description": "Cloudflare bundle — Tunnel (network-access) + TURN relay (turn-provider). Multi-entry npm package shipping 2 addons under a single bundle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|