diff --git a/src/algos/index.ts b/src/algos/index.ts index b7ee48a..7316b8b 100644 --- a/src/algos/index.ts +++ b/src/algos/index.ts @@ -3,12 +3,12 @@ import { QueryParams, OutputSchema as AlgoOutput, } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' -import * as whatsAlf from './whats-alf' +import * as starset from './starset' type AlgoHandler = (ctx: AppContext, params: QueryParams) => Promise const algos: Record = { - [whatsAlf.shortname]: whatsAlf.handler, + [starset.shortname]: starset.handler, } export default algos diff --git a/src/algos/whats-alf.ts b/src/algos/starset.ts similarity index 95% rename from src/algos/whats-alf.ts rename to src/algos/starset.ts index ece91fa..8528722 100644 --- a/src/algos/whats-alf.ts +++ b/src/algos/starset.ts @@ -2,7 +2,7 @@ import { QueryParams } from '../lexicon/types/app/bsky/feed/getFeedSkeleton' import { AppContext } from '../config' // max 15 chars -export const shortname = 'whats-alf' +export const shortname = 'starset' export const handler = async (ctx: AppContext, params: QueryParams) => { let builder = ctx.db diff --git a/src/assets/sst-logo.png b/src/assets/sst-logo.png new file mode 100644 index 0000000..ac15ddc Binary files /dev/null and b/src/assets/sst-logo.png differ diff --git a/src/filter.ts b/src/filter.ts new file mode 100644 index 0000000..7872aba --- /dev/null +++ b/src/filter.ts @@ -0,0 +1,31 @@ +export const keywords = ['starset', 'starsetonline'] +export const users = [ + 'did:plc:aaa5q4evo6nnn35bjwuekdkh', // @mirror.starset.fans +] +export const bandMembers = [ + 'dustin bates', 'ron dechant', 'brock richards', 'adam gilbert' +] +export const albums = [ + 'transmissions', 'vessels', 'divisions', 'horizons' +] +export const songs = [ + // transmissions + 'first light', 'down with the fallen', 'halo', 'carnivore', 'telescope', + 'it has begun', 'my demons', 'antigravity', 'dark on me', 'let it die', + 'the future is now', 'point of no return', 'rise and fall', + // vessels + 'the order', 'satellite', 'frequency', 'die for you', 'ricochet', 'starlight', + 'into the unknown', 'gravity of you', 'back to the earth', 'last to fall', + 'bringing it down', 'unbecoming', 'monster', 'telepathic', 'everglow', + // divisions + 'a brief history of the future', 'manifest', 'echo', 'where the skies end', + 'perfect machine', 'telekinetic', 'stratosphere', 'faultline', 'solstice', + 'trials', 'waking up', 'other worlds than these', 'diving bell', + // horizons + 'unveiling the architecture', 'the breach', 'otherworldly', 'icarus', + 'earthrise', 'leaving this world behind', 'devolution', 'annihilated love', + 'alchemy', 'disappear', 'this endless endeavor', 'symbiotic', 'dreamcatcher', + 'tunnelvision', 'infected', 'something wicked', + // s5 + 'brave new world', 'degenerate', 'toksik', 'dystopia' +] \ No newline at end of file diff --git a/src/subscription.ts b/src/subscription.ts index 0422a03..a8c7f09 100644 --- a/src/subscription.ts +++ b/src/subscription.ts @@ -3,6 +3,7 @@ import { isCommit, } from './lexicon/types/com/atproto/sync/subscribeRepos' import { FirehoseSubscriptionBase, getOpsByType } from './util/subscription' +import { keywords, users, bandMembers, albums, songs } from './filter' export class FirehoseSubscription extends FirehoseSubscriptionBase { async handleEvent(evt: RepoEvent) { @@ -10,21 +11,30 @@ export class FirehoseSubscription extends FirehoseSubscriptionBase { const ops = await getOpsByType(evt) - // This logs the text of every post off the firehose. - // Just for fun :) - // Delete before actually using - for (const post of ops.posts.creates) { - console.log(post.record.text) - } + // Test only + // for (const post of ops.posts.creates) { + // console.log('DEBUG: New Post') + // console.log('DEBUG: Author', post.author) + // console.log('DEBUG: Text', post.record.text) + // console.log('DEBUG: Tags', post.record.tags) + // } const postsToDelete = ops.posts.deletes.map((del) => del.uri) const postsToCreate = ops.posts.creates .filter((create) => { - // only alf-related posts - return create.record.text.toLowerCase().includes('alf') + const text = create.record.text.toLowerCase() + const tags = create.record.tags?.map(tag => tag.toLowerCase()) || [] + const author = create.author || '' + + return ( + keywords.some(keyword => text.includes(keyword)) || + users.includes(author) || + bandMembers.some(member => text.includes(member)) || + albums.some(album => text.includes(album)) || + songs.some(song => text.includes(song)) + ) }) .map((create) => { - // map alf-related posts to a db row return { uri: create.uri, cid: create.cid,