@rmdes/indiekit-endpoint-webmention-io 1.1.2 → 1.1.3
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/lib/storage/webmentions.js +11 -4
- package/package.json +1 -1
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
* Webmentions MongoDB storage
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
extractDomain,
|
|
7
|
+
ensureISOString,
|
|
8
|
+
normaliseDomain,
|
|
9
|
+
sanitiseHtml,
|
|
10
|
+
} from "../utils.js";
|
|
6
11
|
|
|
7
12
|
/**
|
|
8
13
|
* Ensure indexes exist
|
|
@@ -218,7 +223,7 @@ export async function unhideWebmention(collection, wmId) {
|
|
|
218
223
|
*/
|
|
219
224
|
export async function hideByDomain(collection, domain, reason = "blocklist") {
|
|
220
225
|
const result = await collection.updateMany(
|
|
221
|
-
{ sourceDomain: domain, hidden: { $ne: true } },
|
|
226
|
+
{ sourceDomain: normaliseDomain(domain) ?? domain, hidden: { $ne: true } },
|
|
222
227
|
{
|
|
223
228
|
$set: {
|
|
224
229
|
hidden: true,
|
|
@@ -238,7 +243,7 @@ export async function hideByDomain(collection, domain, reason = "blocklist") {
|
|
|
238
243
|
*/
|
|
239
244
|
export async function unhideByDomain(collection, domain) {
|
|
240
245
|
const result = await collection.updateMany(
|
|
241
|
-
{ sourceDomain: domain, hiddenReason: "blocklist" },
|
|
246
|
+
{ sourceDomain: normaliseDomain(domain) ?? domain, hiddenReason: "blocklist" },
|
|
242
247
|
{ $set: { hidden: false, hiddenAt: null, hiddenReason: null } },
|
|
243
248
|
);
|
|
244
249
|
return result.modifiedCount;
|
|
@@ -251,7 +256,9 @@ export async function unhideByDomain(collection, domain) {
|
|
|
251
256
|
* @returns {Promise<number>} Number deleted
|
|
252
257
|
*/
|
|
253
258
|
export async function deleteByDomain(collection, domain) {
|
|
254
|
-
const result = await collection.deleteMany({
|
|
259
|
+
const result = await collection.deleteMany({
|
|
260
|
+
sourceDomain: normaliseDomain(domain) ?? domain,
|
|
261
|
+
});
|
|
255
262
|
return result.deletedCount;
|
|
256
263
|
}
|
|
257
264
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rmdes/indiekit-endpoint-webmention-io",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Webmention moderation endpoint for Indiekit. Syncs webmentions from webmention.io into MongoDB with delete, block, and privacy removal capabilities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"indiekit",
|