@hhkaos/webmentions-widget 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/snapshot.js +16 -3
- package/package.json +1 -1
package/bin/snapshot.js
CHANGED
|
@@ -165,12 +165,25 @@ async function main() {
|
|
|
165
165
|
|
|
166
166
|
const before = getSnapshotMentions(existing).length;
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
console.log(`Fetched ${collected.length} mention(s) for ${domain}${sinceId ? ` since #${sinceId}` : ''}.`);
|
|
169
|
+
|
|
170
|
+
if (!collected.length) {
|
|
171
|
+
if (args.full) {
|
|
172
|
+
// An authoritative refetch that came back empty is far more likely to be
|
|
173
|
+
// a wrong --domain than a genuinely empty account, so keep what we have.
|
|
174
|
+
console.log('Nothing returned for a full refresh; keeping the current snapshot.');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
console.log(`Snapshot unchanged (${before}).`);
|
|
170
179
|
return;
|
|
171
180
|
}
|
|
172
181
|
|
|
173
|
-
|
|
182
|
+
// A full refetch is authoritative: replace rather than merge, so mentions
|
|
183
|
+
// collected under a domain we no longer query do not linger forever.
|
|
184
|
+
const snapshot = args.full
|
|
185
|
+
? mergeSnapshot(null, collected)
|
|
186
|
+
: mergeSnapshot(existing, collected);
|
|
174
187
|
|
|
175
188
|
if (snapshot.count === before) {
|
|
176
189
|
console.log(`Snapshot unchanged (${before} mentions).`);
|
package/package.json
CHANGED