@walldock/agent 0.2.3 → 0.2.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.
Files changed (2) hide show
  1. package/dist/auth.js +9 -2
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -134,8 +134,15 @@ async function validateStoredToken(api) {
134
134
  }
135
135
  return { token, deviceId: v.deviceId, deviceName: v.deviceName };
136
136
  }
137
- catch {
138
- // Network error try cached identity for offline start
137
+ catch (err) {
138
+ // Auth errors mean the token is genuinely invalid — clear it and re-pair
139
+ const msg = err instanceof Error ? err.message.toLowerCase() : '';
140
+ if (msg.includes('invalid device token') || msg.includes('http 401') || msg.includes('http 403')) {
141
+ await storage.deleteDeviceToken();
142
+ await storage.clearDeviceIdentity();
143
+ return null;
144
+ }
145
+ // Genuine network error (offline, timeout) — start offline with cached identity
139
146
  const cached = await storage.getDeviceIdentity();
140
147
  if (cached)
141
148
  return { token, ...cached };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walldock/agent",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Walldock desktop agent — sync wallpapers across all your screens",
5
5
  "license": "MIT",
6
6
  "main": "dist/main.js",