@openpeepshq/common 0.1.44 → 0.1.46
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/dist/lib/adminSections.d.ts +4 -0
- package/dist/lib/adminSections.js +5 -0
- package/dist/lib/capabilitiesHelpers.d.ts +9 -7
- package/dist/lib/capabilitiesHelpers.js +21 -13
- package/dist/lib/eventIcs.d.ts +17 -0
- package/dist/lib/eventIcs.js +138 -2
- package/dist/lib/eventRecurrence.d.ts +32 -0
- package/dist/lib/eventRecurrence.js +284 -0
- package/dist/lib/eventTime.d.ts +29 -0
- package/dist/lib/eventTime.js +143 -0
- package/dist/lib/federationHosts.d.ts +3 -0
- package/dist/lib/federationHosts.js +17 -0
- package/dist/lib/feedCursor.d.ts +14 -0
- package/dist/lib/feedCursor.js +22 -0
- package/dist/lib/feedFormat.d.ts +12 -0
- package/dist/lib/feedFormat.js +14 -0
- package/dist/lib/groupHelpers.d.ts +63 -41
- package/dist/lib/groupHelpers.js +155 -45
- package/dist/lib/groupTemplateHelpers.d.ts +16 -0
- package/dist/lib/groupTemplateHelpers.js +51 -0
- package/dist/lib/index.d.ts +11 -0
- package/dist/lib/index.js +11 -0
- package/dist/lib/jamHelpers.d.ts +38 -3
- package/dist/lib/jamHelpers.js +93 -8
- package/dist/lib/legacyThemeRoot.d.ts +3 -0
- package/dist/lib/legacyThemeRoot.js +10 -0
- package/dist/lib/markdownHelpers.d.ts +22 -0
- package/dist/lib/markdownHelpers.js +73 -3
- package/dist/lib/postHelpers.d.ts +164 -9
- package/dist/lib/postHelpers.js +353 -11
- package/dist/lib/profileHelpers.d.ts +11 -0
- package/dist/lib/profileHelpers.js +31 -0
- package/dist/lib/pushHelpers.d.ts +3 -1
- package/dist/lib/pushHelpers.js +13 -0
- package/dist/lib/reactions.d.ts +17 -0
- package/dist/lib/reactions.js +37 -0
- package/dist/lib/scopeHelpers.d.ts +31 -2
- package/dist/lib/scopeHelpers.js +37 -3
- package/dist/lib/ssoLoginUrl.d.ts +24 -0
- package/dist/lib/ssoLoginUrl.js +75 -0
- package/dist/lib/ssoProviders.d.ts +72 -0
- package/dist/lib/ssoProviders.js +370 -0
- package/dist/lib/text.d.ts +2 -0
- package/dist/lib/text.js +2 -0
- package/dist/lib/timeZone.d.ts +9 -0
- package/dist/lib/timeZone.js +44 -0
- package/dist/lib/tokenHelpers.d.ts +5 -0
- package/dist/lib/tokenHelpers.js +19 -0
- package/dist/types/analytics.d.ts +20 -0
- package/dist/types/analytics.js +4 -0
- package/dist/types/api.d.ts +42669 -10689
- package/dist/types/api.js +94 -16
- package/dist/types/auth.d.ts +22 -13
- package/dist/types/capabilities.d.ts +26 -5
- package/dist/types/capabilities.js +95 -1
- package/dist/types/config.d.ts +93 -6
- package/dist/types/config.js +56 -5
- package/dist/types/db.d.ts +1911 -248
- package/dist/types/db.js +17 -3
- package/dist/types/export.d.ts +120 -0
- package/dist/types/export.js +7 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/internal.d.ts +8313 -2675
- package/dist/types/internal.js +16 -1
- package/dist/types/models.d.ts +343 -16
- package/dist/types/models.js +98 -7
- package/dist/types/notifications.d.ts +1 -0
- package/dist/types/plugins.d.ts +43 -1
- package/dist/types/plugins.js +75 -1
- package/dist/types/roleDefaults.d.ts +31 -0
- package/dist/types/roleDefaults.js +110 -0
- package/dist/types/stats.d.ts +54359 -4718
- package/dist/types/stats.js +30 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types/utils.js +1 -3
- package/package.json +1 -1
package/dist/types/config.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare const mediaStorageParamsSchema: z.ZodObject<{
|
|
|
11
11
|
host: z.ZodOptional<z.ZodString>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
13
|
export type MediaStorageParams = z.infer<typeof mediaStorageParamsSchema>;
|
|
14
|
+
/** MiB. 1024 is 1 GiB — the default shown in the admin media section. */
|
|
15
|
+
export declare const DEFAULT_MAX_MEDIA_UPLOAD_MB = 1024;
|
|
16
|
+
export declare const mediaUploadLimitBytes: (maxUploadMb: number) => number;
|
|
14
17
|
export declare const stripePaymentConfigSchema: (sanitize?: boolean) => z.ZodObject<{
|
|
15
18
|
paidMembership: z.ZodOptional<z.ZodObject<{
|
|
16
19
|
enabled: z.ZodBoolean;
|
|
@@ -85,7 +88,7 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
85
88
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
86
89
|
}, z.core.$strip>;
|
|
87
90
|
db: z.ZodObject<{
|
|
88
|
-
url: z.ZodString
|
|
91
|
+
url: z.ZodOptional<z.ZodString>;
|
|
89
92
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
90
93
|
databaseUrl: z.ZodString;
|
|
91
94
|
}, z.core.$strip>;
|
|
@@ -112,6 +115,7 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
112
115
|
}, z.core.$strip>;
|
|
113
116
|
}, z.core.$strip>;
|
|
114
117
|
media: z.ZodObject<{
|
|
118
|
+
maxUploadMb: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
115
119
|
storage: z.ZodObject<{
|
|
116
120
|
driver: z.ZodEnum<{
|
|
117
121
|
openpeeps: "openpeeps";
|
|
@@ -147,6 +151,7 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
147
151
|
}, z.core.$strip>;
|
|
148
152
|
federation: z.ZodObject<{
|
|
149
153
|
active: z.ZodBoolean;
|
|
154
|
+
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
150
155
|
}, z.core.$strip>;
|
|
151
156
|
activityPub: z.ZodObject<{
|
|
152
157
|
defaultDomain: z.ZodString;
|
|
@@ -157,7 +162,11 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
157
162
|
}, z.core.$strip>;
|
|
158
163
|
}, z.core.$strip>;
|
|
159
164
|
sso: z.ZodObject<{
|
|
165
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
160
166
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
167
|
+
id: z.ZodDefault<z.ZodString>;
|
|
168
|
+
name: z.ZodDefault<z.ZodString>;
|
|
169
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
161
170
|
userProfileRequest: z.ZodObject<{
|
|
162
171
|
url: z.ZodString;
|
|
163
172
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -174,9 +183,26 @@ export declare const coreConfigSchemaFactory: (sanitize?: boolean) => z.ZodObjec
|
|
|
174
183
|
oidc: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
175
184
|
id: z.ZodString;
|
|
176
185
|
name: z.ZodString;
|
|
186
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
187
|
+
oidc: "oidc";
|
|
188
|
+
github: "github";
|
|
189
|
+
gitlab: "gitlab";
|
|
190
|
+
"gitlab-selfhosted": "gitlab-selfhosted";
|
|
191
|
+
google: "google";
|
|
192
|
+
entra: "entra";
|
|
193
|
+
auth0: "auth0";
|
|
194
|
+
keycloak: "keycloak";
|
|
195
|
+
authentik: "authentik";
|
|
196
|
+
okta: "okta";
|
|
197
|
+
discord: "discord";
|
|
198
|
+
pocketid: "pocketid";
|
|
199
|
+
}>>;
|
|
200
|
+
instanceUrl: z.ZodOptional<z.ZodString>;
|
|
201
|
+
tenant: z.ZodOptional<z.ZodString>;
|
|
177
202
|
authorizationUrl: z.ZodString;
|
|
178
203
|
tokenUrl: z.ZodString;
|
|
179
204
|
userinfoUrl: z.ZodString;
|
|
205
|
+
emailsUrl: z.ZodOptional<z.ZodString>;
|
|
180
206
|
jwksUri: z.ZodOptional<z.ZodString>;
|
|
181
207
|
clientId: z.ZodString;
|
|
182
208
|
clientSecret: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
@@ -241,7 +267,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
241
267
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
242
268
|
}, z.core.$strip>;
|
|
243
269
|
db: z.ZodObject<{
|
|
244
|
-
url: z.ZodString
|
|
270
|
+
url: z.ZodOptional<z.ZodString>;
|
|
245
271
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
246
272
|
databaseUrl: z.ZodString;
|
|
247
273
|
}, z.core.$strip>;
|
|
@@ -268,6 +294,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
268
294
|
}, z.core.$strip>;
|
|
269
295
|
}, z.core.$strip>;
|
|
270
296
|
media: z.ZodObject<{
|
|
297
|
+
maxUploadMb: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
271
298
|
storage: z.ZodObject<{
|
|
272
299
|
driver: z.ZodEnum<{
|
|
273
300
|
openpeeps: "openpeeps";
|
|
@@ -303,6 +330,7 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
303
330
|
}, z.core.$strip>;
|
|
304
331
|
federation: z.ZodObject<{
|
|
305
332
|
active: z.ZodBoolean;
|
|
333
|
+
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
306
334
|
}, z.core.$strip>;
|
|
307
335
|
activityPub: z.ZodObject<{
|
|
308
336
|
defaultDomain: z.ZodString;
|
|
@@ -313,7 +341,11 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
313
341
|
}, z.core.$strip>;
|
|
314
342
|
}, z.core.$strip>;
|
|
315
343
|
sso: z.ZodObject<{
|
|
344
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
316
345
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
346
|
+
id: z.ZodDefault<z.ZodString>;
|
|
347
|
+
name: z.ZodDefault<z.ZodString>;
|
|
348
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
317
349
|
userProfileRequest: z.ZodObject<{
|
|
318
350
|
url: z.ZodString;
|
|
319
351
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -330,9 +362,26 @@ export declare const coreConfigSchema: z.ZodObject<{
|
|
|
330
362
|
oidc: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
331
363
|
id: z.ZodString;
|
|
332
364
|
name: z.ZodString;
|
|
365
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
366
|
+
oidc: "oidc";
|
|
367
|
+
github: "github";
|
|
368
|
+
gitlab: "gitlab";
|
|
369
|
+
"gitlab-selfhosted": "gitlab-selfhosted";
|
|
370
|
+
google: "google";
|
|
371
|
+
entra: "entra";
|
|
372
|
+
auth0: "auth0";
|
|
373
|
+
keycloak: "keycloak";
|
|
374
|
+
authentik: "authentik";
|
|
375
|
+
okta: "okta";
|
|
376
|
+
discord: "discord";
|
|
377
|
+
pocketid: "pocketid";
|
|
378
|
+
}>>;
|
|
379
|
+
instanceUrl: z.ZodOptional<z.ZodString>;
|
|
380
|
+
tenant: z.ZodOptional<z.ZodString>;
|
|
333
381
|
authorizationUrl: z.ZodString;
|
|
334
382
|
tokenUrl: z.ZodString;
|
|
335
383
|
userinfoUrl: z.ZodString;
|
|
384
|
+
emailsUrl: z.ZodOptional<z.ZodString>;
|
|
336
385
|
jwksUri: z.ZodOptional<z.ZodString>;
|
|
337
386
|
clientId: z.ZodString;
|
|
338
387
|
clientSecret: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
@@ -397,7 +446,7 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
397
446
|
maxProfiles: z.ZodOptional<z.ZodNumber>;
|
|
398
447
|
}, z.core.$strip>;
|
|
399
448
|
db: z.ZodObject<{
|
|
400
|
-
url: z.ZodString
|
|
449
|
+
url: z.ZodOptional<z.ZodString>;
|
|
401
450
|
databaseName: z.ZodOptional<z.ZodString>;
|
|
402
451
|
databaseUrl: z.ZodString;
|
|
403
452
|
}, z.core.$strip>;
|
|
@@ -424,6 +473,7 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
424
473
|
}, z.core.$strip>;
|
|
425
474
|
}, z.core.$strip>;
|
|
426
475
|
media: z.ZodObject<{
|
|
476
|
+
maxUploadMb: z.ZodCatch<z.ZodDefault<z.ZodNumber>>;
|
|
427
477
|
storage: z.ZodObject<{
|
|
428
478
|
driver: z.ZodEnum<{
|
|
429
479
|
openpeeps: "openpeeps";
|
|
@@ -459,6 +509,7 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
459
509
|
}, z.core.$strip>;
|
|
460
510
|
federation: z.ZodObject<{
|
|
461
511
|
active: z.ZodBoolean;
|
|
512
|
+
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
462
513
|
}, z.core.$strip>;
|
|
463
514
|
activityPub: z.ZodObject<{
|
|
464
515
|
defaultDomain: z.ZodString;
|
|
@@ -469,7 +520,11 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
469
520
|
}, z.core.$strip>;
|
|
470
521
|
}, z.core.$strip>;
|
|
471
522
|
sso: z.ZodObject<{
|
|
523
|
+
onlySSO: z.ZodOptional<z.ZodBoolean>;
|
|
472
524
|
generic: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
525
|
+
id: z.ZodDefault<z.ZodString>;
|
|
526
|
+
name: z.ZodDefault<z.ZodString>;
|
|
527
|
+
loginLink: z.ZodOptional<z.ZodString>;
|
|
473
528
|
userProfileRequest: z.ZodObject<{
|
|
474
529
|
url: z.ZodString;
|
|
475
530
|
authHeader: z.ZodOptional<z.ZodString>;
|
|
@@ -486,9 +541,26 @@ export declare const coreConfigSanitizedSchema: z.ZodObject<{
|
|
|
486
541
|
oidc: z.ZodArray<z.ZodDefault<z.ZodObject<{
|
|
487
542
|
id: z.ZodString;
|
|
488
543
|
name: z.ZodString;
|
|
544
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
545
|
+
oidc: "oidc";
|
|
546
|
+
github: "github";
|
|
547
|
+
gitlab: "gitlab";
|
|
548
|
+
"gitlab-selfhosted": "gitlab-selfhosted";
|
|
549
|
+
google: "google";
|
|
550
|
+
entra: "entra";
|
|
551
|
+
auth0: "auth0";
|
|
552
|
+
keycloak: "keycloak";
|
|
553
|
+
authentik: "authentik";
|
|
554
|
+
okta: "okta";
|
|
555
|
+
discord: "discord";
|
|
556
|
+
pocketid: "pocketid";
|
|
557
|
+
}>>;
|
|
558
|
+
instanceUrl: z.ZodOptional<z.ZodString>;
|
|
559
|
+
tenant: z.ZodOptional<z.ZodString>;
|
|
489
560
|
authorizationUrl: z.ZodString;
|
|
490
561
|
tokenUrl: z.ZodString;
|
|
491
562
|
userinfoUrl: z.ZodString;
|
|
563
|
+
emailsUrl: z.ZodOptional<z.ZodString>;
|
|
492
564
|
jwksUri: z.ZodOptional<z.ZodString>;
|
|
493
565
|
clientId: z.ZodString;
|
|
494
566
|
clientSecret: z.ZodOptional<z.ZodString> | z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
@@ -557,7 +629,7 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
|
|
|
557
629
|
base: z.ZodString;
|
|
558
630
|
icon: z.ZodOptional<z.ZodString>;
|
|
559
631
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
560
|
-
primaryHex: z.ZodString
|
|
632
|
+
primaryHex: z.ZodOptional<z.ZodString>;
|
|
561
633
|
logoFull: z.ZodOptional<z.ZodString>;
|
|
562
634
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
563
635
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -614,6 +686,11 @@ export declare const communityConfigSchemaFactory: (_sanitize?: boolean) => z.Zo
|
|
|
614
686
|
settings: z.ZodObject<{
|
|
615
687
|
openRegistrations: z.ZodBoolean;
|
|
616
688
|
defaultLanguage: z.ZodOptional<z.ZodString>;
|
|
689
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
690
|
+
defaultFeedFormat: z.ZodOptional<z.ZodEnum<{
|
|
691
|
+
threaded: "threaded";
|
|
692
|
+
linear: "linear";
|
|
693
|
+
}>>;
|
|
617
694
|
}, z.core.$strip>;
|
|
618
695
|
roles: z.ZodObject<{
|
|
619
696
|
onRegistration: z.ZodObject<{
|
|
@@ -631,7 +708,7 @@ export declare const communityConfigSchema: z.ZodObject<{
|
|
|
631
708
|
base: z.ZodString;
|
|
632
709
|
icon: z.ZodOptional<z.ZodString>;
|
|
633
710
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
634
|
-
primaryHex: z.ZodString
|
|
711
|
+
primaryHex: z.ZodOptional<z.ZodString>;
|
|
635
712
|
logoFull: z.ZodOptional<z.ZodString>;
|
|
636
713
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
637
714
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -688,6 +765,11 @@ export declare const communityConfigSchema: z.ZodObject<{
|
|
|
688
765
|
settings: z.ZodObject<{
|
|
689
766
|
openRegistrations: z.ZodBoolean;
|
|
690
767
|
defaultLanguage: z.ZodOptional<z.ZodString>;
|
|
768
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
769
|
+
defaultFeedFormat: z.ZodOptional<z.ZodEnum<{
|
|
770
|
+
threaded: "threaded";
|
|
771
|
+
linear: "linear";
|
|
772
|
+
}>>;
|
|
691
773
|
}, z.core.$strip>;
|
|
692
774
|
roles: z.ZodObject<{
|
|
693
775
|
onRegistration: z.ZodObject<{
|
|
@@ -705,7 +787,7 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
|
|
|
705
787
|
base: z.ZodString;
|
|
706
788
|
icon: z.ZodOptional<z.ZodString>;
|
|
707
789
|
mobileIcon: z.ZodOptional<z.ZodString>;
|
|
708
|
-
primaryHex: z.ZodString
|
|
790
|
+
primaryHex: z.ZodOptional<z.ZodString>;
|
|
709
791
|
logoFull: z.ZodOptional<z.ZodString>;
|
|
710
792
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
711
793
|
defaultProfileAvatar: z.ZodOptional<z.ZodString>;
|
|
@@ -762,6 +844,11 @@ export declare const communityConfigSanitizedSchema: z.ZodObject<{
|
|
|
762
844
|
settings: z.ZodObject<{
|
|
763
845
|
openRegistrations: z.ZodBoolean;
|
|
764
846
|
defaultLanguage: z.ZodOptional<z.ZodString>;
|
|
847
|
+
defaultTimeZone: z.ZodOptional<z.ZodString>;
|
|
848
|
+
defaultFeedFormat: z.ZodOptional<z.ZodEnum<{
|
|
849
|
+
threaded: "threaded";
|
|
850
|
+
linear: "linear";
|
|
851
|
+
}>>;
|
|
765
852
|
}, z.core.$strip>;
|
|
766
853
|
roles: z.ZodObject<{
|
|
767
854
|
onRegistration: z.ZodObject<{
|
package/dist/types/config.js
CHANGED
|
@@ -17,6 +17,14 @@ export const mediaStorageParamsSchema = z.object({
|
|
|
17
17
|
prefix: z.string(),
|
|
18
18
|
host: z.string().optional(),
|
|
19
19
|
});
|
|
20
|
+
/** MiB. 1024 is 1 GiB — the default shown in the admin media section. */
|
|
21
|
+
export const DEFAULT_MAX_MEDIA_UPLOAD_MB = 1024;
|
|
22
|
+
export const mediaUploadLimitBytes = (maxUploadMb) => {
|
|
23
|
+
const mb = Number.isInteger(maxUploadMb) && maxUploadMb >= 1
|
|
24
|
+
? maxUploadMb
|
|
25
|
+
: DEFAULT_MAX_MEDIA_UPLOAD_MB;
|
|
26
|
+
return mb * 1024 * 1024;
|
|
27
|
+
};
|
|
20
28
|
export const stripePaymentConfigSchema = (sanitize) => z.object({
|
|
21
29
|
paidMembership: z
|
|
22
30
|
.object({
|
|
@@ -59,7 +67,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
59
67
|
maxProfiles: fixed(z.number().int().nonnegative().optional(), sanitize),
|
|
60
68
|
}),
|
|
61
69
|
db: fixed(z.object({
|
|
62
|
-
|
|
70
|
+
// Optional legacy fields so older stored configs still parse.
|
|
71
|
+
url: z.string().url().optional(),
|
|
63
72
|
databaseName: z.string().optional(),
|
|
64
73
|
databaseUrl: z.string(),
|
|
65
74
|
}), sanitize),
|
|
@@ -73,6 +82,12 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
73
82
|
}), sanitize),
|
|
74
83
|
}), sanitize),
|
|
75
84
|
media: z.object({
|
|
85
|
+
maxUploadMb: z
|
|
86
|
+
.number()
|
|
87
|
+
.int()
|
|
88
|
+
.min(1)
|
|
89
|
+
.default(DEFAULT_MAX_MEDIA_UPLOAD_MB)
|
|
90
|
+
.catch(DEFAULT_MAX_MEDIA_UPLOAD_MB),
|
|
76
91
|
storage: z.object({
|
|
77
92
|
driver: z.enum(['openpeeps']),
|
|
78
93
|
params: mediaStorageParamsSchema,
|
|
@@ -102,6 +117,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
102
117
|
}),
|
|
103
118
|
federation: z.object({
|
|
104
119
|
active: z.boolean(),
|
|
120
|
+
/** Host patterns (`mastodon.social`, `*.example.com`). Empty = fail closed. */
|
|
121
|
+
allowedHosts: z.array(z.string()).default([]),
|
|
105
122
|
}),
|
|
106
123
|
activityPub: z.object({
|
|
107
124
|
defaultDomain: z.string(),
|
|
@@ -111,9 +128,15 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
111
128
|
requestTimeout: z.number(),
|
|
112
129
|
}),
|
|
113
130
|
}),
|
|
114
|
-
sso: z
|
|
131
|
+
sso: z
|
|
132
|
+
.object({
|
|
133
|
+
onlySSO: z.boolean().optional(),
|
|
115
134
|
generic: z
|
|
116
135
|
.object({
|
|
136
|
+
id: z.string().default('example-generic'),
|
|
137
|
+
name: z.string().default('Generic SSO'),
|
|
138
|
+
/** URL or path shown on the login page to start this provider's flow. */
|
|
139
|
+
loginLink: z.string().optional(),
|
|
117
140
|
userProfileRequest: z.object({
|
|
118
141
|
url: z.string(),
|
|
119
142
|
authHeader: z.string().optional(),
|
|
@@ -128,6 +151,9 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
128
151
|
createProfiles: z.boolean().optional(),
|
|
129
152
|
})
|
|
130
153
|
.default({
|
|
154
|
+
id: 'example-generic',
|
|
155
|
+
name: 'Generic SSO',
|
|
156
|
+
loginLink: '',
|
|
131
157
|
userProfileRequest: {
|
|
132
158
|
url: 'https://example.com/profile',
|
|
133
159
|
authHeader: 'Bearer ${token}',
|
|
@@ -143,9 +169,28 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
143
169
|
.object({
|
|
144
170
|
id: z.string(),
|
|
145
171
|
name: z.string(),
|
|
172
|
+
kind: z
|
|
173
|
+
.enum([
|
|
174
|
+
'oidc',
|
|
175
|
+
'github',
|
|
176
|
+
'gitlab',
|
|
177
|
+
'gitlab-selfhosted',
|
|
178
|
+
'google',
|
|
179
|
+
'entra',
|
|
180
|
+
'auth0',
|
|
181
|
+
'keycloak',
|
|
182
|
+
'authentik',
|
|
183
|
+
'okta',
|
|
184
|
+
'discord',
|
|
185
|
+
'pocketid',
|
|
186
|
+
])
|
|
187
|
+
.optional(),
|
|
188
|
+
instanceUrl: z.string().optional(),
|
|
189
|
+
tenant: z.string().optional(),
|
|
146
190
|
authorizationUrl: z.string(),
|
|
147
191
|
tokenUrl: z.string(),
|
|
148
192
|
userinfoUrl: z.string(),
|
|
193
|
+
emailsUrl: z.string().optional(),
|
|
149
194
|
jwksUri: z.string().optional(),
|
|
150
195
|
clientId: z.string(),
|
|
151
196
|
clientSecret: password(sanitize).optional(),
|
|
@@ -163,6 +208,7 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
163
208
|
.default({
|
|
164
209
|
id: 'example-oidc',
|
|
165
210
|
name: 'OIDC Provider',
|
|
211
|
+
kind: 'oidc',
|
|
166
212
|
authorizationUrl: 'https://example.com/authorize',
|
|
167
213
|
tokenUrl: 'https://example.com/token',
|
|
168
214
|
userinfoUrl: 'https://example.com/userinfo',
|
|
@@ -177,7 +223,8 @@ export const coreConfigSchemaFactory = (sanitize) => z.object({
|
|
|
177
223
|
approvalRequired: false,
|
|
178
224
|
})
|
|
179
225
|
.array(),
|
|
180
|
-
})
|
|
226
|
+
})
|
|
227
|
+
.describe('hidden'),
|
|
181
228
|
services: z.object({
|
|
182
229
|
sentry: z.object({
|
|
183
230
|
enabled: z.boolean(),
|
|
@@ -225,7 +272,9 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
225
272
|
base: z.string(),
|
|
226
273
|
icon: z.string().optional(),
|
|
227
274
|
mobileIcon: z.string().optional(),
|
|
228
|
-
|
|
275
|
+
// Kept so /server/info still satisfies common 0.1.44 (required
|
|
276
|
+
// theme.primaryHex) and RN 0.3.1 root-theme reads.
|
|
277
|
+
primaryHex: z.string().optional(),
|
|
229
278
|
logoFull: z.string().optional(),
|
|
230
279
|
logoSmall: z.string().optional(),
|
|
231
280
|
defaultProfileAvatar: z.string().optional(),
|
|
@@ -281,6 +330,8 @@ export const communityConfigSchemaFactory = (_sanitize) => z.object({
|
|
|
281
330
|
settings: z.object({
|
|
282
331
|
openRegistrations: z.boolean(),
|
|
283
332
|
defaultLanguage: z.string().optional(),
|
|
333
|
+
defaultTimeZone: z.string().optional(),
|
|
334
|
+
defaultFeedFormat: z.enum(['threaded', 'linear']).optional(),
|
|
284
335
|
}),
|
|
285
336
|
roles: z.object({
|
|
286
337
|
onRegistration: z.object({
|
|
@@ -308,7 +359,7 @@ const addWildCardOptions = (capabilities) => {
|
|
|
308
359
|
[...firstLevelCategories].map((flc) => `${flc}-${wildCard}`),
|
|
309
360
|
[...secondLevelCategories].flatMap((slc) => [
|
|
310
361
|
...slc,
|
|
311
|
-
|
|
362
|
+
...[...slc].map((key) => `${key}-${wildCard}`),
|
|
312
363
|
]),
|
|
313
364
|
].flat();
|
|
314
365
|
};
|