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

plc histories

Changed files
+194 -5
+194 -5
index.html
··· 390 this.loading = false; 391 }, 392 })); 393 }) 394 </script> 395 </head> ··· 449 x-data="pdsCheck(pds)" 450 x-init="$watch('pds', v => update(v))" 451 > 452 - <h3 class="text-lg"> 453 Server 454 <span 455 x-show="description !== null" ··· 544 </template> 545 </div> 546 547 - <h3 class="text-lg">Relay host status</h3> 548 <div class="overflow-x-auto overflow-y-auto max-h-33"> 549 <table class="table table-xs"> 550 <tbody> ··· 614 </h2> 615 <template x-if="pds != null"> 616 <div x-data="didRepoState(did, pds)"> 617 - <h3 class="text-lg"> 618 Repo 619 <span 620 x-show="state && state.active" ··· 645 </table> 646 </div> 647 648 - <h3 class="text-lg"> 649 Relay repo status 650 </h3> 651 <div class="overflow-x-auto overflow-y-auto max-h-33"> ··· 697 </tbody> 698 </table> 699 </div> 700 </div> 701 </template> 702 </div> 703 </div> 704 </template> 705 706 - <template x-if="handle != null"> 707 <div class="card bg-base-100 w-full max-w-lg shrink-0 shadow-2xl"> 708 <div 709 x-data="checkHandle(handle)" ··· 714 <span class="badge badge-secondary">Handle</span> 715 <span x-text="handle"></span> 716 </h2> 717 <p x-show="loading" class="text-i">Loading&hellip;</p> 718 <div x-show="!loading" class="overflow-x-auto"> 719 <table class="table table-xs"> ··· 747 </tbody> 748 </table> 749 </div> 750 </div> 751 </div> 752 </template>
··· 390 this.loading = false; 391 }, 392 })); 393 + 394 + Alpine.data('pdsHistory', (did, currentPds) => ({ 395 + loading: false, 396 + error: null, 397 + history: [], 398 + 399 + async init() { 400 + this.loading = true; 401 + this.error = null; 402 + this.history = []; 403 + try { 404 + const res = await fetch(`https://plc.directory/${did}/log/audit`); 405 + if (res.ok) { 406 + const log = await res.json(); 407 + const seen = new Set(); 408 + seen.add(currentPds); 409 + for (op of log) { 410 + const opPds = op.operation.services.atproto_pds.endpoint; 411 + if (seen.has(opPds)) continue; 412 + seen.add(opPds); 413 + this.history.push({ 414 + pds: opPds, 415 + date: op.createdAt, 416 + }); 417 + } 418 + this.history.reverse(); 419 + } else { 420 + this.error = `${res.status}: ${await res.text()}`; 421 + } 422 + } catch (e) { 423 + this.error = 'failed to get history'; 424 + console.error(e); 425 + } 426 + this.loading = false; 427 + }, 428 + })); 429 + 430 + Alpine.data('handleHistory', (did, currentHandle) => ({ 431 + loading: false, 432 + error: null, 433 + history: [], 434 + 435 + async init() { 436 + this.loading = true; 437 + this.error = null; 438 + this.history = []; 439 + try { 440 + const res = await fetch(`https://plc.directory/${did}/log/audit`); 441 + if (res.ok) { 442 + const log = await res.json(); 443 + const seen = new Set(); 444 + seen.add(currentHandle); 445 + for (op of log) { 446 + let opHandle = null; 447 + for (aka of op.operation.alsoKnownAs) { 448 + if (aka.startsWith("at://")) { 449 + opHandle = aka.slice("at://".length); 450 + break; 451 + } 452 + } 453 + if (seen.has(opHandle)) continue; 454 + seen.add(opHandle); 455 + this.history.push({ 456 + handle: opHandle, 457 + date: op.createdAt, 458 + }); 459 + } 460 + this.history.reverse(); 461 + } else { 462 + this.error = `${res.status}: ${await res.text()}`; 463 + } 464 + } catch (e) { 465 + this.error = 'failed to get history'; 466 + console.error(e); 467 + } 468 + this.loading = false; 469 + }, 470 + })); 471 }) 472 </script> 473 </head> ··· 527 x-data="pdsCheck(pds)" 528 x-init="$watch('pds', v => update(v))" 529 > 530 + <h3 class="text-lg mt-3"> 531 Server 532 <span 533 x-show="description !== null" ··· 622 </template> 623 </div> 624 625 + <h3 class="text-lg mt-3">Relay host status</h3> 626 <div class="overflow-x-auto overflow-y-auto max-h-33"> 627 <table class="table table-xs"> 628 <tbody> ··· 692 </h2> 693 <template x-if="pds != null"> 694 <div x-data="didRepoState(did, pds)"> 695 + <h3 class="text-lg mt-3"> 696 Repo 697 <span 698 x-show="state && state.active" ··· 723 </table> 724 </div> 725 726 + <h3 class="text-lg mt-3"> 727 Relay repo status 728 </h3> 729 <div class="overflow-x-auto overflow-y-auto max-h-33"> ··· 775 </tbody> 776 </table> 777 </div> 778 + 779 + <template x-if="did.startsWith('did:plc:')"> 780 + <div x-data="pdsHistory(did, pds)"> 781 + <h3 class="text-lg mt-3"> 782 + PLC PDS history 783 + </h3> 784 + <div class="overflow-x-auto"> 785 + <table class="table table-xs"> 786 + <tbody> 787 + <template x-if="loading"> 788 + <tr> 789 + <td>Loading&hellip;</td> 790 + </tr> 791 + </template> 792 + <template x-if="error"> 793 + <tr> 794 + <td>Error: <span x-text="error"></span></td> 795 + </tr> 796 + </template> 797 + <template x-if="!loading && !error && history.length === 0"> 798 + <tr> 799 + <td class="text-sm"> 800 + <em>no previous PDS</em> 801 + </td> 802 + </tr> 803 + </template> 804 + <template x-for="event in history"> 805 + <tr x-data="didRepoState(did, event.pds)"> 806 + <td> 807 + <code x-text="event.date.split('T')[0]"></code> 808 + </td> 809 + <td> 810 + <a 811 + href="#" 812 + class="link" 813 + @click.prevent="goto(event.pds)" 814 + x-text="event.pds" 815 + ></a> 816 + </td> 817 + <td> 818 + <span 819 + x-show="state && !state.active" 820 + x-text="state && state.status" 821 + class="badge badge-sm badge-soft badge-success" 822 + ></span> 823 + <span 824 + x-show="state && state.active" 825 + class="badge badge-sm badge-soft badge-warning" 826 + >active</span> 827 + </td> 828 + </tr> 829 + </template> 830 + </tbody> 831 + </table> 832 + </div> 833 + </div> 834 + </template> 835 </div> 836 </template> 837 </div> 838 </div> 839 </template> 840 841 + <template x-if="handle !== null"> 842 <div class="card bg-base-100 w-full max-w-lg shrink-0 shadow-2xl"> 843 <div 844 x-data="checkHandle(handle)" ··· 849 <span class="badge badge-secondary">Handle</span> 850 <span x-text="handle"></span> 851 </h2> 852 + 853 + <h3 class="text-lg mt-3"> 854 + Resolution 855 + </h3> 856 <p x-show="loading" class="text-i">Loading&hellip;</p> 857 <div x-show="!loading" class="overflow-x-auto"> 858 <table class="table table-xs"> ··· 886 </tbody> 887 </table> 888 </div> 889 + 890 + <template x-if="did !== null && did.startsWith('did:plc:')"> 891 + 892 + <div x-data="handleHistory(did, handle)"> 893 + <h3 class="text-lg mt-3"> 894 + PLC handle history 895 + </h3> 896 + <div class="overflow-x-auto"> 897 + <table class="table table-xs"> 898 + <tbody> 899 + <template x-if="loading"> 900 + <tr> 901 + <td>Loading&hellip;</td> 902 + </tr> 903 + </template> 904 + <template x-if="error"> 905 + <tr> 906 + <td>Error: <span x-text="error"></span></td> 907 + </tr> 908 + </template> 909 + <template x-if="!loading && !error && history.length === 0"> 910 + <tr> 911 + <td class="text-sm"> 912 + <em>no previous handle</em> 913 + </td> 914 + </tr> 915 + </template> 916 + <template x-for="event in history"> 917 + <tr> 918 + <td> 919 + <code x-text="event.date.split('T')[0]"></code> 920 + </td> 921 + <td> 922 + <a 923 + href="#" 924 + class="link" 925 + @click.prevent="goto(event.handle)" 926 + x-text="event.handle" 927 + ></a> 928 + </td> 929 + </tr> 930 + </template> 931 + </tbody> 932 + </table> 933 + </div> 934 + </div> 935 + 936 + 937 + 938 + </template> 939 </div> 940 </div> 941 </template>