Webhooks for the AT Protocol airglow.run
atproto atprotocol automation webhook
12
fork

Configure Feed

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

fix: lang and tags inputs

Hugo deceef49 2057a6b0

+24 -33
+24 -33
app/islands/AutomationForm.tsx
··· 38 38 type BskyPostDraft = { 39 39 type: "bsky-post"; 40 40 textTemplate: string; 41 - langs: string[]; 41 + langsText: string; 42 42 labels: string[]; 43 43 comment: string; 44 44 }; ··· 54 54 targetSource: string; 55 55 targetTitle: string; 56 56 bodyValue: string; 57 - tags: string[]; 57 + tagsText: string; 58 58 comment: string; 59 59 }; 60 60 type ActionDraft = WebhookDraft | RecordDraft | BskyPostDraft | PatchRecordDraft | BookmarkDraft; ··· 353 353 action: BskyPostDraft; 354 354 onChange: (a: BskyPostDraft) => void; 355 355 }) { 356 - const [langsText, setLangsText] = useState(action.langs.join(", ")); 357 - 358 356 return ( 359 357 <> 360 358 <div class={s.fieldGroup}> ··· 382 380 class={s.input} 383 381 type="text" 384 382 placeholder="e.g. en, fr, pt" 385 - value={langsText} 386 - onInput={(e: Event) => setLangsText((e.target as HTMLInputElement).value)} 387 - onBlur={() => { 388 - const langs = langsText 389 - .split(",") 390 - .map((l) => l.trim()) 391 - .filter(Boolean); 392 - setLangsText(langs.join(", ")); 393 - onChange({ ...action, langs }); 394 - }} 383 + value={action.langsText} 384 + onInput={(e: Event) => 385 + onChange({ ...action, langsText: (e.target as HTMLInputElement).value }) 386 + } 395 387 /> 396 388 <span class={s.hint}>Comma-separated language codes (BCP-47)</span> 397 389 </div> ··· 536 528 action: BookmarkDraft; 537 529 onChange: (a: BookmarkDraft) => void; 538 530 }) { 539 - const [tagsText, setTagsText] = useState(action.tags.join(", ")); 540 - 541 531 return ( 542 532 <> 543 533 <div class={s.fieldGroup}> ··· 595 585 class={s.input} 596 586 type="text" 597 587 placeholder="e.g. reading, research, bluesky" 598 - value={tagsText} 599 - onInput={(e: Event) => setTagsText((e.target as HTMLInputElement).value)} 600 - onBlur={() => { 601 - const tags = tagsText 602 - .split(",") 603 - .map((t) => t.trim()) 604 - .filter(Boolean) 605 - .slice(0, 10); 606 - setTagsText(tags.join(", ")); 607 - onChange({ ...action, tags }); 608 - }} 588 + value={action.tagsText} 589 + onInput={(e: Event) => 590 + onChange({ ...action, tagsText: (e.target as HTMLInputElement).value }) 591 + } 609 592 /> 610 593 <span class={s.hint}>Comma-separated. Each tag supports {"{{placeholders}}"}.</span> 611 594 </div> ··· 660 643 return { 661 644 type: "bsky-post", 662 645 textTemplate: a.textTemplate, 663 - langs: a.langs ?? [], 646 + langsText: (a.langs ?? []).join(", "), 664 647 labels: a.labels ?? [], 665 648 comment: a.comment ?? "", 666 649 }; ··· 680 663 targetSource: a.targetSource, 681 664 targetTitle: a.targetTitle ?? "", 682 665 bodyValue: a.bodyValue ?? "", 683 - tags: a.tags ?? [], 666 + tagsText: (a.tags ?? []).join(", "), 684 667 comment: a.comment ?? "", 685 668 }; 686 669 } ··· 877 860 } else if (type === "bsky-post") { 878 861 setActions((prev) => [ 879 862 ...prev, 880 - { type: "bsky-post", textTemplate: "", langs: [], labels: [], comment: "" }, 863 + { type: "bsky-post", textTemplate: "", langsText: "", labels: [], comment: "" }, 881 864 ]); 882 865 } else if (type === "patch-record") { 883 866 setActions((prev) => [ ··· 898 881 targetSource: "", 899 882 targetTitle: "", 900 883 bodyValue: "", 901 - tags: [], 884 + tagsText: "", 902 885 comment: "", 903 886 }, 904 887 ]); ··· 954 937 }; 955 938 } 956 939 if (a.type === "bsky-post") { 940 + const langs = a.langsText 941 + .split(",") 942 + .map((l) => l.trim()) 943 + .filter(Boolean); 957 944 return { 958 945 type: "bsky-post", 959 946 textTemplate: a.textTemplate, 960 - ...(a.langs.length > 0 ? { langs: a.langs } : {}), 947 + ...(langs.length > 0 ? { langs } : {}), 961 948 ...(a.labels.length > 0 ? { labels: a.labels } : {}), 962 949 ...comment, 963 950 }; ··· 974 961 if (a.type === "bookmark") { 975 962 const targetTitle = a.targetTitle.trim(); 976 963 const bodyValue = a.bodyValue.trim(); 977 - const tags = a.tags.filter(Boolean); 964 + const tags = a.tagsText 965 + .split(",") 966 + .map((t) => t.trim()) 967 + .filter(Boolean) 968 + .slice(0, 10); 978 969 return { 979 970 type: "bookmark", 980 971 targetSource: a.targetSource,