mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 08:23:45 +08:00
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>
10 lines
178 B
SCSS
Vendored
10 lines
178 B
SCSS
Vendored
.form-kit__control-image {
|
|
width: 100%;
|
|
|
|
.file-uploader-preview {
|
|
max-width: 100%;
|
|
width: 100%;
|
|
margin: 0;
|
|
border-radius: var(--d-input-border-radius);
|
|
}
|
|
}
|