parent
0090530484
commit
eec469ab31
3 changed files with 0 additions and 61 deletions
|
@ -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}`,
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -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} -"
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
age-encryption.org/v1
|
|
||||||
-> ssh-ed25519 sj88Xw F3De7q6a36OheceZn2yclnFF0poH+gW4fwyGOTMJc2U
|
|
||||||
e/Qi4QG3tljKx9ekNYdc+5rFZRfpnAqPxg1ZRjwkUeY
|
|
||||||
--- lh9CvUs/ZSSsn/6KM90YPu8ILa2HyBny3NT5toWGD6c
|
|
||||||
rµP/¥<>‡ˆ—‚y>—H5ÝÍ£<C38D>1,–ôxþÐ…Ú9Œáí‡÷d^ X¶þS`hÄøÄ\+ŒÓ³Í7Ù¦ÒßØŸÚ §FíRq6ÿh×ñ¬Ã•`ò‰<1B>
|
|
Loading…
Reference in a new issue