@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.
- package/.data/.internal/idp/keys/cookie-secret$.json +1 -0
- package/.data/.internal/idp/keys/jwks$.json +1 -0
- package/.data/.internal/setup/current-base-url$.json +1 -0
- package/PLUGIN_DEVELOPER_GUIDE.md +213 -0
- package/README.md +25 -28
- package/components/context.jsonld +11 -0
- package/config/default.json +14 -28
- package/dist/ModerationHandler.d.ts +21 -0
- package/dist/ModerationHandler.d.ts.map +1 -0
- package/dist/ModerationHandler.js +158 -0
- package/dist/ModerationHandler.js.map +1 -0
- package/dist/ModerationHandler.jsonld +126 -0
- package/dist/components/components.jsonld +4 -9
- package/dist/components/context.jsonld +6 -245
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/providers/SightEngineProvider.jsonld +2 -2
- package/package.json +10 -10
- package/src/ModerationHandler.ts +189 -0
- package/src/index.ts +1 -6
- package/ARCHITECTURE.md +0 -52
- package/CONFIG-GUIDE.md +0 -49
- package/DEVELOPMENT.md +0 -129
- package/ENV-VARIABLES.md +0 -137
- package/INSTALLATION.md +0 -90
- package/MIGRATION.md +0 -81
- package/PRODUCTION.md +0 -186
- package/PUBLISHING.md +0 -104
- package/TESTING.md +0 -93
- package/css-moderation-spec.md +0 -1422
- package/dist/ModerationConfig.d.ts +0 -16
- package/dist/ModerationConfig.d.ts.map +0 -1
- package/dist/ModerationConfig.js +0 -18
- package/dist/ModerationConfig.js.map +0 -1
- package/dist/ModerationConfig.jsonld +0 -66
- package/dist/ModerationMixin.d.ts +0 -13
- package/dist/ModerationMixin.d.ts.map +0 -1
- package/dist/ModerationMixin.js +0 -136
- package/dist/ModerationMixin.js.map +0 -1
- package/dist/ModerationMixin.jsonld +0 -180
- package/dist/ModerationOperationHandler.d.ts +0 -16
- package/dist/ModerationOperationHandler.d.ts.map +0 -1
- package/dist/ModerationOperationHandler.js +0 -45
- package/dist/ModerationOperationHandler.js.map +0 -1
- package/dist/ModerationOperationHandler.jsonld +0 -140
- package/dist/ModerationRecord.d.ts +0 -20
- package/dist/ModerationRecord.d.ts.map +0 -1
- package/dist/ModerationRecord.js +0 -3
- package/dist/ModerationRecord.js.map +0 -1
- package/dist/ModerationRecord.jsonld +0 -59
- package/dist/ModerationResourceStore.d.ts +0 -30
- package/dist/ModerationResourceStore.d.ts.map +0 -1
- package/dist/ModerationResourceStore.js +0 -167
- package/dist/ModerationResourceStore.js.map +0 -1
- package/dist/ModerationResourceStore.jsonld +0 -157
- package/dist/ModerationStore.d.ts +0 -12
- package/dist/ModerationStore.d.ts.map +0 -1
- package/dist/ModerationStore.js +0 -37
- package/dist/ModerationStore.js.map +0 -1
- package/dist/ModerationStore.jsonld +0 -59
- package/dist/util/GuardedStream.d.ts +0 -33
- package/dist/util/GuardedStream.d.ts.map +0 -1
- package/dist/util/GuardedStream.js +0 -89
- package/dist/util/GuardedStream.js.map +0 -1
- package/simple-test.json +0 -7
- package/src/ModerationConfig.ts +0 -29
- package/src/ModerationMixin.ts +0 -153
- package/src/ModerationOperationHandler.ts +0 -64
- package/src/ModerationRecord.ts +0 -19
- package/src/ModerationResourceStore.ts +0 -227
- package/src/ModerationStore.ts +0 -41
- package/src/util/GuardedStream.ts +0 -101
|
@@ -1,16 +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
|
-
export declare const DEFAULT_MODERATION_CONFIG: ModerationConfig;
|
|
16
|
-
//# sourceMappingURL=ModerationConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModerationConfig.d.ts","sourceRoot":"","sources":["../src/ModerationConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,yBAAyB,EAAE,gBAavC,CAAC"}
|
package/dist/ModerationConfig.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_MODERATION_CONFIG = void 0;
|
|
4
|
-
exports.DEFAULT_MODERATION_CONFIG = {
|
|
5
|
-
enabled: true,
|
|
6
|
-
auditLoggingEnabled: true,
|
|
7
|
-
auditLoggingStorePath: './data/moderation-logs',
|
|
8
|
-
sightEngineApiUser: '',
|
|
9
|
-
sightEngineApiSecret: '',
|
|
10
|
-
imagesEnabled: true,
|
|
11
|
-
textEnabled: true,
|
|
12
|
-
videoEnabled: true,
|
|
13
|
-
imageNudityThreshold: 0.5,
|
|
14
|
-
textSexualThreshold: 0.5,
|
|
15
|
-
textToxicThreshold: 0.5,
|
|
16
|
-
videoNudityThreshold: 0.5,
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=ModerationConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModerationConfig.js","sourceRoot":"","sources":["../src/ModerationConfig.ts"],"names":[],"mappings":";;;AAea,QAAA,yBAAyB,GAAqB;IACzD,OAAO,EAAE,IAAI;IACb,mBAAmB,EAAE,IAAI;IACzB,qBAAqB,EAAE,wBAAwB;IAC/C,kBAAkB,EAAE,EAAE;IACtB,oBAAoB,EAAE,EAAE;IACxB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,oBAAoB,EAAE,GAAG;IACzB,mBAAmB,EAAE,GAAG;IACxB,kBAAkB,EAAE,GAAG;IACvB,oBAAoB,EAAE,GAAG;CAC1B,CAAC"}
|
|
@@ -1,66 +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/ModerationConfig.jsonld#ModerationConfig",
|
|
10
|
-
"@type": "AbstractClass",
|
|
11
|
-
"requireElement": "ModerationConfig",
|
|
12
|
-
"parameters": [],
|
|
13
|
-
"memberFields": [
|
|
14
|
-
{
|
|
15
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_enabled",
|
|
16
|
-
"memberFieldName": "enabled"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_auditLoggingEnabled",
|
|
20
|
-
"memberFieldName": "auditLoggingEnabled"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_auditLoggingStorePath",
|
|
24
|
-
"memberFieldName": "auditLoggingStorePath"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_sightEngineApiUser",
|
|
28
|
-
"memberFieldName": "sightEngineApiUser"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_sightEngineApiSecret",
|
|
32
|
-
"memberFieldName": "sightEngineApiSecret"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_imagesEnabled",
|
|
36
|
-
"memberFieldName": "imagesEnabled"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_textEnabled",
|
|
40
|
-
"memberFieldName": "textEnabled"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_videoEnabled",
|
|
44
|
-
"memberFieldName": "videoEnabled"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_imageNudityThreshold",
|
|
48
|
-
"memberFieldName": "imageNudityThreshold"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_textSexualThreshold",
|
|
52
|
-
"memberFieldName": "textSexualThreshold"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_textToxicThreshold",
|
|
56
|
-
"memberFieldName": "textToxicThreshold"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"@id": "ksmp:dist/ModerationConfig.jsonld#ModerationConfig__member_videoNudityThreshold",
|
|
60
|
-
"memberFieldName": "videoNudityThreshold"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
"constructorArguments": []
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Operation } from '@solid/community-server';
|
|
2
|
-
import type { ModerationConfig } from './ModerationConfig';
|
|
3
|
-
export declare class ModerationMixin {
|
|
4
|
-
protected readonly logger: import("@solid/community-server").Logger;
|
|
5
|
-
private readonly moderationConfig;
|
|
6
|
-
private readonly moderationStore?;
|
|
7
|
-
constructor(moderationConfig: ModerationConfig);
|
|
8
|
-
moderateContent(operation: Operation): Promise<void>;
|
|
9
|
-
private moderateImageContent;
|
|
10
|
-
private moderateTextContent;
|
|
11
|
-
private moderateVideoContent;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ModerationMixin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModerationMixin.d.ts","sourceRoot":"","sources":["../src/ModerationMixin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D,qBAAa,eAAe;IAC1B,SAAS,CAAC,QAAQ,CAAC,MAAM,2CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAkB;gBAEhC,gBAAgB,EAAE,gBAAgB;IAOxC,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;YAenD,oBAAoB;YAwCpB,mBAAmB;YAuCnB,oBAAoB;CAsCnC"}
|
package/dist/ModerationMixin.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModerationMixin = void 0;
|
|
4
|
-
const node_stream_1 = require("node:stream");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const community_server_1 = require("@solid/community-server");
|
|
7
|
-
const SightEngineProvider_1 = require("./providers/SightEngineProvider");
|
|
8
|
-
const ModerationStore_1 = require("./ModerationStore");
|
|
9
|
-
class ModerationMixin {
|
|
10
|
-
constructor(moderationConfig) {
|
|
11
|
-
this.logger = (0, community_server_1.getLoggerFor)(this);
|
|
12
|
-
this.moderationConfig = moderationConfig;
|
|
13
|
-
this.moderationStore = moderationConfig.auditLoggingEnabled ?
|
|
14
|
-
new ModerationStore_1.ModerationStore(moderationConfig.auditLoggingStorePath) :
|
|
15
|
-
undefined;
|
|
16
|
-
}
|
|
17
|
-
async moderateContent(operation) {
|
|
18
|
-
if (!this.moderationConfig.enabled || !operation.body?.data) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const contentType = operation.body.metadata.contentType;
|
|
22
|
-
if (contentType?.startsWith('image/') && this.moderationConfig.imagesEnabled) {
|
|
23
|
-
await this.moderateImageContent(operation);
|
|
24
|
-
}
|
|
25
|
-
else if (contentType?.startsWith('text/') && this.moderationConfig.textEnabled) {
|
|
26
|
-
await this.moderateTextContent(operation);
|
|
27
|
-
}
|
|
28
|
-
else if (contentType?.startsWith('video/') && this.moderationConfig.videoEnabled) {
|
|
29
|
-
await this.moderateVideoContent(operation);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async moderateImageContent(operation) {
|
|
33
|
-
const chunks = [];
|
|
34
|
-
for await (const chunk of operation.body.data) {
|
|
35
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
36
|
-
}
|
|
37
|
-
const buffer = Buffer.concat(chunks);
|
|
38
|
-
operation.body.data = (0, community_server_1.guardStream)(node_stream_1.Readable.from(buffer));
|
|
39
|
-
const tempFile = `/tmp/moderation_${Date.now()}.jpg`;
|
|
40
|
-
await node_fs_1.promises.writeFile(tempFile, buffer);
|
|
41
|
-
try {
|
|
42
|
-
const client = new SightEngineProvider_1.SightEngineProvider(this.moderationConfig.sightEngineApiUser, this.moderationConfig.sightEngineApiSecret);
|
|
43
|
-
const result = await client.analyzeImage(tempFile);
|
|
44
|
-
this.logger.info(`MODERATION: Image analysis result - nudity score: ${result.nudity?.raw}, threshold: ${this.moderationConfig.imageNudityThreshold}`);
|
|
45
|
-
if (result.nudity?.raw && result.nudity.raw > this.moderationConfig.imageNudityThreshold) {
|
|
46
|
-
if (this.moderationStore) {
|
|
47
|
-
await this.moderationStore.recordViolation({
|
|
48
|
-
contentType: 'image',
|
|
49
|
-
resourcePath: operation.target.path,
|
|
50
|
-
violations: [{ model: 'nudity', score: result.nudity.raw, threshold: this.moderationConfig.imageNudityThreshold }],
|
|
51
|
-
contentSize: buffer.length,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
throw new community_server_1.ForbiddenHttpError('Upload blocked: Content violates community guidelines');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
if (error instanceof community_server_1.ForbiddenHttpError) {
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
this.logger.warn(`MODERATION: Image check failed (fail-open): ${error}`);
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
await node_fs_1.promises.unlink(tempFile).catch(() => { });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async moderateTextContent(operation) {
|
|
68
|
-
const chunks = [];
|
|
69
|
-
for await (const chunk of operation.body.data) {
|
|
70
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
71
|
-
}
|
|
72
|
-
const buffer = Buffer.concat(chunks);
|
|
73
|
-
const text = buffer.toString('utf8');
|
|
74
|
-
operation.body.data = (0, community_server_1.guardStream)(node_stream_1.Readable.from(buffer));
|
|
75
|
-
if (!text?.trim()) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const client = new SightEngineProvider_1.SightEngineProvider(this.moderationConfig.sightEngineApiUser, this.moderationConfig.sightEngineApiSecret);
|
|
80
|
-
const result = await client.analyzeText(text);
|
|
81
|
-
if (result.sexual > this.moderationConfig.textSexualThreshold || result.toxic > this.moderationConfig.textToxicThreshold) {
|
|
82
|
-
if (this.moderationStore) {
|
|
83
|
-
await this.moderationStore.recordViolation({
|
|
84
|
-
contentType: 'text',
|
|
85
|
-
resourcePath: operation.target.path,
|
|
86
|
-
violations: [{ model: 'text', score: Math.max(result.sexual, result.toxic), threshold: Math.min(this.moderationConfig.textSexualThreshold, this.moderationConfig.textToxicThreshold) }],
|
|
87
|
-
contentSize: buffer.length,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
throw new community_server_1.ForbiddenHttpError('Upload blocked: Content violates community guidelines');
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
if (error instanceof community_server_1.ForbiddenHttpError) {
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
this.logger.warn(`MODERATION: Text check failed (fail-open): ${error}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async moderateVideoContent(operation) {
|
|
101
|
-
const chunks = [];
|
|
102
|
-
for await (const chunk of operation.body.data) {
|
|
103
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
104
|
-
}
|
|
105
|
-
const buffer = Buffer.concat(chunks);
|
|
106
|
-
operation.body.data = (0, community_server_1.guardStream)(node_stream_1.Readable.from(buffer));
|
|
107
|
-
const tempFile = `/tmp/moderation_${Date.now()}.mp4`;
|
|
108
|
-
await node_fs_1.promises.writeFile(tempFile, buffer);
|
|
109
|
-
try {
|
|
110
|
-
const client = new SightEngineProvider_1.SightEngineProvider(this.moderationConfig.sightEngineApiUser, this.moderationConfig.sightEngineApiSecret);
|
|
111
|
-
const result = await client.analyzeVideo(tempFile);
|
|
112
|
-
if (result.nudity?.raw && result.nudity.raw > this.moderationConfig.videoNudityThreshold) {
|
|
113
|
-
if (this.moderationStore) {
|
|
114
|
-
await this.moderationStore.recordViolation({
|
|
115
|
-
contentType: 'video',
|
|
116
|
-
resourcePath: operation.target.path,
|
|
117
|
-
violations: [{ model: 'nudity', score: result.nudity.raw, threshold: this.moderationConfig.videoNudityThreshold }],
|
|
118
|
-
contentSize: buffer.length,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
throw new community_server_1.ForbiddenHttpError('Upload blocked: Content violates community guidelines');
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
if (error instanceof community_server_1.ForbiddenHttpError) {
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
this.logger.warn(`MODERATION: Video check failed (fail-open): ${error}`);
|
|
129
|
-
}
|
|
130
|
-
finally {
|
|
131
|
-
await node_fs_1.promises.unlink(tempFile).catch(() => { });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
exports.ModerationMixin = ModerationMixin;
|
|
136
|
-
//# sourceMappingURL=ModerationMixin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModerationMixin.js","sourceRoot":"","sources":["../src/ModerationMixin.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,qCAAyC;AAEzC,8DAAwF;AAExF,yEAAsE;AACtE,uDAAoD;AAEpD,MAAa,eAAe;IAK1B,YAAmB,gBAAkC;QAJlC,WAAM,GAAG,IAAA,+BAAY,EAAC,IAAI,CAAC,CAAC;QAK7C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;YAC3D,IAAI,iCAAe,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,C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AAC;YACd,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+CAA+C,KAAK,EAAE,CAAC,CAAC;QAC3E,CAAC;gBAAS,CAAC;YACT,MAAM,kBAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF;AAhJD,0CAgJC"}
|
|
@@ -1,180 +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/ModerationMixin.jsonld#ModerationMixin",
|
|
10
|
-
"@type": "Class",
|
|
11
|
-
"requireElement": "ModerationMixin",
|
|
12
|
-
"parameters": [
|
|
13
|
-
{
|
|
14
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_enabled",
|
|
15
|
-
"range": "xsd:boolean"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingEnabled",
|
|
19
|
-
"range": "xsd:boolean"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingStorePath",
|
|
23
|
-
"range": "xsd:string"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiUser",
|
|
27
|
-
"range": "xsd:string"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiSecret",
|
|
31
|
-
"range": "xsd:string"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imagesEnabled",
|
|
35
|
-
"range": "xsd:boolean"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textEnabled",
|
|
39
|
-
"range": "xsd:boolean"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoEnabled",
|
|
43
|
-
"range": "xsd:boolean"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imageNudityThreshold",
|
|
47
|
-
"range": "xsd:number"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textSexualThreshold",
|
|
51
|
-
"range": "xsd:number"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textToxicThreshold",
|
|
55
|
-
"range": "xsd:number"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoNudityThreshold",
|
|
59
|
-
"range": "xsd:number"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
"memberFields": [
|
|
63
|
-
{
|
|
64
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_logger",
|
|
65
|
-
"memberFieldName": "logger",
|
|
66
|
-
"range": {
|
|
67
|
-
"@type": "ParameterRangeWildcard"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderationConfig",
|
|
72
|
-
"memberFieldName": "moderationConfig"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderationStore",
|
|
76
|
-
"memberFieldName": "moderationStore"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_constructor",
|
|
80
|
-
"memberFieldName": "constructor"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderateContent",
|
|
84
|
-
"memberFieldName": "moderateContent"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderateImageContent",
|
|
88
|
-
"memberFieldName": "moderateImageContent"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderateTextContent",
|
|
92
|
-
"memberFieldName": "moderateTextContent"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin__member_moderateVideoContent",
|
|
96
|
-
"memberFieldName": "moderateVideoContent"
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
"constructorArguments": [
|
|
100
|
-
{
|
|
101
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig__constructorArgument",
|
|
102
|
-
"fields": [
|
|
103
|
-
{
|
|
104
|
-
"keyRaw": "enabled",
|
|
105
|
-
"value": {
|
|
106
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_enabled"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
"keyRaw": "auditLoggingEnabled",
|
|
111
|
-
"value": {
|
|
112
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingEnabled"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"keyRaw": "auditLoggingStorePath",
|
|
117
|
-
"value": {
|
|
118
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingStorePath"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"keyRaw": "sightEngineApiUser",
|
|
123
|
-
"value": {
|
|
124
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiUser"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"keyRaw": "sightEngineApiSecret",
|
|
129
|
-
"value": {
|
|
130
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiSecret"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
"keyRaw": "imagesEnabled",
|
|
135
|
-
"value": {
|
|
136
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imagesEnabled"
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"keyRaw": "textEnabled",
|
|
141
|
-
"value": {
|
|
142
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textEnabled"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
"keyRaw": "videoEnabled",
|
|
147
|
-
"value": {
|
|
148
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoEnabled"
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"keyRaw": "imageNudityThreshold",
|
|
153
|
-
"value": {
|
|
154
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imageNudityThreshold"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"keyRaw": "textSexualThreshold",
|
|
159
|
-
"value": {
|
|
160
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textSexualThreshold"
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"keyRaw": "textToxicThreshold",
|
|
165
|
-
"value": {
|
|
166
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textToxicThreshold"
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"keyRaw": "videoNudityThreshold",
|
|
171
|
-
"value": {
|
|
172
|
-
"@id": "ksmp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoNudityThreshold"
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
]
|
|
180
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ResponseDescription, OperationHandlerInput, OperationHandler } from '@solid/community-server';
|
|
2
|
-
/**
|
|
3
|
-
* Wraps an OperationHandler to add content moderation for operations with body data.
|
|
4
|
-
* Checks PUT, POST, and PATCH operations before passing them to the wrapped handler.
|
|
5
|
-
*
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
export declare class ModerationOperationHandler {
|
|
9
|
-
protected readonly logger: import("@solid/community-server").Logger;
|
|
10
|
-
private readonly source;
|
|
11
|
-
private readonly moderationMixin;
|
|
12
|
-
constructor(source: OperationHandler, enabled: boolean, auditLoggingEnabled: boolean, auditLoggingStorePath: string, sightEngineApiUser: string, sightEngineApiSecret: string, imagesEnabled: boolean, textEnabled: boolean, videoEnabled: boolean, imageNudityThreshold: number, textSexualThreshold: number, textToxicThreshold: number, videoNudityThreshold: number);
|
|
13
|
-
canHandle(input: OperationHandlerInput): Promise<void>;
|
|
14
|
-
handle(input: OperationHandlerInput): Promise<ResponseDescription>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ModerationOperationHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModerationOperationHandler.d.ts","sourceRoot":"","sources":["../src/ModerationOperationHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG5G;;;;;GAKG;AACH,qBAAa,0BAA0B;IACrC,SAAS,CAAC,QAAQ,CAAC,MAAM,2CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;gBAGhD,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,OAAO,EAC5B,qBAAqB,EAAE,MAAM,EAC7B,kBAAkB,EAAE,MAAM,EAC1B,oBAAoB,EAAE,MAAM,EAC5B,aAAa,EAAE,OAAO,EACtB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,oBAAoB,EAAE,MAAM,EAC5B,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,EAAE,MAAM,EAC1B,oBAAoB,EAAE,MAAM;IAmBjB,SAAS,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,MAAM,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAWhF"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModerationOperationHandler = void 0;
|
|
4
|
-
const community_server_1 = require("@solid/community-server");
|
|
5
|
-
const ModerationMixin_1 = require("./ModerationMixin");
|
|
6
|
-
/**
|
|
7
|
-
* Wraps an OperationHandler to add content moderation for operations with body data.
|
|
8
|
-
* Checks PUT, POST, and PATCH operations before passing them to the wrapped handler.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
class ModerationOperationHandler {
|
|
13
|
-
constructor(source, enabled, auditLoggingEnabled, auditLoggingStorePath, sightEngineApiUser, sightEngineApiSecret, imagesEnabled, textEnabled, videoEnabled, imageNudityThreshold, textSexualThreshold, textToxicThreshold, videoNudityThreshold) {
|
|
14
|
-
this.logger = (0, community_server_1.getLoggerFor)(this);
|
|
15
|
-
this.source = source;
|
|
16
|
-
this.moderationMixin = new ModerationMixin_1.ModerationMixin({
|
|
17
|
-
enabled,
|
|
18
|
-
auditLoggingEnabled,
|
|
19
|
-
auditLoggingStorePath,
|
|
20
|
-
sightEngineApiUser,
|
|
21
|
-
sightEngineApiSecret,
|
|
22
|
-
imagesEnabled,
|
|
23
|
-
textEnabled,
|
|
24
|
-
videoEnabled,
|
|
25
|
-
imageNudityThreshold,
|
|
26
|
-
textSexualThreshold,
|
|
27
|
-
textToxicThreshold,
|
|
28
|
-
videoNudityThreshold,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
async canHandle(input) {
|
|
32
|
-
return this.source.canHandle(input);
|
|
33
|
-
}
|
|
34
|
-
async handle(input) {
|
|
35
|
-
const { operation } = input;
|
|
36
|
-
// Only moderate operations with body data
|
|
37
|
-
if (operation.body?.data && ['PUT', 'POST', 'PATCH'].includes(operation.method)) {
|
|
38
|
-
this.logger.info(`MODERATION: Checking ${operation.method} request to ${operation.target.path}`);
|
|
39
|
-
await this.moderationMixin.moderateContent(operation);
|
|
40
|
-
}
|
|
41
|
-
return this.source.handle(input);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.ModerationOperationHandler = ModerationOperationHandler;
|
|
45
|
-
//# sourceMappingURL=ModerationOperationHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|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