openclaw-mobile 1.0.3 → 1.0.4
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/index.ts +18 -7
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -184,6 +184,10 @@ function getRelayState(accountId: string): RelayState {
|
|
|
184
184
|
|
|
185
185
|
// ── Account resolution ───────────────────────────────────────────────────────
|
|
186
186
|
|
|
187
|
+
/** Default relay deployed at https://github.com/openclaw/openclaw-mobile */
|
|
188
|
+
const DEFAULT_RELAY_URL = "wss://openclaw-relay.eldermoo8718.workers.dev";
|
|
189
|
+
const DEFAULT_ROOM_ID = "default";
|
|
190
|
+
|
|
187
191
|
interface ResolvedAccount {
|
|
188
192
|
accountId: string;
|
|
189
193
|
enabled: boolean;
|
|
@@ -194,22 +198,28 @@ interface ResolvedAccount {
|
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
function listAccountIds(cfg: any): string[] {
|
|
197
|
-
|
|
201
|
+
const ids = Object.keys(
|
|
198
202
|
cfg.channels?.[CHANNEL_ID]?.accounts ?? {}
|
|
199
203
|
);
|
|
204
|
+
// Always expose at least the default account so the Control UI
|
|
205
|
+
// shows a pre-filled entry without the user having to click "Add Entry".
|
|
206
|
+
if (!ids.includes(DEFAULT_ACCOUNT_ID)) ids.unshift(DEFAULT_ACCOUNT_ID);
|
|
207
|
+
return ids;
|
|
200
208
|
}
|
|
201
209
|
|
|
202
210
|
function resolveAccount(cfg: any, accountId?: string): ResolvedAccount {
|
|
203
211
|
const id = accountId ?? DEFAULT_ACCOUNT_ID;
|
|
204
212
|
const acct =
|
|
205
213
|
cfg.channels?.[CHANNEL_ID]?.accounts?.[id] ?? {};
|
|
214
|
+
const relayUrl = acct.relayUrl || DEFAULT_RELAY_URL;
|
|
215
|
+
const roomId = acct.roomId || DEFAULT_ROOM_ID;
|
|
206
216
|
return {
|
|
207
217
|
accountId: id,
|
|
208
218
|
enabled: acct.enabled !== false,
|
|
209
|
-
relayUrl
|
|
219
|
+
relayUrl,
|
|
210
220
|
relayToken: acct.relayToken ?? "",
|
|
211
|
-
roomId
|
|
212
|
-
configured:
|
|
221
|
+
roomId,
|
|
222
|
+
configured: true, // always ready out of the box with the default relay
|
|
213
223
|
};
|
|
214
224
|
}
|
|
215
225
|
|
|
@@ -248,7 +258,7 @@ const mobileConfigSchema = {
|
|
|
248
258
|
uiHints: {
|
|
249
259
|
relayUrl: {
|
|
250
260
|
label: "Relay URL",
|
|
251
|
-
placeholder:
|
|
261
|
+
placeholder: DEFAULT_RELAY_URL,
|
|
252
262
|
},
|
|
253
263
|
relayToken: {
|
|
254
264
|
label: "Relay Token",
|
|
@@ -256,7 +266,7 @@ const mobileConfigSchema = {
|
|
|
256
266
|
},
|
|
257
267
|
roomId: {
|
|
258
268
|
label: "Room ID",
|
|
259
|
-
placeholder:
|
|
269
|
+
placeholder: DEFAULT_ROOM_ID,
|
|
260
270
|
},
|
|
261
271
|
},
|
|
262
272
|
};
|
|
@@ -309,7 +319,8 @@ const channel = {
|
|
|
309
319
|
accountId: account.accountId,
|
|
310
320
|
enabled: account.enabled,
|
|
311
321
|
configured: account.configured,
|
|
312
|
-
relayUrl: account.relayUrl
|
|
322
|
+
relayUrl: account.relayUrl,
|
|
323
|
+
roomId: account.roomId,
|
|
313
324
|
}),
|
|
314
325
|
},
|
|
315
326
|
outbound: {
|