@kkuffour/solid-moderation-plugin 0.2.3 → 0.3.0

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.
Files changed (74) hide show
  1. package/.data/.internal/idp/keys/cookie-secret$.json +1 -0
  2. package/.data/.internal/idp/keys/jwks$.json +1 -0
  3. package/.data/.internal/setup/current-base-url$.json +1 -0
  4. package/PLUGIN_DEVELOPER_GUIDE.md +213 -0
  5. package/README.md +25 -28
  6. package/components/context.jsonld +11 -0
  7. package/config/default.json +14 -28
  8. package/dist/ModerationHandler.d.ts +21 -0
  9. package/dist/ModerationHandler.d.ts.map +1 -0
  10. package/dist/ModerationHandler.js +158 -0
  11. package/dist/ModerationHandler.js.map +1 -0
  12. package/dist/ModerationHandler.jsonld +126 -0
  13. package/dist/components/components.jsonld +4 -9
  14. package/dist/components/context.jsonld +6 -245
  15. package/dist/index.d.ts +1 -6
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/providers/SightEngineProvider.jsonld +2 -2
  20. package/package.json +10 -10
  21. package/src/ModerationHandler.ts +189 -0
  22. package/src/index.ts +1 -6
  23. package/ARCHITECTURE.md +0 -52
  24. package/CONFIG-GUIDE.md +0 -49
  25. package/DEVELOPMENT.md +0 -129
  26. package/ENV-VARIABLES.md +0 -137
  27. package/INSTALLATION.md +0 -90
  28. package/MIGRATION.md +0 -81
  29. package/PRODUCTION.md +0 -186
  30. package/PUBLISHING.md +0 -104
  31. package/TESTING.md +0 -93
  32. package/css-moderation-spec.md +0 -1422
  33. package/dist/ModerationConfig.d.ts +0 -16
  34. package/dist/ModerationConfig.d.ts.map +0 -1
  35. package/dist/ModerationConfig.js +0 -18
  36. package/dist/ModerationConfig.js.map +0 -1
  37. package/dist/ModerationConfig.jsonld +0 -66
  38. package/dist/ModerationMixin.d.ts +0 -13
  39. package/dist/ModerationMixin.d.ts.map +0 -1
  40. package/dist/ModerationMixin.js +0 -136
  41. package/dist/ModerationMixin.js.map +0 -1
  42. package/dist/ModerationMixin.jsonld +0 -180
  43. package/dist/ModerationOperationHandler.d.ts +0 -16
  44. package/dist/ModerationOperationHandler.d.ts.map +0 -1
  45. package/dist/ModerationOperationHandler.js +0 -45
  46. package/dist/ModerationOperationHandler.js.map +0 -1
  47. package/dist/ModerationOperationHandler.jsonld +0 -140
  48. package/dist/ModerationRecord.d.ts +0 -20
  49. package/dist/ModerationRecord.d.ts.map +0 -1
  50. package/dist/ModerationRecord.js +0 -3
  51. package/dist/ModerationRecord.js.map +0 -1
  52. package/dist/ModerationRecord.jsonld +0 -59
  53. package/dist/ModerationResourceStore.d.ts +0 -30
  54. package/dist/ModerationResourceStore.d.ts.map +0 -1
  55. package/dist/ModerationResourceStore.js +0 -167
  56. package/dist/ModerationResourceStore.js.map +0 -1
  57. package/dist/ModerationResourceStore.jsonld +0 -157
  58. package/dist/ModerationStore.d.ts +0 -12
  59. package/dist/ModerationStore.d.ts.map +0 -1
  60. package/dist/ModerationStore.js +0 -37
  61. package/dist/ModerationStore.js.map +0 -1
  62. package/dist/ModerationStore.jsonld +0 -59
  63. package/dist/util/GuardedStream.d.ts +0 -33
  64. package/dist/util/GuardedStream.d.ts.map +0 -1
  65. package/dist/util/GuardedStream.js +0 -89
  66. package/dist/util/GuardedStream.js.map +0 -1
  67. package/simple-test.json +0 -7
  68. package/src/ModerationConfig.ts +0 -29
  69. package/src/ModerationMixin.ts +0 -153
  70. package/src/ModerationOperationHandler.ts +0 -64
  71. package/src/ModerationRecord.ts +0 -19
  72. package/src/ModerationResourceStore.ts +0 -227
  73. package/src/ModerationStore.ts +0 -41
  74. package/src/util/GuardedStream.ts +0 -101
@@ -1,140 +0,0 @@
1
- {
2
- "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/config/context.jsonld",
5
- "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld"
6
- ],
7
- "@id": "npmd:@kkuffour/solid-moderation-plugin",
8
- "components": [
9
- {
10
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler",
11
- "@type": "Class",
12
- "requireElement": "ModerationOperationHandler",
13
- "comment": "Wraps an OperationHandler to add content moderation for operations with body data. Checks PUT, POST, and PATCH operations before passing them to the wrapped handler.",
14
- "parameters": [
15
- {
16
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_enabled",
17
- "range": "xsd:boolean"
18
- },
19
- {
20
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingEnabled",
21
- "range": "xsd:boolean"
22
- },
23
- {
24
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingStorePath",
25
- "range": "xsd:string"
26
- },
27
- {
28
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiUser",
29
- "range": "xsd:string"
30
- },
31
- {
32
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiSecret",
33
- "range": "xsd:string"
34
- },
35
- {
36
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imagesEnabled",
37
- "range": "xsd:boolean"
38
- },
39
- {
40
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textEnabled",
41
- "range": "xsd:boolean"
42
- },
43
- {
44
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoEnabled",
45
- "range": "xsd:boolean"
46
- },
47
- {
48
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imageNudityThreshold",
49
- "range": "xsd:number"
50
- },
51
- {
52
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textSexualThreshold",
53
- "range": "xsd:number"
54
- },
55
- {
56
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textToxicThreshold",
57
- "range": "xsd:number"
58
- },
59
- {
60
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoNudityThreshold",
61
- "range": "xsd:number"
62
- },
63
- {
64
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_source",
65
- "range": "css:dist/http/ldp/OperationHandler.jsonld#OperationHandler"
66
- }
67
- ],
68
- "memberFields": [
69
- {
70
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_logger",
71
- "memberFieldName": "logger",
72
- "range": {
73
- "@type": "ParameterRangeWildcard"
74
- }
75
- },
76
- {
77
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_source",
78
- "memberFieldName": "source"
79
- },
80
- {
81
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_moderationMixin",
82
- "memberFieldName": "moderationMixin"
83
- },
84
- {
85
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_constructor",
86
- "memberFieldName": "constructor"
87
- },
88
- {
89
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_canHandle",
90
- "memberFieldName": "canHandle"
91
- },
92
- {
93
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler__member_handle",
94
- "memberFieldName": "handle"
95
- }
96
- ],
97
- "constructorArguments": [
98
- {
99
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_source"
100
- },
101
- {
102
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_enabled"
103
- },
104
- {
105
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingEnabled"
106
- },
107
- {
108
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingStorePath"
109
- },
110
- {
111
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiUser"
112
- },
113
- {
114
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiSecret"
115
- },
116
- {
117
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imagesEnabled"
118
- },
119
- {
120
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textEnabled"
121
- },
122
- {
123
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoEnabled"
124
- },
125
- {
126
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imageNudityThreshold"
127
- },
128
- {
129
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textSexualThreshold"
130
- },
131
- {
132
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textToxicThreshold"
133
- },
134
- {
135
- "@id": "ksmp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoNudityThreshold"
136
- }
137
- ]
138
- }
139
- ]
140
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Record of a content moderation violation for admin review.
3
- */
4
- export interface ModerationRecord {
5
- id: string;
6
- timestamp: Date;
7
- contentType: 'image' | 'text' | 'video';
8
- resourcePath: string;
9
- userWebId?: string;
10
- userAgent?: string;
11
- clientIp?: string;
12
- violations: {
13
- model: string;
14
- score: number;
15
- threshold: number;
16
- }[];
17
- contentSize: number;
18
- contentHash?: string;
19
- }
20
- //# sourceMappingURL=ModerationRecord.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationRecord.d.ts","sourceRoot":"","sources":["../src/ModerationRecord.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ModerationRecord.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationRecord.js","sourceRoot":"","sources":["../src/ModerationRecord.ts"],"names":[],"mappings":""}
@@ -1,59 +0,0 @@
1
- {
2
- "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/config/context.jsonld"
5
- ],
6
- "@id": "npmd:@kkuffour/solid-moderation-plugin",
7
- "components": [
8
- {
9
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord",
10
- "@type": "AbstractClass",
11
- "requireElement": "ModerationRecord",
12
- "comment": "Record of a content moderation violation for admin review.",
13
- "parameters": [],
14
- "memberFields": [
15
- {
16
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_id",
17
- "memberFieldName": "id"
18
- },
19
- {
20
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_timestamp",
21
- "memberFieldName": "timestamp"
22
- },
23
- {
24
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_contentType",
25
- "memberFieldName": "contentType"
26
- },
27
- {
28
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_resourcePath",
29
- "memberFieldName": "resourcePath"
30
- },
31
- {
32
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_userWebId",
33
- "memberFieldName": "userWebId"
34
- },
35
- {
36
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_userAgent",
37
- "memberFieldName": "userAgent"
38
- },
39
- {
40
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_clientIp",
41
- "memberFieldName": "clientIp"
42
- },
43
- {
44
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_violations",
45
- "memberFieldName": "violations"
46
- },
47
- {
48
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_contentSize",
49
- "memberFieldName": "contentSize"
50
- },
51
- {
52
- "@id": "ksmp:dist/ModerationRecord.jsonld#ModerationRecord__member_contentHash",
53
- "memberFieldName": "contentHash"
54
- }
55
- ],
56
- "constructorArguments": []
57
- }
58
- ]
59
- }
@@ -1,30 +0,0 @@
1
- import type { ResourceStore, ChangeMap, Representation, ResourceIdentifier, RepresentationPreferences, Conditions, Patch } from '@solid/community-server';
2
- import type { SightEngineProvider } from './providers/SightEngineProvider';
3
- /**
4
- * @module
5
- * Wraps a ResourceStore to add content moderation on write operations.
6
- */
7
- export declare class ModerationResourceStore implements ResourceStore {
8
- private readonly logger;
9
- private readonly source;
10
- private readonly client;
11
- private readonly enabled;
12
- private readonly imageNudityThreshold;
13
- private readonly textSexualThreshold;
14
- private readonly textToxicThreshold;
15
- private readonly videoNudityThreshold;
16
- constructor(source: ResourceStore, client: SightEngineProvider, enabled: boolean, imageNudityThreshold: number, textSexualThreshold: number, textToxicThreshold: number, videoNudityThreshold: number);
17
- hasResource(identifier: ResourceIdentifier): Promise<boolean>;
18
- getRepresentation(identifier: ResourceIdentifier, preferences: RepresentationPreferences, conditions?: Conditions): Promise<Representation>;
19
- setRepresentation(identifier: ResourceIdentifier, representation: Representation, conditions?: Conditions): Promise<ChangeMap>;
20
- addResource(container: ResourceIdentifier, representation: Representation, conditions?: Conditions): Promise<ChangeMap>;
21
- deleteResource(identifier: ResourceIdentifier, conditions?: Conditions): Promise<ChangeMap>;
22
- modifyResource(identifier: ResourceIdentifier, patch: Patch, conditions?: Conditions): Promise<ChangeMap>;
23
- private moderateRepresentation;
24
- private shouldModerateContentType;
25
- private moderateImage;
26
- private moderateVideo;
27
- private moderateText;
28
- private getFileExtension;
29
- }
30
- //# sourceMappingURL=ModerationResourceStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationResourceStore.d.ts","sourceRoot":"","sources":["../src/ModerationResourceStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAG1J,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAG5C,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,MAAM,EAC5B,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAC1B,oBAAoB,EAAE,MAAM;IAejB,WAAW,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAI7D,iBAAiB,CAC5B,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,yBAAyB,EACtC,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,cAAc,CAAC;IAIb,iBAAiB,CAC5B,UAAU,EAAE,kBAAkB,EAC9B,cAAc,EAAE,cAAc,EAC9B,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,SAAS,CAAC;IAKR,WAAW,CACtB,SAAS,EAAE,kBAAkB,EAC7B,cAAc,EAAE,cAAc,EAC9B,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,SAAS,CAAC;IAKR,cAAc,CACzB,UAAU,EAAE,kBAAkB,EAC9B,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,SAAS,CAAC;IAIR,cAAc,CACzB,UAAU,EAAE,kBAAkB,EAC9B,KAAK,EAAE,KAAK,EACZ,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,SAAS,CAAC;YAIP,sBAAsB;IAyDpC,OAAO,CAAC,yBAAyB;YAMnB,aAAa;YAsBb,aAAa;YAsBb,YAAY;IAsB1B,OAAO,CAAC,gBAAgB;CAWzB"}
@@ -1,167 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModerationResourceStore = void 0;
4
- const community_server_1 = require("@solid/community-server");
5
- const fs_1 = require("fs");
6
- /**
7
- * @module
8
- * Wraps a ResourceStore to add content moderation on write operations.
9
- */
10
- class ModerationResourceStore {
11
- constructor(source, client, enabled, imageNudityThreshold, textSexualThreshold, textToxicThreshold, videoNudityThreshold) {
12
- this.logger = (0, community_server_1.getLoggerFor)(this);
13
- this.source = source;
14
- this.client = client;
15
- this.enabled = enabled;
16
- this.imageNudityThreshold = imageNudityThreshold;
17
- this.textSexualThreshold = textSexualThreshold;
18
- this.textToxicThreshold = textToxicThreshold;
19
- this.videoNudityThreshold = videoNudityThreshold;
20
- this.logger.info('ModerationResourceStore initialized');
21
- this.logger.info(` Enabled: ${enabled}`);
22
- this.logger.info(` Thresholds: image=${imageNudityThreshold}, text=${textSexualThreshold}/${textToxicThreshold}, video=${videoNudityThreshold}`);
23
- }
24
- async hasResource(identifier) {
25
- return this.source.hasResource(identifier);
26
- }
27
- async getRepresentation(identifier, preferences, conditions) {
28
- return this.source.getRepresentation(identifier, preferences, conditions);
29
- }
30
- async setRepresentation(identifier, representation, conditions) {
31
- await this.moderateRepresentation(identifier, representation);
32
- return this.source.setRepresentation(identifier, representation, conditions);
33
- }
34
- async addResource(container, representation, conditions) {
35
- await this.moderateRepresentation(container, representation);
36
- return this.source.addResource(container, representation, conditions);
37
- }
38
- async deleteResource(identifier, conditions) {
39
- return this.source.deleteResource(identifier, conditions);
40
- }
41
- async modifyResource(identifier, patch, conditions) {
42
- return this.source.modifyResource(identifier, patch, conditions);
43
- }
44
- async moderateRepresentation(identifier, representation) {
45
- if (!this.enabled || !representation.data) {
46
- return;
47
- }
48
- const contentType = representation.metadata.contentType;
49
- if (!contentType) {
50
- return;
51
- }
52
- const shouldModerate = this.shouldModerateContentType(contentType);
53
- if (!shouldModerate) {
54
- return;
55
- }
56
- this.logger.info(`Moderating ${contentType} upload to ${identifier.path}`);
57
- try {
58
- const chunks = [];
59
- for await (const chunk of representation.data) {
60
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
61
- }
62
- const buffer = Buffer.concat(chunks);
63
- if (contentType.startsWith('image/')) {
64
- await this.moderateImage(identifier.path, buffer, contentType);
65
- }
66
- else if (contentType.startsWith('video/')) {
67
- await this.moderateVideo(identifier.path, buffer, contentType);
68
- }
69
- else if (contentType.startsWith('text/')) {
70
- await this.moderateText(identifier.path, buffer);
71
- }
72
- representation.data = (0, community_server_1.guardedStreamFrom)(buffer);
73
- }
74
- catch (error) {
75
- if (error instanceof community_server_1.ForbiddenHttpError) {
76
- throw error;
77
- }
78
- this.logger.error(`Moderation failed for ${identifier.path}: ${error.message}`);
79
- this.logger.warn('Allowing content through due to moderation failure (fail-open policy)');
80
- // Re-create stream from buffer if we have it
81
- const chunks = [];
82
- try {
83
- for await (const chunk of representation.data) {
84
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
85
- }
86
- representation.data = (0, community_server_1.guardedStreamFrom)(Buffer.concat(chunks));
87
- }
88
- catch {
89
- // Stream already consumed, can't recover
90
- }
91
- }
92
- }
93
- shouldModerateContentType(contentType) {
94
- return contentType.startsWith('image/') ||
95
- contentType.startsWith('video/') ||
96
- contentType.startsWith('text/');
97
- }
98
- async moderateImage(path, buffer, contentType) {
99
- const tempFile = `/tmp/moderation_${Date.now()}.${this.getFileExtension(contentType)}`;
100
- (0, fs_1.writeFileSync)(tempFile, buffer);
101
- try {
102
- const result = await this.client.analyzeImage(tempFile);
103
- if (result.nudity?.raw && result.nudity.raw > this.imageNudityThreshold) {
104
- this.logger.warn(`Image BLOCKED: ${path} - nudity score ${result.nudity.raw.toFixed(2)} > ${this.imageNudityThreshold}`);
105
- throw new community_server_1.ForbiddenHttpError(`Image contains inappropriate content (nudity: ${result.nudity.raw.toFixed(2)})`);
106
- }
107
- this.logger.info(`Image APPROVED: ${path}`);
108
- }
109
- finally {
110
- try {
111
- (0, fs_1.unlinkSync)(tempFile);
112
- }
113
- catch {
114
- this.logger.warn(`Failed to cleanup temp file: ${tempFile}`);
115
- }
116
- }
117
- }
118
- async moderateVideo(path, buffer, contentType) {
119
- const tempFile = `/tmp/moderation_${Date.now()}.${this.getFileExtension(contentType)}`;
120
- (0, fs_1.writeFileSync)(tempFile, buffer);
121
- try {
122
- const result = await this.client.analyzeVideo(tempFile);
123
- if (result.nudity?.raw && result.nudity.raw > this.videoNudityThreshold) {
124
- this.logger.warn(`Video BLOCKED: ${path} - nudity score ${result.nudity.raw.toFixed(2)} > ${this.videoNudityThreshold}`);
125
- throw new community_server_1.ForbiddenHttpError(`Video contains inappropriate content (nudity: ${result.nudity.raw.toFixed(2)})`);
126
- }
127
- this.logger.info(`Video APPROVED: ${path}`);
128
- }
129
- finally {
130
- try {
131
- (0, fs_1.unlinkSync)(tempFile);
132
- }
133
- catch {
134
- this.logger.warn(`Failed to cleanup temp file: ${tempFile}`);
135
- }
136
- }
137
- }
138
- async moderateText(path, buffer) {
139
- const text = buffer.toString('utf-8');
140
- const result = await this.client.analyzeText(text);
141
- const violations = [];
142
- if (result.sexual > this.textSexualThreshold) {
143
- violations.push(`sexual content (${result.sexual.toFixed(2)} > ${this.textSexualThreshold})`);
144
- }
145
- if (result.toxic > this.textToxicThreshold) {
146
- violations.push(`toxic content (${result.toxic.toFixed(2)} > ${this.textToxicThreshold})`);
147
- }
148
- if (violations.length > 0) {
149
- this.logger.warn(`Text BLOCKED: ${path} - ${violations.join(', ')}`);
150
- throw new community_server_1.ForbiddenHttpError(`Text contains inappropriate content: ${violations.join(', ')}`);
151
- }
152
- this.logger.info(`Text APPROVED: ${path}`);
153
- }
154
- getFileExtension(contentType) {
155
- const map = {
156
- 'image/jpeg': 'jpg',
157
- 'image/png': 'png',
158
- 'image/gif': 'gif',
159
- 'image/webp': 'webp',
160
- 'video/mp4': 'mp4',
161
- 'video/webm': 'webm',
162
- };
163
- return map[contentType] || 'bin';
164
- }
165
- }
166
- exports.ModerationResourceStore = ModerationResourceStore;
167
- //# sourceMappingURL=ModerationResourceStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationResourceStore.js","sourceRoot":"","sources":["../src/ModerationResourceStore.ts"],"names":[],"mappings":";;;AACA,8DAA8F;AAC9F,2BAA+C;AAG/C;;;GAGG;AACH,MAAa,uBAAuB;IAUlC,YACE,MAAqB,EACrB,MAA2B,EAC3B,OAAgB,EAChB,oBAA4B,EAC5B,mBAA2B,EAC3B,kBAA0B,EAC1B,oBAA4B;QAhBb,WAAM,GAAG,IAAA,+BAAY,EAAC,IAAI,CAAC,CAAC;QAkB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,EAAE,MAAM;SACrB,CAAC;QACF,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;IACnC,CAAC;CACF;AAzND,0DAyNC"}
@@ -1,157 +0,0 @@
1
- {
2
- "@context": [
3
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/components/context.jsonld",
4
- "https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.2.0/config/context.jsonld",
5
- "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld"
6
- ],
7
- "@id": "npmd:@kkuffour/solid-moderation-plugin",
8
- "components": [
9
- {
10
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore",
11
- "@type": "Class",
12
- "requireElement": "ModerationResourceStore",
13
- "extends": [
14
- "css:dist/storage/ResourceStore.jsonld#ResourceStore"
15
- ],
16
- "parameters": [
17
- {
18
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_enabled",
19
- "range": "xsd:boolean"
20
- },
21
- {
22
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_imageNudityThreshold",
23
- "range": "xsd:number"
24
- },
25
- {
26
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_textSexualThreshold",
27
- "range": "xsd:number"
28
- },
29
- {
30
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_textToxicThreshold",
31
- "range": "xsd:number"
32
- },
33
- {
34
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_videoNudityThreshold",
35
- "range": "xsd:number"
36
- },
37
- {
38
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_client",
39
- "range": "ksmp:dist/providers/SightEngineProvider.jsonld#SightEngineProvider"
40
- },
41
- {
42
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_source",
43
- "range": "css:dist/storage/ResourceStore.jsonld#ResourceStore"
44
- }
45
- ],
46
- "memberFields": [
47
- {
48
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_logger",
49
- "memberFieldName": "logger"
50
- },
51
- {
52
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_source",
53
- "memberFieldName": "source"
54
- },
55
- {
56
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_client",
57
- "memberFieldName": "client"
58
- },
59
- {
60
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_enabled",
61
- "memberFieldName": "enabled"
62
- },
63
- {
64
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_imageNudityThreshold",
65
- "memberFieldName": "imageNudityThreshold"
66
- },
67
- {
68
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_textSexualThreshold",
69
- "memberFieldName": "textSexualThreshold"
70
- },
71
- {
72
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_textToxicThreshold",
73
- "memberFieldName": "textToxicThreshold"
74
- },
75
- {
76
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_videoNudityThreshold",
77
- "memberFieldName": "videoNudityThreshold"
78
- },
79
- {
80
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_constructor",
81
- "memberFieldName": "constructor"
82
- },
83
- {
84
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_hasResource",
85
- "memberFieldName": "hasResource"
86
- },
87
- {
88
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_getRepresentation",
89
- "memberFieldName": "getRepresentation"
90
- },
91
- {
92
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_setRepresentation",
93
- "memberFieldName": "setRepresentation"
94
- },
95
- {
96
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_addResource",
97
- "memberFieldName": "addResource"
98
- },
99
- {
100
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_deleteResource",
101
- "memberFieldName": "deleteResource"
102
- },
103
- {
104
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_modifyResource",
105
- "memberFieldName": "modifyResource"
106
- },
107
- {
108
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_moderateRepresentation",
109
- "memberFieldName": "moderateRepresentation"
110
- },
111
- {
112
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_shouldModerateContentType",
113
- "memberFieldName": "shouldModerateContentType"
114
- },
115
- {
116
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_moderateImage",
117
- "memberFieldName": "moderateImage"
118
- },
119
- {
120
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_moderateVideo",
121
- "memberFieldName": "moderateVideo"
122
- },
123
- {
124
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_moderateText",
125
- "memberFieldName": "moderateText"
126
- },
127
- {
128
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore__member_getFileExtension",
129
- "memberFieldName": "getFileExtension"
130
- }
131
- ],
132
- "constructorArguments": [
133
- {
134
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_source"
135
- },
136
- {
137
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_client"
138
- },
139
- {
140
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_enabled"
141
- },
142
- {
143
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_imageNudityThreshold"
144
- },
145
- {
146
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_textSexualThreshold"
147
- },
148
- {
149
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_textToxicThreshold"
150
- },
151
- {
152
- "@id": "ksmp:dist/ModerationResourceStore.jsonld#ModerationResourceStore_videoNudityThreshold"
153
- }
154
- ]
155
- }
156
- ]
157
- }
@@ -1,12 +0,0 @@
1
- import type { ModerationRecord } from './ModerationRecord';
2
- /**
3
- * Service for storing moderation violation records.
4
- */
5
- export declare class ModerationStore {
6
- protected readonly logger: import("@solid/community-server").Logger;
7
- private readonly storePath;
8
- constructor(storePath?: string);
9
- recordViolation(record: Omit<ModerationRecord, 'id' | 'timestamp'>): Promise<void>;
10
- private generateId;
11
- }
12
- //# sourceMappingURL=ModerationStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationStore.d.ts","sourceRoot":"","sources":["../src/ModerationStore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,qBAAa,eAAe;IAC1B,SAAS,CAAC,QAAQ,CAAC,MAAM,2CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEhB,SAAS,SAA2B;IAI1C,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB/F,OAAO,CAAC,UAAU;CAGnB"}