dsh-dock 0.9.5 → 0.9.7
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/LICENSE +18 -18
- package/README.md +325 -325
- package/client.js +42 -8
- package/cordis.patch.yml +2 -2
- package/features/animation/host.js +660 -660
- package/features/animation/view.jsx +2247 -2247
- package/features/balance/host.js +494 -494
- package/features/balance/view.js +351 -351
- package/features/games/games/breakout.jsx +227 -227
- package/features/games/games/gomoku.jsx +244 -244
- package/features/games/games/racer.jsx +169 -169
- package/features/games/games/shared.jsx +118 -118
- package/features/games/games/snake.jsx +144 -144
- package/features/games/games/sokoban.jsx +180 -180
- package/features/games/games/tank.jsx +128 -128
- package/features/games/games/tetris.jsx +308 -308
- package/features/games/games/xiangqi.jsx +277 -277
- package/features/games/tank-core.js +152 -152
- package/features/games/view.jsx +639 -639
- package/features/games/xiangqi-core.js +299 -299
- package/features/heartbeat/view.js +35 -35
- package/features/mobile-relay/gateway.js +472 -415
- package/features/mobile-relay/host.js +570 -546
- package/features/mobile-relay/view.jsx +300 -300
- package/features/modelconfig/host.js +403 -403
- package/features/modelconfig/view.js +490 -490
- package/features/theme/view.js +61 -61
- package/features/tokenlog/host.js +678 -678
- package/features/tokenlog/view.jsx +561 -561
- package/features/visionproxy/host.js +315 -315
- package/index.js +175 -118
- package/package.json +59 -59
- package/src/client.jsx +668 -668
- package/src/host-core.js +98 -95
- package/src/shared.js +167 -130
package/client.js
CHANGED
|
@@ -2179,22 +2179,56 @@ function initFeatureState(defs) {
|
|
|
2179
2179
|
if (typeof saved === "boolean") enabled = saved;
|
|
2180
2180
|
featureState.set(f.id, { enabled, error: null });
|
|
2181
2181
|
}
|
|
2182
|
+
syncFeatureStateFromHost(defs);
|
|
2183
|
+
}
|
|
2184
|
+
function syncFeatureStateFromHost(defs) {
|
|
2185
|
+
if (typeof fetch !== "function") return;
|
|
2186
|
+
fetch("/dsh-dock/features").then(async (res) => {
|
|
2187
|
+
if (!res.ok) return;
|
|
2188
|
+
const data = await res.json().catch(() => null);
|
|
2189
|
+
const persisted = data && data.ok && data.data && data.data.persisted;
|
|
2190
|
+
if (!persisted || typeof persisted !== "object") return;
|
|
2191
|
+
let changed = false;
|
|
2192
|
+
for (const f of defs) {
|
|
2193
|
+
if (featurePersist.map[f.id] !== void 0) continue;
|
|
2194
|
+
const v = persisted[f.id];
|
|
2195
|
+
if (typeof v === "boolean") {
|
|
2196
|
+
const st = stateOf(f.id);
|
|
2197
|
+
if (st.enabled !== v) {
|
|
2198
|
+
st.enabled = v;
|
|
2199
|
+
changed = true;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
if (changed) notifyState();
|
|
2204
|
+
}).catch(() => {
|
|
2205
|
+
});
|
|
2182
2206
|
}
|
|
2183
|
-
function
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2207
|
+
function pushFeatureEnabledToHost(id, enabled) {
|
|
2208
|
+
if (typeof fetch !== "function") return;
|
|
2209
|
+
fetch("/dsh-dock/features", {
|
|
2210
|
+
method: "POST",
|
|
2211
|
+
headers: { "content-type": "application/json" },
|
|
2212
|
+
body: JSON.stringify({ id, enabled })
|
|
2213
|
+
}).catch(() => {
|
|
2214
|
+
});
|
|
2190
2215
|
}
|
|
2191
2216
|
function toggleFeature(id) {
|
|
2192
2217
|
const st = stateOf(id);
|
|
2193
2218
|
st.enabled = !st.enabled;
|
|
2194
2219
|
featurePersist.map[id] = st.enabled;
|
|
2195
2220
|
persistFeatureEnabled();
|
|
2221
|
+
pushFeatureEnabledToHost(id, st.enabled);
|
|
2196
2222
|
notifyState();
|
|
2197
2223
|
}
|
|
2224
|
+
function stateOf(id) {
|
|
2225
|
+
let st = featureState.get(id);
|
|
2226
|
+
if (!st) {
|
|
2227
|
+
st = { enabled: true, error: null };
|
|
2228
|
+
featureState.set(id, st);
|
|
2229
|
+
}
|
|
2230
|
+
return st;
|
|
2231
|
+
}
|
|
2198
2232
|
function subscribeFeatureState(fn) {
|
|
2199
2233
|
stateListeners.add(fn);
|
|
2200
2234
|
return () => {
|
|
@@ -10107,7 +10141,7 @@ var feature8 = {
|
|
|
10107
10141
|
};
|
|
10108
10142
|
|
|
10109
10143
|
// src/client.jsx
|
|
10110
|
-
var DOCK_VERSION = "0.9.
|
|
10144
|
+
var DOCK_VERSION = "0.9.7";
|
|
10111
10145
|
var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6, feature7, feature8];
|
|
10112
10146
|
var PLANNED_FEATURES = [];
|
|
10113
10147
|
var PLANNED_NOTES = {};
|
package/cordis.patch.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
- insert:
|
|
2
|
-
- id: dsh-dock
|
|
1
|
+
- insert:
|
|
2
|
+
- id: dsh-dock
|
|
3
3
|
name: dsh-dock
|