Client side atproto account migrator in your web browser, along with services for backups and adversarial migrations.

Invite Code is now optional

Changed files
+15 -11
src
+3 -3
index.html
··· 25 25 newPds: '', 26 26 newEmail: '', 27 27 newHandle: '', 28 - inviteCode: '', 28 + inviteCode: null, 29 29 twoFactorCode: null, 30 30 confirmation: false, 31 31 showTwoFactorCodeInput: false, ··· 178 178 179 179 <div class="form-group"> 180 180 <label for="invite-code">Invite Code:</label> 181 - <input type="text" id="invite-code" name="invite-code" placeholder="Invite code from your new PDS" 182 - x-model="inviteCode" required> 181 + <input type="text" id="invite-code" name="invite-code" placeholder="Invite code from your new PDS (Leave blank if you don't have one)" 182 + x-model="inviteCode"> 183 183 </div> 184 184 </div> 185 185 <div class="form-group">
+12 -8
src/pdsmoover.js
··· 54 54 * @param {string} newPdsUrl - The new URL for your pds. Like https://coolnewpds.com 55 55 * @param {string} newEmail - The email you want to use on the new pds (can be the same as the previous one as long as it's not already being used on the new pds) 56 56 * @param {string} newHandle - The new handle you want, like alice.bsky.social, or if you already have a domain name set as a handle can use it myname.com. 57 - * @param {string} inviteCode - The invite code you got from the PDS you are migrating to 57 + * @param {string|null} inviteCode - The invite code you got from the PDS you are migrating to. If null does not include one 58 58 * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI. Like (status) => console.log(status) 59 59 * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required 60 60 */ ··· 114 114 }); 115 115 const serviceJwt = createAuthResp.data.token; 116 116 117 - const createNewAccount = await newAgent.com.atproto.server.createAccount({ 117 + let createAccountRequest = { 118 118 did: usersDid, 119 119 handle: newHandle, 120 120 email: newEmail, 121 121 password: password, 122 - inviteCode: inviteCode, 123 - }, 124 - { 125 - headers: {authorization: `Bearer ${serviceJwt}`}, 126 - encoding: 'application/json', 127 - }); 122 + }; 123 + if (inviteCode) { 124 + createAccountRequest.inviteCode = inviteCode; 125 + } 126 + const createNewAccount = await newAgent.com.atproto.server.createAccount( 127 + createAccountRequest, 128 + { 129 + headers: {authorization: `Bearer ${serviceJwt}`}, 130 + encoding: 'application/json', 131 + }); 128 132 129 133 if (createNewAccount.data.did !== usersDid.toString()) { 130 134 throw new Error('Did not create the new account with the same did as the old account');