Compare commits

..
Author SHA1 Message Date
Sapphire e4b0d0a58e Catch exceptions in implementation of ProcessHandle::allProcesses 2026-11-21 20:16:00 -05:00
Sapphire ae9efb1a92 Clean up conditions in TrackerBattery a bit 2026-11-21 17:39:48 -05:00
Sapphire 0368292bf1 Toggle to show battery runtime estimate instead of percentage 2026-11-21 17:37:05 -05:00
Sapphire d55c0ef494 Don't snap skeleton height when switching units
This ends up showing the 'are you sure you want to do this' popup
when switching units, which is annoying. Feel free to revert if this has
bad side effects.
2026-11-21 17:15:00 -05:00
Butterscotch! 7bc6d99f09 AutoBone weighted average bone contribution 2026-11-20 01:35:27 -05:00
Erimel 7cf14188e6 make foot plant and toe snap less agressive 2026-11-19 16:15:57 -05:00
Erimel 292da8d91f upper waist as default 2026-11-19 16:14:11 -05:00
Erimel 594391a647 gui lint 2026-11-18 17:45:06 -05:00
Erimel e719fe38cf spotless 2026-11-18 17:37:23 -05:00
Erimel 9667fd93be Fix Stay Aligned first frame being way too strong 2026-11-18 17:36:19 -05:00
Erimel e2406cacac improve upper leg twist math 2026-11-18 17:25:44 -05:00
Erimel 48b36961f7 Increase max yaw reset smooth time to 1s 2026-11-18 16:31:06 -05:00
Erimel 128d5e58da Skeleton processor reset when yaw reset smoothing finishes 2026-11-18 16:20:11 -05:00
Erimel c71f06cf71 TapDetection -> TrackerAction 2026-11-18 16:04:05 -05:00
Aed 78deb81e21 Tap/Button Reset settings (#1963) 2026-11-18 13:32:52 -05:00
Erimel 768a623cd2 Move Setup Wizard at the bottom of the settings 2026-11-17 23:29:03 -05:00
Erimel 3ea39549ba fix tests 2026-11-17 20:59:47 -05:00
Erimel e2e0a3d87d tune prediction 2026-11-17 20:52:02 -05:00
Erimel 2068b208f8 lower default prediction 2026-11-17 20:19:28 -05:00
Erimel f44baef615 compensate for feet pose mounting going inwards 2026-11-17 20:19:20 -05:00
Erimel 40848cd8a3 bone offset in tracker module 2026-11-17 19:48:24 -05:00
Erimel c9e0479a51 Remove TrackerDataType 2026-11-17 14:49:45 -05:00
Erimel 4e5f0736d9 Constrain preferred rotations 2026-11-16 20:07:50 -05:00
Erimel 4e84ebdfc9 upper leg twist as post processing 2026-11-16 19:59:44 -05:00
Erimel 999c27c36f yawAlign 300ms todo 2026-11-16 19:58:14 -05:00
Erimel 64af814db0 Revert "Add TODO for GIT_COMMIT_HASH"
This reverts commit f2b86ec6fd.
2026-11-16 19:03:00 -05:00
Erimel 0479b162b4 Improve feet scaling in preview 2026-11-16 17:14:43 -05:00
Erimel f2b86ec6fd Add TODO for GIT_COMMIT_HASH 2026-11-16 15:43:42 -05:00
Erimel e4482971b0 Disable stay aligned for ADC_RESISTANCE 2026-11-16 15:43:18 -05:00
Erimel cf55f48e2f reorganize stayaligned ImuTypes 2026-11-16 15:34:11 -05:00
loucass003 caf8435636 Migrate old server configs to rewrite 2026-11-13 23:59:35 +01:00
loucass003 6b65058bb3 Fix multiple trackers on the same part display. add occluded to the assignment conflict stuff 2026-11-13 21:34:34 +01:00
loucass003 4fa3f83f95 Fix crowdin when built for prod 2026-11-13 19:36:26 +01:00
Erimel 4481aea2b3 80% knee interpolation default 2026-11-12 16:33:09 -05:00
Erimel 8c1478d3e4 Fix preffered rotation snapping 2026-11-12 16:07:14 -05:00
Erimel 9942e843ff Fix upper legs twist math 2026-11-12 15:12:01 -05:00
Erimel d0fa419131 improve hip tracker reliability 2026-11-12 15:07:14 -05:00
Erimel 834e5d340e Improve arm IK constraints 2026-11-12 14:04:48 -05:00
Erimel 1a65edb0d0 CI 2026-11-11 18:57:42 -05:00
Erimel b87b1f3e42 Improve arm IK and allow leg positional trackers 2026-11-11 18:47:55 -05:00
Erimel f1578ed3fe improved finger tracking 2026-11-11 16:36:07 -05:00
Erimel 178f40226b Recenter mocap mode 2026-11-11 14:06:58 -05:00
Erimel 7c5d3219c3 Improved constraints and reduced feet sinking 2026-11-10 19:41:48 -05:00
Erimel 1d8a441d01 IK preferred rotation WIP 2026-11-09 20:01:56 -05:00
Erimel c64fcb1f95 Fix floor level calculation 2026-11-09 17:04:30 -05:00
Butterscotch! 7e40b54c1b Fix IK offset constraint alignment 2026-11-07 01:42:22 -05:00
Erimel bcf4e9e027 Better arm FK 2026-11-06 17:11:07 -05:00
Butterscotch! 456e09c1ed Improve arm IK consistency 2026-11-05 22:53:34 -05:00
Sapphire ab82ce59e7 Fix bindings provider 2026-11-05 03:53:02 -05:00
Erimel 24e7719ed9 arms prediction multiplier 2026-11-04 16:42:26 -05:00
Erimel 33771abed1 Better smoothing scaling 2026-11-04 16:20:18 -05:00
Erimel 2b5f3a12e1 Filter out non-imu trackers from tap detection 2026-11-04 16:20:08 -05:00
Erimel e17c8c6ee0 Skating correction fix unlock warmup 2026-11-04 16:19:40 -05:00
Erimel b7fbe7832a Skating correction improvements through COM and Lift 2026-11-03 20:02:20 -05:00
Erimel fe4c9514a4 tracking tweak improvements 2026-11-03 17:35:14 -05:00
Erimel ae12d8afa2 limit filtering carryover 2026-11-03 15:46:01 -05:00
Erimel 005a9707ef comment spine code 2026-11-02 20:11:25 -05:00
Erimel ec6fe67afa fix lower chest spine 2026-11-02 20:01:55 -05:00
Erimel ac15eb5266 Improve thighs prioritization 2026-11-02 19:50:20 -05:00
Erimel 1d312e3d50 improve OLED theme 2026-11-02 18:08:53 -05:00
Erimel 7d75825b82 more lenient full reset checklist step 2026-11-02 17:56:01 -05:00
Erimel 3586127381 Fix OSC Trackers tracking 2026-11-02 17:46:46 -05:00
Erimel 0256c472e1 tweak default filtering for more prediction 2026-11-02 17:11:59 -05:00
Erimel 5a38235814 Fix assignment conflict 2026-11-02 17:11:38 -05:00
Erimel 6e33631005 Simplify filtering 2026-11-02 15:53:01 -05:00
Sapphire 479b16f1e8 Actually reject driver handshakes when driver is disabled 2026-11-01 21:33:25 -05:00
Sapphire 4edc23ad59 Show different source for resets triggered via HID button press 2026-11-01 21:25:10 -05:00
Butterscotch! 0ad0b3c07f $5 Footlong Meatball Sub Sandwich
We use a looooot of sandwich, so we need fast sandwich
2026-10-30 20:01:48 -04:00
Erimel 9b63d21ce1 Fix tests 2026-10-30 18:48:10 -04:00
Erimel 79d8d2f9ce Latency aware filtering 2026-10-30 18:40:50 -04:00
Erimel 5202013cf5 Fallback processor optimizations 2026-10-30 15:24:32 -04:00
Erimel 61c4e47984 accent colour for OLED theme 2026-10-30 14:38:29 -04:00
Erimel a55c0849e6 OLED theme 2026-10-30 13:56:10 -04:00
Erimel eb4f977c50 Revert "Accel fix for butterfly 0.0.1"
This reverts commit bdb5715a9e.
2026-10-29 23:48:18 -04:00
Erimel babb269d72 Fix test 2026-10-29 20:52:35 -04:00
Erimel 7b7b36738c Filtering smoothing 2026-10-29 20:43:52 -04:00
Sapphire 3e4219c48b Fix HID tests
lol
2026-10-29 00:48:33 -05:00
Sapphire 5d0dc5bae7 Fix tracking paused state not being broadcast to all connections 2026-10-28 20:51:08 -05:00
Sapphire 0c0e2b8acb More consistently consume txId for RPC messages 2026-10-28 20:48:50 -05:00
Butterscotch! d58a0c88fa Fix IK local constraint axes 2026-10-28 21:12:23 -04:00
Sapphire 2bc5265ed6 fixup! Make tx_id and reply_to nullable 2026-10-28 20:00:56 -05:00
Sapphire 088adb88ea Set reply_to in ResetStatusResponses 2026-10-28 19:59:17 -05:00
Sapphire 0eea8b30cc Make tx_id and reply_to nullable 2026-10-28 19:57:49 -05:00
Sapphire aa1343b49c Fix tap reset enable toggle not working 2026-10-28 19:51:17 -05:00
Sapphire 02df411819 Allow performing resets with button press
Maybe we'd want some UI changes for the resets section, not sure.
Sorry if this code sucks 😭
2026-10-28 18:55:35 -05:00
Butterscotch! c911a29d25 IK cleanup, test, docs & quat parent space fix 2026-10-28 19:53:36 -04:00
loucass003 546101defa Fix udp tests on windows 2026-10-29 00:43:06 +01:00
Butterscotch! 44a34d6142 Add space translation helpers to Quaternion 2026-10-28 18:51:30 -04:00
Erimel 6b159eb5a5 Update solarxr-protocol 2026-10-28 18:38:20 -04:00
Erimel 9b4274847b Unify prediction, smoothing, and upsampling 2026-10-28 18:30:25 -04:00
Sapphire aa29c48983 Lower STEAMVR_WEB_SERVER_STARTUP delay
SteamVR brings up the web server pretty early (after about 200ms)
2026-10-28 17:19:51 -05:00
Sapphire 9e1222eedb Fix open config folder button opening wrong folder on Linux 2026-10-28 17:13:29 -05:00
Erimel bb91af389a Dynamic upsampling 2026-10-28 15:49:27 -04:00
Sapphire 9fc9201e0b Make udev rules check more restrictive 2026-10-28 14:08:49 -05:00
Sapphire 80a819cad9 Remove installer code 2026-10-28 14:04:42 -05:00
Sapphire 661bb37760 Add ACCESS_NETWORK_STATE permission to Android manifest 2026-10-28 11:56:09 -05:00
Butterscotch! 4f8ac26653 Fix IK aborting on any goal met & optimize all met 2026-10-28 12:35:45 -04:00
Erimel 5ddad57851 Linear upsampling 2026-10-27 22:49:24 -04:00
loucass003 dbbcf677e1 New serial console 2026-10-27 23:52:14 +01:00
loucass003 54c043c127 Add move file retry when saving files. Windows moment.... 2026-10-27 22:21:55 +01:00
loucass003 e53fcf294b Better steamvr detection that does not race or crash 2026-10-27 22:10:43 +01:00
loucass003 baea5d3227 Fix timeout delay 0 causing a connection loop 2026-10-27 21:24:22 +01:00
loucass003 d7570ad3f4 Fix text wrap on logger dropdowns 2026-10-27 21:15:10 +01:00
loucass003 fe7ca9fc80 Properly handle HID errors 2026-10-27 21:07:36 +01:00
loucass003 4c80f1c54c Fix warning icon on tracker card 2026-10-27 21:01:11 +01:00
Erimel 289a314608 Fix spine toSources empty 2026-10-27 14:49:17 -04:00
loucass003 2b27f4b157 Connection groups for VRchat and VMC 2026-10-27 19:46:13 +01:00
loucass003 3875fda909 Fix mdns on android 2026-10-27 19:30:09 +01:00
loucass003 b0c266039d Fix mdns on android 2026-10-27 19:30:09 +01:00
Erimel bdb5715a9e Accel fix for butterfly 0.0.1 2026-10-27 14:16:58 -04:00
loucass003 4bef38a4fd Better handling of network switching. Better handling of exceptions with mdns 2026-10-27 19:15:33 +01:00
lucas lelievre e52e2f8bc0 Update / remove stale comments 2026-10-27 02:22:58 +01:00
lucas lelievre f84ce0831e Fix VRCOSC on windows: new mdns discovery and advertise; proper handling of vrc output port; change to keep advertise of the server receiver even when manual mode is used 2026-10-27 02:20:42 +01:00
Erimel fe788ed3a7 ComparableTimeMark 2026-10-26 20:23:36 -04:00
Aed 60caa0395e translation for "select all" firmare update button (#1953) 2026-10-27 00:21:37 +01:00
Erimel 0e227ea0eb spine.kt: continue on empty toSources 2026-10-26 19:16:55 -04:00
loucass003 10b018a77a Fix mag toggle 2026-10-27 00:04:32 +01:00
loucass003 2614168f05 Fix global mag toggle hang 2026-10-26 23:53:52 +01:00
loucass003 1b51e99313 Ack SensorInfo packet 2026-10-26 23:51:05 +01:00
SlimeVR-bot 4b07fb7417 New Crowdin updates (#1942) 2026-10-26 23:36:38 +01:00
Aed b2034d5d70 select all button when updating ESP trackers (#1952) 2026-10-26 23:15:59 +01:00
loucass003 45b8af5ff7 Fix sleep status 2026-10-26 23:08:01 +01:00
Erimel b13754b1e0 boneOffsets all the way and wip improving smoothness 2026-10-26 17:44:28 -04:00
Erimel 8a7794545c Fix tracking pause neck 2026-10-26 15:45:36 -04:00
Erimel 4b44cd1414 Pass on theme saturations 2026-10-26 14:33:03 -04:00
606 changed files with 7821 additions and 35517 deletions

No files matched your search

-7
View File
@@ -5,10 +5,3 @@
*.gif binary
*.ftl -linguist-detectable
# GUI assets (gui/app-next/src/assets)
gui/app-next/src/assets/**/*.webp filter=lfs diff=lfs merge=lfs -text
gui/app-next/src/assets/**/*.webm filter=lfs diff=lfs merge=lfs -text
gui/app-next/src/assets/**/*.gltf filter=lfs diff=lfs merge=lfs -text
gui/app-next/src/assets/**/*.glb filter=lfs diff=lfs merge=lfs -text
gui/app-next/src/assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
+5 -5
View File
@@ -32,7 +32,7 @@ static void OnYawReset(BridgeTransport& conn) {
flatbuffers::FlatBufferBuilder fbb;
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::YAW, 0, 0.f);
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, flatbuffers::nullopt, flatbuffers::nullopt, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto rpcMsgs = fbb.CreateVector({ msgHeader });
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
@@ -43,7 +43,7 @@ static void OnFullReset(BridgeTransport& conn) {
flatbuffers::FlatBufferBuilder fbb;
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::FULL, 0, 0.f);
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, flatbuffers::nullopt, flatbuffers::nullopt, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto rpcMsgs = fbb.CreateVector({ msgHeader });
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
@@ -54,7 +54,7 @@ static void OnMountingCalibration(BridgeTransport& conn) {
flatbuffers::FlatBufferBuilder fbb;
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::MOUNTING, 0, 0.f);
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, flatbuffers::nullopt, flatbuffers::nullopt, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto rpcMsgs = fbb.CreateVector({ msgHeader });
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
@@ -67,7 +67,7 @@ static void OnFeetMountingCalibration(BridgeTransport& conn) {
auto bodyParts = fbb.CreateVector(
{ datatypes::BodyPart::LEFT_FOOT, datatypes::BodyPart::RIGHT_FOOT });
auto resetReq = rpc::CreateResetRequest(fbb, rpc::ResetType::MOUNTING, bodyParts, 0.f);
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, flatbuffers::nullopt, flatbuffers::nullopt, rpc::RpcMessage::ResetRequest, resetReq.Union());
auto rpcMsgs = fbb.CreateVector({ msgHeader });
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
@@ -80,7 +80,7 @@ static void OnToggleTracking(BridgeTransport& conn) {
shouldPause = !shouldPause;
auto toggleReq = rpc::CreateSetPauseTrackingRequest(fbb, shouldPause);
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, 0, 0, rpc::RpcMessage::SetPauseTrackingRequest, toggleReq.Union());
auto msgHeader = rpc::CreateRpcMessageHeader(fbb, flatbuffers::nullopt, flatbuffers::nullopt, rpc::RpcMessage::SetPauseTrackingRequest, toggleReq.Union());
auto rpcMsgs = fbb.CreateVector({ msgHeader });
auto bundle = CreateMessageBundle(fbb, 0, rpcMsgs);
-213
View File
@@ -1,213 +0,0 @@
import eslint from '@eslint/js';
import betterTailwind from 'eslint-plugin-better-tailwindcss';
import boundaries from 'eslint-plugin-boundaries';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import solid from 'eslint-plugin-solid/configs/typescript';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import l10n from './eslint/l10n.js';
import layers from './eslint/layers.js';
const UI_DEEP_IMPORT = {
group: ['@/ui/*/*'],
message: 'Import a ui folder through its index, e.g. @/ui/select.',
};
// Each entry is allowed only in the files listed in `allowedIn`
const restricted = {
toFixed: {
allowedIn: ['src/lib/format.ts'],
selector: "CallExpression[callee.property.name='toFixed']",
message: 'Use fmt() from @/lib/format, it is locale aware.',
},
intl: {
allowedIn: ['src/lib/format.ts'],
selector: "NewExpression[callee.object.name='Intl']",
message: 'Use fmt/fmtList/fmtRelative from @/lib/format, they cache per locale.',
},
storage: {
allowedIn: ['src/lib/storage.ts', 'src/lib/storage.test.ts'],
selector: 'Identifier[name=/^(localStorage|sessionStorage)$/]',
message: 'Use definePref/defineCache/defineSession from @/lib/storage.',
},
electronApi: {
allowedIn: ['src/app/platform/**'],
selector: "MemberExpression[property.name='electronAPI']",
message: 'Use platform from @/lib/platform.',
},
keydown: {
allowedIn: ['src/lib/keyboard.ts', 'src/ui/motion/**'],
selector:
"CallExpression[callee.property.name='addEventListener'][arguments.0.value=/^key(down|up)$/]",
message:
'Use useShortcut from @/lib/keyboard, Escape goes to the back stack (useBack).',
},
android: {
allowedIn: ['src/app/platform/**', 'src/env.d.ts'],
selector: "Identifier[name='__ANDROID__']",
message: 'Use platform from @/lib/platform.',
},
};
function allow(from, to) {
return {
from: { element: { type: from } },
allow: { to: { element: { type: to } } },
};
}
function restrictedSyntax(except = []) {
return [
'error',
...Object.entries(restricted)
.filter(([name]) => !except.includes(name))
.map(([, { selector, message }]) => ({ selector, message })),
];
}
function restrictedOverrides() {
const byPattern = new Map();
for (const [name, { allowedIn }] of Object.entries(restricted)) {
for (const pattern of allowedIn) {
byPattern.set(pattern, [...(byPattern.get(pattern) ?? []), name]);
}
}
return [...byPattern].map(([pattern, names]) => ({
files: [pattern],
rules: { 'no-restricted-syntax': restrictedSyntax(names) },
}));
}
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['src/**/*.{ts,tsx}'],
...solid,
languageOptions: {
parser: tseslint.parser,
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
globals: globals.browser,
},
plugins: {
...solid.plugins,
boundaries,
l10n,
},
settings: {
'import/resolver': {
typescript: { alwaysTryTypes: true, project: './tsconfig.json' },
},
'boundaries/include': ['src/**/*'],
'boundaries/elements': [
{ type: 'app', pattern: 'src/app' },
{ type: 'ui', pattern: 'src/ui' },
{ type: 'lib', pattern: 'src/lib' },
{ type: 'solarxr', pattern: 'src/solarxr' },
{ type: 'domain', pattern: 'src/domain/*', capture: ['concept'] },
{ type: 'pages', pattern: 'src/pages/*', capture: ['page'] },
{ type: 'assets', pattern: 'src/assets' },
],
},
rules: {
...solid.rules,
// External packages and imports inside one element (same page, same concept) are not checked
'boundaries/dependencies': [
'error',
{
default: 'disallow',
policies: [
allow('app', ['app', 'ui', 'lib', 'solarxr', 'domain', 'pages', 'assets']),
allow('pages', ['ui', 'lib', 'solarxr', 'domain', 'assets']),
allow('domain', ['ui', 'lib', 'solarxr', 'domain', 'assets']),
allow('solarxr', ['lib', 'solarxr']),
allow('ui', ['ui', 'lib', 'assets']),
allow('assets', ['lib']),
],
},
],
'l10n/message-id': 'error',
'no-throw-literal': 'error',
'no-duplicate-imports': 'error',
'no-restricted-syntax': restrictedSyntax(),
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
],
},
},
...restrictedOverrides(),
{
files: ['src/lib/**/*.{ts,tsx}'],
plugins: { layers },
rules: { 'layers/no-jsx': 'error' },
},
// Peer range stops at ESLint 9 but the rules only read JSX attributes
{ files: ['src/**/*.tsx'], ...jsxA11y.flatConfigs.recommended },
// Long class strings wrap into a multiline template literal, fixed by lint:fix
{
files: ['src/**/*.tsx'],
plugins: { 'better-tailwindcss': betterTailwind },
settings: { 'better-tailwindcss': { entryPoint: 'src/styles.css' } },
rules: {
'better-tailwindcss/enforce-consistent-line-wrapping': [
'error',
// Packed lines, no line per variant group. Wider than prettier so
// only really long strings wrap at JSX indentation depth.
{
printWidth: 100,
group: 'never',
preferSingleLine: true,
strictness: 'loose',
},
],
// The type scale is the text tokens in styles.css, nothing else
'better-tailwindcss/no-restricted-classes': [
'error',
{
restrict: [
{
pattern: '^(?:.*:)?!?text-[\\[(].*$',
message: 'No arbitrary text values, use text-standard, text-section or text-title.',
},
{
pattern: '^(?:.*:)?!?text-(?:xs|sm|base|lg|xl|\\dxl)$',
message: 'Tailwind sizes are removed, use text-standard, text-section or text-title.',
},
],
},
],
},
},
// Solid compiles `ref={x}` into an assignment the rule cannot see
{ files: ['src/**/*.tsx'], rules: { 'no-unassigned-vars': 'off' } },
// Motion hooks belong to ui primitives, pages only use the containers
{
files: ['src/**/*.{ts,tsx}'],
ignores: ['src/ui/**'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@/ui/motion',
importNames: ['useMotionItem'],
message: 'Only ui primitives register motion items.',
},
],
patterns: [UI_DEEP_IMPORT],
},
],
},
},
// Each ui folder is entered through its index; files inside it import each other relatively
{
files: ['src/ui/**/*.{ts,tsx}'],
rules: { 'no-restricted-imports': ['error', { patterns: [UI_DEEP_IMPORT] }] },
},
// Local rules run in node
{ files: ['eslint/**/*.js'], languageOptions: { globals: globals.node } },
// Tests build their own bundles with made-up ids
{ files: ['src/**/*.test.{ts,tsx}'], rules: { 'l10n/message-id': 'off' } }
);
-202
View File
@@ -1,202 +0,0 @@
// Checks Fluent ids against the en-US translation.ftl: literal ids passed to `t`, `t.attr`,
// the `id` prop of l10n components (with args), and any other string literal typed as MessageId
// (props, options, `satisfies Record<..., MessageId>`). Ids must be full literals, args must match.
import { parse } from '@fluent/syntax';
import { readFileSync, statSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
const FTL_FILE = fileURLToPath(new URL('../../app/public/i18n/en/translation.ftl', import.meta.url));
const COMPONENTS = new Set(['Localized']);
let cache = { mtime: -1, messages: new Map() };
function collect(node, out) {
if (!node || typeof node !== 'object') return;
if (Array.isArray(node)) {
for (const child of node) collect(child, out);
return;
}
if (node.type === 'VariableReference') out.vars.add(node.id.name);
else if (node.type === 'MessageReference') {
out.refs.push({ id: node.id.name, attr: node.attribute?.name ?? null });
}
for (const [key, value] of Object.entries(node)) {
if (key !== 'span' && typeof value === 'object') collect(value, out);
}
}
function patternInfo(pattern) {
const out = { vars: new Set(), refs: [] };
collect(pattern, out);
return out;
}
function loadMessages() {
const mtime = statSync(FTL_FILE).mtimeMs;
if (mtime === cache.mtime) return cache.messages;
const messages = new Map();
for (const entry of parse(readFileSync(FTL_FILE, 'utf8'), { withSpans: false }).body) {
if (entry.type !== 'Message') continue;
messages.set(entry.id.name, {
value: entry.value ? patternInfo(entry.value) : null,
attrs: new Map(entry.attributes.map((a) => [a.id.name, patternInfo(a.value)])),
});
}
cache = { mtime, messages };
return messages;
}
function requiredVars(messages, id, attr, seen = new Set()) {
const key = `${id}.${attr ?? ''}`;
const message = messages.get(id);
const info = attr === null ? message?.value : message?.attrs.get(attr);
if (!info || seen.has(key)) return new Set();
seen.add(key);
const vars = new Set(info.vars);
for (const ref of info.refs) {
for (const v of requiredVars(messages, ref.id, ref.attr, seen)) vars.add(v);
}
return vars;
}
// `handled` collects literals already checked through t()/Localized, so the type-based pass skips them
function literalIds(node, context, handled) {
if (node.type === 'Literal' || node.type === 'TemplateLiteral') handled.add(node);
if (node.type === 'Literal' && typeof node.value === 'string') return [node.value];
if (node.type === 'TemplateLiteral') {
if (node.expressions.length === 0) return [node.quasis[0].value.cooked];
context.report({ node, messageId: 'dynamic' });
return null;
}
if (node.type === 'ConditionalExpression') {
const a = literalIds(node.consequent, context, handled);
const b = literalIds(node.alternate, context, handled);
return a && b ? [...a, ...b] : null;
}
return null;
}
function isMessageIdType(type) {
if (!type) return false;
if (type.aliasSymbol?.escapedName === 'MessageId') return true;
return type.isUnion() && type.types.some(isMessageIdType);
}
function propName(prop) {
if (prop.computed) return null;
if (prop.key.type === 'Identifier') return prop.key.name;
if (prop.key.type === 'Literal') return String(prop.key.value);
return null;
}
const messageId = {
meta: {
type: 'problem',
docs: { description: 'Fluent ids exist in en-US and get the args they need' },
schema: [],
messages: {
dynamic: 'Fluent ids must be full literals so they stay greppable.',
unknown: 'Unknown Fluent id "{{id}}" (not in en-US translation.ftl).',
noValue: 'Fluent message "{{id}}" has no value, only attributes.',
unknownAttr: 'Fluent message "{{id}}" has no attribute "{{attr}}".',
missingArgs: 'Fluent message "{{id}}" needs args: {{vars}}.',
unknownArg: 'Fluent message "{{id}}" does not use arg "{{arg}}".',
},
},
create(context) {
const messages = loadMessages();
const handled = new WeakSet();
const services = context.sourceCode.parserServices;
const checker = services?.program?.getTypeChecker();
function typedAsMessageId(node) {
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
return isMessageIdType(checker.getContextualType(tsNode));
}
function checkTyped(node) {
if (!checker || handled.has(node) || !typedAsMessageId(node)) return;
check(node, { attr: undefined, withArgs: false });
}
function checkArgs(node, id, attr, argsNode) {
const vars = requiredVars(messages, id, attr);
if (!argsNode) {
if (vars.size) context.report({ node, messageId: 'missingArgs', data: { id, vars: [...vars].join(', ') } });
return;
}
if (argsNode.type !== 'ObjectExpression') return;
if (argsNode.properties.some((p) => p.type !== 'Property' || propName(p) === null)) return;
const given = new Set(argsNode.properties.map(propName));
const missing = [...vars].filter((v) => !given.has(v));
if (missing.length) {
context.report({ node: argsNode, messageId: 'missingArgs', data: { id, vars: missing.join(', ') } });
}
for (const prop of argsNode.properties) {
const arg = propName(prop);
if (!vars.has(arg)) context.report({ node: prop, messageId: 'unknownArg', data: { id, arg } });
}
}
function check(idNode, { attr, argsNode, withArgs }) {
const ids = literalIds(idNode, context, handled);
if (!ids) return;
for (const id of ids) {
const message = messages.get(id);
if (!message) {
context.report({ node: idNode, messageId: 'unknown', data: { id } });
continue;
}
if (attr === undefined && !message.value) {
context.report({ node: idNode, messageId: 'noValue', data: { id } });
continue;
}
if (typeof attr === 'string' && !message.attrs.has(attr)) {
context.report({ node: idNode, messageId: 'unknownAttr', data: { id, attr } });
continue;
}
if (withArgs && attr !== null) checkArgs(idNode, id, attr ?? null, argsNode);
}
}
return {
CallExpression(node) {
const { callee } = node;
const [first, second, third] = node.arguments;
if (!first) return;
if (callee.type === 'Identifier' && callee.name === 't') {
check(first, { attr: undefined, argsNode: second, withArgs: true });
} else if (
callee.type === 'MemberExpression' &&
callee.object.type === 'Identifier' &&
callee.object.name === 't' &&
callee.property.type === 'Identifier' &&
callee.property.name === 'attr' &&
second
) {
const attr = second.type === 'Literal' && typeof second.value === 'string' ? second.value : null;
check(first, { attr, argsNode: third, withArgs: true });
}
},
JSXOpeningElement(node) {
if (node.name.type !== 'JSXIdentifier' || !COMPONENTS.has(node.name.name)) return;
const attrs = node.attributes.filter((a) => a.type === 'JSXAttribute');
const idAttr = attrs.find((a) => a.name.name === 'id');
if (!idAttr?.value) return;
const idNode = idAttr.value.type === 'JSXExpressionContainer' ? idAttr.value.expression : idAttr.value;
const argsAttr = attrs.find((a) => a.name.name === 'args');
// Spread props may carry args, skip the args check then
const withArgs = !node.attributes.some((a) => a.type === 'JSXSpreadAttribute');
const argsNode = argsAttr?.value?.type === 'JSXExpressionContainer' ? argsAttr.value.expression : undefined;
check(idNode, { attr: undefined, argsNode, withArgs });
},
// Props, options and `satisfies Record<..., MessageId>` values: anything typed MessageId
Literal(node) {
if (typeof node.value === 'string') checkTyped(node);
},
TemplateLiteral: checkTyped,
};
},
};
export default { rules: { 'message-id': messageId } };
-14
View File
@@ -1,14 +0,0 @@
// lib holds services and reactive state, anything that renders lives in ui
const noJsx = {
meta: {
type: 'problem',
messages: { jsx: 'No JSX in lib, components belong in ui.' },
schema: [],
},
create(context) {
const report = (node) => context.report({ node, messageId: 'jsx' });
return { JSXElement: report, JSXFragment: report };
},
};
export default { rules: { 'no-jsx': noJsx } };
-17
View File
@@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0" />
<meta name="theme-color" content="#000000" />
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<title>SlimeVR GUI</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
-69
View File
@@ -1,69 +0,0 @@
{
"name": "@slimevr/gui-app-next",
"version": "0.0.0",
"author": "SlimeVR Team <[email protected]>",
"homepage": "https://slimevr.dev",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node.json",
"test": "vitest run",
"lint": "pnpm typecheck && eslint src && prettier --check \"src/**/*.{ts,tsx,css,json}\"",
"lint:fix": "eslint --fix src && prettier --write \"src/**/*.{ts,tsx,css,json}\""
},
"dependencies": {
"@fluent/bundle": "0.19.1",
"@fluent/langneg": "0.7.0",
"@fontsource-variable/lexend": "5.3.0",
"@fontsource/jetbrains-mono": "5.3.0",
"@fontsource/noto-sans": "5.3.0",
"@fontsource/opendyslexic": "5.3.0",
"@fontsource/poppins": "5.2.7",
"@fontsource/ubuntu": "5.3.0",
"@sentry/solid": "11.9.0",
"@slimevr/gui-shared": "workspace:*",
"@solidjs/router": "1.0.0",
"browser-fs-access": "0.38.0",
"flatbuffers": "22.10.26",
"semver": "7.7.4",
"solarxr-protocol": "workspace:*",
"solid-js": "1.9.17",
"valibot": "1.5.0"
},
"devDependencies": {
"@eslint/js": "10.0.1",
"@sentry/vite-plugin": "11.9.0",
"@fluent/syntax": "0.19.0",
"@iconify-json/heroicons": "1.2.3",
"@iconify-json/ic": "1.2.4",
"@iconify-json/lucide": "1.2.147",
"@iconify-json/material-symbols": "1.2.96",
"@solidjs/testing-library": "0.8.10",
"@tailwindcss/vite": "4.3.3",
"@testing-library/jest-dom": "7.0.1",
"@testing-library/user-event": "14.6.8",
"@types/node": "26.6.5",
"@types/semver": "7.7.1",
"axe-core": "4.14.0",
"eslint": "10.13.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-better-tailwindcss": "4.10.0",
"eslint-plugin-boundaries": "7.3.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-solid": "0.18.1",
"globals": "17.13.0",
"jsdom": "30.1.3",
"prettier": "3.9.10",
"tailwindcss": "4.3.3",
"typescript": "~6.0.3",
"typescript-eslint": "8.72.0",
"unplugin-icons": "24.0.0",
"vite": "8.3.5",
"vite-imagetools": "12.0.1",
"vite-plugin-solid": "2.11.14",
"vitest": "5.0.5"
}
}
-86
View File
@@ -1,86 +0,0 @@
import { useMatch } from '@solidjs/router';
import { type JSX, Show } from 'solid-js';
import HomeIcon from '~icons/material-symbols/home';
import DesignIcon from '~icons/material-symbols/palette-outline-rounded';
import GearIcon from '~icons/material-symbols/settings-rounded';
import RulerIcon from '~icons/material-symbols/straighten-rounded';
import { ConnectionGate } from '@/app/connection-gate';
import { paths } from '@/app/routes';
import { TitleBar } from '@/app/title-bar';
import { handleBack } from '@/lib/back-stack';
import { createMediaQuery, SHELL_QUERY } from '@/lib/media';
import { MotionRegion } from '@/ui/motion';
import { NavLink } from '@/ui/nav-link';
const MOUSE_BACK = 3;
// Same destinations at every width: bottom bar on phones, rail from `shell` up
function Destinations() {
const rail = createMediaQuery(SHELL_QUERY);
return (
<MotionRegion
orientation={rail() ? 'vertical' : 'horizontal'}
class="
order-last flex justify-around gap-sm px-sm pt-sm shell:order-first shell:flex-col
shell:w-27.5 shell:shrink-0 shell:justify-start shell:pt-0 shell:pb-sm
"
>
<NavLink to={paths.home} end label="navbar-home" icon={<HomeIcon />} />
<NavLink
to={paths.body}
label="navbar-body_proportions"
icon={<RulerIcon class="icon -rotate-45" />}
/>
<Show when={import.meta.env.DEV}>
<NavLink
to={paths.design}
label="navbar-design"
icon={<DesignIcon />}
/>
</Show>
<div class="contents shell:mt-auto shell:flex shell:flex-col">
<NavLink
to={paths.settings}
label="navbar-settings"
icon={<GearIcon />}
/>
</div>
</MotionRegion>
);
}
export function AppShell(props: { children: JSX.Element }) {
// Setup runs without destinations, the flow footer owns the bottom
const onboarding = useMatch(() => `${paths.onboarding}/*`);
function onPointerUp(e: PointerEvent) {
if (e.button !== MOUSE_BACK) return;
if (handleBack()) e.preventDefault();
}
return (
<div
class="flex h-dvh flex-col bg-surface text-fg surface-sidebar"
onPointerUp={onPointerUp}
>
<TitleBar />
<ConnectionGate>
<div class="flex min-h-0 flex-1 flex-col shell:flex-row">
<Show when={!onboarding()}>
<Destinations />
</Show>
<main
classList={{ 'shell:ml-sm': !!onboarding() }}
class="
relative min-h-0 flex-1 overflow-y-auto overscroll-contain @container shell:mb-sm
shell:scrollbar-gutter-stable
"
>
{props.children}
</main>
</div>
</ConnectionGate>
</div>
);
}
-41
View File
@@ -1,41 +0,0 @@
import { HashRouter, type RouteSectionProps } from '@solidjs/router';
import { withSentryRouterRouting } from '@sentry/solid/solidrouter';
import { AppShell } from '@/app/app-shell';
import { CrashBoundary } from '@/app/crash-screen';
import { useHistoryBack } from '@/app/history-back';
import { paths, routes } from '@/app/routes';
import { searchDestinations } from '@/app/search-destinations';
import { useShortcut } from '@/lib/keyboard';
import { DOCS_SITE } from '@/lib/links';
import { platform } from '@/lib/platform';
import { QuickSearch } from '@/pages/settings/quick-search/quick-search';
import { DialogHost } from '@/ui/dialog';
import { MotionRoot } from '@/ui/motion';
import { ToastHost } from '@/ui/toast';
const Router = withSentryRouterRouting(HashRouter);
function AppRoot(props: RouteSectionProps) {
useHistoryBack();
useShortcut('F1', () => platform.openUrl(DOCS_SITE), {
scope: 'global',
label: 'titlebar-docs',
});
return (
<MotionRoot>
<AppShell>{props.children}</AppShell>
<QuickSearch base={paths.settings} destinations={searchDestinations} />
<DialogHost />
<ToastHost />
</MotionRoot>
);
}
export function App() {
return (
<CrashBoundary>
<Router root={AppRoot}>{routes}</Router>
</CrashBoundary>
);
}
-30
View File
@@ -1,30 +0,0 @@
import { createPlatform } from '@/app/platform/detect';
import { startReleaseCheck } from '@/domain/app-update/release-check';
import { startDatafeed } from '@/domain/datafeed';
import { initErrorReporting } from '@/domain/error-reporting';
import { initSaveToasts } from '@/domain/settings/save-toasts';
import { initKeyboard } from '@/lib/keyboard';
import { initL10n } from '@/lib/l10n';
import { setPlatform } from '@/lib/platform';
import { loadPrefs } from '@/lib/storage';
import { createSocketClient, serverUrl, setClient } from '@/solarxr/client';
// Everything that runs before render, in order. Returns the stop for the
// background services.
export async function boot(): Promise<() => void> {
setPlatform(await createPlatform());
setClient(createSocketClient({ url: serverUrl() }));
await initErrorReporting();
await loadPrefs();
await initL10n();
const services = [
initKeyboard(),
initSaveToasts(),
startReleaseCheck(),
startDatafeed(),
];
return () => {
for (const stop of services) stop();
};
}
@@ -1,72 +0,0 @@
import { cleanup, render, screen } from '@solidjs/testing-library';
import {
ErrorReportingConsent,
ErrorReportingSettingsResponseT,
} from 'solarxr-protocol';
import { afterEach, beforeAll, describe, expect, it } from 'vitest';
import { ConnectionGate } from '@/app/connection-gate';
import { setPlatform } from '@/lib/platform';
import { fakePlatform } from '@/lib/platform-fake';
import { setClient } from '@/solarxr/client';
import { createFakeClient, type FakeClient } from '@/solarxr/testing';
let fake: FakeClient;
beforeAll(() => {
setPlatform(fakePlatform());
fake = createFakeClient({ connected: false });
setClient(fake);
});
function consent(value: ErrorReportingConsent) {
fake.push(new ErrorReportingSettingsResponseT(value, 'user-1', 'session-1'));
}
function renderGate() {
render(() => (
<ConnectionGate>
<p>app</p>
</ConnectionGate>
));
}
// Resources are module state, so the cases run as one story in order
describe('ConnectionGate', () => {
afterEach(cleanup);
it('shows the timeout error when the first connect takes too long', () => {
renderGate();
expect(screen.getByText('websocket-connecting')).toBeInTheDocument();
fake.setTimedOut(true);
expect(screen.getByText('websocket-timedout')).toBeInTheDocument();
expect(screen.queryByText('app')).toBeNull();
fake.setTimedOut(false);
});
it('waits for consent, asks it, then shows the app and covers it on loss', () => {
renderGate();
fake.connect();
expect(screen.getByText('websocket-connecting')).toBeInTheDocument();
expect(screen.queryByText('app')).toBeNull();
consent(ErrorReportingConsent.UNDECIDED);
expect(
screen.getByText('error_collection_modal-title')
).toBeInTheDocument();
expect(screen.queryByText('app')).toBeNull();
consent(ErrorReportingConsent.ALLOWED);
expect(screen.queryByText('error_collection_modal-title')).toBeNull();
expect(screen.getByText('app').parentElement).not.toHaveClass('hidden');
fake.disconnect();
expect(screen.getByText('websocket-connection_lost')).toBeInTheDocument();
// Kept mounted under the screen
expect(screen.getByText('app').parentElement).toHaveClass('hidden');
fake.connect();
consent(ErrorReportingConsent.ALLOWED);
expect(screen.queryByText('websocket-connection_lost')).toBeNull();
expect(screen.getByText('app').parentElement).not.toHaveClass('hidden');
});
});
-188
View File
@@ -1,188 +0,0 @@
import {
createEffect,
createSignal,
type JSX,
Match,
onMount,
Show,
Switch,
} from 'solid-js';
import { ErrorReportingConsent } from 'solarxr-protocol';
import {
answerConsent,
crashReportAvailable,
errorReportingSettings,
needsConsentAnswer,
sendCrashReport,
} from '@/domain/error-reporting';
import { ErrorReportingDetails } from '@/domain/error-reporting/error-reporting-details';
import { cx } from '@/lib/cx';
import { t } from '@/lib/l10n';
import { platform, type CrashKind } from '@/lib/platform';
import { flushPrefs } from '@/lib/storage';
import { client } from '@/solarxr/client';
import { TextButton } from '@/ui/button';
import { focusEntry, MotionRegion } from '@/ui/motion';
import { StatusState } from '@/ui/status-state';
type GateScreen = 'connection' | 'consent';
function CrashReportBanner(props: { kind: CrashKind }) {
const [sent, setSent] = createSignal(false);
const [sending, setSending] = createSignal(false);
async function send() {
setSending(true);
try {
if (await sendCrashReport(props.kind)) setSent(true);
} finally {
setSending(false);
}
}
return (
<Show when={crashReportAvailable()}>
<div
class="
flex w-full max-w-2xl flex-wrap items-center justify-between gap-md rounded-lg bg-surface
px-lg py-md surface-section
"
>
<p>
{t(sent() ? 'websocket-report-sent' : 'websocket-report-question')}
</p>
<Show when={!sent()}>
<TextButton
label="websocket-report-send"
loading={sending()}
onClick={send}
/>
</Show>
</div>
</Show>
);
}
function ConnectionScreen() {
const timedOut = () => client.status() === 'connecting' && client.timedOut();
const lost = () => client.status() === 'disconnected';
async function close() {
await flushPrefs();
platform.window?.close();
}
return (
<Show
when={timedOut() || lost()}
fallback={
<StatusState kind="loading" size="page" title="websocket-connecting" />
}
>
<div class="flex flex-1 flex-col items-center gap-lg p-lg">
<StatusState
kind="error"
size="page"
title={
timedOut() ? 'websocket-timedout' : 'websocket-connection_lost'
}
description={
timedOut()
? 'websocket-timedout-desc'
: 'websocket-connection_lost-desc'
}
action={
<Show when={platform.window}>
<div class="flex flex-wrap justify-center gap-sm">
<TextButton
variant="primary"
label="websocket-error-close"
onClick={close}
/>
<Show when={platform.folders}>
{(folders) => (
<TextButton
label="websocket-error-logs"
onClick={() => void folders().openLogs()}
/>
)}
</Show>
</div>
</Show>
}
/>
<CrashReportBanner kind={timedOut() ? 'timeout' : 'connection_lost'} />
</div>
</Show>
);
}
function ConsentScreen() {
let el!: HTMLDivElement;
onMount(() => focusEntry(el));
return (
<div
ref={el}
class="flex min-h-0 flex-1 justify-center overflow-y-auto p-lg"
>
<MotionRegion class="flex w-full max-w-2xl flex-col items-center gap-lg">
<StatusState
kind="empty"
title="error_collection_modal-title"
description="error_collection_modal-subtitle"
/>
<ErrorReportingDetails />
<p class="text-center">{t('error_collection_modal-change_later')}</p>
<div class="flex w-full flex-wrap-reverse justify-between gap-md">
<TextButton
variant="ghost"
label="error_collection_modal-cancel"
onClick={() => answerConsent(ErrorReportingConsent.DENIED)}
/>
<TextButton
variant="primary"
label="error_collection_modal-confirm"
onClick={() => answerConsent(ErrorReportingConsent.ALLOWED)}
/>
</div>
</MotionRegion>
</div>
);
}
export function ConnectionGate(props: { children: JSX.Element }) {
const [shown, setShown] = createSignal(false);
function screen(): GateScreen | null {
if (client.status() !== 'connected') return 'connection';
if (!shown() && errorReportingSettings.state() !== 'fresh')
return 'connection';
if (needsConsentAnswer()) return 'consent';
return null;
}
createEffect(() => {
if (!screen()) setShown(true);
});
return (
<>
<Switch>
<Match when={screen() === 'connection'}>
<ConnectionScreen />
</Match>
<Match when={screen() === 'consent'}>
<ConsentScreen />
</Match>
</Switch>
<Show when={shown()}>
<div
class={cx('min-h-0 flex-1 flex-col', screen() ? 'hidden' : 'flex')}
>
{props.children}
</div>
</Show>
</>
);
}
-57
View File
@@ -1,57 +0,0 @@
import { ErrorBoundary, type JSX, Show } from 'solid-js';
import { MinimalTitleBar } from '@/app/title-bar';
import { lastReportId, reportError } from '@/domain/error-reporting';
import { t } from '@/lib/l10n';
import { TextButton } from '@/ui/button';
import { CopyButton } from '@/ui/copy-button';
import { StatusState } from '@/ui/status-state';
function CrashScreen(props: { eventId: string | undefined }) {
return (
<div class="flex h-screen flex-col bg-surface text-fg surface-sidebar">
<MinimalTitleBar />
<div class="flex min-h-0 flex-1 flex-col overflow-y-auto">
<StatusState
kind="error"
size="page"
title="crash_screen-title"
description="crash_screen-description"
action={
<div class="flex flex-col items-center gap-md">
<Show when={props.eventId}>
{(id) => (
<p class="font-mono select-text">
{t('crash_screen-event_id', { id: id() })}
</p>
)}
</Show>
<div class="flex flex-wrap justify-center gap-sm">
<Show when={props.eventId}>
{(id) => <CopyButton text={id()} label="crash_screen-copy" />}
</Show>
<TextButton
variant="primary"
label="crash_screen-reload"
onClick={() => window.location.reload()}
/>
</div>
</div>
}
/>
</div>
</div>
);
}
export function CrashBoundary(props: { children: JSX.Element }) {
return (
<ErrorBoundary
fallback={(error) => {
reportError(error, { tags: { boundary: 'app' } });
return <CrashScreen eventId={lastReportId()} />;
}}
>
{props.children}
</ErrorBoundary>
);
}
-27
View File
@@ -1,27 +0,0 @@
import { useLocation, useNavigate } from '@solidjs/router';
import { onCleanup } from 'solid-js';
import { setBackFallback } from '@/lib/back-stack';
function depth(): number {
const state: unknown = window.history.state;
if (typeof state !== 'object' || state === null || !('_depth' in state)) return 0;
return typeof state._depth === 'number' ? state._depth : 0;
}
// Router history under the overlays. Stops at the entry the app started on,
// so back never leaves the app.
export function useHistoryBack() {
const navigate = useNavigate();
const location = useLocation();
const start = depth();
onCleanup(
setBackFallback({
can: () => {
void location.key;
return depth() > start;
},
back: () => navigate(-1),
})
);
}
-40
View File
@@ -1,40 +0,0 @@
import type { Platform } from '@/lib/platform';
import { localCrossStorage } from '@/lib/storage';
import { saveWithBrowser } from './browser-save';
type AndroidBridge = NonNullable<Window['__ANDROID__']>;
function toBase64(blob: Blob) {
return new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const url = reader.result as string;
resolve(url.slice(url.indexOf(',') + 1));
};
reader.onerror = () => reject(reader.error);
reader.readAsDataURL(blob);
});
}
export function createAndroidPlatform(android: AndroidBridge): Platform {
const settings = localCrossStorage('');
const cache = localCrossStorage('slimevr-cache/');
return {
kind: 'android',
os: 'android',
storage: (name) => (name === 'settings' ? settings : cache),
openUrl: (url) => void window.open(url, '_blank'),
saveFile: async (opts) => {
if (typeof android.saveFile !== 'function') return saveWithBrowser(opts);
const { blob, fileName } = opts;
android.saveFile(
fileName,
blob.type || 'application/octet-stream',
await toBase64(blob)
);
return 'saved';
},
systemInsets: { setBackground: (color) => android.updateInsetBackground(color) },
};
}
@@ -1,16 +0,0 @@
import { fileSave } from 'browser-fs-access';
import type { SaveOptions, SaveResult } from '@/lib/platform';
export async function saveWithBrowser({
blob,
fileName,
extensions,
}: SaveOptions): Promise<SaveResult> {
try {
await fileSave(blob, { fileName, extensions });
return 'saved';
} catch (e) {
if (e instanceof DOMException && e.name === 'AbortError') return 'canceled';
throw e;
}
}
@@ -1,39 +0,0 @@
import type { IElectronAPI } from '@slimevr/gui-shared';
import { describe, expect, it, vi } from 'vitest';
import { memoryCrossStorage } from '@/lib/platform-fake';
import { createPlatform } from './detect';
describe('createPlatform', () => {
it('resolves the OS before returning on electron', async () => {
const storage = memoryCrossStorage();
vi.stubGlobal('electronAPI', {
osStats: async () => ({ type: 'linux' }),
getStorage: async () => storage,
} as Partial<IElectronAPI>);
const platform = await createPlatform();
expect(platform.kind).toBe('desktop');
expect(platform.os).toBe('linux');
expect(platform.storage('settings')).toBe(storage);
expect(platform.window).toBeDefined();
});
it('picks android when the bridge is there', async () => {
vi.stubGlobal('__ANDROID__', {
isThere: () => true,
updateInsetBackground: () => {},
saveFile: () => {},
});
const platform = await createPlatform();
expect(platform.kind).toBe('android');
expect(platform.systemInsets).toBeDefined();
expect(platform.window).toBeUndefined();
});
it('falls back to web', async () => {
const platform = await createPlatform();
expect(platform.kind).toBe('web');
expect(platform.pickFile).toBeUndefined();
});
});
-11
View File
@@ -1,11 +0,0 @@
import type { Platform } from '@/lib/platform';
import { createAndroidPlatform } from './android';
import { createElectronPlatform } from './electron';
import { createWebPlatform } from './web';
export async function createPlatform(): Promise<Platform> {
if (window.electronAPI) return createElectronPlatform(window.electronAPI);
const android = window.__ANDROID__;
if (android?.isThere()) return createAndroidPlatform(android);
return createWebPlatform();
}
-63
View File
@@ -1,63 +0,0 @@
import type { IElectronAPI } from '@slimevr/gui-shared';
import type { Platform } from '@/lib/platform';
import { saveWithBrowser } from './browser-save';
export async function createElectronPlatform(api: IElectronAPI): Promise<Platform> {
const [os, settings, cache] = await Promise.all([
api.osStats(),
api.getStorage('settings'),
api.getStorage('cache'),
]);
return {
kind: 'desktop',
os: os.type,
storage: (name) => (name === 'settings' ? settings : cache),
openUrl: (url) => void api.openUrl(url),
saveFile: saveWithBrowser,
pickFile: async ({ mode, title, filters, defaultPath }) => {
if (mode === 'save') {
const res = await api.saveDialog({ title, filters, defaultPath });
return res.canceled || !res.filePath ? null : res.filePath;
}
const res = await api.openDialog({
title,
filters,
defaultPath,
properties: [mode === 'directory' ? 'openDirectory' : 'openFile'],
});
return res.canceled ? null : (res.filePaths[0] ?? null);
},
window: {
minimize: () => api.minimize(),
toggleMaximize: () => api.toggleMaximize(),
hide: () => api.hide(),
close: () => api.close(),
showDecorations: (on) => api.showDecorations(on),
},
folders: {
openLogs: () => api.openLogsFolder(),
openConfig: () => api.openConfigFolder(),
installDir: () => api.getInstallDir(),
},
guiLogs: {
onEvents: (cb) => api.onGuiLogEvents(cb),
files: () => api.guiLogFiles(),
read: (name) => api.readGuiLogFile(name),
},
log: (level, ...args) => api.log(level, ...args),
errorReporting: {
setState: (state) => api.setErrorReporting(state),
sendCrash: (kind) => api.sendCrashReport(kind),
},
discordPresence: { set: (presence) => api.setPresence(presence) },
translations: {
set: (translations) => api.setTranslations(translations),
override: () => api.i18nOverride(),
onCrowdinPopupClosed: (cb) => api.onCrowdinPopupClosed(cb),
},
github: { get: (request) => api.ghGet(request) },
steam: { isSteam: () => api.isSteam() },
keybindRecording: (on) => api.setKeybindRecording(on),
};
}
-16
View File
@@ -1,16 +0,0 @@
import type { Platform } from '@/lib/platform';
import { localCrossStorage } from '@/lib/storage';
import { saveWithBrowser } from './browser-save';
export function createWebPlatform(): Platform {
const settings = localCrossStorage('');
const cache = localCrossStorage('slimevr-cache/');
return {
kind: 'web',
os: 'unknown',
storage: (name) => (name === 'settings' ? settings : cache),
openUrl: (url) => void window.open(url, '_blank'),
saveFile: saveWithBrowser,
};
}
-25
View File
@@ -1,25 +0,0 @@
import type { RouteDefinition } from '@solidjs/router';
import { BodyPage } from '@/pages/body/body-page';
import { DesignPage } from '@/pages/design/design-page';
import { HomePage } from '@/pages/home/home-page';
import { onboardingRoute } from '@/pages/onboarding/onboarding-route';
import { settingsRoute } from '@/pages/settings/settings-route';
import { SetupPage } from '@/pages/setup/setup-page';
export const paths = {
home: '/',
body: '/body',
setup: '/setup',
onboarding: '/onboarding',
settings: '/settings',
design: '/design',
} as const;
export const routes: RouteDefinition[] = [
{ path: paths.home, component: HomePage },
{ path: paths.body, component: BodyPage },
{ path: paths.setup, component: SetupPage },
onboardingRoute(paths.onboarding),
settingsRoute({ base: paths.settings, wizard: paths.onboarding }),
...(import.meta.env.DEV ? [{ path: paths.design, component: DesignPage }] : []),
];
@@ -1,8 +0,0 @@
import { paths } from '@/app/routes';
import type { SearchDestination } from '@/pages/settings/quick-search/search-entries';
// Pages outside the settings that quick search lists. Add a row when a page's route lands.
export const searchDestinations: SearchDestination[] = [
{ path: paths.home, title: 'navbar-home' },
{ path: paths.onboarding, title: 'navbar-onboarding' },
];
-198
View File
@@ -1,198 +0,0 @@
import { useMatch } from '@solidjs/router';
import { createSignal, createUniqueId, Show } from 'solid-js';
import { ServerInfosRequestT, ServerInfosResponseT } from 'solarxr-protocol';
import DownloadIcon from '~icons/heroicons/arrow-down-tray-solid';
import SearchIcon from '~icons/heroicons/magnifying-glass-20-solid';
import QuestionIcon from '~icons/heroicons/question-mark-circle';
import CloseIcon from '~icons/material-symbols/close-rounded';
import MaximiseIcon from '~icons/material-symbols/crop-square-outline-rounded';
import MinimiseIcon from '~icons/material-symbols/minimize-rounded';
import GearIcon from '~icons/material-symbols/settings-rounded';
import SlimevrLogoIcon from '~icons/slime/slimevr-logo';
import { paths } from '@/app/routes';
import { serverUpdate } from '@/domain/app-update/release-check';
import {
DOCS_SITE,
LATEST_RELEASE_URL,
RELEASES_URL,
WINDOWS_DOWNLOAD_URL,
} from '@/lib/links';
import { platform, type WindowApi } from '@/lib/platform';
import { flushPrefs } from '@/lib/storage';
import { openQuickSearch } from '@/pages/settings/quick-search/quick-search';
import { defineResource } from '@/solarxr/resource';
import { TextButton } from '@/ui/button';
import { MotionRegion } from '@/ui/motion';
import { PlainLink } from '@/ui/plain-link';
import { Tooltip } from '@/ui/tooltip';
const serverInfos = defineResource({
request: () => new ServerInfosRequestT(),
response: ServerInfosResponseT,
});
const VERSION =
(__VERSION_TAG__ || __COMMIT_HASH__) + (__GIT_CLEAN__ ? '' : '-dirty');
function localIp() {
const ip = serverInfos.value()?.localIp;
return ip ? String(ip) : null;
}
function openUpdate() {
platform.openUrl(
platform.os === 'windows' ? WINDOWS_DOWNLOAD_URL : LATEST_RELEASE_URL
);
}
function WindowControls(props: { api: WindowApi }) {
async function close() {
await flushPrefs();
props.api.close();
}
return (
<>
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-minimize"
icon={<MinimiseIcon class="icon icon-sm" />}
onClick={() => props.api.minimize()}
/>
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-maximize"
icon={<MaximiseIcon class="icon icon-sm" />}
onClick={() => props.api.toggleMaximize()}
/>
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-close"
icon={<CloseIcon class="icon icon-sm" />}
onClick={close}
/>
</>
);
}
// Window controls and logo only, for screens outside the router (crash screen): no links,
// no server data, so it keeps working whatever broke
export function MinimalTitleBar() {
return (
<div class="flex h-titlebar shrink-0 items-center gap-sm px-sm">
<span class="flex h-5.5 w-12.25 translate-x-[2.17px] items-center justify-center text-special">
<SlimevrLogoIcon
aria-hidden="true"
style={{ '--icon-size': '49.66px' }}
/>
</span>
<span class="flex h-full items-center" data-electron-drag-region="true">
SlimeVR
</span>
<div class="h-full flex-1" data-electron-drag-region="true" />
<Show when={platform.window}>
{(api) => <WindowControls api={api()} />}
</Show>
</div>
);
}
export function TitleBar() {
const onSettings = useMatch(() => `${paths.settings}/*`);
const [versionEl, setVersionEl] = createSignal<HTMLAnchorElement>();
const commitTipId = createUniqueId();
return (
<MotionRegion
orientation="horizontal"
class="flex h-titlebar shrink-0 items-center gap-sm px-sm"
>
<div class="hidden shell:contents">
<PlainLink
to={paths.home}
label="navbar-home"
class="h-5.5 w-12.25 justify-center text-special"
>
<span class="flex translate-x-[2.17px]">
<SlimevrLogoIcon
aria-hidden="true"
style={{ '--icon-size': '49.66px' }}
/>
</span>
</PlainLink>
<span class="flex h-full items-center" data-electron-drag-region="true">
SlimeVR
</span>
</div>
<div class={onSettings() ? 'hidden shell:contents' : 'contents'}>
<PlainLink
ref={setVersionEl}
href={RELEASES_URL}
describedBy={commitTipId}
class="
h-5.5 shrink-0 rounded-lg bg-success/20 px-3 font-bold whitespace-nowrap text-success
select-text
"
>
{VERSION}
</PlainLink>
<Tooltip id={commitTipId} anchor={versionEl}>
{__COMMIT_HASH__}
</Tooltip>
</div>
<Show when={onSettings() && localIp()}>
{(ip) => (
<span class="rounded-md bg-special/20 px-sm font-bold text-special select-text">
{ip()}
</span>
)}
</Show>
<Show when={platform.window && serverUpdate()}>
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-update"
icon={<DownloadIcon />}
onClick={openUpdate}
/>
</Show>
<div class="h-full flex-1" data-electron-drag-region="true" />
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-search"
icon={<SearchIcon />}
onClick={openQuickSearch}
/>
<TextButton
to={paths.settings}
variant="ghost"
size="small"
iconOnly
label="titlebar-settings"
icon={<GearIcon />}
/>
<div class="hidden shell:contents">
<TextButton
variant="ghost"
size="small"
iconOnly
label="titlebar-docs"
icon={<QuestionIcon />}
onClick={() => platform.openUrl(DOCS_SITE)}
/>
</div>
<Show when={platform.window}>
{(api) => <WindowControls api={api()} />}
</Show>
</MotionRegion>
);
}
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9d02c57155f8011a4363e242f3c195633450477b19ca5784ecf9b28df5401143
size 460668
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78bcd8987b35612739dfc8f556f6da497f689b26e96f5267b9a008ea9f46bd14
size 592038
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d54e1a99c1c228d004d2c94d3e1ed49f0cc14d7a471b71130fe89aa1518acc73
size 438548
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76d5b68294770112ee3d97cddcf5751008df2cb3a372655e7611d4db231243fc
size 139344
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:71fa8383b0fde387e91e88c0f95eb057ad62905df8ac78c89ade1627ad17b0b3
size 21360
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76c1f559ecc11239e2f126eb76ae4c2e097a26f227a915de7127db4f61eafc40
size 27230
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:13b7a9177af9378284c4eca264590deae6654b8b92c00d9ca948628c16dd118f
size 22590
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd98226b28ed3f68b5a6fa03dada951fc4326c56119d59fcad09fef261053446
size 155016
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe7893c1645174eee669dfa9e7222c55638c8d498eb126a397a6df759c028919
size 28604
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c71f29809334563348f8f29cf41afeb8bedbbd5ba2875bf40621b011ac52d2d3
size 30678
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8b00c02450258536066870137876f4fe1882d4e4b6fc4ab9f32ad46220ed5efa
size 52158
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:faabda8027d550b10723457a8274962b3b8d9eb906cbac0c73d20916e6633e95
size 13558
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8bd89b59087cc0f019ca2179fcc57d99811c327cdd6b1fd6e57705f7299aa2ae
size 14402
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38aebca5266f47270dc60c4682022809e43676ac9b3dd4b5a586ce3157f8a8a0
size 99786
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b40baa0413d30f5df34eb7bd7e8867cb73905a098fd7398de67a2d60b3882070
size 152284
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:31e6929b6176244f53e85088812f5cc4e7b94679039688f929b21b8e1bb985e7
size 94060
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e95853b79d711826f454fcc48e5d4ffd608a74e13aff2c7aa8628730362dd0f
size 154508
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f6dc4d54b43844a85099941b64a9b92cba0f58ebe33dc61a48e12536f20174b3
size 130492
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9cfe4aa1ed1422df92dd34952331cdf4dddcac4f6135b96bc1f5e112276deef5
size 46890
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a9f7a0b082efc151cf0147a6e2194ce686a86751a7d168f5052fef5ef2e9890
size 20458
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7b2bf36937133e653a83f2523e51cb40f372622a347c19fef94a2e45ee2f913
size 67850
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fce09373239c8f1781b9f8deba8b9fe7b70b0b7acdd1ae7de82841c44507bf83
size 70686
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:18789a9b9bdadb09a6e016ca998cceace5d2ac371ce9f21b094d4e26f741b20d
size 58344
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:305526056be521e08af825f81c14461008137656c8d5ae2cde278958071c5d19
size 27460
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6c40f36772015ce29eb6916e08b2fb3735b837dba4a6d0de253fc879ffb5119a
size 92960
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78530533994a3515947123a5fb9d495c5c18698fc0a7894e3d6f5ae68bf8683c
size 241652
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37a2e21db039c707632467bea72ceada8fbbe89f6dcf71efa90761f6efd7df4c
size 243576
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63c95f09e4ad1b2ad33c008c18344cdbbacfbc923f0817ce999aed27e2e621f3
size 226052
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fb48ab063b7628e0236ec90982301a0f1b34a8f04e74e6e01944834f857ed5e1
size 308426
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cd154cda0e1dd0258e6ac7f945b9e965b586ce110c1476e7765d4f486e9c129d
size 224468
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:448bda8904bb72de261f035ef23ad90bad33f3ced17180dc1c8a50391c6c587c
size 229804
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:963bc302f6a88d613c4907d2ece6802198b5e2d7147360ce9f5d9024e014c02d
size 219678
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:771d3c1222073db09ea45a4afe4fd79e18a16592733eb73e8614865d4f442114
size 371974
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:57ca3e79eb5dadc9861462f54e0bdf74e96885b8dcc961bb134de2f8c383a21c
size 174124
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c369d04af7f341fe50811b74532962f02048b46a69690d0ebbbc59123e674c99
size 302760
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90abbb29202768f5e12d2bdeaa020b8bd831faf39decf309ae714d6ea0196fa5
size 268014
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4ec384b4afdf344eefe66674e675a3e7dbc34f1e9212c2a7d21ec1426bec7238
size 35321
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4691ba3c289538e2578f7e366421031963fae6d593418fb8fb94b8ed0bd53453
size 27421
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8180983bcdd98afc329b23b8fbe549d448b861e625926f19cfef1f1d17e96713
size 183196
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9ffeb4e7c6ff95dc4e5d4b648f9dc79e58463410e7e3b2261213643e7c05e4a1
size 40841
-16
View File
@@ -1,16 +0,0 @@
import type { SpriteAsset } from '@/lib/assets';
import curious from './sprites/curious-slime.webp?url';
import happy from './sprites/happy-slime.webp?url';
import jumping from './sprites/jumping-slime.webp?url';
import sad from './sprites/sad-slime.webp?url';
// Lossless sheets of the original slime GIFs (6286c50ef^), 300px frames.
// Rebuild one with ffmpeg: `fps=1000/<frameMs>` on the GIF repeats frames
// onto the tick, then `tile=<columns>x<rows>:color=0x00000000` and
// `-c:v libwebp -lossless 1`. 13 columns keeps sheets under 4096px.
export const slimes = {
happy: { src: happy, frames: 56, columns: 13, rows: 5, frameMs: 80 },
sad: { src: sad, frames: 48, columns: 13, rows: 4, frameMs: 80 },
jumping: { src: jumping, frames: 14, columns: 13, rows: 2, frameMs: 80 },
curious: { src: curious, frames: 33, columns: 13, rows: 3, frameMs: 90 },
} as const satisfies Record<string, SpriteAsset>;
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34815b0f9071d7b9be492c8093a3be34e7f4b2a889612056d0b21fce0902cf19
size 48912
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c9af45e58483237a532a32f1ab0c1940d473b393fb1302161b5c6eceedc96b4d
size 7519
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10809600a3d25da9b2509e69ad76dc455eaadf8682d6c3112cda6cfcff9caa4c
size 7918
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c157326536d34d357384cb8f8221ea7b60b5ea864c1479d579843300735a70a
size 7539
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fbcd300219427218ea6d78a0c139154f70568c798de49c79799f7d23f8298361
size 49848
-3
View File
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fd6535827d65876e3abdb5a91781dd010254cbe09388f80506ab5db3269dc57f
size 25953
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:90cbfc0220b890ed0b22809f1796b620be478aadc2f9bb4c6625f5afbbf22fc6
size 48776
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b52329d49daae223bfab6ae740ec26459dba424d8e3c959523827c478c6829e4
size 50266
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0660415cd6e9bdd9bcbcf0c410e03bd047f4361a63c11e1bb216d8273d5d0e9
size 7390
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ffce3c6285d385dbaa8e52e7bf5f0b3876a09a8942c328aebd7ebb556450becd
size 7672
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78a9b5a07025c4c580386920b1086d90144d166283f988d9e2d8798f43046519
size 7177
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:112f9ee9a88eff6daf22a730425534aefa4ca6e32036617fdd6b4c647b92e180
size 19559
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cfe20747e65605c453ec1d59b2116333dd8653ee736ff851776cecfb4e560d0c
size 34939
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ecedfb6aa9ec6b2f74c6a37a7f6ca2453b2a3c916ed3940af5912c1f02fe1b6c
size 27736
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6eec33ca48514361e24324f4cfb13a225b42061279f48bae5117c71cf9c6915c
size 53508
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dafb0a9d195796147a161d3a6f305781d5e0e0ad5f1ea2c006fe4685a9ddbf17
size 14856
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37933096c74292a81e046eb1f51e2c269dd85415a6c488c7de7934026471bec1
size 25320
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a05d98b93a156886d4c15dfe65869b7a9029d6a4c3d345894bfc91f577b82132
size 13916
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c6d4c79902ee6f3a379aaaa751bf78c906324142fd30c3c78b1651cd8e558ea
size 1444369
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bd936a1490d3ad7f3e6baacaf543d362a261a89958809abf7799f9c17314aa35
size 4166598
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cf4d60cdc1d30f1ea547851cd846399c5307aa39eb7676089c826bdae157ae1a
size 4497360
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9e2933a8485ca89ca386f666fe59de1e0413733706a5501b7d737bef1b3ef8e7
size 2319993
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5870685cba7e928d1c180b1ab4d71542949572b67a016d999af68807a334c9e3
size 2433462
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7da340acea0eae03b634445019e4fb80665069c407faa9e06cdc8e36b818b338
size 2639547
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e01e73d3c7ec9fad8e920fd0fd020fffd3e6f7e11b82d80d4cce7b897c8d165
size 2656057
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0164b6deb84417e9884e035613d964e86c044614b6a65c67c18f054eb1fa14ee
size 2496521
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c44a6a677326cc12f8a3dde47b9f4e640ef8a4b35044877d6078602feb7205bb
size 2507396
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d51ec4476f04331c637ca1df076c1f1b74c843e830419f691ff2c1fe3184d790
size 1569182
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9b6cfee1aad10ccc62e6e9a8c6ae605fc41c4ad71fb07d727d959cdc4ccd5abf
size 1392993
@@ -1,42 +0,0 @@
import semver from 'semver';
import { createSignal } from 'solid-js';
import * as v from 'valibot';
import { ignoreError } from '@/domain/error-reporting';
import { RELEASES_API_URL } from '@/lib/links';
import { platform } from '@/lib/platform';
const releasesSchema = v.array(
v.looseObject({ tag_name: v.string(), prerelease: v.boolean() })
);
const [update, setUpdate] = createSignal<string | null>(null);
// Tag of a stable server release newer than this build, null when none
export function serverUpdate() {
return update();
}
async function newerRelease(signal: AbortSignal): Promise<string | null> {
if (platform.kind === 'android') return null;
if (await platform.steam?.isSteam()) return null;
if (!semver.valid(__VERSION_TAG__)) {
console.info('Non semver version, skipping the server update check');
return null;
}
const response = await fetch(RELEASES_API_URL, { signal });
const parsed = v.safeParse(releasesSchema, await response.json());
if (!parsed.success) return null;
const tag = parsed.output.find((release) => !release.prerelease)?.tag_name;
const version = tag ? semver.coerce(tag) : null;
return tag && version && semver.gt(version, __VERSION_TAG__) ? tag : null;
}
export function startReleaseCheck(): () => void {
const abort = new AbortController();
newerRelease(abort.signal)
.then(setUpdate)
.catch(ignoreError('release check offline or rate limited'));
return () => abort.abort();
}
@@ -1,71 +0,0 @@
import {
BoneMaskT,
DataFeedConfigT,
DeviceDataMaskT,
DongleDataMaskT,
TrackerDataMaskT,
} from 'solarxr-protocol';
// Position in StartDataFeed.dataFeeds, echoed back as DataFeedUpdate.index
export const TRACKERS_FEED = 0;
export const BONES_FEED = 1;
export function trackersFeedConfig(fast: boolean): DataFeedConfigT {
const trackerData = new TrackerDataMaskT();
trackerData.position = true;
trackerData.rotation = true;
trackerData.info = true;
trackerData.status = true;
trackerData.temp = true;
trackerData.linearAcceleration = true;
trackerData.rotationReferenceAdjusted = true;
trackerData.rotationIdentityAdjusted = true;
trackerData.tps = true;
trackerData.rawMagneticVector = true;
trackerData.stayAligned = true;
trackerData.origin = true;
const dataMask = new DeviceDataMaskT();
dataMask.deviceData = true;
dataMask.trackerData = trackerData;
const dongleMask = new DongleDataMaskT();
dongleMask.boardType = true;
dongleMask.customName = true;
dongleMask.devicesIds = true;
dongleMask.displayName = true;
dongleMask.firmwareDate = true;
dongleMask.firmwareVersion = true;
dongleMask.hardwareAddress = true;
dongleMask.hardwareRevision = true;
dongleMask.manufacturer = true;
dongleMask.model = true;
dongleMask.status = true;
dongleMask.protocolVersion = true;
const config = new DataFeedConfigT();
config.dataMask = dataMask;
config.boneMask = null;
config.minimumTimeSinceLast = 1000 / (fast ? 90 : 10);
config.serverGuardsMask = true;
config.dongleMask = dongleMask;
return config;
}
export function bonesFeedConfig(fast: boolean): DataFeedConfigT {
const boneMask = new BoneMaskT();
boneMask.bodyPart = true;
boneMask.boneLength = true;
boneMask.rotation = false;
boneMask.orientation = true;
boneMask.headPosition = true;
boneMask.tailPosition = false;
boneMask.angularVelocity = false;
boneMask.linearVelocity = false;
boneMask.trackerOffset = false;
const config = new DataFeedConfigT();
config.boneMask = boneMask;
config.minimumTimeSinceLast = 1000 / (fast ? 90 : 40);
return config;
}
@@ -1,107 +0,0 @@
import {
BodyPart,
BoneT,
DataFeedUpdateT,
DeviceDataT,
ServerGuardsT,
StartDataFeedT,
TrackerDataT,
} from 'solarxr-protocol';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { debugPref, devSettingsPref } from '@/domain/developer';
import { resetTrackers, trackerKeys } from '@/domain/trackers';
import { setPlatform } from '@/lib/platform';
import { fakePlatform } from '@/lib/platform-fake';
import { setClient } from '@/solarxr/client';
import { createFakeClient, type FakeClient } from '@/solarxr/testing';
import { BONES_FEED, TRACKERS_FEED } from './config';
import {
boneByPart,
bones,
resetDatafeed,
serverGuards,
startDatafeed,
} from './datafeed';
let fake: FakeClient;
let stop: () => void;
function trackersUpdate() {
const tracker = new TrackerDataT();
tracker.deviceId = 1;
const device = new DeviceDataT();
device.id = 1;
device.trackers = [tracker];
const update = new DataFeedUpdateT();
update.index = TRACKERS_FEED;
update.devices = [device];
update.serverGuards = new ServerGuardsT();
return update;
}
beforeEach(() => {
setPlatform(fakePlatform());
resetTrackers();
resetDatafeed();
debugPref.set(false);
fake = createFakeClient({ connected: false });
setClient(fake);
stop = startDatafeed();
});
afterEach(() => {
stop();
});
describe('startDatafeed', () => {
it('starts both feeds on every connect', () => {
expect(fake.sentOf(StartDataFeedT)).toHaveLength(0);
fake.connect();
const [start] = fake.sentOf(StartDataFeedT);
expect(start?.dataFeeds).toHaveLength(2);
expect(start?.dataFeeds[TRACKERS_FEED]?.minimumTimeSinceLast).toBe(100);
expect(start?.dataFeeds[BONES_FEED]?.boneMask?.orientation).toBe(true);
fake.disconnect();
fake.connect();
expect(fake.sentOf(StartDataFeedT)).toHaveLength(2);
});
it('restarts at the fast rate only with debug and the dev setting on', () => {
fake.connect();
devSettingsPref.set({ ...devSettingsPref(), fastDataFeed: true });
expect(fake.sentOf(StartDataFeedT)).toHaveLength(1);
debugPref.set(true);
const starts = fake.sentOf(StartDataFeedT);
expect(starts).toHaveLength(2);
expect(starts[1]?.dataFeeds[TRACKERS_FEED]?.minimumTimeSinceLast).toBeCloseTo(
1000 / 90
);
devSettingsPref.set({ ...devSettingsPref(), fastDataFeed: false });
});
it('routes updates by feed index', () => {
fake.connect();
fake.push(trackersUpdate());
expect(trackerKeys()).toEqual(['1:0']);
expect(serverGuards()?.canDoUserHeightCalibration).toBe(false);
const bone = new BoneT();
bone.bodyPart = BodyPart.HEAD;
const update = new DataFeedUpdateT();
update.index = BONES_FEED;
update.bones = [bone];
fake.push(update);
expect(bones()).toHaveLength(1);
expect(boneByPart(BodyPart.HEAD)?.bodyPart).toBe(BodyPart.HEAD);
expect(trackerKeys()).toEqual(['1:0']);
});
it('stops listening once stopped', () => {
stop();
fake.connect();
fake.push(trackersUpdate());
expect(fake.sentOf(StartDataFeedT)).toHaveLength(0);
expect(trackerKeys()).toEqual([]);
});
});
@@ -1,76 +0,0 @@
import {
DataFeedUpdateT,
StartDataFeedT,
type BodyPart,
type BoneT,
type ServerGuardsT,
} from 'solarxr-protocol';
import { createEffect, createRoot, createSignal, onCleanup, untrack } from 'solid-js';
import { devSetting } from '@/domain/developer';
import { ingestTrackers } from '@/domain/trackers';
import { client } from '@/solarxr/client';
import { toPlain, type Plain } from '@/solarxr/plain';
import {
BONES_FEED,
bonesFeedConfig,
TRACKERS_FEED,
trackersFeedConfig,
} from './config';
export type Bone = Plain<BoneT>;
export type ServerGuards = Plain<ServerGuardsT>;
function sameGuards(a: ServerGuards | null, b: ServerGuards | null) {
if (a === null || b === null) return a === b;
return (
a.yawReset === b.yawReset &&
a.mountingReset === b.mountingReset &&
a.canDoUserHeightCalibration === b.canDoUserHeightCalibration
);
}
// Hot data, replaced every tick: read it in leaves or three.js frame loops
const [bones, setBones] = createSignal<readonly Bone[]>([], { equals: false });
const [serverGuards, setServerGuards] = createSignal<ServerGuards | null>(null, {
equals: sameGuards,
});
export { bones, serverGuards };
export function boneByPart(part: BodyPart): Bone | undefined {
return bones().find((bone) => bone.bodyPart === part);
}
function sendStart(fast: boolean) {
const start = new StartDataFeedT();
start.dataFeeds = [trackersFeedConfig(fast), bonesFeedConfig(fast)];
client.send(start);
}
// Boot service. Starts the feeds on every connect and when the rate pref
// changes, the server replaces the previous feeds on each StartDataFeed.
export function startDatafeed(): () => void {
return createRoot((dispose) => {
createEffect(() => {
const fast = devSetting('fastDataFeed');
if (client.status() === 'connected') untrack(() => sendStart(fast));
});
onCleanup(
client.on(DataFeedUpdateT, (update) => {
if (update.index === TRACKERS_FEED) {
ingestTrackers(update, performance.now());
setServerGuards(update.serverGuards && toPlain(update.serverGuards));
} else if (update.index === BONES_FEED) {
setBones(toPlain(update.bones));
}
})
);
return dispose;
});
}
// Tests and HMR
export function resetDatafeed() {
setBones([]);
setServerGuards(null);
}
-15
View File
@@ -1,15 +0,0 @@
export {
BONES_FEED,
bonesFeedConfig,
TRACKERS_FEED,
trackersFeedConfig,
} from './config';
export {
boneByPart,
bones,
resetDatafeed,
serverGuards,
startDatafeed,
type Bone,
type ServerGuards,
} from './datafeed';
@@ -1,7 +0,0 @@
export {
debugPref,
devSetting,
devSettingsPref,
type DevFlag,
type DevSettings,
} from './prefs';
@@ -1,26 +0,0 @@
import * as v from 'valibot';
import { definePref } from '@/lib/storage';
const devSettingsSchema = v.looseObject({
highContrast: v.optional(v.boolean(), false),
preciseRotation: v.optional(v.boolean(), false),
fastDataFeed: v.optional(v.boolean(), false),
rawSlimeRotation: v.optional(v.boolean(), false),
});
export type DevSettings = v.InferOutput<typeof devSettingsSchema>;
export type DevFlag =
'highContrast' | 'preciseRotation' | 'fastDataFeed' | 'rawSlimeRotation';
export const debugPref = definePref('debug', v.boolean(), false);
export const devSettingsPref = definePref('devSettings', devSettingsSchema, {
highContrast: false,
preciseRotation: false,
fastDataFeed: false,
rawSlimeRotation: false,
});
export function devSetting(key: DevFlag): boolean {
return debugPref() && devSettingsPref()[key] === true;
}
Loaded 100 of 606 files, more files were not shown because too many files have changed in this diff. Show more