@meith/settings 0.30.1 → 0.32.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/settings",
3
- "version": "0.30.1",
3
+ "version": "0.32.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "zod": "^4.4.3",
23
- "@meith/core": "0.30.1",
24
- "@meith/i18n": "0.30.1"
23
+ "@meith/core": "0.32.0",
24
+ "@meith/i18n": "0.32.0"
25
25
  }
26
26
  }
@@ -5,6 +5,11 @@ import { normaliseLocale, SOURCE_LOCALE } from '@meith/i18n'
5
5
  import { DEFAULT_PRIVACY_POLICY, DEFAULT_TERMS_OF_SERVICE } from './legal'
6
6
  import { mailEndpointProblem } from './mail'
7
7
  import { isUsableFeedUrl, isUsableIssuer, isUsableOrigin } from './origin'
8
+ import {
9
+ DEFAULT_SEARCH_LANGUAGE,
10
+ SEARCH_LANGUAGE_OPTIONS,
11
+ SEARCH_LANGUAGES,
12
+ } from './search-languages'
8
13
 
9
14
  export type SettingGroup =
10
15
  | 'board'
@@ -133,6 +138,20 @@ export const SETTING_DEFINITIONS = [
133
138
  ui: { multiline: true, advanced: true },
134
139
  }),
135
140
 
141
+ define({
142
+ key: 'board.digest_lapsed_days',
143
+ group: 'board',
144
+ label: 'Board digest: days away before a member counts as lapsed',
145
+ description:
146
+ 'A member whose board activity digest is switched on only receives one once their ' +
147
+ 'last visit is at least this many days ago — a member who drops in daily should not ' +
148
+ 'be told what they already saw. Their own chosen cadence, weekly or monthly, decides ' +
149
+ 'how often after that.',
150
+ schema: z.number().int().min(1).max(365),
151
+ default: 7,
152
+ ui: { min: 1, max: 365 },
153
+ }),
154
+
136
155
  define({
137
156
  key: 'registration.enabled',
138
157
  group: 'registration',
@@ -392,6 +411,25 @@ export const SETTING_DEFINITIONS = [
392
411
  default: 2,
393
412
  ui: { min: 1, max: 10 },
394
413
  }),
414
+ define({
415
+ key: 'search.language',
416
+ group: 'search',
417
+ label: 'Search language',
418
+ description:
419
+ 'The Postgres text-search configuration used to stem posts as they are ' +
420
+ 'indexed and to stem the words a member searches for. Match it to the ' +
421
+ 'language the board is written in, so a search for one form of a word ' +
422
+ 'finds the others — the German configuration ties "Häuser" to "Haus", ' +
423
+ 'where English would leave them apart. "No stemming" indexes and matches ' +
424
+ 'whole words only, which is the safe choice for a board that mixes ' +
425
+ 'languages. Changing it schedules a background reindex: every post is ' +
426
+ 'rewritten under the new configuration by the search reindex task, a ' +
427
+ 'batch at a time, and stays findable under the old one until its turn ' +
428
+ 'comes.',
429
+ schema: z.enum(SEARCH_LANGUAGES),
430
+ default: DEFAULT_SEARCH_LANGUAGE,
431
+ ui: { options: SEARCH_LANGUAGE_OPTIONS },
432
+ }),
395
433
 
396
434
  define({
397
435
  key: 'mail.transport',
@@ -680,6 +718,19 @@ export const SETTING_DEFINITIONS = [
680
718
  default: 0,
681
719
  ui: { min: 0, max: 50 },
682
720
  }),
721
+ define({
722
+ key: 'moderation.flag_threshold',
723
+ group: 'antispam',
724
+ label: 'Community flag threshold',
725
+ description:
726
+ 'How many different members must report the same visible post before ' +
727
+ 'the board holds it for a moderator to look at. 0 turns community ' +
728
+ 'flagging off. One member reporting the same post many times never ' +
729
+ 'trips it — the count is of distinct members.',
730
+ schema: z.number().int().min(0).max(100),
731
+ default: 0,
732
+ ui: { min: 0, max: 100 },
733
+ }),
683
734
 
684
735
  define({
685
736
  key: 'antispam.register_ip_per_hour',
package/src/index.ts CHANGED
@@ -64,6 +64,12 @@ export {
64
64
  pushContact,
65
65
  resolvePushConfig,
66
66
  } from './push'
67
+ export {
68
+ DEFAULT_SEARCH_LANGUAGE,
69
+ SEARCH_LANGUAGE_OPTIONS,
70
+ SEARCH_LANGUAGES,
71
+ type SearchLanguage,
72
+ } from './search-languages'
67
73
  export {
68
74
  type SaveResult,
69
75
  type SettingsRepository,
@@ -0,0 +1,72 @@
1
+ export const SEARCH_LANGUAGES = [
2
+ 'simple',
3
+ 'arabic',
4
+ 'armenian',
5
+ 'basque',
6
+ 'catalan',
7
+ 'danish',
8
+ 'dutch',
9
+ 'english',
10
+ 'estonian',
11
+ 'finnish',
12
+ 'french',
13
+ 'german',
14
+ 'greek',
15
+ 'hindi',
16
+ 'hungarian',
17
+ 'indonesian',
18
+ 'irish',
19
+ 'italian',
20
+ 'lithuanian',
21
+ 'nepali',
22
+ 'norwegian',
23
+ 'portuguese',
24
+ 'romanian',
25
+ 'russian',
26
+ 'serbian',
27
+ 'spanish',
28
+ 'swedish',
29
+ 'tamil',
30
+ 'turkish',
31
+ 'yiddish',
32
+ ] as const
33
+
34
+ export type SearchLanguage = (typeof SEARCH_LANGUAGES)[number]
35
+
36
+ export const DEFAULT_SEARCH_LANGUAGE: SearchLanguage = 'english'
37
+
38
+ export const SEARCH_LANGUAGE_OPTIONS: readonly {
39
+ readonly value: SearchLanguage
40
+ readonly label: string
41
+ }[] = [
42
+ { value: 'simple', label: 'No stemming (exact words)' },
43
+ { value: 'arabic', label: 'Arabic' },
44
+ { value: 'armenian', label: 'Armenian' },
45
+ { value: 'basque', label: 'Basque' },
46
+ { value: 'catalan', label: 'Catalan' },
47
+ { value: 'danish', label: 'Danish' },
48
+ { value: 'dutch', label: 'Dutch' },
49
+ { value: 'english', label: 'English' },
50
+ { value: 'estonian', label: 'Estonian' },
51
+ { value: 'finnish', label: 'Finnish' },
52
+ { value: 'french', label: 'French' },
53
+ { value: 'german', label: 'German' },
54
+ { value: 'greek', label: 'Greek' },
55
+ { value: 'hindi', label: 'Hindi' },
56
+ { value: 'hungarian', label: 'Hungarian' },
57
+ { value: 'indonesian', label: 'Indonesian' },
58
+ { value: 'irish', label: 'Irish' },
59
+ { value: 'italian', label: 'Italian' },
60
+ { value: 'lithuanian', label: 'Lithuanian' },
61
+ { value: 'nepali', label: 'Nepali' },
62
+ { value: 'norwegian', label: 'Norwegian' },
63
+ { value: 'portuguese', label: 'Portuguese' },
64
+ { value: 'romanian', label: 'Romanian' },
65
+ { value: 'russian', label: 'Russian' },
66
+ { value: 'serbian', label: 'Serbian' },
67
+ { value: 'spanish', label: 'Spanish' },
68
+ { value: 'swedish', label: 'Swedish' },
69
+ { value: 'tamil', label: 'Tamil' },
70
+ { value: 'turkish', label: 'Turkish' },
71
+ { value: 'yiddish', label: 'Yiddish' },
72
+ ]