@kkuffour/solid-moderation-plugin 0.2.2 → 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 +6 -245
  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 +13 -0
  14. package/dist/components/context.jsonld +11 -0
  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 +11 -11
  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/components/components.jsonld +0 -18
  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,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":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C,IAAI,CAAC,kBAAkB,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAEO,gBAAgB,CAAC,WAAmB;QAC1C,MAAM,GAAG,GAA2B;YAClC,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,KAAK;YAClB,YAAY,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"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ModerationStore = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const node_path_1 = require("node:path");
6
- const community_server_1 = require("@solid/community-server");
7
- /**
8
- * Service for storing moderation violation records.
9
- */
10
- class ModerationStore {
11
- constructor(storePath = './data/moderation-logs') {
12
- this.logger = (0, community_server_1.getLoggerFor)(this);
13
- this.storePath = storePath;
14
- }
15
- async recordViolation(record) {
16
- try {
17
- await node_fs_1.promises.mkdir(this.storePath, { recursive: true });
18
- const fullRecord = {
19
- ...record,
20
- id: this.generateId(),
21
- timestamp: new Date(),
22
- };
23
- const filename = `${new Date().toISOString().split('T')[0]}.jsonl`;
24
- const filepath = (0, node_path_1.join)(this.storePath, filename);
25
- const logEntry = `${JSON.stringify(fullRecord)}\n`;
26
- await node_fs_1.promises.appendFile(filepath, logEntry);
27
- }
28
- catch (error) {
29
- this.logger.error(`Failed to record moderation violation: ${String(error)}`);
30
- }
31
- }
32
- generateId() {
33
- return Date.now().toString(36) + Math.random().toString(36).slice(2);
34
- }
35
- }
36
- exports.ModerationStore = ModerationStore;
37
- //# sourceMappingURL=ModerationStore.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModerationStore.js","sourceRoot":"","sources":["../src/ModerationStore.ts"],"names":[],"mappings":";;;AAAA,qCAAyC;AACzC,yCAAiC;AACjC,8DAAuD;AAGvD;;GAEG;AACH,MAAa,eAAe;IAK1B,YAAmB,SAAS,GAAG,wBAAwB;QAJpC,WAAM,GAAG,IAAA,+BAAY,EAAC,IAAI,CAAC,CAAC;QAK7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAkD;QAC7E,IAAI,CAAC;YACH,MAAM,kBAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAEpD,MAAM,UAAU,GAAqB;gBACnC,GAAG,MAAM;gBACT,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE;gBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;aACtB,CAAC;YAEF,MAAM,QAAQ,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACnE,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAChD,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;YAEnD,MAAM,kBAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAEO,UAAU;QAChB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;CACF;AAhCD,0CAgCC"}
@@ -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/ModerationStore.jsonld#ModerationStore",
10
- "@type": "Class",
11
- "requireElement": "ModerationStore",
12
- "comment": "Service for storing moderation violation records.",
13
- "parameters": [
14
- {
15
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore_storePath",
16
- "range": {
17
- "@type": "ParameterRangeUnion",
18
- "parameterRangeElements": [
19
- "xsd:string",
20
- {
21
- "@type": "ParameterRangeUndefined"
22
- }
23
- ]
24
- }
25
- }
26
- ],
27
- "memberFields": [
28
- {
29
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore__member_logger",
30
- "memberFieldName": "logger",
31
- "range": {
32
- "@type": "ParameterRangeWildcard"
33
- }
34
- },
35
- {
36
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore__member_storePath",
37
- "memberFieldName": "storePath"
38
- },
39
- {
40
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore__member_constructor",
41
- "memberFieldName": "constructor"
42
- },
43
- {
44
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore__member_recordViolation",
45
- "memberFieldName": "recordViolation"
46
- },
47
- {
48
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore__member_generateId",
49
- "memberFieldName": "generateId"
50
- }
51
- ],
52
- "constructorArguments": [
53
- {
54
- "@id": "ksmp:dist/ModerationStore.jsonld#ModerationStore_storePath"
55
- }
56
- ]
57
- }
58
- ]
59
- }
@@ -1,33 +0,0 @@
1
- declare const guardedErrors: unique symbol;
2
- declare const guardedTimeout: unique symbol;
3
- declare class Guard {
4
- private [guardedErrors];
5
- private [guardedTimeout]?;
6
- }
7
- /**
8
- * A stream that is guarded from emitting errors when there are no listeners.
9
- * If an error occurs while no listener is attached,
10
- * it will store the error and emit it once a listener is added (or a timeout occurs).
11
- */
12
- export type Guarded<T extends NodeJS.EventEmitter = NodeJS.EventEmitter> = T & Guard;
13
- /**
14
- * Determines whether the stream is guarded against emitting errors.
15
- */
16
- export declare function isGuarded<T extends NodeJS.EventEmitter>(stream: T): stream is Guarded<T>;
17
- /**
18
- * Makes sure that listeners always receive the error event of a stream,
19
- * even if it was thrown before the listener was attached.
20
- *
21
- * When guarding a stream it is assumed that error listeners already attached should be ignored,
22
- * only error listeners attached after the stream is guarded will prevent an error from being logged.
23
- *
24
- * If the input is already guarded the guard will be reset,
25
- * which means ignoring error listeners already attached.
26
- *
27
- * @param stream - Stream that can potentially throw an error.
28
- *
29
- * @returns The stream.
30
- */
31
- export declare function guardStream<T extends NodeJS.EventEmitter>(stream: T): Guarded<T>;
32
- export {};
33
- //# sourceMappingURL=GuardedStream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GuardedStream.d.ts","sourceRoot":"","sources":["../../src/util/GuardedStream.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,aAAa,eAA0B,CAAC;AAC9C,QAAA,MAAM,cAAc,eAA2B,CAAC;AAGhD,cAAM,KAAK;IAET,QAAgB,CAAC,aAAa,CAAC,CAAU;IACzC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,CAAiB;CAC3C;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,CAAC,GAAG,KAAK,CAAC;AAErF;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAExF;AA+CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYhF"}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isGuarded = isGuarded;
4
- exports.guardStream = guardStream;
5
- const community_server_1 = require("@solid/community-server");
6
- const logger = (0, community_server_1.getLoggerFor)('GuardedStream');
7
- // Using symbols to make sure we don't override existing parameters
8
- const guardedErrors = Symbol('guardedErrors');
9
- const guardedTimeout = Symbol('guardedTimeout');
10
- // Private fields for guarded streams
11
- class Guard {
12
- }
13
- /**
14
- * Determines whether the stream is guarded against emitting errors.
15
- */
16
- function isGuarded(stream) {
17
- return typeof stream[guardedErrors] === 'object';
18
- }
19
- /**
20
- * Callback that is used when a stream emits an error and no other error listener is attached.
21
- * Used to store the error and start the logger timer.
22
- *
23
- * It is important that this listener always remains attached for edge cases where an error listener gets removed
24
- * and the number of error listeners is checked immediately afterwards.
25
- * See https://github.com/CommunitySolidServer/CommunitySolidServer/pull/462#issuecomment-758013492 .
26
- */
27
- function guardingErrorListener(error) {
28
- // Only fall back to this if no new listeners are attached since guarding started.
29
- const errorListeners = this.listeners('error');
30
- if (errorListeners.at(-1) === guardingErrorListener) {
31
- this[guardedErrors].push(error);
32
- if (!this[guardedTimeout]) {
33
- this[guardedTimeout] = setTimeout(() => {
34
- logger.error(`No error listener was attached but error was thrown: ${error.message}`);
35
- }, 1000);
36
- }
37
- }
38
- }
39
- /**
40
- * Callback that is used when a new listener is attached and there are errors that were not emitted yet.
41
- */
42
- function emitStoredErrors(event, func) {
43
- if (event === 'error' && func !== guardingErrorListener) {
44
- // Cancel an error timeout
45
- if (this[guardedTimeout]) {
46
- clearTimeout(this[guardedTimeout]);
47
- this[guardedTimeout] = undefined;
48
- }
49
- // Emit any errors that were guarded
50
- const errors = this[guardedErrors];
51
- if (errors.length > 0) {
52
- this[guardedErrors] = [];
53
- setImmediate(() => {
54
- for (const error of errors) {
55
- this.emit('error', error);
56
- }
57
- });
58
- }
59
- }
60
- }
61
- /**
62
- * Makes sure that listeners always receive the error event of a stream,
63
- * even if it was thrown before the listener was attached.
64
- *
65
- * When guarding a stream it is assumed that error listeners already attached should be ignored,
66
- * only error listeners attached after the stream is guarded will prevent an error from being logged.
67
- *
68
- * If the input is already guarded the guard will be reset,
69
- * which means ignoring error listeners already attached.
70
- *
71
- * @param stream - Stream that can potentially throw an error.
72
- *
73
- * @returns The stream.
74
- */
75
- function guardStream(stream) {
76
- const guarded = stream;
77
- if (isGuarded(stream)) {
78
- // This makes sure the guarding error listener is the last one in the list again
79
- guarded.removeListener('error', guardingErrorListener);
80
- guarded.on('error', guardingErrorListener);
81
- }
82
- else {
83
- guarded[guardedErrors] = [];
84
- guarded.on('error', guardingErrorListener);
85
- guarded.on('newListener', emitStoredErrors);
86
- }
87
- return guarded;
88
- }
89
- //# sourceMappingURL=GuardedStream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GuardedStream.js","sourceRoot":"","sources":["../../src/util/GuardedStream.ts"],"names":[],"mappings":";;AAyBA,8BAEC;AA6DD,kCAYC;AApGD,8DAAuD;AAEvD,MAAM,MAAM,GAAG,IAAA,+BAAY,EAAC,eAAe,CAAC,CAAC;AAE7C,mEAAmE;AACnE,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAC9C,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEhD,qCAAqC;AACrC,MAAM,KAAK;CAIV;AASD;;GAEG;AACH,SAAgB,SAAS,CAAgC,MAAS;IAChE,OAAO,OAAQ,MAA6B,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC;AAC3E,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAAgB,KAAY;IACxD,kFAAkF;IAClF,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,qBAAqB,EAAE,CAAC;QACpD,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,GAAS,EAAE;gBAC3C,MAAM,CAAC,KAAK,CAAC,wDAAwD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxF,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAgB,KAAa,EAAE,IAA4B;IAClF,IAAI,KAAK,KAAK,OAAO,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;QACxD,0BAA0B;QAC1B,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;YACzB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;QACnC,CAAC;QAED,oCAAoC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;YACzB,YAAY,CAAC,GAAS,EAAE;gBACtB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW,CAAgC,MAAS;IAClE,MAAM,OAAO,GAAG,MAAoB,CAAC;IACrC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,gFAAgF;QAChF,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QACvD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QAC5B,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/simple-test.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld",
3
- "import": [
4
- "css:config/file.json",
5
- "file:///Users/opendata/solid-moderation/config/default.json"
6
- ]
7
- }
@@ -1,29 +0,0 @@
1
- export interface ModerationConfig {
2
- enabled: boolean;
3
- auditLoggingEnabled: boolean;
4
- auditLoggingStorePath: string;
5
- sightEngineApiUser: string;
6
- sightEngineApiSecret: string;
7
- imagesEnabled: boolean;
8
- textEnabled: boolean;
9
- videoEnabled: boolean;
10
- imageNudityThreshold: number;
11
- textSexualThreshold: number;
12
- textToxicThreshold: number;
13
- videoNudityThreshold: number;
14
- }
15
-
16
- export const DEFAULT_MODERATION_CONFIG: ModerationConfig = {
17
- enabled: true,
18
- auditLoggingEnabled: true,
19
- auditLoggingStorePath: './data/moderation-logs',
20
- sightEngineApiUser: '',
21
- sightEngineApiSecret: '',
22
- imagesEnabled: true,
23
- textEnabled: true,
24
- videoEnabled: true,
25
- imageNudityThreshold: 0.5,
26
- textSexualThreshold: 0.5,
27
- textToxicThreshold: 0.5,
28
- videoNudityThreshold: 0.5,
29
- };