+42
-11
index.html
+42
-11
index.html
···
84
84
this.pds = null;
85
85
this.did = null;
86
86
this.handle = null;
87
-
if (this.identifier.startsWith('https://')) {
87
+
this.identifier = this.identifier.trim();
88
+
if (this.identifier === '') {
89
+
// do nothing
90
+
} else if (this.identifier.startsWith('https://')) {
88
91
this.pds = this.identifier;
89
92
} else {
90
93
if (this.identifier.startsWith('at://')) {
···
92
95
}
93
96
if (this.identifier.startsWith('did:')) {
94
97
this.did = this.identifier;
98
+
let data;
99
+
try {
100
+
data = await window.slingshot('com.bad-example.identity.resolveMiniDoc', {
101
+
params: { identifier: this.identifier },
102
+
});
103
+
this.pds = data.pds;
104
+
this.handle = data.handle;
105
+
} catch (e) {
106
+
if (window.isXrpcErr(e)) {
107
+
this.identifierError = e.error;
108
+
if (e.message) this.description += ` ${e.description}`;
109
+
} else {
110
+
this.identifierError = 'Failed to resolve identifier, see console for error.';
111
+
console.error(e);
112
+
}
113
+
}
95
114
} else {
96
115
this.handle = this.identifier;
97
116
let data;
···
117
136
}));
118
137
119
138
Alpine.data('pdsCheck', pds => ({
120
-
loading: false,
139
+
loadingDesc: false,
121
140
error: null,
122
141
description: null,
123
142
124
143
async init() {
125
-
this.loading = true;
144
+
await this.update(pds);
145
+
},
146
+
147
+
async update(pds) {
148
+
this.loadingDesc = true;
126
149
this.error = null;
127
150
this.description = null;
128
151
let query = window.SimpleQuery(pds);
···
136
159
console.error(e);
137
160
}
138
161
}
139
-
this.loading = false;
140
-
}
162
+
this.loadingDesc = false;
163
+
},
141
164
}));
142
165
143
166
Alpine.data('relayCheckHost', (pds, relay) => ({
···
148
171
reqCrawlError: null,
149
172
150
173
async init() {
151
-
await this.check();
174
+
await this.check(pds, relay);
152
175
},
153
176
154
-
async check() {
177
+
async check(pds, relay) {
155
178
this.loading = true;
156
179
this.error = null;
157
180
this.status = null;
···
176
199
this.reqCrawlError = null;
177
200
},
178
201
179
-
async requestCrawl() {
202
+
async requestCrawl(pds, relay) {
180
203
this.reqCrawlStatus = "loading";
181
204
const proc = window.SimpleProc(`https://${relay.hostname}`);
182
205
const hostname = pds.split('://')[1];
···
281
304
<span x-text="pds"></span>
282
305
</h2>
283
306
284
-
<div x-data="pdsCheck(pds)">
307
+
<div
308
+
x-data="pdsCheck(pds)"
309
+
x-init="$watch('pds', v => update(v))"
310
+
>
285
311
<h3 class="text-lg">
286
312
Server
287
313
<span
···
289
315
class="badge badge-sm badge-soft badge-success"
290
316
>online</span>
291
317
</h3>
318
+
<p x-show="loadingDesc">Loading…</p>
319
+
<p x-show="error" class="text-warning" x-text="error"></p>
292
320
<template x-if="description !== null">
293
321
<div class="overflow-x-auto">
294
322
<table class="table table-xs">
···
311
339
<table class="table table-xs">
312
340
<tbody>
313
341
<template x-for="relay in window.relays">
314
-
<tr x-data="relayCheckHost(pds, relay)">
342
+
<tr
343
+
x-data="relayCheckHost(pds, relay)"
344
+
x-init="$watch('pds', pds => check(pds, relay))"
345
+
>
315
346
<td x-text="relay.name" class="text-sm"></td>
316
347
<td>
317
348
<template x-if="loading">
···
337
368
x-show="reqCrawlStatus !== 'done'"
338
369
class="btn btn-xs btn-ghost whitespace-nowrap"
339
370
:disabled="reqCrawlStatus === 'loading'"
340
-
@click="requestCrawl"
371
+
@click="requestCrawl(pds, relay)"
341
372
>
342
373
request crawl
343
374
</button>