From edfb8fa07847609bed51db6f805d02a29d732585 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 20 Dec 2025 12:10:48 -0500 Subject: [PATCH] empty identifier, did input, watch pds --- index.html | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 2fc2a76..96cf130 100644 --- a/index.html +++ b/index.html @@ -84,7 +84,10 @@ this.pds = null; this.did = null; this.handle = null; - if (this.identifier.startsWith('https://')) { + this.identifier = this.identifier.trim(); + if (this.identifier === '') { + // do nothing + } else if (this.identifier.startsWith('https://')) { this.pds = this.identifier; } else { if (this.identifier.startsWith('at://')) { @@ -92,6 +95,22 @@ } if (this.identifier.startsWith('did:')) { this.did = this.identifier; + let data; + try { + data = await window.slingshot('com.bad-example.identity.resolveMiniDoc', { + params: { identifier: this.identifier }, + }); + this.pds = data.pds; + this.handle = data.handle; + } catch (e) { + if (window.isXrpcErr(e)) { + this.identifierError = e.error; + if (e.message) this.description += ` ${e.description}`; + } else { + this.identifierError = 'Failed to resolve identifier, see console for error.'; + console.error(e); + } + } } else { this.handle = this.identifier; let data; @@ -117,12 +136,16 @@ })); Alpine.data('pdsCheck', pds => ({ - loading: false, + loadingDesc: false, error: null, description: null, async init() { - this.loading = true; + await this.update(pds); + }, + + async update(pds) { + this.loadingDesc = true; this.error = null; this.description = null; let query = window.SimpleQuery(pds); @@ -136,8 +159,8 @@ console.error(e); } } - this.loading = false; - } + this.loadingDesc = false; + }, })); Alpine.data('relayCheckHost', (pds, relay) => ({ @@ -148,10 +171,10 @@ reqCrawlError: null, async init() { - await this.check(); + await this.check(pds, relay); }, - async check() { + async check(pds, relay) { this.loading = true; this.error = null; this.status = null; @@ -176,7 +199,7 @@ this.reqCrawlError = null; }, - async requestCrawl() { + async requestCrawl(pds, relay) { this.reqCrawlStatus = "loading"; const proc = window.SimpleProc(`https://${relay.hostname}`); const hostname = pds.split('://')[1]; @@ -281,7 +304,10 @@ -
+

Server online

+

Loading…

+