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

plc histories

Changed files
+194 -5
+194 -5
index.html
··· 390 390 this.loading = false; 391 391 }, 392 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 + })); 393 471 }) 394 472 </script> 395 473 </head> ··· 449 527 x-data="pdsCheck(pds)" 450 528 x-init="$watch('pds', v => update(v))" 451 529 > 452 - <h3 class="text-lg"> 530 + <h3 class="text-lg mt-3"> 453 531 Server 454 532 <span 455 533 x-show="description !== null" ··· 544 622 </template> 545 623 </div> 546 624 547 - <h3 class="text-lg">Relay host status</h3> 625 + <h3 class="text-lg mt-3">Relay host status</h3> 548 626 <div class="overflow-x-auto overflow-y-auto max-h-33"> 549 627 <table class="table table-xs"> 550 628 <tbody> ··· 614 692 </h2> 615 693 <template x-if="pds != null"> 616 694 <div x-data="didRepoState(did, pds)"> 617 - <h3 class="text-lg"> 695 + <h3 class="text-lg mt-3"> 618 696 Repo 619 697 <span 620 698 x-show="state && state.active" ··· 645 723 </table> 646 724 </div> 647 725 648 - <h3 class="text-lg"> 726 + <h3 class="text-lg mt-3"> 649 727 Relay repo status 650 728 </h3> 651 729 <div class="overflow-x-auto overflow-y-auto max-h-33"> ··· 697 775 </tbody> 698 776 </table> 699 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> 700 835 </div> 701 836 </template> 702 837 </div> 703 838 </div> 704 839 </template> 705 840 706 - <template x-if="handle != null"> 841 + <template x-if="handle !== null"> 707 842 <div class="card bg-base-100 w-full max-w-lg shrink-0 shadow-2xl"> 708 843 <div 709 844 x-data="checkHandle(handle)" ··· 714 849 <span class="badge badge-secondary">Handle</span> 715 850 <span x-text="handle"></span> 716 851 </h2> 852 + 853 + <h3 class="text-lg mt-3"> 854 + Resolution 855 + </h3> 717 856 <p x-show="loading" class="text-i">Loading&hellip;</p> 718 857 <div x-show="!loading" class="overflow-x-auto"> 719 858 <table class="table table-xs"> ··· 747 886 </tbody> 748 887 </table> 749 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> 750 939 </div> 751 940 </div> 752 941 </template>