Diagnostics for atproto PDS hosts, DIDs, and handles: https://debug.hose.cam

add accounts preview

Changed files
+64
+64
index.html
··· 78 78 did: null, 79 79 handle: null, 80 80 81 + async goto(identifier) { 82 + this.identifier = identifier; 83 + await this.diagnose(); 84 + }, 85 + 81 86 async diagnose() { 82 87 this.identifierLoading = true; 83 88 this.identifierError = null; ··· 139 144 loadingDesc: false, 140 145 error: null, 141 146 description: null, 147 + accounts: [], 148 + accountsComplete: false, 142 149 143 150 async init() { 144 151 await this.update(pds); ··· 148 155 this.loadingDesc = true; 149 156 this.error = null; 150 157 this.description = null; 158 + this.accounts = []; 151 159 let query = window.SimpleQuery(pds); 152 160 try { 153 161 this.description = await query('com.atproto.server.describeServer'); 162 + } catch (e) { 163 + if (window.isXrpcErr(e)) { 164 + this.error = e.error; 165 + } else { 166 + this.error = 'Failed to reach (see console)'; 167 + console.error(e); 168 + } 169 + } 170 + let accountsRes; 171 + try { 172 + accountsRes = await query('com.atproto.sync.listRepos', { 173 + params: { limit: 7 }, 174 + }); 175 + this.accounts = accountsRes.repos; 176 + this.accountsComplete == !accountsRes.cursor; 154 177 } catch (e) { 155 178 if (window.isXrpcErr(e)) { 156 179 this.error = e.error; ··· 328 351 x-text="!description.inviteCodeRequired" 329 352 ></td> 330 353 </tr> 354 + </tbody> 355 + </table> 356 + <h4 class="font-bold"> 357 + Accounts 358 + </h4> 359 + <table class="table table-xs"> 360 + <tbody> 361 + <template x-for="account in accounts"> 362 + <tr> 363 + <td> 364 + <code> 365 + <a 366 + href="#" 367 + class="link" 368 + x-text="account.did" 369 + @click.prevent="goto(account.did)" 370 + ></a> 371 + </code> 372 + </td> 373 + <td> 374 + <span 375 + x-show="account.active" 376 + class="badge badge-sm badge-soft badge-success" 377 + > 378 + active 379 + </span> 380 + <span 381 + x-show="!account.active" 382 + x-text="account.status" 383 + class="badge badge-sm badge-soft badge-warning" 384 + ></span> 385 + </td> 386 + </tr> 387 + </template> 388 + <template x-if="!accountsComplete"> 389 + <tr> 390 + <td colspan="2" class="text-sm text-warning-content"> 391 + (account list clipped) 392 + </td> 393 + </tr> 394 + </template> 331 395 </tbody> 332 396 </table> 333 397 </div>