diff --git a/index.html b/index.html index 847be0b..7e5b499 100644 --- a/index.html +++ b/index.html @@ -362,6 +362,39 @@ }, })); + Alpine.data('repoSize', () => ({ + lading: false, + error: null, + size: null, + + async loadRepoForSize(did, pds) { + this.loading = true; + + if (!did || !pds) { + this.loading = false; + return; + } + const query = window.SimpleQuery(pds); + try { + const res = await query('com.atproto.sync.getRepo', { + params: { did }, + as: 'blob', + }); + let bytes = res.size; + let mbs = bytes / Math.pow(2, 20); + this.size = mbs.toFixed(1); + } catch (e) { + if (window.isXrpcErr(e)) { + this.error = e.error; + } else { + this.error = 'failed (see console)'; + console.error(e); + } + } + this.loading = false; + }, + })); + Alpine.data('relayCheckRepo', (did, relay) => ({ loading: false, error: null, @@ -727,6 +760,30 @@ > +
+ MiB
+
+
+
+
+
+
+