1681-engine 0.5.8 → 0.5.10
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 +95 -0
- package/README.md +3 -0
- package/dist/1681-engine.js +526 -409
- package/dist/ambient/ColorGrade.js +0 -1
- package/dist/ambient/DayClock.js +0 -1
- package/dist/ambient/WeatherLayer.js +0 -1
- package/dist/ambient/grade.js +0 -1
- package/dist/ambient/life/Birds.js +73 -0
- package/dist/ambient/life/Butterflies.js +43 -0
- package/dist/ambient/life/ChimneySmoke.js +50 -0
- package/dist/ambient/life/Drift.js +75 -0
- package/dist/ambient/life/Fireflies.js +52 -0
- package/dist/ambient/life/lifeMotion.js +49 -0
- package/dist/ambient/weather.js +0 -1
- package/dist/anim/AnimStateMachine.js +0 -1
- package/dist/anim/Animator.js +0 -1
- package/dist/anim/animStateCompile.js +0 -1
- package/dist/anim/animStateSystem.js +0 -1
- package/dist/anim/animationSystem.js +0 -1
- package/dist/anim/asepriteSlices.js +0 -1
- package/dist/anim/asepriteTags.js +0 -1
- package/dist/anim/parseAseprite.js +0 -1
- package/dist/assets/AssetLoader.js +177 -34
- package/dist/assets/Prepainter.js +61 -0
- package/dist/assets/loadAseprite.js +0 -1
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +0 -1
- package/dist/assets/textureAtlas.js +58 -0
- package/dist/assets/workerPainter.js +39 -0
- package/dist/audio/Footsteps.js +0 -1
- package/dist/audio/MusicPlayer.js +0 -1
- package/dist/audio/SoundEngine.js +13 -7
- package/dist/audio/cleanTake.js +0 -1
- package/dist/audio/music/ElementVoice.js +0 -1
- package/dist/audio/music/GraphVoice.js +0 -1
- package/dist/audio/music/MusicChannel.js +0 -1
- package/dist/audio/music/musicVoice.js +0 -1
- package/dist/audio/sampleBank.js +0 -1
- package/dist/audio/soundTable.js +0 -1
- package/dist/audio/synth.js +0 -1
- package/dist/cjs/electron/electronLike.d.ts +55 -0
- package/dist/cjs/electron/electronLike.js +7 -0
- package/dist/cjs/electron/index.d.ts +14 -0
- package/dist/cjs/electron/index.js +20 -0
- package/dist/cjs/electron/lockdown.d.ts +33 -0
- package/dist/cjs/electron/lockdown.js +69 -0
- package/dist/cjs/electron/lockdownRules.d.ts +28 -0
- package/dist/cjs/electron/lockdownRules.js +61 -0
- package/dist/cjs/electron/sessionStore.d.ts +40 -0
- package/dist/cjs/electron/sessionStore.js +77 -0
- package/dist/cjs/electron/shellId.d.ts +22 -0
- package/dist/cjs/electron/shellId.js +31 -0
- package/dist/cjs/electron/webFiles.d.ts +13 -0
- package/dist/cjs/electron/webFiles.js +52 -0
- package/dist/cjs/electron/webPatcher.d.ts +80 -0
- package/dist/cjs/electron/webPatcher.js +216 -0
- package/dist/cjs/electron/webPointers.d.ts +19 -0
- package/dist/cjs/electron/webPointers.js +35 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/updates/index.d.ts +8 -0
- package/dist/cjs/updates/index.js +21 -0
- package/dist/cjs/updates/manifest.d.ts +73 -0
- package/dist/cjs/updates/manifest.js +67 -0
- package/dist/cjs/updates/pickUpdate.d.ts +42 -0
- package/dist/cjs/updates/pickUpdate.js +52 -0
- package/dist/cjs/updates/webPlan.d.ts +20 -0
- package/dist/cjs/updates/webPlan.js +34 -0
- package/dist/core/BitmapLabel.js +0 -1
- package/dist/core/Camera.js +1 -2
- package/dist/core/Clock.js +31 -21
- package/dist/core/Graphics.js +0 -1
- package/dist/core/Group.js +0 -1
- package/dist/core/Image.js +0 -1
- package/dist/core/ObjectFactory.js +0 -1
- package/dist/core/Pointer.js +46 -24
- package/dist/core/Rectangle.js +0 -1
- package/dist/core/Stage.js +5 -6
- package/dist/core/Text.js +0 -1
- package/dist/core/TextureRegistry.js +54 -24
- package/dist/core/Timeline.js +0 -1
- package/dist/core/TimelineBuilder.js +0 -1
- package/dist/core/TimelineChild.js +0 -1
- package/dist/core/Tweener.js +0 -1
- package/dist/core/atlas.js +0 -1
- package/dist/core/atlasPlan.js +0 -1
- package/dist/core/blendLayer.js +11 -0
- package/dist/core/eases.js +0 -1
- package/dist/core/gameObject.js +22 -20
- package/dist/core/pixelZoom.js +43 -0
- package/dist/core/pixiPatches.js +0 -1
- package/dist/core/runDue.js +28 -0
- package/dist/core/silhouette.js +49 -0
- package/dist/core/timelinePlace.js +0 -1
- package/dist/core/tweenProps.js +0 -1
- package/dist/debug/DebugOverlay.js +0 -1
- package/dist/debug/DrawCallCounter.js +15 -12
- package/dist/debug/ErrorLog.js +0 -1
- package/dist/debug/FrameStats.js +0 -1
- package/dist/debug/inspectWorld.js +0 -1
- package/dist/diagnostics/ErrorDeduper.js +0 -1
- package/dist/diagnostics/FrameSampler.js +0 -1
- package/dist/diagnostics/bootWatch.js +0 -1
- package/dist/diagnostics/captureErrors.js +0 -1
- package/dist/diagnostics/contextLoss.js +0 -1
- package/dist/diagnostics/frameStats.js +0 -1
- package/dist/diagnostics/gpuInfo.js +0 -1
- package/dist/diagnostics/renderGuard.js +0 -1
- package/dist/ecs/SparseSet.js +0 -1
- package/dist/ecs/World.js +0 -1
- package/dist/ecs/fields.js +0 -1
- package/dist/electron/lockdown.js +31 -0
- package/dist/electron/lockdownRules.js +42 -0
- package/dist/electron/sessionStore.js +48 -0
- package/dist/electron/shellId.js +18 -0
- package/dist/electron/webFiles.js +36 -0
- package/dist/electron/webPatcher.js +147 -0
- package/dist/electron/webPointers.js +25 -0
- package/dist/electron.js +19 -0
- package/dist/engine/Engine.js +42 -18
- package/dist/engine/FixedLoop.js +0 -1
- package/dist/engine/HiddenPause.js +27 -0
- package/dist/engine/Scene.js +0 -1
- package/dist/engine/SceneManager.js +0 -1
- package/dist/events/EventBus.js +0 -1
- package/dist/fx/Afterimages.js +82 -0
- package/dist/fx/FloatingText.js +0 -1
- package/dist/fx/hitStop.js +0 -1
- package/dist/fx/viewCull.js +0 -1
- package/dist/i18n/Translator.js +0 -1
- package/dist/i18n/extractStrings.js +0 -1
- package/dist/i18n/formatMessage.js +0 -1
- package/dist/input/Actions.js +29 -21
- package/dist/input/AimGesture.js +0 -1
- package/dist/input/Keyboard.js +0 -1
- package/dist/input/Keymap.js +0 -1
- package/dist/input/TargetLock.js +0 -1
- package/dist/input/aimAxis.js +0 -1
- package/dist/input/haptics.js +50 -0
- package/dist/input/keyChord.js +0 -1
- package/dist/input/longPress.js +0 -1
- package/dist/input/rumble.js +42 -0
- package/dist/input/stickAxis.js +0 -1
- package/dist/input/touchDetect.js +0 -1
- package/dist/light/LightLayer.js +0 -1
- package/dist/nav/MinHeap.js +0 -1
- package/dist/nav/findPath.js +0 -1
- package/dist/nav/navGrid.js +0 -1
- package/dist/nav/nearestOpen.js +0 -1
- package/dist/nav/straightenPath.js +0 -1
- package/dist/net/ApiClient.js +96 -0
- package/dist/net/Connection.js +39 -16
- package/dist/net/InterpolationBuffer.js +0 -1
- package/dist/net/PredictedMover.js +0 -1
- package/dist/net/Room.js +0 -1
- package/dist/net/RoomHost.js +0 -1
- package/dist/net/cadence.js +0 -1
- package/dist/net/constants.js +0 -1
- package/dist/net/lobby/LobbyClient.js +0 -1
- package/dist/net/lobby/LobbyHost.js +0 -1
- package/dist/net/lobby/LobbyRooms.js +0 -1
- package/dist/net/lobby/Matchmaker.js +0 -1
- package/dist/net/movement.js +40 -39
- package/dist/net/protocol.js +0 -1
- package/dist/net/reconnect.js +10 -0
- package/dist/net/serverClock.js +0 -1
- package/dist/net/snapshotCodec.js +0 -1
- package/dist/parallax/Parallax.js +0 -1
- package/dist/parallax/ParallaxLayer.js +0 -1
- package/dist/parallax/parallaxMath.js +0 -1
- package/dist/particles/Emitter.js +0 -1
- package/dist/particles/ParticleBudget.js +0 -1
- package/dist/particles/ParticleSim.js +0 -1
- package/dist/particles/particleCurves.js +0 -1
- package/dist/particles/particleSampling.js +0 -1
- package/dist/physics/Body.js +0 -1
- package/dist/physics/BroadPhase.js +0 -1
- package/dist/physics/Contact.js +0 -1
- package/dist/physics/ContactSolver.js +0 -1
- package/dist/physics/PhysicsWorld.js +0 -1
- package/dist/physics/SpatialHash.js +0 -1
- package/dist/physics/collide.js +0 -1
- package/dist/physics/collidePolygon.js +0 -1
- package/dist/physics/contactReport.js +0 -1
- package/dist/physics/drawColliders.js +0 -1
- package/dist/physics/physicsSystem.js +0 -1
- package/dist/physics/polygon.js +0 -1
- package/dist/physics/raycast.js +0 -1
- package/dist/physics/syncToBody.js +0 -1
- package/dist/physics/tileBodies.js +0 -1
- package/dist/physics/types.js +0 -1
- package/dist/pixel/Darkness.js +50 -47
- package/dist/pixel/DitherVignette.js +0 -1
- package/dist/pixel/Evaporation.js +0 -1
- package/dist/pixel/NightShade.js +0 -1
- package/dist/pixel/PixelLayer.js +0 -1
- package/dist/pixel/PixelMarks.js +99 -0
- package/dist/pixel/SwayProp.js +0 -1
- package/dist/pixel/aimPixels.js +67 -0
- package/dist/pixel/lifeArt.js +83 -0
- package/dist/pixel/lights.js +0 -1
- package/dist/pixel/nineSlice.js +0 -1
- package/dist/pixel/paintLayer.js +0 -1
- package/dist/pixel/palette.js +0 -1
- package/dist/pixel/pixel.js +0 -1
- package/dist/pixel/pixelPaint.js +27 -24
- package/dist/pixel/pixelParticles.js +35 -0
- package/dist/pixel/pixelTone.js +0 -1
- package/dist/pixel/propKit.js +0 -1
- package/dist/pixel/ramp.js +0 -1
- package/dist/pixel/selout.js +0 -1
- package/dist/pixel/spritePixels.js +0 -1
- package/dist/pixel/swayRig.js +0 -1
- package/dist/pixel/vignetteMask.js +0 -1
- package/dist/pixel/weatherArt.js +0 -1
- package/dist/pixel.js +82 -71
- package/dist/platform/appResume.js +18 -0
- package/dist/platform/fullscreen.js +52 -0
- package/dist/platform/orientation.js +26 -0
- package/dist/platform/pointerLock.js +37 -0
- package/dist/platform/reducedMotion.js +23 -0
- package/dist/platform/timeoutSignal.js +14 -0
- package/dist/platform/touch.js +0 -1
- package/dist/postfx/BloomFilter.js +0 -1
- package/dist/postfx/ChromaticAberrationFilter.js +0 -1
- package/dist/postfx/ColorAdjustFilter.js +0 -1
- package/dist/postfx/CrtFilter.js +0 -1
- package/dist/postfx/PixelateFilter.js +0 -1
- package/dist/postfx/PostFx.js +0 -1
- package/dist/postfx/ShockwaveFilter.js +0 -1
- package/dist/postfx/VignetteFilter.js +0 -1
- package/dist/postfx/fxAnimator.js +0 -1
- package/dist/postfx/fxShader.js +0 -1
- package/dist/postfx.js +0 -1
- package/dist/react/ChoiceDialog.js +0 -1
- package/dist/react/ConfirmButton.js +24 -0
- package/dist/react/ConfirmDialog.js +0 -1
- package/dist/react/Glyph.js +0 -1
- package/dist/react/Modal.js +0 -1
- package/dist/react/Panel.js +0 -1
- package/dist/react/PixelImage.js +0 -1
- package/dist/react/Select.js +0 -1
- package/dist/react/Slider.js +0 -1
- package/dist/react/SplitPane.js +0 -1
- package/dist/react/TabStrip.js +0 -1
- package/dist/react/TitleTips.js +0 -1
- package/dist/react/Tooltip.js +0 -1
- package/dist/react/UiProvider.js +0 -1
- package/dist/react/baseCss.js +1 -1
- package/dist/react/choiceStore.js +0 -1
- package/dist/react/classNames.js +0 -1
- package/dist/react/confirmStore.js +0 -1
- package/dist/react/labels.js +7 -7
- package/dist/react/placement.js +0 -1
- package/dist/react/useFillSheet.js +0 -1
- package/dist/react/useFitToViewport.js +0 -1
- package/dist/react/useJsonSelector.js +13 -0
- package/dist/react/usePicked.js +0 -1
- package/dist/react/useStore.js +0 -1
- package/dist/react/useViewport.js +0 -1
- package/dist/react.js +73 -69
- package/dist/rig/PosePlayer.js +0 -1
- package/dist/rig/RigView.js +0 -1
- package/dist/rig/Skeleton.js +0 -1
- package/dist/rig/humanoid.js +0 -1
- package/dist/rig/humanoid.json.js +0 -1
- package/dist/rig/humanoidPoses.js +0 -1
- package/dist/rig/poseMath.js +0 -1
- package/dist/rig/poses.json.js +0 -1
- package/dist/save/Autosaver.js +0 -1
- package/dist/save/MemoryBackend.js +0 -1
- package/dist/save/SaveStore.js +0 -1
- package/dist/save/WebStorageBackend.js +0 -1
- package/dist/save/checksum.js +0 -1
- package/dist/save/migrateSave.js +0 -1
- package/dist/settings.js +0 -1
- package/dist/tilemap/TilemapView.js +57 -33
- package/dist/tilemap/autotile.js +103 -0
- package/dist/tilemap/collision.js +29 -19
- package/dist/tilemap/ldtk.js +21 -0
- package/dist/tilemap/ldtkParse.js +191 -0
- package/dist/tilemap/tiled.js +0 -1
- package/dist/transitions/CrossfadeTransition.js +0 -1
- package/dist/transitions/DitherWipeTransition.js +0 -1
- package/dist/transitions/FadeTransition.js +0 -1
- package/dist/transitions/Letterbox.js +0 -1
- package/dist/transitions/ditherMask.js +0 -1
- package/dist/transitions/transitionTo.js +0 -1
- package/dist/transitions/tweenDone.js +0 -1
- package/dist/types/ambient/life/Birds.d.ts +50 -0
- package/dist/types/ambient/life/Birds.d.ts.map +1 -0
- package/dist/types/ambient/life/Butterflies.d.ts +32 -0
- package/dist/types/ambient/life/Butterflies.d.ts.map +1 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts +37 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts.map +1 -0
- package/dist/types/ambient/life/Drift.d.ts +58 -0
- package/dist/types/ambient/life/Drift.d.ts.map +1 -0
- package/dist/types/ambient/life/Fireflies.d.ts +43 -0
- package/dist/types/ambient/life/Fireflies.d.ts.map +1 -0
- package/dist/types/ambient/life/lifeMotion.d.ts +63 -0
- package/dist/types/ambient/life/lifeMotion.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +83 -8
- package/dist/types/assets/AssetLoader.d.ts.map +1 -1
- package/dist/types/assets/Prepainter.d.ts +64 -0
- package/dist/types/assets/Prepainter.d.ts.map +1 -0
- package/dist/types/assets/textureAtlas.d.ts +35 -0
- package/dist/types/assets/textureAtlas.d.ts.map +1 -0
- package/dist/types/assets/workerPainter.d.ts +21 -0
- package/dist/types/assets/workerPainter.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +5 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -1
- package/dist/types/core/Camera.d.ts +1 -1
- package/dist/types/core/Camera.d.ts.map +1 -1
- package/dist/types/core/Clock.d.ts +14 -2
- package/dist/types/core/Clock.d.ts.map +1 -1
- package/dist/types/core/Pointer.d.ts +18 -0
- package/dist/types/core/Pointer.d.ts.map +1 -1
- package/dist/types/core/Stage.d.ts.map +1 -1
- package/dist/types/core/TextureRegistry.d.ts +39 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -1
- package/dist/types/core/blendLayer.d.ts +23 -0
- package/dist/types/core/blendLayer.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts.map +1 -1
- package/dist/types/core/pixelZoom.d.ts +45 -0
- package/dist/types/core/pixelZoom.d.ts.map +1 -0
- package/dist/types/core/runDue.d.ts +15 -0
- package/dist/types/core/runDue.d.ts.map +1 -0
- package/dist/types/core/silhouette.d.ts +16 -0
- package/dist/types/core/silhouette.d.ts.map +1 -0
- package/dist/types/debug/DrawCallCounter.d.ts.map +1 -1
- package/dist/types/electron/electronLike.d.ts +56 -0
- package/dist/types/electron/electronLike.d.ts.map +1 -0
- package/dist/types/electron/index.d.ts +15 -0
- package/dist/types/electron/index.d.ts.map +1 -0
- package/dist/types/electron/lockdown.d.ts +34 -0
- package/dist/types/electron/lockdown.d.ts.map +1 -0
- package/dist/types/electron/lockdownRules.d.ts +29 -0
- package/dist/types/electron/lockdownRules.d.ts.map +1 -0
- package/dist/types/electron/sessionStore.d.ts +41 -0
- package/dist/types/electron/sessionStore.d.ts.map +1 -0
- package/dist/types/electron/shellId.d.ts +23 -0
- package/dist/types/electron/shellId.d.ts.map +1 -0
- package/dist/types/electron/webFiles.d.ts +14 -0
- package/dist/types/electron/webFiles.d.ts.map +1 -0
- package/dist/types/electron/webPatcher.d.ts +81 -0
- package/dist/types/electron/webPatcher.d.ts.map +1 -0
- package/dist/types/electron/webPointers.d.ts +20 -0
- package/dist/types/electron/webPointers.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +16 -0
- package/dist/types/engine/Engine.d.ts.map +1 -1
- package/dist/types/engine/HiddenPause.d.ts +22 -0
- package/dist/types/engine/HiddenPause.d.ts.map +1 -0
- package/dist/types/fx/Afterimages.d.ts +62 -0
- package/dist/types/fx/Afterimages.d.ts.map +1 -0
- package/dist/types/index.d.ts +32 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/input/Actions.d.ts +7 -1
- package/dist/types/input/Actions.d.ts.map +1 -1
- package/dist/types/input/haptics.d.ts +42 -0
- package/dist/types/input/haptics.d.ts.map +1 -0
- package/dist/types/input/rumble.d.ts +41 -0
- package/dist/types/input/rumble.d.ts.map +1 -0
- package/dist/types/net/ApiClient.d.ts +74 -0
- package/dist/types/net/ApiClient.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +22 -0
- package/dist/types/net/Connection.d.ts.map +1 -1
- package/dist/types/net/constants.d.ts +13 -4
- package/dist/types/net/constants.d.ts.map +1 -1
- package/dist/types/net/movement.d.ts.map +1 -1
- package/dist/types/net/reconnect.d.ts +14 -0
- package/dist/types/net/reconnect.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +17 -5
- package/dist/types/pixel/Darkness.d.ts.map +1 -1
- package/dist/types/pixel/PixelMarks.d.ts +68 -0
- package/dist/types/pixel/PixelMarks.d.ts.map +1 -0
- package/dist/types/pixel/aimPixels.d.ts +23 -0
- package/dist/types/pixel/aimPixels.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +4 -1
- package/dist/types/pixel/index.d.ts.map +1 -1
- package/dist/types/pixel/lifeArt.d.ts +63 -0
- package/dist/types/pixel/lifeArt.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +1 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -1
- package/dist/types/pixel/pixelParticles.d.ts +21 -0
- package/dist/types/pixel/pixelParticles.d.ts.map +1 -0
- package/dist/types/platform/appResume.d.ts +25 -0
- package/dist/types/platform/appResume.d.ts.map +1 -0
- package/dist/types/platform/fullscreen.d.ts +37 -0
- package/dist/types/platform/fullscreen.d.ts.map +1 -0
- package/dist/types/platform/orientation.d.ts +19 -0
- package/dist/types/platform/orientation.d.ts.map +1 -0
- package/dist/types/platform/pointerLock.d.ts +26 -0
- package/dist/types/platform/pointerLock.d.ts.map +1 -0
- package/dist/types/platform/reducedMotion.d.ts +20 -0
- package/dist/types/platform/reducedMotion.d.ts.map +1 -0
- package/dist/types/platform/timeoutSignal.d.ts +6 -0
- package/dist/types/platform/timeoutSignal.d.ts.map +1 -0
- package/dist/types/react/ConfirmButton.d.ts +26 -0
- package/dist/types/react/ConfirmButton.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +1 -1
- package/dist/types/react/baseCss.d.ts.map +1 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/index.d.ts.map +1 -1
- package/dist/types/react/labels.d.ts +2 -0
- package/dist/types/react/labels.d.ts.map +1 -1
- package/dist/types/react/useJsonSelector.d.ts +13 -0
- package/dist/types/react/useJsonSelector.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +17 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -1
- package/dist/types/tilemap/autotile.d.ts +95 -0
- package/dist/types/tilemap/autotile.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +8 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -1
- package/dist/types/tilemap/ldtk.d.ts +97 -0
- package/dist/types/tilemap/ldtk.d.ts.map +1 -0
- package/dist/types/tilemap/ldtkParse.d.ts +26 -0
- package/dist/types/tilemap/ldtkParse.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +4 -0
- package/dist/types/ui/index.d.ts.map +1 -1
- package/dist/types/ui/rich/RichText.d.ts +48 -0
- package/dist/types/ui/rich/RichText.d.ts.map +1 -0
- package/dist/types/ui/rich/richFonts.d.ts +70 -0
- package/dist/types/ui/rich/richFonts.d.ts.map +1 -0
- package/dist/types/ui/rich/richLayout.d.ts +76 -0
- package/dist/types/ui/rich/richLayout.d.ts.map +1 -0
- package/dist/types/ui/rich/richMarkup.d.ts +48 -0
- package/dist/types/ui/rich/richMarkup.d.ts.map +1 -0
- package/dist/types/updates/index.d.ts +9 -0
- package/dist/types/updates/index.d.ts.map +1 -0
- package/dist/types/updates/manifest.d.ts +74 -0
- package/dist/types/updates/manifest.d.ts.map +1 -0
- package/dist/types/updates/pickUpdate.d.ts +43 -0
- package/dist/types/updates/pickUpdate.d.ts.map +1 -0
- package/dist/types/updates/webPlan.d.ts +21 -0
- package/dist/types/updates/webPlan.d.ts.map +1 -0
- package/dist/ui/Bar.js +0 -1
- package/dist/ui/Button.js +0 -1
- package/dist/ui/Dialog.js +0 -1
- package/dist/ui/FocusManager.js +0 -1
- package/dist/ui/Label.js +0 -1
- package/dist/ui/List.js +0 -1
- package/dist/ui/Panel.js +0 -1
- package/dist/ui/ScrollView.js +0 -1
- package/dist/ui/Slider.js +0 -1
- package/dist/ui/Stack.js +0 -1
- package/dist/ui/Toggle.js +0 -1
- package/dist/ui/UiHost.js +0 -1
- package/dist/ui/UiPointerGate.js +0 -1
- package/dist/ui/UiRoot.js +0 -1
- package/dist/ui/Widget.js +0 -1
- package/dist/ui/dom/DomOverlay.js +0 -1
- package/dist/ui/dom/DomWorldAnchors.js +0 -1
- package/dist/ui/dom/InputShield.js +0 -1
- package/dist/ui/dom/createStore.js +0 -1
- package/dist/ui/dom/shieldDecision.js +0 -1
- package/dist/ui/dom/worldToScreen.js +0 -1
- package/dist/ui/layout/anchor.js +0 -1
- package/dist/ui/layout/barDrain.js +0 -1
- package/dist/ui/layout/fitToViewport.js +0 -1
- package/dist/ui/layout/focusNav.js +0 -1
- package/dist/ui/layout/geometry.js +0 -1
- package/dist/ui/layout/listWidth.js +0 -1
- package/dist/ui/layout/placeTooltip.js +0 -1
- package/dist/ui/layout/scroll.js +0 -1
- package/dist/ui/layout/slider.js +0 -1
- package/dist/ui/layout/stack.js +0 -1
- package/dist/ui/layout/wrapRow.js +0 -1
- package/dist/ui/rich/RichText.js +87 -0
- package/dist/ui/rich/richFonts.js +105 -0
- package/dist/ui/rich/richLayout.js +132 -0
- package/dist/ui/rich/richMarkup.js +67 -0
- package/dist/ui.js +75 -65
- package/dist/updates/manifest.js +35 -0
- package/dist/updates/pickUpdate.js +27 -0
- package/dist/updates/webPlan.js +14 -0
- package/dist/updates.js +15 -0
- package/package.json +31 -6
- package/dist/1681-engine.js.map +0 -1
- package/dist/ambient/ColorGrade.js.map +0 -1
- package/dist/ambient/DayClock.js.map +0 -1
- package/dist/ambient/WeatherLayer.js.map +0 -1
- package/dist/ambient/grade.js.map +0 -1
- package/dist/ambient/weather.js.map +0 -1
- package/dist/anim/AnimStateMachine.js.map +0 -1
- package/dist/anim/Animator.js.map +0 -1
- package/dist/anim/animStateCompile.js.map +0 -1
- package/dist/anim/animStateSystem.js.map +0 -1
- package/dist/anim/animationSystem.js.map +0 -1
- package/dist/anim/asepriteSlices.js.map +0 -1
- package/dist/anim/asepriteTags.js.map +0 -1
- package/dist/anim/parseAseprite.js.map +0 -1
- package/dist/assets/AssetLoader.js.map +0 -1
- package/dist/assets/loadAseprite.js.map +0 -1
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +0 -1
- package/dist/audio/Footsteps.js.map +0 -1
- package/dist/audio/MusicPlayer.js.map +0 -1
- package/dist/audio/SoundEngine.js.map +0 -1
- package/dist/audio/cleanTake.js.map +0 -1
- package/dist/audio/music/ElementVoice.js.map +0 -1
- package/dist/audio/music/GraphVoice.js.map +0 -1
- package/dist/audio/music/MusicChannel.js.map +0 -1
- package/dist/audio/music/musicVoice.js.map +0 -1
- package/dist/audio/sampleBank.js.map +0 -1
- package/dist/audio/soundTable.js.map +0 -1
- package/dist/audio/synth.js.map +0 -1
- package/dist/core/BitmapLabel.js.map +0 -1
- package/dist/core/Camera.js.map +0 -1
- package/dist/core/Clock.js.map +0 -1
- package/dist/core/Graphics.js.map +0 -1
- package/dist/core/Group.js.map +0 -1
- package/dist/core/Image.js.map +0 -1
- package/dist/core/ObjectFactory.js.map +0 -1
- package/dist/core/Pointer.js.map +0 -1
- package/dist/core/Rectangle.js.map +0 -1
- package/dist/core/Stage.js.map +0 -1
- package/dist/core/Text.js.map +0 -1
- package/dist/core/TextureRegistry.js.map +0 -1
- package/dist/core/Timeline.js.map +0 -1
- package/dist/core/TimelineBuilder.js.map +0 -1
- package/dist/core/TimelineChild.js.map +0 -1
- package/dist/core/Tweener.js.map +0 -1
- package/dist/core/atlas.js.map +0 -1
- package/dist/core/atlasPlan.js.map +0 -1
- package/dist/core/eases.js.map +0 -1
- package/dist/core/gameObject.js.map +0 -1
- package/dist/core/pixiPatches.js.map +0 -1
- package/dist/core/timelinePlace.js.map +0 -1
- package/dist/core/tweenProps.js.map +0 -1
- package/dist/debug/DebugOverlay.js.map +0 -1
- package/dist/debug/DrawCallCounter.js.map +0 -1
- package/dist/debug/ErrorLog.js.map +0 -1
- package/dist/debug/FrameStats.js.map +0 -1
- package/dist/debug/inspectWorld.js.map +0 -1
- package/dist/diagnostics/ErrorDeduper.js.map +0 -1
- package/dist/diagnostics/FrameSampler.js.map +0 -1
- package/dist/diagnostics/bootWatch.js.map +0 -1
- package/dist/diagnostics/captureErrors.js.map +0 -1
- package/dist/diagnostics/contextLoss.js.map +0 -1
- package/dist/diagnostics/frameStats.js.map +0 -1
- package/dist/diagnostics/gpuInfo.js.map +0 -1
- package/dist/diagnostics/renderGuard.js.map +0 -1
- package/dist/ecs/SparseSet.js.map +0 -1
- package/dist/ecs/World.js.map +0 -1
- package/dist/ecs/fields.js.map +0 -1
- package/dist/engine/Engine.js.map +0 -1
- package/dist/engine/FixedLoop.js.map +0 -1
- package/dist/engine/Scene.js.map +0 -1
- package/dist/engine/SceneManager.js.map +0 -1
- package/dist/events/EventBus.js.map +0 -1
- package/dist/fx/FloatingText.js.map +0 -1
- package/dist/fx/hitStop.js.map +0 -1
- package/dist/fx/viewCull.js.map +0 -1
- package/dist/i18n/Translator.js.map +0 -1
- package/dist/i18n/extractStrings.js.map +0 -1
- package/dist/i18n/formatMessage.js.map +0 -1
- package/dist/input/Actions.js.map +0 -1
- package/dist/input/AimGesture.js.map +0 -1
- package/dist/input/Keyboard.js.map +0 -1
- package/dist/input/Keymap.js.map +0 -1
- package/dist/input/TargetLock.js.map +0 -1
- package/dist/input/aimAxis.js.map +0 -1
- package/dist/input/keyChord.js.map +0 -1
- package/dist/input/longPress.js.map +0 -1
- package/dist/input/stickAxis.js.map +0 -1
- package/dist/input/touchDetect.js.map +0 -1
- package/dist/light/LightLayer.js.map +0 -1
- package/dist/nav/MinHeap.js.map +0 -1
- package/dist/nav/findPath.js.map +0 -1
- package/dist/nav/navGrid.js.map +0 -1
- package/dist/nav/nearestOpen.js.map +0 -1
- package/dist/nav/straightenPath.js.map +0 -1
- package/dist/net/Connection.js.map +0 -1
- package/dist/net/InterpolationBuffer.js.map +0 -1
- package/dist/net/PredictedMover.js.map +0 -1
- package/dist/net/Room.js.map +0 -1
- package/dist/net/RoomHost.js.map +0 -1
- package/dist/net/cadence.js.map +0 -1
- package/dist/net/constants.js.map +0 -1
- package/dist/net/lobby/LobbyClient.js.map +0 -1
- package/dist/net/lobby/LobbyHost.js.map +0 -1
- package/dist/net/lobby/LobbyRooms.js.map +0 -1
- package/dist/net/lobby/Matchmaker.js.map +0 -1
- package/dist/net/movement.js.map +0 -1
- package/dist/net/protocol.js.map +0 -1
- package/dist/net/serverClock.js.map +0 -1
- package/dist/net/snapshotCodec.js.map +0 -1
- package/dist/parallax/Parallax.js.map +0 -1
- package/dist/parallax/ParallaxLayer.js.map +0 -1
- package/dist/parallax/parallaxMath.js.map +0 -1
- package/dist/particles/Emitter.js.map +0 -1
- package/dist/particles/ParticleBudget.js.map +0 -1
- package/dist/particles/ParticleSim.js.map +0 -1
- package/dist/particles/particleCurves.js.map +0 -1
- package/dist/particles/particleSampling.js.map +0 -1
- package/dist/physics/Body.js.map +0 -1
- package/dist/physics/BroadPhase.js.map +0 -1
- package/dist/physics/Contact.js.map +0 -1
- package/dist/physics/ContactSolver.js.map +0 -1
- package/dist/physics/PhysicsWorld.js.map +0 -1
- package/dist/physics/SpatialHash.js.map +0 -1
- package/dist/physics/collide.js.map +0 -1
- package/dist/physics/collidePolygon.js.map +0 -1
- package/dist/physics/contactReport.js.map +0 -1
- package/dist/physics/drawColliders.js.map +0 -1
- package/dist/physics/physicsSystem.js.map +0 -1
- package/dist/physics/polygon.js.map +0 -1
- package/dist/physics/raycast.js.map +0 -1
- package/dist/physics/syncToBody.js.map +0 -1
- package/dist/physics/tileBodies.js.map +0 -1
- package/dist/physics/types.js.map +0 -1
- package/dist/pixel/Darkness.js.map +0 -1
- package/dist/pixel/DitherVignette.js.map +0 -1
- package/dist/pixel/Evaporation.js.map +0 -1
- package/dist/pixel/NightShade.js.map +0 -1
- package/dist/pixel/PixelLayer.js.map +0 -1
- package/dist/pixel/SwayProp.js.map +0 -1
- package/dist/pixel/lights.js.map +0 -1
- package/dist/pixel/nineSlice.js.map +0 -1
- package/dist/pixel/paintLayer.js.map +0 -1
- package/dist/pixel/palette.js.map +0 -1
- package/dist/pixel/pixel.js.map +0 -1
- package/dist/pixel/pixelPaint.js.map +0 -1
- package/dist/pixel/pixelTone.js.map +0 -1
- package/dist/pixel/propKit.js.map +0 -1
- package/dist/pixel/ramp.js.map +0 -1
- package/dist/pixel/selout.js.map +0 -1
- package/dist/pixel/spritePixels.js.map +0 -1
- package/dist/pixel/swayRig.js.map +0 -1
- package/dist/pixel/vignetteMask.js.map +0 -1
- package/dist/pixel/weatherArt.js.map +0 -1
- package/dist/pixel.js.map +0 -1
- package/dist/platform/touch.js.map +0 -1
- package/dist/postfx/BloomFilter.js.map +0 -1
- package/dist/postfx/ChromaticAberrationFilter.js.map +0 -1
- package/dist/postfx/ColorAdjustFilter.js.map +0 -1
- package/dist/postfx/CrtFilter.js.map +0 -1
- package/dist/postfx/PixelateFilter.js.map +0 -1
- package/dist/postfx/PostFx.js.map +0 -1
- package/dist/postfx/ShockwaveFilter.js.map +0 -1
- package/dist/postfx/VignetteFilter.js.map +0 -1
- package/dist/postfx/fxAnimator.js.map +0 -1
- package/dist/postfx/fxShader.js.map +0 -1
- package/dist/postfx.js.map +0 -1
- package/dist/react/ChoiceDialog.js.map +0 -1
- package/dist/react/ConfirmDialog.js.map +0 -1
- package/dist/react/Glyph.js.map +0 -1
- package/dist/react/Modal.js.map +0 -1
- package/dist/react/Panel.js.map +0 -1
- package/dist/react/PixelImage.js.map +0 -1
- package/dist/react/Select.js.map +0 -1
- package/dist/react/Slider.js.map +0 -1
- package/dist/react/SplitPane.js.map +0 -1
- package/dist/react/TabStrip.js.map +0 -1
- package/dist/react/TitleTips.js.map +0 -1
- package/dist/react/Tooltip.js.map +0 -1
- package/dist/react/UiProvider.js.map +0 -1
- package/dist/react/baseCss.js.map +0 -1
- package/dist/react/choiceStore.js.map +0 -1
- package/dist/react/classNames.js.map +0 -1
- package/dist/react/confirmStore.js.map +0 -1
- package/dist/react/labels.js.map +0 -1
- package/dist/react/placement.js.map +0 -1
- package/dist/react/useFillSheet.js.map +0 -1
- package/dist/react/useFitToViewport.js.map +0 -1
- package/dist/react/usePicked.js.map +0 -1
- package/dist/react/useStore.js.map +0 -1
- package/dist/react/useViewport.js.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/rig/PosePlayer.js.map +0 -1
- package/dist/rig/RigView.js.map +0 -1
- package/dist/rig/Skeleton.js.map +0 -1
- package/dist/rig/humanoid.js.map +0 -1
- package/dist/rig/humanoid.json.js.map +0 -1
- package/dist/rig/humanoidPoses.js.map +0 -1
- package/dist/rig/poseMath.js.map +0 -1
- package/dist/rig/poses.json.js.map +0 -1
- package/dist/save/Autosaver.js.map +0 -1
- package/dist/save/MemoryBackend.js.map +0 -1
- package/dist/save/SaveStore.js.map +0 -1
- package/dist/save/WebStorageBackend.js.map +0 -1
- package/dist/save/checksum.js.map +0 -1
- package/dist/save/migrateSave.js.map +0 -1
- package/dist/settings.js.map +0 -1
- package/dist/tilemap/TilemapView.js.map +0 -1
- package/dist/tilemap/collision.js.map +0 -1
- package/dist/tilemap/tiled.js.map +0 -1
- package/dist/transitions/CrossfadeTransition.js.map +0 -1
- package/dist/transitions/DitherWipeTransition.js.map +0 -1
- package/dist/transitions/FadeTransition.js.map +0 -1
- package/dist/transitions/Letterbox.js.map +0 -1
- package/dist/transitions/ditherMask.js.map +0 -1
- package/dist/transitions/transitionTo.js.map +0 -1
- package/dist/transitions/tweenDone.js.map +0 -1
- package/dist/ui/Bar.js.map +0 -1
- package/dist/ui/Button.js.map +0 -1
- package/dist/ui/Dialog.js.map +0 -1
- package/dist/ui/FocusManager.js.map +0 -1
- package/dist/ui/Label.js.map +0 -1
- package/dist/ui/List.js.map +0 -1
- package/dist/ui/Panel.js.map +0 -1
- package/dist/ui/ScrollView.js.map +0 -1
- package/dist/ui/Slider.js.map +0 -1
- package/dist/ui/Stack.js.map +0 -1
- package/dist/ui/Toggle.js.map +0 -1
- package/dist/ui/UiHost.js.map +0 -1
- package/dist/ui/UiPointerGate.js.map +0 -1
- package/dist/ui/UiRoot.js.map +0 -1
- package/dist/ui/Widget.js.map +0 -1
- package/dist/ui/dom/DomOverlay.js.map +0 -1
- package/dist/ui/dom/DomWorldAnchors.js.map +0 -1
- package/dist/ui/dom/InputShield.js.map +0 -1
- package/dist/ui/dom/createStore.js.map +0 -1
- package/dist/ui/dom/shieldDecision.js.map +0 -1
- package/dist/ui/dom/worldToScreen.js.map +0 -1
- package/dist/ui/layout/anchor.js.map +0 -1
- package/dist/ui/layout/barDrain.js.map +0 -1
- package/dist/ui/layout/fitToViewport.js.map +0 -1
- package/dist/ui/layout/focusNav.js.map +0 -1
- package/dist/ui/layout/geometry.js.map +0 -1
- package/dist/ui/layout/listWidth.js.map +0 -1
- package/dist/ui/layout/placeTooltip.js.map +0 -1
- package/dist/ui/layout/scroll.js.map +0 -1
- package/dist/ui/layout/slider.js.map +0 -1
- package/dist/ui/layout/stack.js.map +0 -1
- package/dist/ui/layout/wrapRow.js.map +0 -1
- package/dist/ui.js.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AppLike, SessionLike, ShellLike, WindowLike } from './electronLike';
|
|
2
|
+
import { type ExternalPolicy } from './lockdownRules';
|
|
3
|
+
/** How {@link lockDownWindow} treats a window. */
|
|
4
|
+
export interface LockdownOptions {
|
|
5
|
+
/** `electron.shell`, which opens an allowed link in the system browser. */
|
|
6
|
+
shell: ShellLike;
|
|
7
|
+
/** The links that may leave for the system browser. */
|
|
8
|
+
external: ExternalPolicy;
|
|
9
|
+
/** `app.isPackaged`: a packaged build refuses the DevTools keys. */
|
|
10
|
+
packaged: boolean;
|
|
11
|
+
/** A dev run's page origin, allowed for navigation; leave unset in a packaged build whatever the environment says. */
|
|
12
|
+
devServerUrl?: string;
|
|
13
|
+
/** In a dev run, this key toggles DevTools. Default `F12`; null for none. */
|
|
14
|
+
devToolsKey?: string | null;
|
|
15
|
+
/** Where refusals are reported. Default `console.log`. */
|
|
16
|
+
log?: (...args: unknown[]) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Keeps a window on the game: a new window is never opened (an allowed link goes to the system browser instead, any
|
|
20
|
+
* other is refused), the window never navigates or redirects away from the game's own page, and a packaged build
|
|
21
|
+
* refuses the DevTools keys (set `webPreferences.devTools: !app.isPackaged` too: the keys are only the visible way in).
|
|
22
|
+
*/
|
|
23
|
+
export declare function lockDownWindow(win: WindowLike, o: LockdownOptions): void;
|
|
24
|
+
/**
|
|
25
|
+
* Answers every permission request and check on `session` (camera, microphone, notifications, geolocation…) with no,
|
|
26
|
+
* but those in `allow`. Chromium's default in Electron is yes to almost everything, which a game never needs.
|
|
27
|
+
*/
|
|
28
|
+
export declare function denyPermissions(session: SessionLike, allow?: readonly string[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* A packaged app started with a debugger switch quits before it opens a window. Call it first thing in the main
|
|
31
|
+
* process; `exit` defaults to `process.exit` — not `app.exit`, so nothing after the call may run.
|
|
32
|
+
*/
|
|
33
|
+
export declare function refuseDebugLaunch(app: AppLike, argv?: readonly string[], exit?: (code: number) => void): boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lockDownWindow = lockDownWindow;
|
|
4
|
+
exports.denyPermissions = denyPermissions;
|
|
5
|
+
exports.refuseDebugLaunch = refuseDebugLaunch;
|
|
6
|
+
const lockdownRules_1 = require("./lockdownRules");
|
|
7
|
+
/**
|
|
8
|
+
* Keeps a window on the game: a new window is never opened (an allowed link goes to the system browser instead, any
|
|
9
|
+
* other is refused), the window never navigates or redirects away from the game's own page, and a packaged build
|
|
10
|
+
* refuses the DevTools keys (set `webPreferences.devTools: !app.isPackaged` too: the keys are only the visible way in).
|
|
11
|
+
*/
|
|
12
|
+
function lockDownWindow(win, o) {
|
|
13
|
+
const log = o.log ?? ((...a) => console.log(...a));
|
|
14
|
+
const wc = win.webContents;
|
|
15
|
+
const openOut = (url, what) => {
|
|
16
|
+
if ((0, lockdownRules_1.isAllowedExternal)(url, o.external))
|
|
17
|
+
void o.shell.openExternal(url).catch((err) => log('could not open', url, err));
|
|
18
|
+
else
|
|
19
|
+
log(`refused ${what}:`, url);
|
|
20
|
+
};
|
|
21
|
+
wc.setWindowOpenHandler(({ url }) => {
|
|
22
|
+
openOut(url, 'external link');
|
|
23
|
+
return { action: 'deny' };
|
|
24
|
+
});
|
|
25
|
+
wc.on('will-navigate', (event, url) => {
|
|
26
|
+
if ((0, lockdownRules_1.isAllowedNavigation)(url, o.devServerUrl))
|
|
27
|
+
return;
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
openOut(url, 'navigation');
|
|
30
|
+
});
|
|
31
|
+
wc.on('will-redirect', (event, url) => {
|
|
32
|
+
if (!(0, lockdownRules_1.isAllowedNavigation)(url, o.devServerUrl))
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
});
|
|
35
|
+
const devKey = o.devToolsKey === undefined ? 'F12' : o.devToolsKey;
|
|
36
|
+
wc.on('before-input-event', (event, input) => {
|
|
37
|
+
if (o.packaged) {
|
|
38
|
+
if ((0, lockdownRules_1.isDevToolsKey)(input))
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (devKey && input.type === 'keyDown' && input.key === devKey) {
|
|
43
|
+
wc.toggleDevTools();
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Answers every permission request and check on `session` (camera, microphone, notifications, geolocation…) with no,
|
|
50
|
+
* but those in `allow`. Chromium's default in Electron is yes to almost everything, which a game never needs.
|
|
51
|
+
*/
|
|
52
|
+
function denyPermissions(session, allow = []) {
|
|
53
|
+
const allowed = new Set(allow);
|
|
54
|
+
session.setPermissionRequestHandler((_wc, permission, callback) => callback(allowed.has(permission)));
|
|
55
|
+
session.setPermissionCheckHandler((_wc, permission) => allowed.has(permission));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A packaged app started with a debugger switch quits before it opens a window. Call it first thing in the main
|
|
59
|
+
* process; `exit` defaults to `process.exit` — not `app.exit`, so nothing after the call may run.
|
|
60
|
+
*/
|
|
61
|
+
function refuseDebugLaunch(app, argv = process.argv, exit = (c) => process.exit(c)) {
|
|
62
|
+
if (!app.isPackaged)
|
|
63
|
+
return false;
|
|
64
|
+
if (!(0, lockdownRules_1.debuggerRequested)(argv, (s) => app.commandLine.hasSwitch(s)))
|
|
65
|
+
return false;
|
|
66
|
+
console.error('[main] refusing to run with a debugger attached');
|
|
67
|
+
exit(1);
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InputLike } from './electronLike';
|
|
2
|
+
/**
|
|
3
|
+
* The links a locked-down window may open in the system browser: https only, no credentials in the URL, to one of
|
|
4
|
+
* `hosts` or a subdomain of it — or, for a host where anyone can publish a page (a code host), only under one of its
|
|
5
|
+
* `paths`.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExternalPolicy {
|
|
8
|
+
/** Hosts allowed whole, each with its subdomains (`example.com` allows `www.example.com`). */
|
|
9
|
+
hosts: readonly string[];
|
|
10
|
+
/** Hosts allowed only under a path prefix (exact host, prefix compared case-insensitively), e.g. one owner's repositories. */
|
|
11
|
+
paths?: readonly {
|
|
12
|
+
host: string;
|
|
13
|
+
prefix: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
/** Whether `url` is a link {@link ExternalPolicy} lets out to the system browser. */
|
|
17
|
+
export declare function isAllowedExternal(url: string, policy: ExternalPolicy): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The game's own page: the bundled `file://` build, or the dev server's origin in a dev run. Anything else followed
|
|
20
|
+
* inside the window would replace the game with a web page that has the shell's preload API.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isAllowedNavigation(url: string, devServerUrl?: string): boolean;
|
|
23
|
+
/** The keys that open DevTools (F12, Ctrl/Cmd+Shift/Alt+I/J/C), refused in a packaged build. */
|
|
24
|
+
export declare function isDevToolsKey(input: InputLike): boolean;
|
|
25
|
+
/** Chromium and Node switches that attach a debugger to a running app. */
|
|
26
|
+
export declare const DEBUG_SWITCHES: readonly string[];
|
|
27
|
+
/** Whether the command line (`argv`, or a switch Chromium parsed: `hasSwitch`) asks for a debugger. */
|
|
28
|
+
export declare function debuggerRequested(argv: readonly string[], hasSwitch?: (name: string) => boolean): boolean;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEBUG_SWITCHES = void 0;
|
|
4
|
+
exports.isAllowedExternal = isAllowedExternal;
|
|
5
|
+
exports.isAllowedNavigation = isAllowedNavigation;
|
|
6
|
+
exports.isDevToolsKey = isDevToolsKey;
|
|
7
|
+
exports.debuggerRequested = debuggerRequested;
|
|
8
|
+
function parse(url) {
|
|
9
|
+
try {
|
|
10
|
+
return new URL(url);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Whether `url` is a link {@link ExternalPolicy} lets out to the system browser. */
|
|
17
|
+
function isAllowedExternal(url, policy) {
|
|
18
|
+
const u = parse(url);
|
|
19
|
+
if (!u || u.protocol !== 'https:' || u.username || u.password)
|
|
20
|
+
return false;
|
|
21
|
+
const host = u.hostname.toLowerCase();
|
|
22
|
+
const scoped = (policy.paths ?? []).filter((p) => p.host.toLowerCase() === host);
|
|
23
|
+
if (scoped.length)
|
|
24
|
+
return scoped.some((p) => u.pathname.toLowerCase().startsWith(p.prefix.toLowerCase()));
|
|
25
|
+
return policy.hosts.some((h) => {
|
|
26
|
+
const want = h.toLowerCase();
|
|
27
|
+
return host === want || host.endsWith(`.${want}`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The game's own page: the bundled `file://` build, or the dev server's origin in a dev run. Anything else followed
|
|
32
|
+
* inside the window would replace the game with a web page that has the shell's preload API.
|
|
33
|
+
*/
|
|
34
|
+
function isAllowedNavigation(url, devServerUrl) {
|
|
35
|
+
const u = parse(url);
|
|
36
|
+
if (!u)
|
|
37
|
+
return false;
|
|
38
|
+
if (devServerUrl) {
|
|
39
|
+
const dev = parse(devServerUrl);
|
|
40
|
+
return !!dev && u.origin === dev.origin;
|
|
41
|
+
}
|
|
42
|
+
return u.protocol === 'file:';
|
|
43
|
+
}
|
|
44
|
+
/** The keys that open DevTools (F12, Ctrl/Cmd+Shift/Alt+I/J/C), refused in a packaged build. */
|
|
45
|
+
function isDevToolsKey(input) {
|
|
46
|
+
if (input.type !== 'keyDown')
|
|
47
|
+
return false;
|
|
48
|
+
if (input.key === 'F12')
|
|
49
|
+
return true;
|
|
50
|
+
const key = input.key.toLowerCase();
|
|
51
|
+
const mod = input.control || input.meta;
|
|
52
|
+
return mod && (input.shift || input.alt) && (key === 'i' || key === 'j' || key === 'c');
|
|
53
|
+
}
|
|
54
|
+
/** Chromium and Node switches that attach a debugger to a running app. */
|
|
55
|
+
exports.DEBUG_SWITCHES = ['--inspect', '--remote-debugging-port', '--remote-debugging-pipe', '--remote-debugging-address'];
|
|
56
|
+
const DEBUG_SWITCH_NAMES = ['remote-debugging-port', 'remote-debugging-pipe', 'inspect', 'inspect-brk'];
|
|
57
|
+
/** Whether the command line (`argv`, or a switch Chromium parsed: `hasSwitch`) asks for a debugger. */
|
|
58
|
+
function debuggerRequested(argv, hasSwitch = () => false) {
|
|
59
|
+
const flagged = argv.some((arg) => exports.DEBUG_SWITCHES.some((s) => arg === s || arg.startsWith(`${s}=`) || arg.startsWith(`${s}-`)));
|
|
60
|
+
return flagged || DEBUG_SWITCH_NAMES.some((s) => hasSwitch(s));
|
|
61
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IpcMainLike, SafeStorageLike } from './electronLike';
|
|
2
|
+
/** Where and how a {@link SessionStore} keeps its one secret. */
|
|
3
|
+
export interface SessionStoreOptions {
|
|
4
|
+
/** `electron.safeStorage`. */
|
|
5
|
+
safeStorage: SafeStorageLike;
|
|
6
|
+
/** The folder, e.g. `app.getPath('userData')` — a second app (a test build) with its own user data keeps its own. */
|
|
7
|
+
dir: string;
|
|
8
|
+
/** Default `session.bin`. */
|
|
9
|
+
fileName?: string;
|
|
10
|
+
/** Longest value accepted, in characters. Default 4096: a saved login is a token and a name, never a blob. */
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
/** Default `process.platform`. */
|
|
13
|
+
platform?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One small secret (a refresh token and username, as a JSON string) kept for "stay logged in", encrypted by the OS —
|
|
17
|
+
* `safeStorage`: DPAPI for the Windows user, the Keychain on the Mac. Where the OS offers no real encryption (Linux
|
|
18
|
+
* without a keyring: `basic_text`, a key written into Chromium) nothing is written and the player logs in again after
|
|
19
|
+
* closing; a token on disk in the clear is worse than that. Never `localStorage`: any script in the page could read it.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SessionStore {
|
|
22
|
+
private readonly o;
|
|
23
|
+
private readonly file;
|
|
24
|
+
private readonly maxLength;
|
|
25
|
+
private readonly platform;
|
|
26
|
+
constructor(o: SessionStoreOptions);
|
|
27
|
+
/** Whether the OS can encrypt for real here. */
|
|
28
|
+
canEncrypt(): boolean;
|
|
29
|
+
/** The saved value, or null when there is none, it cannot be decrypted (another OS user, a reinstall) or nothing may be. */
|
|
30
|
+
get(): Promise<string | null>;
|
|
31
|
+
/** Saves `value`; false when it is not a string, too long, or the OS cannot encrypt it. */
|
|
32
|
+
set(value: unknown): Promise<boolean>;
|
|
33
|
+
clear(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Answers a renderer's `<prefix>:get`, `<prefix>:set` (one string) and `<prefix>:clear` from `store`, so the page only
|
|
37
|
+
* ever sees the plain value, and only its own. Expose them in the preload with `ipcRenderer.invoke`. Returns a function
|
|
38
|
+
* that removes the handlers.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerSessionStore(ipcMain: IpcMainLike, store: SessionStore, prefix?: string): () => void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionStore = void 0;
|
|
4
|
+
exports.registerSessionStore = registerSessionStore;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* One small secret (a refresh token and username, as a JSON string) kept for "stay logged in", encrypted by the OS —
|
|
9
|
+
* `safeStorage`: DPAPI for the Windows user, the Keychain on the Mac. Where the OS offers no real encryption (Linux
|
|
10
|
+
* without a keyring: `basic_text`, a key written into Chromium) nothing is written and the player logs in again after
|
|
11
|
+
* closing; a token on disk in the clear is worse than that. Never `localStorage`: any script in the page could read it.
|
|
12
|
+
*/
|
|
13
|
+
class SessionStore {
|
|
14
|
+
o;
|
|
15
|
+
file;
|
|
16
|
+
maxLength;
|
|
17
|
+
platform;
|
|
18
|
+
constructor(o) {
|
|
19
|
+
this.o = o;
|
|
20
|
+
this.file = (0, node_path_1.join)(o.dir, o.fileName ?? 'session.bin');
|
|
21
|
+
this.maxLength = o.maxLength ?? 4096;
|
|
22
|
+
this.platform = o.platform ?? process.platform;
|
|
23
|
+
}
|
|
24
|
+
/** Whether the OS can encrypt for real here. */
|
|
25
|
+
canEncrypt() {
|
|
26
|
+
const s = this.o.safeStorage;
|
|
27
|
+
if (!s.isEncryptionAvailable())
|
|
28
|
+
return false;
|
|
29
|
+
return this.platform !== 'linux' || s.getSelectedStorageBackend?.() !== 'basic_text';
|
|
30
|
+
}
|
|
31
|
+
/** The saved value, or null when there is none, it cannot be decrypted (another OS user, a reinstall) or nothing may be. */
|
|
32
|
+
async get() {
|
|
33
|
+
if (!this.canEncrypt())
|
|
34
|
+
return null;
|
|
35
|
+
try {
|
|
36
|
+
return this.o.safeStorage.decryptString(await node_fs_1.promises.readFile(this.file));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Saves `value`; false when it is not a string, too long, or the OS cannot encrypt it. */
|
|
43
|
+
async set(value) {
|
|
44
|
+
if (typeof value !== 'string' || value.length > this.maxLength || !this.canEncrypt())
|
|
45
|
+
return false;
|
|
46
|
+
// written beside it and renamed over it, so a crash or a second write mid-way never leaves half a file
|
|
47
|
+
const temp = `${this.file}.${process.pid}.${Date.now()}.tmp`;
|
|
48
|
+
try {
|
|
49
|
+
await node_fs_1.promises.mkdir(this.o.dir, { recursive: true });
|
|
50
|
+
await node_fs_1.promises.writeFile(temp, this.o.safeStorage.encryptString(value));
|
|
51
|
+
await node_fs_1.promises.rename(temp, this.file);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
await node_fs_1.promises.rm(temp, { force: true });
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
async clear() {
|
|
60
|
+
await node_fs_1.promises.rm(this.file, { force: true });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.SessionStore = SessionStore;
|
|
64
|
+
/**
|
|
65
|
+
* Answers a renderer's `<prefix>:get`, `<prefix>:set` (one string) and `<prefix>:clear` from `store`, so the page only
|
|
66
|
+
* ever sees the plain value, and only its own. Expose them in the preload with `ipcRenderer.invoke`. Returns a function
|
|
67
|
+
* that removes the handlers.
|
|
68
|
+
*/
|
|
69
|
+
function registerSessionStore(ipcMain, store, prefix = 'session') {
|
|
70
|
+
ipcMain.handle(`${prefix}:get`, () => store.get());
|
|
71
|
+
ipcMain.handle(`${prefix}:set`, (_e, value) => store.set(value));
|
|
72
|
+
ipcMain.handle(`${prefix}:clear`, () => store.clear());
|
|
73
|
+
return () => {
|
|
74
|
+
for (const c of ['get', 'set', 'clear'])
|
|
75
|
+
ipcMain.removeHandler?.(`${prefix}:${c}`);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** What goes into a shell's identity besides the runtime's version. */
|
|
2
|
+
export interface ShellIdOptions {
|
|
3
|
+
/** Folders whose files (non-recursive) are hashed, in this order. */
|
|
4
|
+
dirs: string[];
|
|
5
|
+
/** Which files of each folder count; default the compiled main-process code, `*.cjs`. */
|
|
6
|
+
match?: (fileName: string) => boolean;
|
|
7
|
+
/** More text to fold in (an engine or framework version the main process bundles from elsewhere). */
|
|
8
|
+
extra?: string[];
|
|
9
|
+
/** Hex characters kept; default 16. */
|
|
10
|
+
length?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A desktop shell's identity: a hash of the main process's own code and the Electron version it runs on. A web patch
|
|
14
|
+
* is taken only by a shell with the same identity, because the web talks to the shell through its preload script and
|
|
15
|
+
* may need what a newer shell adds; anything else comes with an installer. The publish script reckons it the same way
|
|
16
|
+
* off the build it uploads, so nobody has to remember to raise a number when the shell changes.
|
|
17
|
+
*
|
|
18
|
+
* `shellId(version, dir)` hashes `dir`'s `*.cjs`; pass {@link ShellIdOptions} for more folders or other files. With one
|
|
19
|
+
* folder, the default match and no `extra`, both forms give the same hash. Code the shell takes from `node_modules`
|
|
20
|
+
* (this module included) is not in `dir`: name its version in `extra`, or a change there would not change the identity.
|
|
21
|
+
*/
|
|
22
|
+
export declare function shellId(electronVersion: string, dirOrOptions: string | ShellIdOptions): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shellId = shellId;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* A desktop shell's identity: a hash of the main process's own code and the Electron version it runs on. A web patch
|
|
9
|
+
* is taken only by a shell with the same identity, because the web talks to the shell through its preload script and
|
|
10
|
+
* may need what a newer shell adds; anything else comes with an installer. The publish script reckons it the same way
|
|
11
|
+
* off the build it uploads, so nobody has to remember to raise a number when the shell changes.
|
|
12
|
+
*
|
|
13
|
+
* `shellId(version, dir)` hashes `dir`'s `*.cjs`; pass {@link ShellIdOptions} for more folders or other files. With one
|
|
14
|
+
* folder, the default match and no `extra`, both forms give the same hash. Code the shell takes from `node_modules`
|
|
15
|
+
* (this module included) is not in `dir`: name its version in `extra`, or a change there would not change the identity.
|
|
16
|
+
*/
|
|
17
|
+
function shellId(electronVersion, dirOrOptions) {
|
|
18
|
+
const o = typeof dirOrOptions === 'string' ? { dirs: [dirOrOptions] } : dirOrOptions;
|
|
19
|
+
const match = o.match ?? ((f) => f.endsWith('.cjs'));
|
|
20
|
+
const h = (0, node_crypto_1.createHash)('sha256');
|
|
21
|
+
h.update(`electron ${electronVersion}\n`);
|
|
22
|
+
for (const dir of o.dirs) {
|
|
23
|
+
for (const name of (0, node_fs_1.readdirSync)(dir).filter(match).sort()) {
|
|
24
|
+
h.update(`${name}\n`);
|
|
25
|
+
h.update((0, node_fs_1.readFileSync)((0, node_path_1.join)(dir, name)));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const e of o.extra ?? [])
|
|
29
|
+
h.update(`extra ${e}\n`);
|
|
30
|
+
return h.digest('hex').slice(0, o.length ?? 16);
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Lower-case hex sha256. */
|
|
2
|
+
export declare const sha256: (data: Uint8Array) => string;
|
|
3
|
+
/** Every file under `dir`, as forward-slash paths relative to it. */
|
|
4
|
+
export declare function listFiles(dir: string, base?: string): Promise<string[]>;
|
|
5
|
+
/** Every file of the web in `dir`, path → sha256. */
|
|
6
|
+
export declare function hashWeb(dir: string): Promise<Map<string, string>>;
|
|
7
|
+
/** Writes `data` at the manifest path `path` under `dir`, making its folders. */
|
|
8
|
+
export declare function putFile(dir: string, path: string, data: Uint8Array): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* `fetch` that gives up after `ms` and never takes a cached answer: a store behind a CDN otherwise hands back
|
|
11
|
+
* yesterday's `latest.json`, and a stalled connection would hold an update check open for good.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchWithTimeout(fetcher: typeof fetch, url: string, ms: number): Promise<Response>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sha256 = void 0;
|
|
4
|
+
exports.listFiles = listFiles;
|
|
5
|
+
exports.hashWeb = hashWeb;
|
|
6
|
+
exports.putFile = putFile;
|
|
7
|
+
exports.fetchWithTimeout = fetchWithTimeout;
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
9
|
+
const promises_1 = require("node:fs/promises");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
/** Lower-case hex sha256. */
|
|
12
|
+
const sha256 = (data) => (0, node_crypto_1.createHash)('sha256').update(data).digest('hex');
|
|
13
|
+
exports.sha256 = sha256;
|
|
14
|
+
/** Every file under `dir`, as forward-slash paths relative to it. */
|
|
15
|
+
async function listFiles(dir, base = '') {
|
|
16
|
+
const out = [];
|
|
17
|
+
for (const e of await (0, promises_1.readdir)((0, node_path_1.join)(dir, base), { withFileTypes: true })) {
|
|
18
|
+
const rel = base ? `${base}/${e.name}` : e.name;
|
|
19
|
+
if (e.isDirectory())
|
|
20
|
+
out.push(...(await listFiles(dir, rel)));
|
|
21
|
+
else
|
|
22
|
+
out.push(rel);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
/** Every file of the web in `dir`, path → sha256. */
|
|
27
|
+
async function hashWeb(dir) {
|
|
28
|
+
const have = new Map();
|
|
29
|
+
for (const path of await listFiles(dir))
|
|
30
|
+
have.set(path, (0, exports.sha256)(await (0, promises_1.readFile)((0, node_path_1.join)(dir, ...path.split('/')))));
|
|
31
|
+
return have;
|
|
32
|
+
}
|
|
33
|
+
/** Writes `data` at the manifest path `path` under `dir`, making its folders. */
|
|
34
|
+
async function putFile(dir, path, data) {
|
|
35
|
+
const file = (0, node_path_1.join)(dir, ...path.split('/'));
|
|
36
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(file), { recursive: true });
|
|
37
|
+
await (0, promises_1.writeFile)(file, data);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* `fetch` that gives up after `ms` and never takes a cached answer: a store behind a CDN otherwise hands back
|
|
41
|
+
* yesterday's `latest.json`, and a stalled connection would hold an update check open for good.
|
|
42
|
+
*/
|
|
43
|
+
async function fetchWithTimeout(fetcher, url, ms) {
|
|
44
|
+
const ctrl = new AbortController();
|
|
45
|
+
const timer = setTimeout(() => ctrl.abort(), ms);
|
|
46
|
+
try {
|
|
47
|
+
return await fetcher(url, { signal: ctrl.signal, cache: 'no-store' });
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type LatestJson } from '../updates/manifest';
|
|
2
|
+
/** How a {@link WebPatcher} finds its webs and its store. */
|
|
3
|
+
export interface WebPatcherOptions {
|
|
4
|
+
/** Where patched webs are built and kept, e.g. `join(app.getPath('userData'), 'web')`. */
|
|
5
|
+
root: string;
|
|
6
|
+
/** The web the installed build ships (the folder holding its `index.html`). */
|
|
7
|
+
builtinDir: string;
|
|
8
|
+
/** The installed build's version (`app.getVersion()`): a patched web must be newer to be loaded. */
|
|
9
|
+
appVersion: string;
|
|
10
|
+
/** This shell's identity (`shellId`), or a function reckoning it on first use. */
|
|
11
|
+
shell: string | (() => string);
|
|
12
|
+
/** The store's channel, e.g. `https://store.example/public/live`: `latest.json`, `web/…`, `files/…` lie under it. */
|
|
13
|
+
channelUrl: string;
|
|
14
|
+
/** False in a dev run: the built-in web is always loaded and nothing is read or tidied. Default true. */
|
|
15
|
+
packaged?: boolean;
|
|
16
|
+
/** Starts an unconfirmed web gets before it is dropped. Default 2. */
|
|
17
|
+
maxTries?: number;
|
|
18
|
+
/** Fall back to the last web that booted, rather than the built-in one, when a new web never boots. Default true. */
|
|
19
|
+
keepPrevious?: boolean;
|
|
20
|
+
/** The page file in a web. Default `index.html`. */
|
|
21
|
+
entry?: string;
|
|
22
|
+
/** Downloads at once. Default 6. */
|
|
23
|
+
parallel?: number;
|
|
24
|
+
/** Per request. Default 15 000 ms. */
|
|
25
|
+
fetchTimeoutMs?: number;
|
|
26
|
+
/** Default `globalThis.fetch`. */
|
|
27
|
+
fetch?: typeof fetch;
|
|
28
|
+
/** Where a failure to read the patched webs is reported. Default `console.error`. */
|
|
29
|
+
log?: (...args: unknown[]) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A desktop shell that patches its web file by file, the way a game launcher does: the web a build ships is its
|
|
33
|
+
* built-in copy, and every newer web is assembled beside it in `<root>/<version>/` from the files already held plus
|
|
34
|
+
* only those whose content is new (`<channel>/files/<sha256>`, checked against their hash), then loaded in its place.
|
|
35
|
+
* A web is taken only by a shell of the same identity; any other change needs an installer. A web that never reports
|
|
36
|
+
* booting ({@link markBooted}, from the page) within `maxTries` starts is dropped, and the shell goes back to the last
|
|
37
|
+
* web that did — or the built-in one — so a broken release cannot lock a player out.
|
|
38
|
+
*
|
|
39
|
+
* Use one per process: {@link startEntry} first (it decides which web this run loads), then the update calls.
|
|
40
|
+
*/
|
|
41
|
+
export declare class WebPatcher {
|
|
42
|
+
private readonly options;
|
|
43
|
+
private readonly o;
|
|
44
|
+
private readonly pointers;
|
|
45
|
+
private shellValue;
|
|
46
|
+
/** The web this run loads, and its version (the installed build's own when none is patched in). */
|
|
47
|
+
private loaded;
|
|
48
|
+
/** The tidy a start began: a build waits for it, or it could delete the `.part` folder being filled. */
|
|
49
|
+
private tidying;
|
|
50
|
+
constructor(options: WebPatcherOptions);
|
|
51
|
+
/** This shell's identity. */
|
|
52
|
+
get shell(): string;
|
|
53
|
+
/** Where the window loads the page from: a patched web when there is a good one, else the built-in copy. */
|
|
54
|
+
startEntry(): string;
|
|
55
|
+
/** The version of the web running now. */
|
|
56
|
+
webVersion(): string;
|
|
57
|
+
/** The page came up: the web it was loaded from is kept from now on. Call it from the page's own "booted" message. */
|
|
58
|
+
markBooted(): void;
|
|
59
|
+
/** The channel's newest build, or null when the store cannot be read. */
|
|
60
|
+
latest(): Promise<LatestJson | null>;
|
|
61
|
+
/** Whether `l`'s web can be patched in here rather than installed: newer than the web running, for this shell. */
|
|
62
|
+
patchable(l: LatestJson): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Builds `l`'s web beside the one running: the files held are copied, the rest downloaded and checked, into
|
|
65
|
+
* `<version>.part/`, which becomes `<version>/` and the pending web once whole — a crash mid-way never leaves a
|
|
66
|
+
* folder that looks finished. `onProgress` gets 0–100. Resolves with the version built; throws on any failure.
|
|
67
|
+
*/
|
|
68
|
+
prepare(l: LatestJson, onProgress?: (percent: number) => void): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Puts the pending web in use now and returns the page to load (reload every window from it), or null when there is
|
|
71
|
+
* none this shell may load. The switch counts as its first start, so a web that never boots is still dropped.
|
|
72
|
+
*/
|
|
73
|
+
applyPending(): string | null;
|
|
74
|
+
/** Makes `p` the active web, keeping the one it replaces as the fallback when that one ever booted. */
|
|
75
|
+
private promote;
|
|
76
|
+
/** A pointer this shell may load: its own shell, newer than the installed build, its folder whole. */
|
|
77
|
+
private usable;
|
|
78
|
+
/** Removes every patched web but the active, pending and previous one, and any half-made folder. */
|
|
79
|
+
tidy(): Promise<void>;
|
|
80
|
+
}
|