0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/spec/lib/site_settings
Régis Hanol 6212b0b736
FEATURE: Support non-image file uploads in site settings (#37005)
This change extends the upload type site setting to support non-image
files by adding two new optional attributes:

- `authorized_extensions`: pipe-separated list of allowed extensions
(e.g., "txt|json"). When not specified, only images are allowed.
- `max_file_size_kb`: maximum file size in KB. When not specified, uses
max_image_size_kb or max_attachment_size_kb based on file type.

The upload component has been rewritten as a Glimmer component with:
- Separate UI for image files (preview with lightbox) and non-image
files (file info with download link)
- Display of upload restrictions when configured
- Drag and drop support
- Progress bar during upload

Example usage in site_settings.yml:

```yaml
llms_txt:
  default: ""
  type: upload
  authorized_extensions: "txt|md"
  max_file_size_kb: 512
```

Ref - t/162690
Related #36939

**Empty site setting**
<img width="1762" height="1229" alt="2026-01-08 @ 09 32 13"
src="https://github.com/user-attachments/assets/8f1bad3a-7070-4313-b82f-66335e9dbaff"
/>

**Site setting with a file uploaded**
<img width="1762" height="1229" alt="2026-01-08 @ 09 32 26"
src="https://github.com/user-attachments/assets/f20cc78b-8e81-451b-b334-8f3dada213b1"
/>

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2026-01-19 22:37:38 +01:00
..
db_provider_spec.rb DEV: Fix core backend CI tests timing out (#34281) 2025-08-13 16:06:19 +08:00
defaults_provider_spec.rb DEV: Add plugin hook for transforming site setting defaults (#20941) 2023-04-05 12:28:16 +01:00
dependency_graph_spec.rb DEV: Allow specifying dependent settings in configuration (#36061) 2025-11-27 13:23:43 +08:00
deprecated_settings_spec.rb DEV: Fix a flaky deprecated settings test (#33996) 2025-07-31 13:16:04 +10:00
hidden_provider_spec.rb DEV: support un-hiding site settings programmatically (#32824) 2025-05-20 21:44:56 +02:00
local_process_provider_multisite_spec.rb
local_process_provider_spec.rb
type_supervisor_spec.rb FEATURE: Support non-image file uploads in site settings (#37005) 2026-01-19 22:37:38 +01:00
validations_spec.rb DEV: Deprecate the assignment of nil to site settings (#36093) 2025-12-01 15:04:23 +08:00
yaml_loader_spec.rb