nodebb-plugin-facebook-post 1.0.13 → 1.0.14
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/library.js +18 -0
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -135,6 +135,24 @@ function sanitizeExcerpt(text, maxLen) {
|
|
|
135
135
|
return s.slice(0, Math.max(0, maxLen - 1)).trimEnd() + '…';
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
function normalizeAllowedGroupsValue(value) {
|
|
139
|
+
if (!value) return '';
|
|
140
|
+
if (Array.isArray(value)) {
|
|
141
|
+
return value.map(String).map(v => v.trim()).filter(Boolean).join(',');
|
|
142
|
+
}
|
|
143
|
+
const s = String(value).trim();
|
|
144
|
+
if (!s) return '';
|
|
145
|
+
if (s.startsWith('[')) {
|
|
146
|
+
try {
|
|
147
|
+
const parsed = JSON.parse(s);
|
|
148
|
+
if (Array.isArray(parsed)) {
|
|
149
|
+
return parsed.map(String).map(v => v.trim()).filter(Boolean).join(',');
|
|
150
|
+
}
|
|
151
|
+
} catch (_) {}
|
|
152
|
+
}
|
|
153
|
+
return s;
|
|
154
|
+
}
|
|
155
|
+
|
|
138
156
|
function parseAllowedGroupsList() {
|
|
139
157
|
const s = trimStr(settings.allowedGroups);
|
|
140
158
|
if (!s) return [];
|
package/package.json
CHANGED