@needle-tools/engine 5.1.12 → 5.1.14
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/CHANGELOG.md +12 -0
- package/SKILL.md +1 -1
- package/dist/gltf-progressive-BnLTsXZw.umd.cjs +10 -0
- package/dist/gltf-progressive-D6RT9IkB.min.js +10 -0
- package/dist/{gltf-progressive-B4DQEeBz.js → gltf-progressive-DaeP5KBr.js} +527 -514
- package/dist/{materialx-BBv-42Th.min.js → materialx-D3ZU4CP6.min.js} +1 -1
- package/dist/{materialx-0m1xlF5m.js → materialx-FhjQQgNu.js} +1 -1
- package/dist/{materialx-8OpPwNc7.umd.cjs → materialx-RxB3AN7d.umd.cjs} +2 -2
- package/dist/{needle-engine.bundle-9m-VdGg2.js → needle-engine.bundle-BEa7CABw.js} +7420 -7254
- package/dist/{needle-engine.bundle-BmdWLmLa.min.js → needle-engine.bundle-mkmiuKZB.min.js} +145 -145
- package/dist/{needle-engine.bundle-DdH96IqH.umd.cjs → needle-engine.bundle-y1_E7Ovt.umd.cjs} +146 -146
- package/dist/needle-engine.d.ts +37 -29
- package/dist/needle-engine.js +519 -520
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{vendor-DiDMDryv.js → vendor-BVzQovzJ.js} +5161 -5161
- package/dist/{vendor-DE_m5MvL.umd.cjs → vendor-C5YVRzxf.umd.cjs} +5 -5
- package/dist/{vendor-B7IfFLrR.min.js → vendor-rvNvQ-IU.min.js} +5 -5
- package/lib/engine/api.d.ts +4 -3
- package/lib/engine/api.js +3 -9
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +32 -1
- package/lib/engine/engine_addressables.js +71 -9
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_application.d.ts +2 -0
- package/lib/engine/engine_application.js +7 -3
- package/lib/engine/engine_application.js.map +1 -1
- package/lib/engine/engine_context.js +25 -1
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gameobject.js +1 -1
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.js +1 -1
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_init.js +2 -2
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_input.js +1 -1
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_instantiate_resolve.js.map +1 -1
- package/lib/engine/engine_license.d.ts +7 -7
- package/lib/engine/engine_license.js +123 -80
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lifecycle_functions_internal.js +20 -2
- package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
- package/lib/engine/engine_materialpropertyblock.js +18 -0
- package/lib/engine/engine_materialpropertyblock.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +1 -1
- package/lib/engine/engine_networking.js +1 -1
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_blob.js +3 -3
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_networking_streams.d.ts +3 -0
- package/lib/engine/engine_networking_streams.js +64 -17
- package/lib/engine/engine_networking_streams.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +5 -0
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
- package/lib/engine/webcomponents/fonts.d.ts +1 -1
- package/lib/engine/webcomponents/fonts.js +16 -1
- package/lib/engine/webcomponents/fonts.js.map +1 -1
- package/lib/engine/webcomponents/icons.js +8 -1
- package/lib/engine/webcomponents/icons.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +5 -0
- package/lib/engine/webcomponents/needle menu/needle-menu.js +34 -16
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +1 -0
- package/lib/engine/webcomponents/needle-engine.js +18 -6
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +2 -0
- package/lib/engine/webcomponents/needle-engine.loading.js +12 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.js +11 -10
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine-components/AnimationBuilder.d.ts +1 -1
- package/lib/engine-components/AnimationBuilder.js.map +1 -1
- package/lib/engine-components/AnimatorController.builder.d.ts +2 -2
- package/lib/engine-components/AnimatorController.builder.js +2 -2
- package/lib/engine-components/AnimatorController.builder.js.map +1 -1
- package/lib/engine-components/Component.d.ts +1 -1
- package/lib/engine-components/Component.js +1 -1
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +2 -2
- package/lib/engine-components/DragControls.js +2 -2
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DragControlsConstraints.js.map +1 -1
- package/lib/engine-components/Light.js +1 -1
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/api.d.ts +2 -2
- package/lib/engine-components/api.js +1 -1
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/postprocessing/index.d.ts +1 -1
- package/lib/engine-components/postprocessing/index.js +1 -1
- package/lib/engine-components/postprocessing/index.js.map +1 -1
- package/lib/engine-components/timeline/TimelineBuilder.d.ts +4 -4
- package/lib/engine-components/timeline/TimelineBuilder.js +2 -2
- package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -1
- package/lib/engine-components/timeline/TimelineTracks.js +24 -15
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.utils.js.map +1 -1
- package/package.json +2 -2
- package/plugins/common/license.js +4 -4
- package/plugins/vite/license.js +4 -4
- package/src/engine/api.ts +5 -3
- package/src/engine/engine_addressables.ts +75 -9
- package/src/engine/engine_application.ts +7 -2
- package/src/engine/engine_context.ts +25 -1
- package/src/engine/engine_gameobject.ts +2 -2
- package/src/engine/engine_gltf_builtin_components.ts +1 -1
- package/src/engine/engine_init.ts +2 -2
- package/src/engine/engine_input.ts +2 -2
- package/src/engine/engine_instantiate_resolve.ts +1 -1
- package/src/engine/engine_license.ts +115 -77
- package/src/engine/engine_lifecycle_functions_internal.ts +21 -2
- package/src/engine/engine_materialpropertyblock.ts +21 -0
- package/src/engine/engine_networking.ts +2 -2
- package/src/engine/engine_networking_blob.ts +3 -3
- package/src/engine/engine_networking_streams.ts +61 -17
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +8 -1
- package/src/engine/webcomponents/fonts.ts +16 -1
- package/src/engine/webcomponents/icons.ts +8 -1
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +33 -15
- package/src/engine/webcomponents/needle-engine.loading.ts +19 -7
- package/src/engine/webcomponents/needle-engine.ts +16 -6
- package/src/engine/xr/NeedleXRSession.ts +11 -10
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine-components/AnimationBuilder.ts +1 -1
- package/src/engine-components/AnimatorController.builder.ts +4 -4
- package/src/engine-components/Component.ts +1 -1
- package/src/engine-components/DragControls.ts +2 -3
- package/src/engine-components/DragControlsConstraints.ts +1 -2
- package/src/engine-components/Light.ts +1 -1
- package/src/engine-components/api.ts +2 -2
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1 -1
- package/src/engine-components/postprocessing/index.ts +1 -1
- package/src/engine-components/timeline/TimelineBuilder.ts +5 -5
- package/src/engine-components/timeline/TimelineTracks.ts +25 -17
- package/src/engine-components/webxr/WebXRImageTracking.utils.ts +0 -1
- package/dist/gltf-progressive-CdjpU5eP.min.js +0 -10
- package/dist/gltf-progressive-DeZioRZe.umd.cjs +0 -10
|
@@ -7,14 +7,14 @@ import { ComponentLifecycleEvents } from "./engine_components_internal.js";
|
|
|
7
7
|
import { activeInHierarchyFieldName } from "./engine_constants.js";
|
|
8
8
|
import { editorGuidKeyName } from "./engine_constants.js";
|
|
9
9
|
import { $isUsingInstancing, InstancingUtil } from "./engine_instancing.js";
|
|
10
|
+
import { type InstantiateContext, type InstantiateReferenceMap, type ObjectCloneReference,resolveInstanceReferences } from "./engine_instantiate_resolve.js";
|
|
10
11
|
import { processNewScripts } from "./engine_mainloop_utils.js";
|
|
11
12
|
import type { syncInstantiate } from "./engine_networking_instantiate.js";
|
|
12
13
|
import { InstantiateIdProvider } from "./engine_networking_instantiate.js";
|
|
13
|
-
import { resolveInstanceReferences, type InstantiateReferenceMap, type InstantiateContext, type ObjectCloneReference } from "./engine_instantiate_resolve.js";
|
|
14
14
|
import { assign } from "./engine_serialization_core.js";
|
|
15
15
|
import { Context, registerComponent } from "./engine_setup.js";
|
|
16
16
|
import { getTempQuaternion, logHierarchy, setWorldPosition, setWorldQuaternion } from "./engine_three_utils.js";
|
|
17
|
-
import { type Constructor, type GuidsMap, type IComponent as Component, type IComponent, type IGameObject as GameObject, type UIDProvider
|
|
17
|
+
import { type Constructor, type GuidsMap, type IComponent as Component, type IComponent, type IGameObject as GameObject, isComponent,type UIDProvider } from "./engine_types.js";
|
|
18
18
|
import { deepClone, getParam, tryFindObject } from "./engine_utils.js";
|
|
19
19
|
import { apply } from "./js-extensions/index.js";
|
|
20
20
|
|
|
@@ -5,7 +5,7 @@ import { LogType, showBalloonMessage } from "./debug/index.js";
|
|
|
5
5
|
import { addNewComponent } from "./engine_components.js";
|
|
6
6
|
import { builtinComponentKeyName, editorGuidKeyName } from "./engine_constants.js";
|
|
7
7
|
import { debugExtension } from "./engine_default_parameters.js";
|
|
8
|
-
import { generateGuidsForHierarchy, resolveStringGuidsInHierarchy
|
|
8
|
+
import { generateGuidsForHierarchy, originalComponentNameKey,resolveStringGuidsInHierarchy } from "./engine_instantiate_resolve.js";
|
|
9
9
|
import { InstantiateIdProvider } from "./engine_networking_instantiate.js"
|
|
10
10
|
import { isLocalNetwork } from "./engine_networking_utils.js";
|
|
11
11
|
import { deserializeObject, serializeObject } from "./engine_serialization.js";
|
|
@@ -8,7 +8,7 @@ import { initBuiltinTypes } from "./codegen/register_types.js";
|
|
|
8
8
|
import { initSpatialConsole } from "./debug/debug_spatial_console.js";
|
|
9
9
|
import { initAddressableSerializers } from "./engine_addressables.js";
|
|
10
10
|
import { ensureAudioContextIsResumed } from "./engine_audio.js";
|
|
11
|
-
import { $
|
|
11
|
+
import { $tbhNjEbR } from "./engine_license.js";
|
|
12
12
|
import { initNeedleLoader } from "./engine_loaders.js";
|
|
13
13
|
import { initPhysics } from "./engine_physics_rapier.js";
|
|
14
14
|
import { initBuiltinSerializers } from "./engine_serialization_builtin_serializer.js";
|
|
@@ -59,7 +59,7 @@ export function initEngine() {
|
|
|
59
59
|
initPhysics();
|
|
60
60
|
initXR();
|
|
61
61
|
initSpatialConsole();
|
|
62
|
-
$
|
|
62
|
+
$tbhNjEbR();
|
|
63
63
|
|
|
64
64
|
// Must be last. customElements.define() upgrades existing <needle-engine>
|
|
65
65
|
// elements synchronously, which can trigger context.create() and dispatch
|
|
@@ -969,7 +969,7 @@ export class Input implements IInput {
|
|
|
969
969
|
window.removeEventListener('contextmenu', this.onContextMenu);
|
|
970
970
|
|
|
971
971
|
this._htmlEventSource?.removeEventListener('pointerdown', this.onPointerDown);
|
|
972
|
-
window.removeEventListener('pointermove', this.onPointerMove);
|
|
972
|
+
window.removeEventListener('pointermove', this.onPointerMove, true);
|
|
973
973
|
window.removeEventListener('pointerup', this.onPointerUp);
|
|
974
974
|
window.removeEventListener('pointercancel', this.onPointerCancel);
|
|
975
975
|
|
|
@@ -1625,4 +1625,4 @@ export declare type KeyCode =
|
|
|
1625
1625
|
// OPEN_BRACKET = 219,
|
|
1626
1626
|
// BACK_SLASH = 220,
|
|
1627
1627
|
// CLOSE_BRACKET = 221,
|
|
1628
|
-
// SINGLE_QUOTE = 222
|
|
1628
|
+
// SINGLE_QUOTE = 222
|
|
@@ -2,7 +2,7 @@ import type { Color, Euler, Matrix2, Matrix3, Matrix4, Object3D, Quaternion, Vec
|
|
|
2
2
|
|
|
3
3
|
import { InstantiateIdProvider } from "./engine_networking_instantiate.js";
|
|
4
4
|
import { isSerializable } from "./engine_serialization_core.js";
|
|
5
|
-
import { type GuidsMap, type IComponent, type UIDProvider
|
|
5
|
+
import { type GuidsMap, type IComponent, isComponent,type UIDProvider } from "./engine_types.js";
|
|
6
6
|
import { getParam } from "./engine_utils.js";
|
|
7
7
|
|
|
8
8
|
const debug = getParam("debuginstantiate");
|
|
@@ -7,21 +7,53 @@ import { SSR } from "./engine_ssr.js";
|
|
|
7
7
|
import type { IContext } from "./engine_types.js";
|
|
8
8
|
import { DeviceUtilities, getParam } from "./engine_utils.js";
|
|
9
9
|
|
|
10
|
+
// License UI polling must stop when its context goes away; otherwise timers retain scenes.
|
|
11
|
+
const licenseIntervals = new WeakMap<IContext, Set<ReturnType<typeof setInterval>>>();
|
|
12
|
+
const licenseTimeouts = new WeakMap<IContext, Set<ReturnType<typeof setTimeout>>>();
|
|
13
|
+
const disposedLicenseContexts = new WeakSet<IContext>();
|
|
14
|
+
ContextRegistry.registerCallback(ContextEvent.ContextDestroying, ({ context }) => {
|
|
15
|
+
disposedLicenseContexts.add(context);
|
|
16
|
+
for (const timer of licenseIntervals.get(context) ?? []) clearInterval(timer);
|
|
17
|
+
licenseIntervals.delete(context);
|
|
18
|
+
for (const timer of licenseTimeouts.get(context) ?? []) clearTimeout(timer);
|
|
19
|
+
licenseTimeouts.delete(context);
|
|
20
|
+
});
|
|
21
|
+
function setLicenseInterval(ctx: IContext, callback: () => void, delay: number) {
|
|
22
|
+
if (disposedLicenseContexts.has(ctx)) return undefined;
|
|
23
|
+
let timers = licenseIntervals.get(ctx);
|
|
24
|
+
if (!timers) licenseIntervals.set(ctx, timers = new Set());
|
|
25
|
+
const timer = setInterval(callback, delay);
|
|
26
|
+
timers.add(timer);
|
|
27
|
+
return timer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function setLicenseTimeout(ctx: IContext, callback: () => void, delay: number) {
|
|
31
|
+
if (disposedLicenseContexts.has(ctx)) return undefined;
|
|
32
|
+
let timers = licenseTimeouts.get(ctx);
|
|
33
|
+
if (!timers) licenseTimeouts.set(ctx, timers = new Set());
|
|
34
|
+
const timer = setTimeout(() => {
|
|
35
|
+
timers.delete(timer);
|
|
36
|
+
callback();
|
|
37
|
+
}, delay);
|
|
38
|
+
timers.add(timer);
|
|
39
|
+
return timer;
|
|
40
|
+
}
|
|
41
|
+
|
|
10
42
|
const debug = getParam("__debuglic__");
|
|
11
43
|
|
|
12
|
-
const
|
|
44
|
+
const hfq: ((result: boolean) => void)[] = [];
|
|
13
45
|
|
|
14
46
|
// DO NOT EDIT MANUALLY
|
|
15
|
-
let
|
|
47
|
+
let _QsjWa: string = "";
|
|
16
48
|
// eslint-disable-next-line prefer-const
|
|
17
|
-
let
|
|
49
|
+
let _puYWsjJC: string = "";
|
|
18
50
|
|
|
19
51
|
if (debug) {
|
|
20
|
-
console.log("License Type: " +
|
|
21
|
-
if (
|
|
22
|
-
console.log("License JWT: " +
|
|
52
|
+
console.log("License Type: " + _QsjWa);
|
|
53
|
+
if (_puYWsjJC) {
|
|
54
|
+
console.log("License JWT: " + _puYWsjJC);
|
|
23
55
|
try {
|
|
24
|
-
const payload = JSON.parse(atob(
|
|
56
|
+
const payload = JSON.parse(atob(_puYWsjJC.split(".")[1].replace(/-/g, '+').replace(/_/g, '/')));
|
|
25
57
|
console.log("License JWT payload:", payload);
|
|
26
58
|
}
|
|
27
59
|
catch { console.log("License JWT payload: (failed to decode)"); }
|
|
@@ -32,8 +64,8 @@ if (debug) {
|
|
|
32
64
|
}
|
|
33
65
|
|
|
34
66
|
/** @internal */
|
|
35
|
-
export function _$
|
|
36
|
-
switch (
|
|
67
|
+
export function _$xBhfh() {
|
|
68
|
+
switch (_QsjWa) {
|
|
37
69
|
case "pro":
|
|
38
70
|
case "enterprise":
|
|
39
71
|
return true;
|
|
@@ -42,8 +74,8 @@ export function _$VfAckLjB() {
|
|
|
42
74
|
}
|
|
43
75
|
|
|
44
76
|
/** @internal */
|
|
45
|
-
export function
|
|
46
|
-
switch (
|
|
77
|
+
export function __YFTdTh() {
|
|
78
|
+
switch (_QsjWa) {
|
|
47
79
|
case "indie":
|
|
48
80
|
return true;
|
|
49
81
|
}
|
|
@@ -51,8 +83,8 @@ export function _$EHSDVcNK() {
|
|
|
51
83
|
}
|
|
52
84
|
|
|
53
85
|
/** @internal */
|
|
54
|
-
export function
|
|
55
|
-
switch (
|
|
86
|
+
export function _$qEBaEKr() {
|
|
87
|
+
switch (_QsjWa) {
|
|
56
88
|
case "edu":
|
|
57
89
|
return true;
|
|
58
90
|
}
|
|
@@ -60,20 +92,26 @@ export function hTrHNMkg() {
|
|
|
60
92
|
}
|
|
61
93
|
|
|
62
94
|
/** @internal */
|
|
63
|
-
export function
|
|
64
|
-
return _$
|
|
95
|
+
export function __alnviAJA() {
|
|
96
|
+
return _$xBhfh() || __YFTdTh() || _$qEBaEKr();
|
|
65
97
|
}
|
|
66
98
|
|
|
67
99
|
|
|
68
100
|
/** @internal */
|
|
69
|
-
export function
|
|
70
|
-
if (_$
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
export function dRcEhn(cb: (result: boolean) => void) {
|
|
102
|
+
if (_$xBhfh() || __YFTdTh() || _$qEBaEKr()) {
|
|
103
|
+
cb(true);
|
|
104
|
+
return () => {};
|
|
105
|
+
}
|
|
106
|
+
hfq.push(cb);
|
|
107
|
+
return () => {
|
|
108
|
+
const index = hfq.indexOf(cb);
|
|
109
|
+
if (index >= 0) hfq.splice(index, 1);
|
|
110
|
+
};
|
|
73
111
|
}
|
|
74
112
|
|
|
75
|
-
function
|
|
76
|
-
for (const cb of
|
|
113
|
+
function $rpNGR(result: boolean) {
|
|
114
|
+
for (const cb of hfq) {
|
|
77
115
|
try {
|
|
78
116
|
cb(result);
|
|
79
117
|
}
|
|
@@ -88,7 +126,7 @@ function IAHYYGp(result: boolean) {
|
|
|
88
126
|
|
|
89
127
|
// ECDSA P-256 public key for verifying license JWTs (verification-only, safe to ship)
|
|
90
128
|
/* eslint-disable no-secrets/no-secrets -- public key, not a secret */
|
|
91
|
-
const
|
|
129
|
+
const $jkMSKnw = {
|
|
92
130
|
kty: "EC",
|
|
93
131
|
crv: "P-256",
|
|
94
132
|
x: "A34nyKMjhQYVgzeE4tyLUYdx34TAKogDa7v7PRaO9Lg",
|
|
@@ -112,7 +150,7 @@ function base64urlDecode(str: string): Uint8Array {
|
|
|
112
150
|
* Verify a JWT license token and return the `type` claim if valid.
|
|
113
151
|
* Returns null if the JWT is missing, malformed, or has an invalid signature.
|
|
114
152
|
*/
|
|
115
|
-
async function
|
|
153
|
+
async function Twm(jwt: string): Promise<string | null> {
|
|
116
154
|
if (!jwt) return null;
|
|
117
155
|
try {
|
|
118
156
|
const parts = jwt.split(".");
|
|
@@ -122,7 +160,7 @@ async function tRvZ(jwt: string): Promise<string | null> {
|
|
|
122
160
|
|
|
123
161
|
const key = await crypto.subtle.importKey(
|
|
124
162
|
"jwk",
|
|
125
|
-
|
|
163
|
+
$jkMSKnw,
|
|
126
164
|
{ name: "ECDSA", namedCurve: "P-256" },
|
|
127
165
|
false,
|
|
128
166
|
["verify"]
|
|
@@ -182,24 +220,24 @@ async function tRvZ(jwt: string): Promise<string | null> {
|
|
|
182
220
|
}
|
|
183
221
|
|
|
184
222
|
/** Verify the injected JWT and update the license type if valid.
|
|
185
|
-
* The engine ONLY trusts the JWT — the plain
|
|
223
|
+
* The engine ONLY trusts the JWT — the plain _QsjWa string is ignored. */
|
|
186
224
|
let _jwtVerificationPromise: Promise<void> | undefined = undefined;
|
|
187
|
-
async function _$
|
|
188
|
-
// NOTE: do NOT add an `if (
|
|
225
|
+
async function _$qGmvPvr(): Promise<void> {
|
|
226
|
+
// NOTE: do NOT add an `if (!_puYWsjJC) return` guard here.
|
|
189
227
|
// esbuild (Vite dependency pre-bundling) would see the variable as constant ""
|
|
190
228
|
// and tree-shake the entire JWT verification code path.
|
|
191
|
-
const jwt =
|
|
229
|
+
const jwt = _puYWsjJC;
|
|
192
230
|
// Clear after reading — this reassignment also prevents esbuild from
|
|
193
231
|
// constant-folding the variable (it now has multiple assignment sites).
|
|
194
|
-
|
|
195
|
-
const verifiedType = await
|
|
232
|
+
_puYWsjJC = "";
|
|
233
|
+
const verifiedType = await Twm(jwt);
|
|
196
234
|
if (verifiedType) {
|
|
197
|
-
|
|
235
|
+
_QsjWa = verifiedType;
|
|
198
236
|
if (debug) console.log("License type set from verified JWT: " + verifiedType);
|
|
199
|
-
|
|
237
|
+
$rpNGR(__alnviAJA());
|
|
200
238
|
}
|
|
201
239
|
else {
|
|
202
|
-
|
|
240
|
+
_QsjWa = "basic";
|
|
203
241
|
if (debug && jwt) console.warn("JWT verification failed — license reset to basic");
|
|
204
242
|
}
|
|
205
243
|
}
|
|
@@ -318,11 +356,11 @@ export namespace Telemetry {
|
|
|
318
356
|
if (!domElement) domElement = document.querySelector<HTMLElement>("needle-engine");
|
|
319
357
|
if (!domElement && !context) return false;
|
|
320
358
|
|
|
321
|
-
// The no-telemetry attribute
|
|
359
|
+
// The no-telemetry attribute is available to PRO and Enterprise builds.
|
|
322
360
|
// NOTE: this does NOT affect license enforcement — the /check call, the "forbidden"
|
|
323
361
|
// overlay and the watermark/logo run on separate, ungated code paths.
|
|
324
362
|
const attribute = domElement?.getAttribute("no-telemetry");
|
|
325
|
-
if (attribute === "" || attribute === "true" || attribute === "1") {
|
|
363
|
+
if (_$xBhfh() && (attribute === "" || attribute === "true" || attribute === "1")) {
|
|
326
364
|
if (debug) console.debug("Telemetry is disabled via no-telemetry attribute");
|
|
327
365
|
return false;
|
|
328
366
|
}
|
|
@@ -650,18 +688,18 @@ export namespace Telemetry {
|
|
|
650
688
|
}
|
|
651
689
|
|
|
652
690
|
|
|
653
|
-
export function $
|
|
691
|
+
export function $tbhNjEbR() {
|
|
654
692
|
|
|
655
|
-
if(
|
|
693
|
+
if(_QsjWa === "") _QsjWa = "basic";
|
|
656
694
|
|
|
657
695
|
// Start JWT verification — must be here (not top-level) to avoid tree-shaking
|
|
658
|
-
_jwtVerificationPromise = _$
|
|
696
|
+
_jwtVerificationPromise = _$qGmvPvr();
|
|
659
697
|
|
|
660
698
|
Telemetry.init();
|
|
661
699
|
ContextRegistry.registerCallback(ContextEvent.ContextRegistered, evt => {
|
|
662
|
-
_$
|
|
663
|
-
|
|
664
|
-
|
|
700
|
+
_$toCs(evt.context);
|
|
701
|
+
$DAPYU(evt.context);
|
|
702
|
+
setLicenseTimeout(evt.context, () => _qzMSGyVj(evt.context), 2000);
|
|
665
703
|
});
|
|
666
704
|
// ContextCreated fires after the renderer exists, so the canvas is available for context-loss monitoring
|
|
667
705
|
ContextRegistry.registerCallback(ContextEvent.ContextCreated, evt => {
|
|
@@ -670,17 +708,17 @@ export function $LgNkf() {
|
|
|
670
708
|
});
|
|
671
709
|
}
|
|
672
710
|
|
|
673
|
-
export let
|
|
711
|
+
export let _$bDVSQf: Promise<void> | undefined = undefined;
|
|
674
712
|
let applicationIsForbidden = false;
|
|
675
713
|
let applicationForbiddenText = "";
|
|
676
|
-
async function
|
|
714
|
+
async function $TPLZ() {
|
|
677
715
|
// Only perform the runtime license check once
|
|
678
|
-
if (
|
|
716
|
+
if (_$bDVSQf) return _$bDVSQf;
|
|
679
717
|
// Wait for JWT verification to complete first (if running)
|
|
680
718
|
if (_jwtVerificationPromise) {
|
|
681
719
|
await _jwtVerificationPromise;
|
|
682
720
|
}
|
|
683
|
-
if (
|
|
721
|
+
if (_QsjWa === "basic") {
|
|
684
722
|
try {
|
|
685
723
|
const licenseUrl = "https://needle.tools/api/v1/needle-engine/check?location=" + encodeURIComponent(window.location.href) + "&version=" + VERSION + "&generator=" + encodeURIComponent(GENERATOR);
|
|
686
724
|
const res = await fetch(licenseUrl, {
|
|
@@ -692,29 +730,29 @@ async function _dFNhgjF() {
|
|
|
692
730
|
if (res?.status === 200) {
|
|
693
731
|
applicationIsForbidden = false;
|
|
694
732
|
if (debug) console.log("License check succeeded");
|
|
695
|
-
|
|
696
|
-
|
|
733
|
+
_QsjWa = "pro";
|
|
734
|
+
$rpNGR(true);
|
|
697
735
|
}
|
|
698
736
|
else if (res?.status === 403) {
|
|
699
|
-
|
|
737
|
+
$rpNGR(false);
|
|
700
738
|
applicationIsForbidden = true;
|
|
701
739
|
applicationForbiddenText = await res.text();
|
|
702
740
|
}
|
|
703
741
|
else {
|
|
704
|
-
|
|
742
|
+
$rpNGR(false);
|
|
705
743
|
if (debug) console.log("License check failed with status " + res?.status);
|
|
706
744
|
}
|
|
707
745
|
}
|
|
708
746
|
catch (err) {
|
|
709
|
-
|
|
747
|
+
$rpNGR(false);
|
|
710
748
|
if (debug) console.error("License check failed", err);
|
|
711
749
|
}
|
|
712
750
|
}
|
|
713
|
-
else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" +
|
|
751
|
+
else if (debug) console.log("Runtime license check is skipped because license is already applied as \"" + _QsjWa + "\"");
|
|
714
752
|
}
|
|
715
|
-
|
|
753
|
+
_$bDVSQf = $TPLZ();
|
|
716
754
|
|
|
717
|
-
async function
|
|
755
|
+
async function $DAPYU(ctx: IContext) {
|
|
718
756
|
function createForbiddenElement() {
|
|
719
757
|
const div = document.createElement("div");
|
|
720
758
|
div.className = "needle-forbidden";
|
|
@@ -755,7 +793,7 @@ async function __iMpjhj(ctx: IContext) {
|
|
|
755
793
|
const expectedTextStyle = text.style.cssText;
|
|
756
794
|
const forbiddenText = applicationForbiddenText?.length > 1 ? applicationForbiddenText : "This web application has been paused.<br/>You might be in violation of the Needle Engine terms of use.<br/>Please contact the Needle support if you think this is a mistake.";
|
|
757
795
|
text.innerHTML = forbiddenText;
|
|
758
|
-
|
|
796
|
+
setLicenseInterval(ctx, () => {
|
|
759
797
|
if (text.innerHTML !== forbiddenText) text.innerHTML = forbiddenText;
|
|
760
798
|
if (text.parentNode !== div) div.appendChild(text);
|
|
761
799
|
if (div.style.cssText !== expectedStyle) div.style.cssText = expectedStyle;
|
|
@@ -765,7 +803,7 @@ async function __iMpjhj(ctx: IContext) {
|
|
|
765
803
|
}
|
|
766
804
|
let forbiddenElement = createForbiddenElement();
|
|
767
805
|
const expectedCSS = forbiddenElement.style.cssText;
|
|
768
|
-
|
|
806
|
+
setLicenseInterval(ctx, () => {
|
|
769
807
|
if (applicationIsForbidden === true) {
|
|
770
808
|
if (forbiddenElement.style.cssText !== expectedCSS) forbiddenElement = createForbiddenElement();
|
|
771
809
|
if (ctx.domElement.shadowRoot) {
|
|
@@ -779,40 +817,40 @@ async function __iMpjhj(ctx: IContext) {
|
|
|
779
817
|
}, 500)
|
|
780
818
|
}
|
|
781
819
|
|
|
782
|
-
async function _$
|
|
820
|
+
async function _$toCs(ctx: IContext) {
|
|
783
821
|
try {
|
|
784
|
-
if (!_$
|
|
785
|
-
return
|
|
822
|
+
if (!_$xBhfh() && !__YFTdTh()) {
|
|
823
|
+
return $BkPUwzsT(ctx);
|
|
786
824
|
}
|
|
787
825
|
}
|
|
788
826
|
catch (err) {
|
|
789
827
|
if (debug) console.log("License check failed", err)
|
|
790
|
-
return
|
|
828
|
+
return $BkPUwzsT(ctx)
|
|
791
829
|
}
|
|
792
|
-
if (debug)
|
|
830
|
+
if (debug) $BkPUwzsT(ctx)
|
|
793
831
|
}
|
|
794
832
|
|
|
795
833
|
|
|
796
834
|
|
|
797
|
-
async function
|
|
835
|
+
async function $BkPUwzsT(ctx: IContext) {
|
|
798
836
|
|
|
799
837
|
// if the engine loads faster than the license check, we need to capture the ready event here
|
|
800
838
|
let isReady = false;
|
|
801
839
|
ctx.domElement.addEventListener("ready", () => isReady = true);
|
|
802
840
|
|
|
803
|
-
await
|
|
841
|
+
await _$bDVSQf?.catch(() => { });
|
|
804
842
|
|
|
805
843
|
|
|
806
|
-
if (_$
|
|
807
|
-
if (
|
|
844
|
+
if (_$xBhfh() || __YFTdTh()) return;
|
|
845
|
+
if (__alnviAJA() === false) EyGW();
|
|
808
846
|
|
|
809
847
|
// check if the engine is already ready (meaning has finished loading)
|
|
810
848
|
if (isReady) {
|
|
811
|
-
|
|
849
|
+
__vrAZI(ctx);
|
|
812
850
|
}
|
|
813
851
|
else {
|
|
814
852
|
ctx.domElement.addEventListener("ready", () => {
|
|
815
|
-
|
|
853
|
+
__vrAZI(ctx);
|
|
816
854
|
});
|
|
817
855
|
}
|
|
818
856
|
}
|
|
@@ -820,7 +858,7 @@ async function WksKzhWY(ctx: IContext) {
|
|
|
820
858
|
// const licenseElementIdentifier = "needle-license-element";
|
|
821
859
|
// const licenseDuration = 10000;
|
|
822
860
|
// const licenseDelay = 1200;
|
|
823
|
-
function
|
|
861
|
+
function __vrAZI(ctx: IContext) {
|
|
824
862
|
|
|
825
863
|
const style = `
|
|
826
864
|
position: relative;
|
|
@@ -833,7 +871,7 @@ function __hUZrkc(ctx: IContext) {
|
|
|
833
871
|
padding: 10px;
|
|
834
872
|
padding-left: 30px;
|
|
835
873
|
`;
|
|
836
|
-
if (
|
|
874
|
+
if (_QsjWa === "edu") {
|
|
837
875
|
if (navigator.webdriver) {
|
|
838
876
|
console.log("This project is supported by Needle for Education – https://needle.tools");
|
|
839
877
|
}
|
|
@@ -871,7 +909,7 @@ function __hUZrkc(ctx: IContext) {
|
|
|
871
909
|
banner.style.cssText = bannerStyle;
|
|
872
910
|
banner.addEventListener("click", () => { window.open("https://needle.tools", "_blank") });
|
|
873
911
|
let expectedBannerStyle = banner.style.cssText;
|
|
874
|
-
|
|
912
|
+
setLicenseTimeout(ctx, () => {
|
|
875
913
|
bannerStyle = bannerStyle.replace("opacity: 0", "opacity: 1");
|
|
876
914
|
bannerStyle = bannerStyle.replace("transform: translateY(10px)", "transform: translateY(0)");
|
|
877
915
|
banner.style.cssText = bannerStyle;
|
|
@@ -879,7 +917,7 @@ function __hUZrkc(ctx: IContext) {
|
|
|
879
917
|
}, 100);
|
|
880
918
|
|
|
881
919
|
// ensure the banner is always visible
|
|
882
|
-
const interval =
|
|
920
|
+
const interval = setLicenseInterval(ctx, () => {
|
|
883
921
|
const parent = ctx.domElement.shadowRoot || ctx.domElement;
|
|
884
922
|
if (banner.parentNode !== parent) {
|
|
885
923
|
parent.appendChild(banner);
|
|
@@ -890,16 +928,16 @@ function __hUZrkc(ctx: IContext) {
|
|
|
890
928
|
}
|
|
891
929
|
}, 1000);
|
|
892
930
|
|
|
893
|
-
if (
|
|
931
|
+
if (_$qEBaEKr()) {
|
|
894
932
|
const removeDelay = 20_000;
|
|
895
|
-
|
|
933
|
+
setLicenseTimeout(ctx, () => {
|
|
896
934
|
clearInterval(interval);
|
|
897
935
|
banner?.remove();
|
|
898
936
|
// show the logo every x minutes
|
|
899
937
|
const intervalInMinutes = 5;
|
|
900
|
-
|
|
938
|
+
setLicenseTimeout(ctx, () => {
|
|
901
939
|
if (ctx.domElement.parentNode)
|
|
902
|
-
|
|
940
|
+
__vrAZI(ctx);
|
|
903
941
|
}, 1000 * 60 * intervalInMinutes)
|
|
904
942
|
}, removeDelay);
|
|
905
943
|
}
|
|
@@ -910,7 +948,7 @@ function __hUZrkc(ctx: IContext) {
|
|
|
910
948
|
const base64Logo = "data:image/webp;base64,UklGRrABAABXRUJQVlA4WAoAAAAQAAAAHwAAHwAAQUxQSKEAAAARN6CmbSM4WR7vdARON11EBDq3fLiNbVtVzpMCPlKAEzsx0Y/x+Ovuv4dn0EFE/ydAvz6YggXzgh5sVgXM/zOC/4sii7qgGvB5N7hmuQYwkvazWAu1JPW41FXSHq6pnaQWvqYH18Fc0j1hO/BFTtIeSBlJi5w6qIIO7IOrwhFsB2Yxukif0FTRLpXswHR8MxbslKe9VZsn/Ub5C7YFOpqSTABWUDgg6AAAAFAGAJ0BKiAAIAA+7VyoTqmkpCI3+qgBMB2JbACdMt69DwMIQBLhkTO6XwY00UEDK6cNIDnuNibPf0EgAP7Y1myuiQHLDsF/0h5unrGh6WAbv7aegg2ZMd3uRKfT/3SJztcaujYfTvMXspfCTmYcoO6a+vhC3ss4M8uM58t4siiu59I4aOl59e9Sr6xoxYlHf2v+NnBNpJYeJf8jABQAId/PXuBkLEFkiCucgSGEcfhvajql/j3reCGl0M5/9gQWy7ayNPs+wlvIxFnNfSlfuND4CZOCyxOHhRqOmHN4ULHo3tCSrUNvgAA=";
|
|
911
949
|
|
|
912
950
|
let lastLogTime = 0;
|
|
913
|
-
async function
|
|
951
|
+
async function EyGW(_logo?: string) {
|
|
914
952
|
const now = Date.now();
|
|
915
953
|
if (now - lastLogTime < 2000) return;
|
|
916
954
|
lastLogTime = now;
|
|
@@ -943,7 +981,7 @@ async function _yCdKI(_logo?: string) {
|
|
|
943
981
|
}
|
|
944
982
|
|
|
945
983
|
|
|
946
|
-
async function
|
|
984
|
+
async function _qzMSGyVj(context: IContext) {
|
|
947
985
|
// isAllowed() now also covers cross-origin-isolated pages (where beacons can't be sent)
|
|
948
986
|
// and Do Not Track / GPC.
|
|
949
987
|
if (!Telemetry.isAllowed(context)) {
|
|
@@ -957,7 +995,7 @@ async function _ZQiK(context: IContext) {
|
|
|
957
995
|
|
|
958
996
|
// current url without query parameters
|
|
959
997
|
const currentUrl = window.location.href.split("?")[0];
|
|
960
|
-
const license =
|
|
998
|
+
const license = _QsjWa;
|
|
961
999
|
|
|
962
1000
|
const beaconData = {
|
|
963
1001
|
license,
|
|
@@ -148,13 +148,27 @@ function internalInvokeLifecycleFunctions(ctx: Context, evt: Event) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
const
|
|
151
|
+
const buffers: Array<Array<RegisteredLifecycleMethod>> = [];
|
|
152
|
+
let invocationDepth = 0;
|
|
152
153
|
const hookContext: LifecycleHookContext = {
|
|
153
154
|
context: null as any as Context
|
|
154
155
|
};
|
|
155
156
|
|
|
156
157
|
function invoke(ctx: Context, methods: Array<RegisteredLifecycleMethod>, invokeOnce: boolean) {
|
|
157
|
-
|
|
158
|
+
// Reuse storage per nesting depth: hooks may synchronously invoke other hooks.
|
|
159
|
+
const bufferArray = buffers[invocationDepth] ?? (buffers[invocationDepth] = []);
|
|
160
|
+
invocationDepth++;
|
|
161
|
+
try {
|
|
162
|
+
invokeWithBuffer(ctx, methods, invokeOnce, bufferArray);
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
// One-time/unregistered callbacks can capture entire scenes as well.
|
|
166
|
+
bufferArray.length = 0;
|
|
167
|
+
invocationDepth--;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function invokeWithBuffer(ctx: Context, methods: Array<RegisteredLifecycleMethod>, invokeOnce: boolean, bufferArray: Array<RegisteredLifecycleMethod>) {
|
|
158
172
|
for (let i = 0; i < methods.length; i++) {
|
|
159
173
|
bufferArray.push(methods[i]);
|
|
160
174
|
}
|
|
@@ -168,6 +182,7 @@ function invoke(ctx: Context, methods: Array<RegisteredLifecycleMethod>, invokeO
|
|
|
168
182
|
}
|
|
169
183
|
|
|
170
184
|
if (invoke) {
|
|
185
|
+
const previousContext = hookContext.context;
|
|
171
186
|
try {
|
|
172
187
|
hookContext.context = ctx;
|
|
173
188
|
entry.method?.call(hookContext, ctx);
|
|
@@ -175,6 +190,10 @@ function invoke(ctx: Context, methods: Array<RegisteredLifecycleMethod>, invokeO
|
|
|
175
190
|
catch (e) {
|
|
176
191
|
console.error("Error in lifecycle method", e);
|
|
177
192
|
}
|
|
193
|
+
finally {
|
|
194
|
+
// This shared receiver must not keep the last invoked context alive.
|
|
195
|
+
hookContext.context = previousContext;
|
|
196
|
+
}
|
|
178
197
|
}
|
|
179
198
|
|
|
180
199
|
// Remove the method if it's a one time call
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BufferGeometry, Camera, Color, Euler,Group, Material, Object3D, Scene, Texture, Vector2, Vector3, Vector4, WebGLRenderer } from "three";
|
|
2
2
|
|
|
3
|
+
import { isDevEnvironment } from "./debug/index.js";
|
|
4
|
+
import { getParam } from "./engine_utils.js";
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
// @TODO: we need to detect objects with materials both transparent and NOT transparent. These need to be updated in scene.onBeforeRender to have correct renderlists
|
|
5
8
|
|
|
@@ -657,6 +660,13 @@ const onAfterRenderListPush = function (this: Object3D, _object: Object3D, _geom
|
|
|
657
660
|
}
|
|
658
661
|
|
|
659
662
|
// #region OnBeforeRender
|
|
663
|
+
/**
|
|
664
|
+
* Set once the "envMap on MeshBasicMaterial is not supported" warning has been logged, so it only appears once.
|
|
665
|
+
* @internal
|
|
666
|
+
*/
|
|
667
|
+
let didWarnBasicMaterialEnvMap = false;
|
|
668
|
+
const debugReflectionProbe = getParam("debugreflectionprobe");
|
|
669
|
+
|
|
660
670
|
/**
|
|
661
671
|
* Main callback invoked before rendering an object.
|
|
662
672
|
* Applies property block overrides and defines to the material.
|
|
@@ -726,6 +736,17 @@ const onBeforeRender_MaterialBlock: ObjectRenderCallback = function (this: Objec
|
|
|
726
736
|
for (const override of overrides) {
|
|
727
737
|
if (override.value === null) continue;
|
|
728
738
|
|
|
739
|
+
// Reflection probe overrides on MeshBasicMaterial cause rendering glitches, so none are applied.
|
|
740
|
+
// No original values are recorded, so onAfterRender leaves these properties untouched.
|
|
741
|
+
if (mat.isMeshBasicMaterial === true &&
|
|
742
|
+
(override.name === "envMap" || override.name === "envMapRotation" || override.name === "envMapIntensity")) {
|
|
743
|
+
if (override.name === "envMap" && !didWarnBasicMaterialEnvMap && (isDevEnvironment() || debugReflectionProbe)) {
|
|
744
|
+
didWarnBasicMaterialEnvMap = true;
|
|
745
|
+
console.warn(`MaterialPropertyBlock: Ignoring envMap override on MeshBasicMaterial (object: "${this.name}", material: "${material.name}"). Use a lit material such as MeshStandardMaterial if reflection probes are intended.`);
|
|
746
|
+
}
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
|
|
729
750
|
const currentValue = mat[override.name];
|
|
730
751
|
|
|
731
752
|
const existingOriginal = originalValues.find((o: OriginalValue) => o.name === override.name);
|
|
@@ -7,13 +7,13 @@ import type { Networking } from "../engine-components/Networking.js";
|
|
|
7
7
|
import type { SyncedRoom } from "../engine-components/SyncedRoom.js";
|
|
8
8
|
import * as schemes from "../engine-schemes/schemes.js";
|
|
9
9
|
import { isDevEnvironment } from './debug/index.js';
|
|
10
|
+
import type { DisposeFn } from "./engine_disposable.js";
|
|
10
11
|
import { Telemetry } from './engine_license.js';
|
|
12
|
+
import { WebsocketTransport } from './engine_networking.transport.websocket.js';
|
|
11
13
|
import { PeerNetworking } from './engine_networking_peer.js';
|
|
12
14
|
import { type IModel, type INetworkConnection, type INetworkTransport, SendQueue } from './engine_networking_types.js';
|
|
13
|
-
import { WebsocketTransport } from './engine_networking.transport.websocket.js';
|
|
14
15
|
import { isHostedOnGlitch } from './engine_networking_utils.js';
|
|
15
16
|
import { Context } from './engine_setup.js';
|
|
16
|
-
import type { DisposeFn } from "./engine_disposable.js";
|
|
17
17
|
import * as utils from "./engine_utils.js";
|
|
18
18
|
|
|
19
19
|
/** @internal Symbol used to attach the original callback to unsubscribe functions returned by beginListen/beginListenBinary */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileLoader } from "three";
|
|
2
2
|
|
|
3
3
|
import { showBalloonWarning } from "./debug/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { __alnviAJA } from "./engine_license.js";
|
|
5
5
|
import { delay } from "./engine_utils.js";
|
|
6
6
|
import { md5AsBytes, md5Hex, sha256Base64 } from "./engine_utils_hash.js";
|
|
7
7
|
|
|
@@ -45,7 +45,7 @@ export namespace BlobStorage {
|
|
|
45
45
|
*/
|
|
46
46
|
export function canUpload(info: { filesize: number }) {
|
|
47
47
|
const sizeInMB = info.filesize / 1024 / 1024;
|
|
48
|
-
if (
|
|
48
|
+
if (__alnviAJA()) {
|
|
49
49
|
return sizeInMB < maxSizeInMB;
|
|
50
50
|
}
|
|
51
51
|
return sizeInMB < maxFreeSizeInMB;
|
|
@@ -100,7 +100,7 @@ export namespace BlobStorage {
|
|
|
100
100
|
console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max allowed size is ${maxSizeInMB}MB`);
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
|
-
else if (
|
|
103
|
+
else if (!__alnviAJA() && filesizeInMB > maxFreeSizeInMB) {
|
|
104
104
|
if (opts?.silent !== true) showBalloonWarning(`File is too large for uploading. Please get a <a href=\"https://needle.tools/pricing\" target=\"_blank\">commercial license</a> to upload files larger than 5MB`);
|
|
105
105
|
console.warn(`Your file is too large for uploading (${filesizeInMB.toFixed(1)}MB). Max size is 5MB for non-commercial users. Please get a commercial license at https://needle.tools/pricing for larger files (up to 50MB)`);
|
|
106
106
|
return null;
|