···55import { drizzle, DrizzleD1Database } from "drizzle-orm/d1";
66import { schema } from "../db";
77import { BSKY_MAX_USERNAME_LENGTH, BSKY_MIN_USERNAME_LENGTH } from "../limits";
88-import { APP_NAME, SITE_URL } from "../siteinfo";
88+import { APP_NAME } from "../siteinfo";
99import { Bindings } from "../types";
1010-import { lookupBskyHandle } from "../utils/bskyApi";
1111-import { createDMWithUser } from "../utils/bskyMsg";
1212-1313-function createPasswordResetMessage(url: string, token: string) {
1414- return `Your ${APP_NAME} password reset url is:
1515-${SITE_URL}/reset-password/${token}
1616-1717-This URL will expire in about an hour.
1818-1919-If you did not request a password reset, please ignore this message.`;
2020-}
1010+import { lookupBskyHandle } from "../utils/bsky/bskyApi";
1111+import { createDMWithUser } from "../utils/bsky/bskyMessage";
1212+import { createPasswordResetMessage } from "../utils/messages/accountReset";
21132214// Single auth configuration that handles both CLI and runtime scenarios
2315function createAuth(env?: Bindings, cf?: IncomingRequestCfProperties) {
···11import isEmpty from 'just-is-empty';
22import split from 'just-split';
33-import { AllContext } from '../types';
33+import { AllContext } from '../../types';
44import { getPostRecords } from './bskyApi';
55-import { getAllPostedPosts, getAllPostedPostsOfUser } from './db/data';
55+import { getAllPostedPosts, getAllPostedPostsOfUser } from '../db/data';
6677// This looks for a bunch of posts that are posted and determines if the posts
88// are still on the network or not. If they are not, then this prunes the posts from
+1-1
src/utils/db/violations.ts
···44import isEmpty from "just-is-empty";
55import { bannedUsers, violations } from "../../db/enforcement.schema";
66import { AccountStatus, AllContext, LooseObj, Violation } from "../../types";
77-import { lookupBskyHandle } from "../bskyApi";
77+import { lookupBskyHandle } from "../bsky/bskyApi";
88import { getUsernameForUserId } from "./userinfo";
991010const createBanForUser = async(db: DrizzleD1Database, userName: string, reason: string) => {
+10
src/utils/messages/accountReset.ts
···11+import { APP_NAME, SITE_URL } from "../../siteinfo";
22+33+export function createPasswordResetMessage(url: string, token: string) {
44+ return `Your ${APP_NAME} password reset url is:
55+${SITE_URL}/reset-password/${token}
66+77+This URL will expire in about an hour.
88+99+If you did not request a password reset, please ignore this message.`;
1010+};
+15
src/utils/messages/resetAppPassword.ts
···11+import { APP_NAME } from "../../siteinfo";
22+33+export function resetAppPasswordMessage() {
44+ return `Hey there! This is an automated message to let you know
55+ that your ${APP_NAME} account is no longer automatically posting.
66+77+ This occurs when your BSky App Password either expires or gets deleted.
88+ If you did not mean to do this, log back onto ${APP_NAME} and provide
99+ an updated BSky app password in the "Account Settings" section of the
1010+ dashboard.
1111+1212+ This message can only be seen by you. If you no longer want to use
1313+ ${APP_NAME} or don't need to for awhile, no worries! This bot will
1414+ only send you this message once (unless you password expires again).`;
1515+};
···11import isEmpty from 'just-is-empty';
22import random from 'just-random';
33import get from 'just-safe-get';
44-import { Post } from "../classes/post";
55-import { Repost } from "../classes/repost";
66-import { AllContext, Bindings, QueueTaskData, TaskType } from "../types";
44+import { Post } from "../../classes/post";
55+import { Repost } from "../../classes/repost";
66+import { AllContext, Bindings, QueueTaskData, TaskType } from "../../types";
7788// picks a random queue to publish data to
99const getRandomQueue = (env: Bindings, listName: string): Queue|null => {
+5-5
src/utils/scheduler.ts
···33import { Post } from "../classes/post";
44import { Repost } from "../classes/repost";
55import { AllContext, TaskType } from '../types';
66-import { AgentMap } from './bskyAgents';
77-import { makePost, makeRepost } from './bskyApi';
88-import { pruneBskyPosts } from './bskyPrune';
66+import { AgentMap } from './bsky/bskyAgents';
77+import { makePost, makeRepost } from './bsky/bskyApi';
88+import { pruneBskyPosts } from './bsky/bskyPrune';
99import {
1010 deleteAllRepostsBeforeCurrentTime, deletePosts, getAllPostsForCurrentTime,
1111 getAllRepostsForCurrentTime, purgePostedPosts,
···1515import {
1616 enqueuePost, enqueueRepost, isQueueEnabled,
1717 isRepostQueueEnabled, shouldPostNowQueue, shouldPostThreadQueue
1818-} from './queuePublisher';
1818+} from './queues/queuePublisher';
1919import { deleteFromR2 } from './r2Query';
20202121export const handlePostTask = async(runtime: AllContext, postData: Post, agent: AtpAgent|null) => {
···4343 postStatus = false;
4444 }
4545 } else {
4646- const agent = await AgentMap.getAgentDirect(c, postData.user);
4646+ const {agent} = await AgentMap.getAgentDirect(c, postData.user, false);
4747 if (agent === null) {
4848 console.error(`unable to get agent for user ${postData.user} to post now`);
4949 postStatus = false;