@kkuffour/solid-moderation-plugin 0.1.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/CONFIG-GUIDE.md +49 -0
- package/DEVELOPMENT.md +129 -0
- package/ENV-VARIABLES.md +137 -0
- package/INSTALLATION.md +90 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +81 -0
- package/PRODUCTION.md +186 -0
- package/PUBLISHING.md +104 -0
- package/README.md +53 -0
- package/TESTING.md +64 -0
- package/components/components.jsonld +17 -0
- package/components/context.jsonld +211 -0
- package/config/context.jsonld +15 -0
- package/config/default.json +80 -0
- package/dist/ModerationConfig.d.ts +16 -0
- package/dist/ModerationConfig.d.ts.map +1 -0
- package/dist/ModerationConfig.js +18 -0
- package/dist/ModerationConfig.js.map +1 -0
- package/dist/ModerationConfig.jsonld +66 -0
- package/dist/ModerationMixin.d.ts +13 -0
- package/dist/ModerationMixin.d.ts.map +1 -0
- package/dist/ModerationMixin.js +136 -0
- package/dist/ModerationMixin.js.map +1 -0
- package/dist/ModerationMixin.jsonld +180 -0
- package/dist/ModerationOperationHandler.d.ts +16 -0
- package/dist/ModerationOperationHandler.d.ts.map +1 -0
- package/dist/ModerationOperationHandler.js +45 -0
- package/dist/ModerationOperationHandler.js.map +1 -0
- package/dist/ModerationOperationHandler.jsonld +140 -0
- package/dist/ModerationRecord.d.ts +20 -0
- package/dist/ModerationRecord.d.ts.map +1 -0
- package/dist/ModerationRecord.js +3 -0
- package/dist/ModerationRecord.js.map +1 -0
- package/dist/ModerationRecord.jsonld +59 -0
- package/dist/ModerationStore.d.ts +12 -0
- package/dist/ModerationStore.d.ts.map +1 -0
- package/dist/ModerationStore.js +37 -0
- package/dist/ModerationStore.js.map +1 -0
- package/dist/ModerationStore.jsonld +59 -0
- package/dist/components/components.jsonld +17 -0
- package/dist/components/context.jsonld +211 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/SightEngineProvider.d.ts +52 -0
- package/dist/providers/SightEngineProvider.d.ts.map +1 -0
- package/dist/providers/SightEngineProvider.js +302 -0
- package/dist/providers/SightEngineProvider.js.map +1 -0
- package/dist/providers/SightEngineProvider.jsonld +209 -0
- package/dist/util/GuardedStream.d.ts +33 -0
- package/dist/util/GuardedStream.d.ts.map +1 -0
- package/dist/util/GuardedStream.js +89 -0
- package/dist/util/GuardedStream.js.map +1 -0
- package/package.json +40 -0
- package/simple-test.json +7 -0
- package/src/ModerationConfig.ts +29 -0
- package/src/ModerationMixin.ts +153 -0
- package/src/ModerationOperationHandler.ts +64 -0
- package/src/ModerationRecord.ts +19 -0
- package/src/ModerationStore.ts +41 -0
- package/src/index.ts +6 -0
- package/src/providers/SightEngineProvider.ts +367 -0
- package/src/util/GuardedStream.ts +101 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.1.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@kkuffour/solid-moderation-plugin/^0.1.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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/moderation-plugin/^1.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/moderation-plugin/^1.0.0/config/context.jsonld"
|
|
5
|
+
],
|
|
6
|
+
"@id": "npmd:@solid/moderation-plugin",
|
|
7
|
+
"@type": "Module",
|
|
8
|
+
"requireName": "@solid/moderation-plugin",
|
|
9
|
+
"import": [
|
|
10
|
+
"smp:components/ModerationOperationHandler.jsonld",
|
|
11
|
+
"smp:components/ModerationConfig.jsonld",
|
|
12
|
+
"smp:components/ModerationStore.jsonld",
|
|
13
|
+
"smp:components/ModerationRecord.jsonld",
|
|
14
|
+
"smp:components/ModerationMixin.jsonld",
|
|
15
|
+
"smp:components/providers/SightEngineProvider.jsonld"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^5.0.0/components/context.jsonld",
|
|
4
|
+
{
|
|
5
|
+
"npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
|
|
6
|
+
"smp": "npmd:@solid/moderation-plugin/^1.0.0/",
|
|
7
|
+
"ModerationOperationHandler": {
|
|
8
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler",
|
|
9
|
+
"@prefix": true,
|
|
10
|
+
"@context": {
|
|
11
|
+
"enabled": {
|
|
12
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_enabled"
|
|
13
|
+
},
|
|
14
|
+
"auditLoggingEnabled": {
|
|
15
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingEnabled"
|
|
16
|
+
},
|
|
17
|
+
"auditLoggingStorePath": {
|
|
18
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingStorePath"
|
|
19
|
+
},
|
|
20
|
+
"sightEngineApiUser": {
|
|
21
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiUser"
|
|
22
|
+
},
|
|
23
|
+
"sightEngineApiSecret": {
|
|
24
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiSecret"
|
|
25
|
+
},
|
|
26
|
+
"imagesEnabled": {
|
|
27
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imagesEnabled"
|
|
28
|
+
},
|
|
29
|
+
"textEnabled": {
|
|
30
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textEnabled"
|
|
31
|
+
},
|
|
32
|
+
"videoEnabled": {
|
|
33
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoEnabled"
|
|
34
|
+
},
|
|
35
|
+
"imageNudityThreshold": {
|
|
36
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imageNudityThreshold"
|
|
37
|
+
},
|
|
38
|
+
"textSexualThreshold": {
|
|
39
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textSexualThreshold"
|
|
40
|
+
},
|
|
41
|
+
"textToxicThreshold": {
|
|
42
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textToxicThreshold"
|
|
43
|
+
},
|
|
44
|
+
"videoNudityThreshold": {
|
|
45
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoNudityThreshold"
|
|
46
|
+
},
|
|
47
|
+
"source": {
|
|
48
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_source"
|
|
49
|
+
},
|
|
50
|
+
"": {
|
|
51
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_enabled"
|
|
52
|
+
},
|
|
53
|
+
"ggingEnabled": {
|
|
54
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingEnabled"
|
|
55
|
+
},
|
|
56
|
+
"ggingStorePath": {
|
|
57
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_auditLoggingStorePath"
|
|
58
|
+
},
|
|
59
|
+
"gineApiUser": {
|
|
60
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiUser"
|
|
61
|
+
},
|
|
62
|
+
"gineApiSecret": {
|
|
63
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_sightEngineApiSecret"
|
|
64
|
+
},
|
|
65
|
+
"nabled": {
|
|
66
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_imagesEnabled"
|
|
67
|
+
},
|
|
68
|
+
"bled": {
|
|
69
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textEnabled"
|
|
70
|
+
},
|
|
71
|
+
"abled": {
|
|
72
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoEnabled"
|
|
73
|
+
},
|
|
74
|
+
"dityThreshold": {
|
|
75
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_videoNudityThreshold"
|
|
76
|
+
},
|
|
77
|
+
"ualThreshold": {
|
|
78
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textSexualThreshold"
|
|
79
|
+
},
|
|
80
|
+
"icThreshold": {
|
|
81
|
+
"@id": "smp:dist/ModerationOperationHandler.jsonld#ModerationOperationHandler_textToxicThreshold"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"ModerationConfig": {
|
|
86
|
+
"@id": "smp:dist/ModerationConfig.jsonld#ModerationConfig",
|
|
87
|
+
"@prefix": true,
|
|
88
|
+
"@context": {}
|
|
89
|
+
},
|
|
90
|
+
"ModerationStore": {
|
|
91
|
+
"@id": "smp:dist/ModerationStore.jsonld#ModerationStore",
|
|
92
|
+
"@prefix": true,
|
|
93
|
+
"@context": {
|
|
94
|
+
"storePath": {
|
|
95
|
+
"@id": "smp:dist/ModerationStore.jsonld#ModerationStore_storePath"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"ModerationRecord": {
|
|
100
|
+
"@id": "smp:dist/ModerationRecord.jsonld#ModerationRecord",
|
|
101
|
+
"@prefix": true,
|
|
102
|
+
"@context": {}
|
|
103
|
+
},
|
|
104
|
+
"ModerationMixin": {
|
|
105
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin",
|
|
106
|
+
"@prefix": true,
|
|
107
|
+
"@context": {
|
|
108
|
+
"moderationConfig_enabled": {
|
|
109
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_enabled"
|
|
110
|
+
},
|
|
111
|
+
"moderationConfig_auditLoggingEnabled": {
|
|
112
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingEnabled"
|
|
113
|
+
},
|
|
114
|
+
"moderationConfig_auditLoggingStorePath": {
|
|
115
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingStorePath"
|
|
116
|
+
},
|
|
117
|
+
"moderationConfig_sightEngineApiUser": {
|
|
118
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiUser"
|
|
119
|
+
},
|
|
120
|
+
"moderationConfig_sightEngineApiSecret": {
|
|
121
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiSecret"
|
|
122
|
+
},
|
|
123
|
+
"moderationConfig_imagesEnabled": {
|
|
124
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imagesEnabled"
|
|
125
|
+
},
|
|
126
|
+
"moderationConfig_textEnabled": {
|
|
127
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textEnabled"
|
|
128
|
+
},
|
|
129
|
+
"moderationConfig_videoEnabled": {
|
|
130
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoEnabled"
|
|
131
|
+
},
|
|
132
|
+
"moderationConfig_imageNudityThreshold": {
|
|
133
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imageNudityThreshold"
|
|
134
|
+
},
|
|
135
|
+
"moderationConfig_textSexualThreshold": {
|
|
136
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textSexualThreshold"
|
|
137
|
+
},
|
|
138
|
+
"moderationConfig_textToxicThreshold": {
|
|
139
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textToxicThreshold"
|
|
140
|
+
},
|
|
141
|
+
"moderationConfig_videoNudityThreshold": {
|
|
142
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoNudityThreshold"
|
|
143
|
+
},
|
|
144
|
+
"enabled": {
|
|
145
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_enabled"
|
|
146
|
+
},
|
|
147
|
+
"auditLoggingEnabled": {
|
|
148
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingEnabled"
|
|
149
|
+
},
|
|
150
|
+
"auditLoggingStorePath": {
|
|
151
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_auditLoggingStorePath"
|
|
152
|
+
},
|
|
153
|
+
"sightEngineApiUser": {
|
|
154
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiUser"
|
|
155
|
+
},
|
|
156
|
+
"sightEngineApiSecret": {
|
|
157
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_sightEngineApiSecret"
|
|
158
|
+
},
|
|
159
|
+
"imagesEnabled": {
|
|
160
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imagesEnabled"
|
|
161
|
+
},
|
|
162
|
+
"textEnabled": {
|
|
163
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textEnabled"
|
|
164
|
+
},
|
|
165
|
+
"videoEnabled": {
|
|
166
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoEnabled"
|
|
167
|
+
},
|
|
168
|
+
"imageNudityThreshold": {
|
|
169
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_imageNudityThreshold"
|
|
170
|
+
},
|
|
171
|
+
"textSexualThreshold": {
|
|
172
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textSexualThreshold"
|
|
173
|
+
},
|
|
174
|
+
"textToxicThreshold": {
|
|
175
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_textToxicThreshold"
|
|
176
|
+
},
|
|
177
|
+
"videoNudityThreshold": {
|
|
178
|
+
"@id": "smp:dist/ModerationMixin.jsonld#ModerationMixin_moderationConfig_videoNudityThreshold"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"SightEngineProvider": {
|
|
183
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineProvider",
|
|
184
|
+
"@prefix": true,
|
|
185
|
+
"@context": {
|
|
186
|
+
"apiUser": {
|
|
187
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineProvider_apiUser"
|
|
188
|
+
},
|
|
189
|
+
"apiSecret": {
|
|
190
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineProvider_apiSecret"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"SightEngineResult": {
|
|
195
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineResult",
|
|
196
|
+
"@prefix": true,
|
|
197
|
+
"@context": {}
|
|
198
|
+
},
|
|
199
|
+
"SightEngineTextResult": {
|
|
200
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineTextResult",
|
|
201
|
+
"@prefix": true,
|
|
202
|
+
"@context": {}
|
|
203
|
+
},
|
|
204
|
+
"SightEngineVideoResult": {
|
|
205
|
+
"@id": "smp:dist/providers/SightEngineProvider.jsonld#SightEngineVideoResult",
|
|
206
|
+
"@prefix": true,
|
|
207
|
+
"@context": {}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './ModerationOperationHandler';
|
|
2
|
+
export * from './ModerationConfig';
|
|
3
|
+
export * from './ModerationStore';
|
|
4
|
+
export * from './ModerationRecord';
|
|
5
|
+
export * from './ModerationMixin';
|
|
6
|
+
export * from './providers/SightEngineProvider';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ModerationOperationHandler"), exports);
|
|
18
|
+
__exportStar(require("./ModerationConfig"), exports);
|
|
19
|
+
__exportStar(require("./ModerationStore"), exports);
|
|
20
|
+
__exportStar(require("./ModerationRecord"), exports);
|
|
21
|
+
__exportStar(require("./ModerationMixin"), exports);
|
|
22
|
+
__exportStar(require("./providers/SightEngineProvider"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,qDAAmC;AACnC,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,kEAAgD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface SightEngineResult {
|
|
2
|
+
nudity?: {
|
|
3
|
+
raw: number;
|
|
4
|
+
};
|
|
5
|
+
violence: number;
|
|
6
|
+
gore: number;
|
|
7
|
+
weapon: number;
|
|
8
|
+
alcohol: number;
|
|
9
|
+
drugs: number;
|
|
10
|
+
offensive: number;
|
|
11
|
+
selfharm: number;
|
|
12
|
+
gambling: number;
|
|
13
|
+
profanity: number;
|
|
14
|
+
personalInfo: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SightEngineTextResult {
|
|
17
|
+
sexual: number;
|
|
18
|
+
discriminatory: number;
|
|
19
|
+
insulting: number;
|
|
20
|
+
violent: number;
|
|
21
|
+
toxic: number;
|
|
22
|
+
selfharm: number;
|
|
23
|
+
personalInfo: number;
|
|
24
|
+
}
|
|
25
|
+
export interface SightEngineVideoResult {
|
|
26
|
+
nudity?: {
|
|
27
|
+
raw: number;
|
|
28
|
+
};
|
|
29
|
+
violence: number;
|
|
30
|
+
gore: number;
|
|
31
|
+
weapon: number;
|
|
32
|
+
alcohol: number;
|
|
33
|
+
offensive: number;
|
|
34
|
+
selfharm: number;
|
|
35
|
+
gambling: number;
|
|
36
|
+
drugs: number;
|
|
37
|
+
tobacco: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* SightEngine implementation of content moderation provider.
|
|
41
|
+
*/
|
|
42
|
+
export declare class SightEngineProvider {
|
|
43
|
+
protected readonly logger: import("@solid/community-server").Logger;
|
|
44
|
+
private readonly apiUser;
|
|
45
|
+
private readonly apiSecret;
|
|
46
|
+
constructor(apiUser: string, apiSecret: string);
|
|
47
|
+
analyzeImage(filePath: string): Promise<SightEngineResult>;
|
|
48
|
+
analyzeText(text: string): Promise<SightEngineTextResult>;
|
|
49
|
+
private getMatchScore;
|
|
50
|
+
analyzeVideo(filePath: string): Promise<SightEngineVideoResult>;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=SightEngineProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SightEngineProvider.d.ts","sourceRoot":"","sources":["../../src/providers/SightEngineProvider.ts"],"names":[],"mappings":"AA2BA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,SAAS,CAAC,QAAQ,CAAC,MAAM,2CAAsB;IAE/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEhB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKxC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAwF1D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAiFtE,OAAO,CAAC,aAAa;IA2BR,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA4F7E"}
|