Retro Bulletin Board Systems on atproto. Web app and TUI. lazy mirror of alyraffauf/atbbs atbbs.xyz
forums python tui atproto bbs
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

add and enforce limits on mx attachments

+12 -1
+1
core/limits.py
··· 11 11 NEWS_BODY = 10000 12 12 REPLY_BODY = 10000 13 13 ATTACHMENT_NAME = 256 14 + MAX_ATTACHMENTS = 10
+1
lexicons/xyz.atboards.news.json
··· 32 32 }, 33 33 "attachments": { 34 34 "type": "array", 35 + "maxLength": 10, 35 36 "items": { 36 37 "type": "ref", 37 38 "ref": "#attachment"
+1
lexicons/xyz.atboards.reply.json
··· 31 31 }, 32 32 "attachments": { 33 33 "type": "array", 34 + "maxLength": 10, 34 35 "items": { 35 36 "type": "ref", 36 37 "ref": "#attachment"
+1
lexicons/xyz.atboards.thread.json
··· 32 32 }, 33 33 "attachments": { 34 34 "type": "array", 35 + "maxLength": 10, 35 36 "items": { 36 37 "type": "ref", 37 38 "ref": "#attachment"
+7 -1
web/src/components/ComposeForm.tsx
··· 1 1 import type { SyntheticEvent } from "react"; 2 2 import { Input, Textarea, Button } from "./Form"; 3 + import { MAX_ATTACHMENTS } from "../lib/limits"; 3 4 4 5 interface ComposeFormProps { 5 6 onSubmit: (e: SyntheticEvent) => void; ··· 42 43 }: ComposeFormProps) { 43 44 function addFiles(fileList: FileList | null) { 44 45 if (!fileList) return; 45 - onFilesChange([...files, ...Array.from(fileList)]); 46 + const combined = [...files, ...Array.from(fileList)].slice(0, MAX_ATTACHMENTS); 47 + onFilesChange(combined); 46 48 } 49 + 50 + const atLimit = files.length >= MAX_ATTACHMENTS; 47 51 48 52 function removeFile(index: number) { 49 53 onFilesChange(files.filter((_, i) => i !== index)); ··· 112 116 <Button type="submit" disabled={posting}> 113 117 {posting ? "posting..." : submitLabel} 114 118 </Button> 119 + {!atLimit && ( 115 120 <label className="text-neutral-200 cursor-pointer bg-neutral-800 hover:bg-neutral-700 px-4 py-2 rounded inline-block"> 116 121 attach 117 122 <input ··· 122 127 className="hidden" 123 128 /> 124 129 </label> 130 + )} 125 131 </div> 126 132 </form> 127 133 );
+1
web/src/lib/limits.ts
··· 11 11 export const NEWS_BODY = 10000; 12 12 export const REPLY_BODY = 10000; 13 13 export const ATTACHMENT_NAME = 256; 14 + export const MAX_ATTACHMENTS = 10;