+87
-2
index.html
+87
-2
index.html
···
143
143
}
144
144
}
145
145
} else {
146
-
this.handle = this.identifier;
146
+
this.handle = this.identifier.toLowerCase();
147
147
let data;
148
148
try {
149
149
data = await window.slingshot('com.bad-example.identity.resolveMiniDoc', {
150
-
params: { identifier: this.identifier },
150
+
params: { identifier: this.identifier.toLowerCase() },
151
151
});
152
152
this.did = data.did;
153
153
this.pds = data.pds;
···
567
567
this.loading = false;
568
568
},
569
569
}));
570
+
571
+
Alpine.data('modLabels', (did) => ({
572
+
loading: false,
573
+
error: null,
574
+
labels: [],
575
+
576
+
async init() {
577
+
this.loading = true;
578
+
this.error = null;
579
+
this.labels = [];
580
+
try {
581
+
const res = await fetch(`https://mod.bsky.app/xrpc/com.atproto.label.queryLabels?uriPatterns=${did}`);
582
+
if (res.ok) {
583
+
const response = await res.json();
584
+
if (response.labels && response.labels.length > 0) {
585
+
this.labels = response.labels;
586
+
}
587
+
} else {
588
+
this.error = `${res.status}: ${await res.text()}`;
589
+
}
590
+
} catch (e) {
591
+
this.error = 'failed to get labels from mod.bsky.app';
592
+
console.error(e);
593
+
}
594
+
this.loading = false;
595
+
},
596
+
}));
570
597
})
571
598
</script>
572
599
</head>
···
1010
1037
</template>
1011
1038
</tr>
1012
1039
</template>
1040
+
</tbody>
1041
+
</table>
1042
+
</div>
1043
+
</div>
1044
+
</template>
1045
+
1046
+
<template x-if="did != null">
1047
+
<div x-data="modLabels(did)">
1048
+
<h3 class="text-lg mt-3">
1049
+
Labels from Bluesky (mod.bsky.app)
1050
+
</h3>
1051
+
<div class="overflow-x-auto">
1052
+
<table class="table table-xs">
1053
+
<template x-if="!loading && !error && labels.length !== 0">
1054
+
<thead>
1055
+
<tr>
1056
+
<th>created</th>
1057
+
<th>exp</th>
1058
+
<th>label</th>
1059
+
</tr>
1060
+
</thead>
1061
+
</template>
1062
+
<tbody>
1063
+
<template x-if="loading">
1064
+
<tr>
1065
+
<td>Loading…</td>
1066
+
</tr>
1067
+
</template>
1068
+
<template x-if="error">
1069
+
<tr>
1070
+
<td>Error: <span x-text="error"></span></td>
1071
+
</tr>
1072
+
</template>
1073
+
<template x-if="!loading && !error && labels.length === 0">
1074
+
<tr>
1075
+
<td class="text-sm">
1076
+
<em>no labels applied by mod.bsky.app</em>
1077
+
</td>
1078
+
</tr>
1079
+
</template>
1080
+
<template x-for="label in labels">
1081
+
<tr>
1082
+
<td>
1083
+
<code x-text="label.cts.split('.')[0]"></code>
1084
+
</td>
1085
+
<td>
1086
+
<code x-text="label.exp.split('.')[0]"></code>
1087
+
</td>
1088
+
1089
+
<td>
1090
+
<span
1091
+
x-text="label.val"
1092
+
class="badge badge-sm badge-soft badge-warning"
1093
+
></span>
1094
+
</td>
1095
+
1096
+
</tr>
1097
+
</template>
1013
1098
</tbody>
1014
1099
</table>
1015
1100
</div>