diff --git a/hosts/koi/containers/bots/bsky-crossposter/config.ts b/hosts/koi/containers/bots/bsky-crossposter/config.ts deleted file mode 100644 index 4210817..0000000 --- a/hosts/koi/containers/bots/bsky-crossposter/config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { EventHandler } from './src/utils/handler.ts' -import { assert } from '@fuman/utils' -import { extractRecordFromEvent } from './src/bluesky/definitions.ts' -import { getPostThreadgateFor } from './src/bluesky/threadgate.ts' -import { makeLinkToOriginalPost } from './src/utils/html.ts' -import { crosspostToTelegram } from './src/utils/telegram.ts' - -export const watchedDids = ['did:web:tei.su'] - -export const handler: EventHandler = async (event) => { - if (event.commit.collection !== 'app.bsky.feed.post') return - - // do not crosspost if replies are following-only - const threadgate = await getPostThreadgateFor(event) - if (threadgate && threadgate.allow.some(it => it.$type === 'app.bsky.feed.threadgate#followingRule')) { - return - } - - // ignore some posts - const post = extractRecordFromEvent(event) - assert(post?.$type === 'app.bsky.feed.post') - if (post.text.match(/\.$|\b(puppy|pubby)\b/)) return - - await crosspostToTelegram(event, { - chatId: -1001432293767, // temp. todo: replace with actual channel - finalizeText: text => `${makeLinkToOriginalPost(event, '~')} ${text}`, - }) -} diff --git a/hosts/koi/containers/bots/bsky-crossposter/default.nix b/hosts/koi/containers/bots/bsky-crossposter/default.nix deleted file mode 100644 index 2184402..0000000 --- a/hosts/koi/containers/bots/bsky-crossposter/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, ... }: - -let - UID = 1120; -in { - desu.secrets.bsky-crossposter-env.owner = "bsky-crossposter"; - - users.users.bsky-crossposter = { - isNormalUser = true; - uid = UID; - }; - - virtualisation.oci-containers.containers.bsky-crossposter = { - image = "ghcr.io/teidesu/bsky-crossposter:latest"; - environmentFiles = [ - config.desu.secrets.bsky-crossposter-env.path - ]; - user = builtins.toString UID; - extraOptions = [ - "--mount=type=bind,source=/srv/bsky-crossposter,target=/app/.runtime" - "--mount=type=bind,source=${./config.ts},target=/app/config.ts" - ]; - }; - - systemd.tmpfiles.rules = [ - "d /srv/bsky-crossposter 0700 ${builtins.toString UID} ${builtins.toString UID} -" - ]; -} \ No newline at end of file diff --git a/secrets/bsky-crossposter-env.age b/secrets/bsky-crossposter-env.age deleted file mode 100644 index 859e912..0000000 --- a/secrets/bsky-crossposter-env.age +++ /dev/null @@ -1,5 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 sj88Xw F3De7q6a36OheceZn2yclnFF0poH+gW4fwyGOTMJc2U -e/Qi4QG3tljKx9ekNYdc+5rFZRfpnAqPxg1ZRjwkUeY ---- lh9CvUs/ZSSsn/6KM90YPu8ILa2HyBny3NT5toWGD6c -rP/ y>H5ͣ1 ,xЅ9d^ XS`h\+ӳ7٦؟ڠFRq6h` \ No newline at end of file