Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers
at main 34 lines 1.6 kB view raw
1import { Context } from "hono"; 2import { APP_NAME } from "../siteinfo"; 3import { getViolationsForCurrentUser } from "../utils/db/violations"; 4 5type ViolationNoticeProps = { 6 ctx: Context; 7} 8 9export async function ViolationNoticeBar(props: ViolationNoticeProps) { 10 const ctx: Context = props.ctx; 11 const violationData = await getViolationsForCurrentUser(ctx); 12 if (violationData !== null) { 13 let errorStr = ""; 14 if (violationData.tosViolation) { 15 errorStr = `Your account is in violation of ${APP_NAME} usage.`; 16 } else if(violationData.userPassInvalid) { 17 errorStr = "Your Bluesky handle or application password is invalid. Please update these in the settings."; 18 } else if (violationData.accountSuspended) { 19 errorStr = "Your account has been suspended by Bluesky. Some features may not work at this time"; 20 } else if (violationData.accountGone) { 21 errorStr = "Unable to find your BSky account, update your Bluesky handle and app password in the settings"; 22 } else if (violationData.mediaTooBig) { 23 errorStr = "You currently have media that's too large for Bluesky (like a video), please delete those posts"; 24 } 25 return ( 26 <div id="violationBar" class="warning-box" hx-trigger="accountViolations from:body" 27 hx-swap="outerHTML" hx-get="/account/violations" hx-target="this"> 28 <span class="warning"><b>WARNING</b>: Account error found! {errorStr}</span> 29 </div> 30 ); 31 } 32 return (<div hx-trigger="accountViolations from:body" hidden id="hiddenViolations" 33 hx-get="/account/violations" hx-swap="outerHTML" hx-target="this"></div>); 34};