fedipod-server 0.16.0 → 0.17.0

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.
@@ -14,10 +14,11 @@ import { createAccountWithPod, mintCredential, makeDpopSession, revokeCredential
14
14
  import { generateKeys, wrapKeys } from './keystore.mjs';
15
15
  import { BrowserRemotePod } from './pod-remote.mjs';
16
16
  import * as podState from '../../lib/pod/state.mjs';
17
+ import { resourceExists } from '../../lib/pod/root.mjs';
17
18
  import { cacheOpenedKeys } from './keys-browser.mjs';
18
19
 
19
20
  // The container everything the agent publishes hangs under. New pods made here
20
- // use `fedipod/`; the agent's own default stays `activitypods-js/` for installs
21
+ // use `fedipod/`; new installs default to `fedipod/` too, and older ones keep
21
22
  // that predate this, so those pods are untouched. The name is stored on the
22
23
  // credential and the config, so the agent reads it rather than guessing.
23
24
  export const AP_ROOT = 'fedipod/';
@@ -102,6 +103,7 @@ export async function signUp(answers, { onStep = () => {}, frontOrigin = null }
102
103
  acct.running('checking your pod');
103
104
  const head = await fetch(brought, { method: 'HEAD' }).catch(() => null);
104
105
  if (!head || head.status >= 400) throw new Error(`the pod at ${brought} did not answer (HTTP ${head?.status || 'no response'})`);
106
+ if (await resourceExists(fetch, actorUrlFor(brought))) throw new Error('The pod already hosts a FediPod account. If you want a second account, put it on a different pod.');
105
107
  prog.pod = brought;
106
108
  acct.skip('using the pod you brought');
107
109
  }