aegis-desktop 1.0.6 → 1.0.8

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.
@@ -1,5 +1,10 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-or-later
2
2
  // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
+ // AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
4
+ // Conveying a modified copy, or running one as a network service, owes the
5
+ // corresponding source under this licence (§5/§13) — see LICENSING.md.
6
+ // SPDX-License-Identifier: AGPL-3.0-or-later
7
+ // Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
3
8
  'use strict';
4
9
 
5
10
  /**
@@ -8,15 +13,7 @@
8
13
  * Pure: Electron, the store and the provisioner are injected.
9
14
  */
10
15
 
11
- function provisionFailureText(result) {
12
- const err = result && result.error;
13
- if (!err) return 'the server returned no account key';
14
- if (err.status === 429) return 'too many sign-ups from this network — try again later';
15
- if (!err.status || err.status === 408 || err.status >= 500) return 'could not reach aegiscloud.org';
16
- return `the server refused the request (HTTP ${err.status})`;
17
- }
18
-
19
- function createAccountKey({ aegis, credentials, persistKey, provision, onChange }) {
16
+ function createAccountKey({ aegis, credentials, persistKey, provision, describeFailure, onChange }) {
20
17
  let failure = null;
21
18
  let inFlight = null;
22
19
 
@@ -26,7 +23,7 @@ function createAccountKey({ aegis, credentials, persistKey, provision, onChange
26
23
  }
27
24
 
28
25
  function recordStartup(result) {
29
- failure = (result.key || aegis.apiKey) ? null : provisionFailureText(result);
26
+ failure = (result.key || aegis.apiKey) ? null : describeFailure(result);
30
27
  onChange(status());
31
28
  }
32
29
 
@@ -39,7 +36,7 @@ function createAccountKey({ aegis, credentials, persistKey, provision, onChange
39
36
  persistKey(result.key);
40
37
  failure = null;
41
38
  } else {
42
- failure = provisionFailureText(result);
39
+ failure = describeFailure(result);
43
40
  }
44
41
  const state = status();
45
42
  onChange(state);
@@ -60,4 +57,4 @@ function startupKeyOverride({ mintedKey, hostKey }) {
60
57
  return mintedKey && hostKey && hostKey !== mintedKey ? hostKey : null;
61
58
  }
62
59
 
63
- module.exports = { createAccountKey, provisionFailureText, startupKeyOverride };
60
+ module.exports = { createAccountKey, startupKeyOverride };