-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathblueprints.yaml
More file actions
701 lines (634 loc) · 23.8 KB
/
Copy pathblueprints.yaml
File metadata and controls
701 lines (634 loc) · 23.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
name: API
slug: api
type: plugin
version: 1.0.37
description: RESTful API for Grav CMS. Provides headless access to pages, media, configuration, users, and system management.
icon: plug
author:
name: Team Grav
email: devs@getgrav.org
url: https://getgrav.org
homepage: https://github.com/getgrav/grav-plugin-api
keywords: api, rest, headless, json
bugs: https://github.com/getgrav/grav-plugin-api/issues
docs: https://learn.getgrav.org/api
license: MIT
compatibility:
grav: ["2.0"]
dependencies:
- { name: grav, version: ">=2.1.5" }
- { name: login, version: ">=3.9.2" }
form:
validation: loose
fields:
enabled:
type: toggle
label: Plugin Status
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
tabs:
type: tabs
classes: side-tabs
fields:
tab_general:
type: tab
title: General
fields:
section_general:
type: section
title: General Settings
underline: true
route:
type: text
label: API Route
help: The base route for the API
default: /api
validate:
type: text
version_prefix:
type: text
label: Version Prefix
help: Current API version prefix
default: v1
validate:
type: text
section_backend:
type: section
title: Backend
underline: true
flex_backend.pages:
type: toggle
label: Flex Pages Backend
help: Use Flex-Objects for page listings (faster search, filtering, and pagination)
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
flex_backend.accounts:
type: toggle
label: Flex Accounts Backend
help: Use Flex-Objects for user listings (faster search and pagination)
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
force_cache:
type: toggle
label: Keep Cache for API Requests
help: "Keep Grav's object cache on for API requests even when the global cache is turned off. Disabling the cache is a frontend-dev convenience (to see template changes live), but the API renders no frontend pages — so leaving this on keeps the admin fast while the frontend runs uncached. Turn off only if you need the API to honor the global cache setting."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
tab_authentication:
type: tab
title: Authentication
fields:
section_auth:
type: section
title: Authentication
underline: true
auth.api_keys_enabled:
type: toggle
label: API Key Authentication
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
auth.jwt_enabled:
type: toggle
label: JWT Authentication
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
auth.jwt_expiry:
type: text
label: JWT Access Token Expiry
help: Access token lifetime in seconds
default: 3600
validate:
type: int
auth.jwt_refresh_expiry:
type: text
label: JWT Refresh Token Expiry
help: Refresh token lifetime in seconds
default: 604800
validate:
type: int
auth.jwt_algorithm:
type: select
label: JWT Signing Algorithm
help: "HMAC algorithm used to sign and verify API tokens. Only symmetric HS variants are supported because tokens are signed with a single shared secret. Leave on HS256 unless you have a specific reason to change it."
default: HS256
options:
HS256: "HS256"
HS384: "HS384"
HS512: "HS512"
validate:
type: string
auth.session_enabled:
type: toggle
label: Session Authentication
help: Allow existing admin sessions to access the API
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
auth.key_cache_ttl:
type: text
label: API Key Verification Cache
help: "How long (seconds) to remember a verified API key so repeat requests skip the deliberately-slow bcrypt check. Revoking, disabling or expiring a key still takes effect immediately. Set to 0 to verify every request."
default: 600
validate:
type: int
min: 0
session_early_close:
type: toggle
label: Release Session Lock Early
help: "Commit the session right after authentication on read-only (GET) requests so the new admin's parallel calls don't queue behind PHP's per-session file lock. Recommended on. Turn off only if a custom read endpoint writes to the session."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
protect_frontend_session:
type: toggle
label: Protect Front-end Session
help: "When a token- or key-authenticated API call arrives without its own session cookie, don't let it plant a new front-end session cookie. This stops the API from booting a visitor who is logged in to the public site in the same browser. Recommended on."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
translation_overrides:
type: toggle
label: Translation Overrides
help: "Apply the translation overrides stored in user/languages so they also beat the active theme's own strings. Turning this off leaves the files in place but stops them overriding theme wording. Recommended on."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
allow_draft_preview:
type: toggle
label: Allow Draft Preview
help: "Let the new admin's page editor preview an unpublished page on the front end. The preview is authorized by a short-lived token minted only for users who can read the page, so turning this off disables draft previews entirely. Recommended on."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
section_login_captcha:
type: section
title: Login Captcha
underline: true
login.captcha.enabled:
type: toggle
label: Login Captcha
help: "Require a captcha challenge on the admin login form. The login is already rate-limited and supports per-account 2FA, so this is an extra layer rather than the only one."
highlight: 0
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
login.captcha.provider:
type: select
label: Captcha Provider
help: "Cap is a proof-of-work challenge served by this plugin — no keys and no third-party service. Turnstile and reCAPTCHA require the Form plugin, and use the keys already configured there."
default: cap
options:
cap: "Cap (built-in, no keys)"
turnstile: "Cloudflare Turnstile (Form plugin)"
recaptcha: "Google reCAPTCHA (Form plugin)"
validate:
type: string
login.captcha.mode:
type: select
label: Captcha Mode
help: "Invisible solves in the background while the user types their credentials. Checkbox makes them click. Honored by Cap and Turnstile."
default: invisible
options:
invisible: Invisible
checkbox: Checkbox
validate:
type: string
login.captcha.flows.login:
type: toggle
label: Guard Login
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
login.captcha.flows.forgot_password:
type: toggle
label: Guard Forgotten Password
help: "Recommended — the forgotten-password endpoint sends mail, which makes it a more attractive target than login itself."
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
login.captcha.flows.setup:
type: toggle
label: Guard First-run Setup
help: "Only reachable on a site with no accounts yet."
highlight: 0
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
login.captcha.cap.challenge_difficulty:
type: text
label: Cap Difficulty
help: "Leading zero bits each sub-challenge must produce. Higher is more work for the client — raise only if you're seeing scripted attempts get through."
default: 4
validate:
type: int
min: 1
max: 8
login.captcha.cap.challenge_count:
type: text
label: Cap Sub-challenges
help: "How many sub-challenges make up one captcha. The default takes well under a second on a phone."
default: 30
validate:
type: int
min: 1
max: 200
tab_cors:
type: tab
title: CORS
fields:
section_cors:
type: section
title: CORS Settings
underline: true
cors.enabled:
type: toggle
label: Enable CORS
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
cors.origins:
type: array
label: Allowed Origins
help: 'Exact origins (scheme + host) allowed to call the API from a browser, e.g. https://app.example.com. Empty means same-origin only. Avoid "*": it lets any website read authenticated responses, so a configured wildcard is honored only for unauthenticated endpoints.'
value_only: true
cors.methods:
type: selectize
label: Allowed Methods
help: HTTP methods allowed for CORS requests
default:
- GET
- POST
- PATCH
- DELETE
- OPTIONS
multiple: true
validate:
type: commalist
cors.headers:
type: array
label: Allowed Headers
default:
- Content-Type
- Authorization
- X-API-Key
- X-Grav-Environment
- If-Match
- If-None-Match
value_only: true
tab_rate_limiting:
type: tab
title: Rate Limiting
fields:
section_rate_limit:
type: section
title: Rate Limiting
underline: true
rate_limit.enabled:
type: toggle
label: Enable Rate Limiting
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
rate_limit.requests:
type: text
label: Requests Per Window
help: Maximum number of requests per time window
default: 120
validate:
type: int
rate_limit.window:
type: text
label: Time Window
help: Rate limit window in seconds
default: 60
validate:
type: int
tab_content:
type: tab
title: Content
fields:
section_media_metadata:
type: section
title: Media Metadata
underline: true
media_metadata.max_length:
type: text
label: Maximum Value Length
help: "Longest metadata value (characters) accepted when saving. Values are also stripped of HTML tags, since they render into image attributes on the site."
default: 2000
validate:
type: int
min: 1
media_metadata.fields:
type: list
label: Editable Metadata Fields
help: "Descriptive fields shown in the media metadata editor. The key is written verbatim into the .meta.yaml sidecar. Any other keys (EXIF, dimensions, upload info) are left untouched on save."
fields:
.key:
type: text
label: Key
help: "Sidecar key, e.g. alt, title, caption. Letters, numbers, dot, dash and underscore only."
validate:
type: text
.label:
type: text
label: Label
.type:
type: select
label: Field Type
default: text
options:
text: "Single line"
textarea: "Multi-line"
tags: "Tags (list)"
section_popularity:
type: section
title: Page Statistics
underline: true
popularity.enabled:
type: toggle
label: Track Page Views
help: Record frontend page views for the Page Statistics dashboard
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
popularity.exclude_admin:
type: toggle
label: Exclude Logged-in Admins
help: Skip page views made while logged in with admin access, so your own testing and demo visits don't skew the stats
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
popularity.exclude_ips:
type: array
label: Excluded IP Addresses
help: "Visitor IPs or CIDR ranges to exclude from tracking, e.g. 203.0.113.7 or 203.0.113.0/24. IPv4 and IPv6 are both supported."
value_only: true
popularity.exclude_non_browsers:
type: toggle
label: Exclude Non-Browser Clients
help: Skip page views from command-line and library HTTP clients such as curl, wget, Go-http-client and python-requests. These report themselves as browsers rather than bots, so a scanner hitting your site would otherwise count as real traffic
highlight: 1
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
popularity.exclude_agents:
type: array
label: Excluded User Agents
help: "Additional User-Agent fragments to exclude from tracking, matched anywhere in the header and ignoring case, e.g. uptimerobot or my-scanner. Added to the built-in list above."
value_only: true
tab_audit_trail:
type: tab
title: Audit Trail
fields:
section_audit:
type: section
title: Audit Trail
underline: true
audit.enabled:
type: toggle
label: Enable Audit Trail
help: Record API activity (logins, content, user, config, and package changes) to a queryable log shown under Tools. Visible to super admins only. Off by default.
highlight: 0
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.coverage:
type: select
label: Detail Level
help: "Standard records who did what, when, and from where. Detailed additionally captures field-level before/after values for page edits (more storage)."
default: standard
options:
standard: "Standard (activity stream)"
detailed: "Detailed (with change diffs)"
audit.retention_days:
type: text
label: Retention (days)
help: Automatically delete entries older than this many days. Set 0 to keep entries indefinitely.
default: 90
validate:
type: int
min: 0
audit.retention_max_rows:
type: text
label: Maximum Entries
help: Hard cap on stored entries; the oldest are trimmed once exceeded. Set 0 for no cap.
default: 100000
validate:
type: int
min: 0
audit.anonymize_ip:
type: toggle
label: Anonymize IP Addresses
help: Mask the last part of each IP before storing (last octet for IPv4, last 80 bits for IPv6), for GDPR-friendlier logs. Off keeps full addresses for forensic detail.
default: 0
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.auth:
type: toggle
label: Capture Authentication
help: Logins, failed logins, logouts, and password resets
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.content:
type: toggle
label: Capture Content Changes
help: Page create, update, delete, move, and translate
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.media:
type: toggle
label: Capture Media Changes
help: Media uploads and deletions
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.users:
type: toggle
label: Capture User & Group Changes
help: User and group create, update, and delete
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.config:
type: toggle
label: Capture Configuration Changes
help: System and plugin configuration updates
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
audit.capture.packages:
type: toggle
label: Capture Package Changes
help: Plugin and theme install, update, remove, and Grav upgrades
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
tab_demo_mode:
type: tab
title: Demo Mode
fields:
section_demo:
type: section
title: Demo Mode
underline: true
demo.notice:
type: display
markdown: true
content: "Demo mode is turned on **per account**, by granting an account the *Demo Mode* access flag (`access.api.demo`) in its permissions. A demo account can browse everything but cannot save changes except to the resources below, and server paths, logs, and backups are hidden from it. Capture the baseline and reset the content from the **Set Baseline / Reset Now** panel, or with `bin/plugin api demo:baseline` and `bin/plugin api demo:reset`."
demo.writable:
type: select
multiple: true
label: Writable Resources
help: "Resources a demo account may still create, update, or delete. Leave empty for a fully read-only demo; select Pages only to allow content editing without media uploads. Config, users, packages, system, backups, and webhooks are always blocked regardless of this list."
default:
- api.pages.write
- api.media.write
options:
api.pages.write: Pages
api.media.write: Media
demo.reset_interval:
type: text
label: Reset Interval (minutes)
help: How often demo content resets back to the captured baseline. Only takes effect once a baseline exists.
default: 30
validate:
type: int
min: 1
demo.reset_on_request:
type: toggle
label: Reset On Request (Lazy)
help: Reset opportunistically on incoming API requests when the content is stale. Recommended for installs that don't run `bin/grav scheduler` via cron.
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
demo.reset_on_schedule:
type: toggle
label: Reset On Schedule
help: Also register a Scheduler job, for installs that run `bin/grav scheduler` via cron.
default: 1
options:
1: Enabled
0: Disabled
validate:
type: bool
demo.keep_safety_snapshots:
type: text
label: Safety Snapshots to Retain
help: A safety snapshot of the current content is taken before every reset, in case the baseline itself is wrong. Oldest snapshots beyond this count are purged.
default: 5
validate:
type: int
min: 0