alpha
Login
or
Join now
bobbby.online
/
blonk
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
some renaming, nothing special
author
Bobby Grayson
date
1 year ago
(Jun 19, 2025, 11:04 AM -0400)
commit
43dd58a5
43dd58a5d711a58c0960b957c0e4a4da54599374
parent
951576d3
951576d34fbabc3c994a211a53092730a4969ac0
+37
-37
3 changed files
Expand all
Collapse all
Unified
Split
src
blips.ts
index.ts
schemas.ts
+18
-18
src/index.ts
View file
Reviewed
···
1
1
import { BlonkAgent } from './agent';
2
2
-
import { PostManager } from './posts';
2
2
+
import { BlipManager } from './blips';
3
3
4
4
async function main() {
5
5
try {
···
7
7
await blonkAgent.login();
8
8
9
9
const agent = blonkAgent.getAgent();
10
10
-
const postManager = new PostManager(agent);
10
10
+
const blipManager = new BlipManager(agent);
11
11
12
12
-
console.log('\n🚀 Blonk - AT Protocol Reddit Clone');
13
13
-
console.log('=====================================\n');
12
12
+
console.log('\n📡 Blonk - Vibe Radar');
13
13
+
console.log('=====================\n');
14
14
15
15
-
console.log('Creating a test post...');
16
16
-
const postUri = await postManager.createPost(
17
17
-
'Welcome to Blonk!',
18
18
-
'This is the first post on Blonk, a Reddit clone built on AT Protocol.',
15
15
+
console.log('Transmitting a test blip...');
16
16
+
const blipUri = await blipManager.createBlip(
17
17
+
'Welcome to the Blonk Vibe Radar!',
18
18
+
'This is the first blip on Blonk, where vibes are tracked on the radar.',
19
19
'https://atproto.com'
20
20
);
21
21
-
console.log(`Post created with URI: ${postUri}\n`);
21
21
+
console.log(`Blip transmitted with URI: ${blipUri}\n`);
22
22
23
23
-
console.log('Fetching recent posts...');
24
24
-
const posts = await postManager.getPosts(10);
23
23
+
console.log('Scanning radar for recent blips...');
24
24
+
const blips = await blipManager.getBlips(10);
25
25
26
26
-
console.log(`\nFound ${posts.length} posts:`);
27
27
-
posts.forEach((post, index) => {
28
28
-
console.log(`\n${index + 1}. ${post.title}`);
29
29
-
if (post.body) console.log(` ${post.body.substring(0, 100)}...`);
30
30
-
if (post.url) console.log(` 🔗 ${post.url}`);
31
31
-
console.log(` 📅 ${new Date(post.createdAt).toLocaleString()}`);
32
32
-
console.log(` ⬆️ ${post.votes} votes`);
26
26
+
console.log(`\n📡 ${blips.length} blips on the radar:`);
27
27
+
blips.forEach((blip, index) => {
28
28
+
console.log(`\n${index + 1}. ${blip.title}`);
29
29
+
if (blip.body) console.log(` ${blip.body.substring(0, 100)}...`);
30
30
+
if (blip.url) console.log(` 🔗 ${blip.url}`);
31
31
+
console.log(` 📅 ${new Date(blip.createdAt).toLocaleString()}`);
32
32
+
console.log(` ✨ ${blip.fluffs} fluffs`);
33
33
});
34
34
35
35
} catch (error) {
+13
-13
src/posts.ts
src/blips.ts
View file
Reviewed
···
1
1
import { BskyAgent } from '@atproto/api';
2
2
-
import { BlonkPost, POST_NSID } from './schemas';
2
2
+
import { BlonkBlip, BLIP_NSID } from './schemas';
3
3
4
4
-
export class PostManager {
4
4
+
export class BlipManager {
5
5
constructor(private agent: BskyAgent) {}
6
6
7
7
-
async createPost(title: string, body?: string, url?: string): Promise<string> {
8
8
-
const post: BlonkPost = {
7
7
+
async createBlip(title: string, body?: string, url?: string): Promise<string> {
8
8
+
const blip: BlonkBlip = {
9
9
title,
10
10
body,
11
11
url,
12
12
createdAt: new Date().toISOString(),
13
13
-
votes: 0,
13
13
+
fluffs: 0,
14
14
};
15
15
16
16
const response = await this.agent.com.atproto.repo.createRecord({
17
17
repo: this.agent.session?.did!,
18
18
-
collection: POST_NSID,
19
19
-
record: post,
18
18
+
collection: BLIP_NSID,
19
19
+
record: blip,
20
20
});
21
21
22
22
-
console.log(`Created post: ${title}`);
22
22
+
console.log(`Created blip: ${title}`);
23
23
return response.data.uri;
24
24
}
25
25
26
26
-
async getPosts(limit: number = 50) {
26
26
+
async getBlips(limit: number = 50) {
27
27
const response = await this.agent.com.atproto.repo.listRecords({
28
28
repo: this.agent.session?.did!,
29
29
-
collection: POST_NSID,
29
29
+
collection: BLIP_NSID,
30
30
limit,
31
31
});
32
32
33
33
return response.data.records.map(record => ({
34
34
uri: record.uri,
35
35
cid: record.cid,
36
36
-
...record.value as BlonkPost,
36
36
+
...record.value as BlonkBlip,
37
37
}));
38
38
}
39
39
40
40
-
async getPost(uri: string) {
40
40
+
async getBlip(uri: string) {
41
41
const [repo, collection, rkey] = uri.replace('at://', '').split('/');
42
42
43
43
const response = await this.agent.com.atproto.repo.getRecord({
···
49
49
return {
50
50
uri,
51
51
cid: response.data.cid,
52
52
-
...response.data.value as BlonkPost,
52
52
+
...response.data.value as BlonkBlip,
53
53
};
54
54
}
55
55
}
+6
-6
src/schemas.ts
View file
Reviewed
···
1
1
-
export const POST_NSID = 'com.blonk.post';
2
2
-
export const VOTE_NSID = 'com.blonk.vote';
1
1
+
export const BLIP_NSID = 'com.blonk.blip';
2
2
+
export const FLUFF_NSID = 'com.blonk.fluff';
3
3
export const COMMENT_NSID = 'com.blonk.comment';
4
4
5
5
-
export interface BlonkPost {
5
5
+
export interface BlonkBlip {
6
6
title: string;
7
7
body?: string;
8
8
url?: string;
9
9
createdAt: string;
10
10
-
votes: number;
10
10
+
fluffs: number;
11
11
}
12
12
13
13
-
export interface BlonkVote {
13
13
+
export interface BlonkFluff {
14
14
subject: {
15
15
uri: string;
16
16
cid: string;
···
20
20
}
21
21
22
22
export interface BlonkComment {
23
23
-
post: {
23
23
+
blip: {
24
24
uri: string;
25
25
cid: string;
26
26
};