+1
-1
lexicons/comment.json
+1
-1
lexicons/comment.json
+1
-1
lexicons/paste.json
+1
-1
lexicons/paste.json
+7
-7
src/ingester.ts
+7
-7
src/ingester.ts
···
2
2
import { IdResolver } from "@atproto/identity";
3
3
import { Firehose } from "@atproto/sync";
4
4
import type { Database } from "#/db";
5
-
import * as Paste from "#/lexicons/types/ovh/plonk/paste";
6
-
import * as Comment from "#/lexicons/types/ovh/plonk/comment";
5
+
import * as Paste from "#/lexicons/types/li/plonk/paste";
6
+
import * as Comment from "#/lexicons/types/li/plonk/comment";
7
7
8
8
export function createIngester(db: Database, idResolver: IdResolver) {
9
9
const logger = pino({ name: "firehose ingestion" });
···
17
17
18
18
// If the write is a valid status update
19
19
if (
20
-
evt.collection === "ovh.plonk.paste" &&
20
+
evt.collection === "li.plonk.paste" &&
21
21
Paste.isRecord(record) &&
22
22
Paste.validateRecord(record).success
23
23
) {
···
43
43
)
44
44
.execute();
45
45
} else if (
46
-
evt.collection === "ovh.plonk.comment" &&
46
+
evt.collection === "li.plonk.comment" &&
47
47
Comment.isRecord(record) &&
48
48
Comment.validateRecord(record).success
49
49
) {
···
70
70
}
71
71
} else if (
72
72
evt.event === "delete" &&
73
-
evt.collection === "ovh.plonk.paste"
73
+
evt.collection === "li.plonk.paste"
74
74
) {
75
75
// Remove the status from our SQLite
76
76
await db
···
79
79
.execute();
80
80
} else if (
81
81
evt.event === "delete" &&
82
-
evt.collection === "ovh.plonk.comment"
82
+
evt.collection === "li.plonk.comment"
83
83
) {
84
84
// Remove the status from our SQLite
85
85
await db
···
91
91
onError: (err) => {
92
92
logger.error({ err }, "error on firehose ingestion");
93
93
},
94
-
filterCollections: ["ovh.plonk.paste"],
94
+
filterCollections: ["li.plonk.paste"],
95
95
excludeIdentity: true,
96
96
excludeAccount: true,
97
97
});
+6
-6
src/lexicons/index.ts
+6
-6
src/lexicons/index.ts
···
18
18
19
19
export class Server {
20
20
xrpc: XrpcServer
21
-
ovh: OvhNS
21
+
li: LiNS
22
22
com: ComNS
23
23
app: AppNS
24
24
25
25
constructor(options?: XrpcOptions) {
26
26
this.xrpc = createXrpcServer(schemas, options)
27
-
this.ovh = new OvhNS(this)
27
+
this.li = new LiNS(this)
28
28
this.com = new ComNS(this)
29
29
this.app = new AppNS(this)
30
30
}
31
31
}
32
32
33
-
export class OvhNS {
33
+
export class LiNS {
34
34
_server: Server
35
-
plonk: OvhPlonkNS
35
+
plonk: LiPlonkNS
36
36
37
37
constructor(server: Server) {
38
38
this._server = server
39
-
this.plonk = new OvhPlonkNS(server)
39
+
this.plonk = new LiPlonkNS(server)
40
40
}
41
41
}
42
42
43
-
export class OvhPlonkNS {
43
+
export class LiPlonkNS {
44
44
_server: Server
45
45
46
46
constructor(server: Server) {
+6
-6
src/lexicons/lexicons.ts
+6
-6
src/lexicons/lexicons.ts
···
4
4
import { LexiconDoc, Lexicons } from '@atproto/lexicon'
5
5
6
6
export const schemaDict = {
7
-
OvhPlonkComment: {
7
+
LiPlonkComment: {
8
8
lexicon: 1,
9
-
id: 'ovh.plonk.comment',
9
+
id: 'li.plonk.comment',
10
10
defs: {
11
11
main: {
12
12
type: 'record',
···
363
363
},
364
364
},
365
365
},
366
-
OvhPlonkPaste: {
366
+
LiPlonkPaste: {
367
367
lexicon: 1,
368
-
id: 'ovh.plonk.paste',
368
+
id: 'li.plonk.paste',
369
369
defs: {
370
370
main: {
371
371
type: 'record',
···
487
487
export const schemas: LexiconDoc[] = Object.values(schemaDict) as LexiconDoc[]
488
488
export const lexicons: Lexicons = new Lexicons(schemas)
489
489
export const ids = {
490
-
OvhPlonkComment: 'ovh.plonk.comment',
490
+
LiPlonkComment: 'li.plonk.comment',
491
491
ComAtprotoLabelDefs: 'com.atproto.label.defs',
492
492
ComAtprotoRepoGetRecord: 'com.atproto.repo.getRecord',
493
493
ComAtprotoRepoListRecords: 'com.atproto.repo.listRecords',
494
-
OvhPlonkPaste: 'ovh.plonk.paste',
494
+
LiPlonkPaste: 'li.plonk.paste',
495
495
AppBskyActorProfile: 'app.bsky.actor.profile',
496
496
ComAtprotoRepoStrongRef: 'com.atproto.repo.strongRef',
497
497
}
+2
-2
src/lexicons/types/ovh/plonk/comment.ts
src/lexicons/types/li/plonk/comment.ts
+2
-2
src/lexicons/types/ovh/plonk/comment.ts
src/lexicons/types/li/plonk/comment.ts
···
20
20
return (
21
21
isObj(v) &&
22
22
hasProp(v, '$type') &&
23
-
(v.$type === 'ovh.plonk.comment#main' || v.$type === 'ovh.plonk.comment')
23
+
(v.$type === 'li.plonk.comment#main' || v.$type === 'li.plonk.comment')
24
24
)
25
25
}
26
26
27
27
export function validateRecord(v: unknown): ValidationResult {
28
-
return lexicons.validate('ovh.plonk.comment#main', v)
28
+
return lexicons.validate('li.plonk.comment#main', v)
29
29
}
+2
-2
src/lexicons/types/ovh/plonk/paste.ts
src/lexicons/types/li/plonk/paste.ts
+2
-2
src/lexicons/types/ovh/plonk/paste.ts
src/lexicons/types/li/plonk/paste.ts
···
19
19
return (
20
20
isObj(v) &&
21
21
hasProp(v, '$type') &&
22
-
(v.$type === 'ovh.plonk.paste#main' || v.$type === 'ovh.plonk.paste')
22
+
(v.$type === 'li.plonk.paste#main' || v.$type === 'li.plonk.paste')
23
23
)
24
24
}
25
25
26
26
export function validateRecord(v: unknown): ValidationResult {
27
-
return lexicons.validate('ovh.plonk.paste#main', v)
27
+
return lexicons.validate('li.plonk.paste#main', v)
28
28
}
+7
src/public/styles.css
+7
src/public/styles.css
+8
-13
src/routes.ts
+8
-13
src/routes.ts
···
11
11
import { Agent } from "@atproto/api";
12
12
import { newShortUrl } from "#/db";
13
13
14
-
import * as Paste from "#/lexicons/types/ovh/plonk/paste";
15
-
import * as Comment from "#/lexicons/types/ovh/plonk/comment";
14
+
import * as Paste from "#/lexicons/types/li/plonk/paste";
15
+
import * as Comment from "#/lexicons/types/li/plonk/comment";
16
16
import { ComAtprotoRepoNS } from "#/lexicons";
17
17
18
18
type Session = {
···
145
145
const agent = new Agent(pds);
146
146
const response = await agent.com.atproto.repo.listRecords({
147
147
repo: authorDid,
148
-
collection: 'ovh.plonk.paste',
148
+
collection: 'li.plonk.paste',
149
149
limit: 99,
150
150
});
151
151
const pastes = response.data.records;
···
224
224
}
225
225
const response = await agent.com.atproto.repo.listRecords({
226
226
repo: agent.assertDid,
227
-
collection: 'ovh.plonk.paste',
227
+
collection: 'li.plonk.paste',
228
228
limit: 10,
229
229
});
230
230
const vals = response.data.records;
···
251
251
const rkey = TID.nextStr();
252
252
const shortUrl = await newShortUrl(ctx.db);
253
253
const record = {
254
-
$type: "ovh.plonk.paste",
254
+
$type: "li.plonk.paste",
255
255
code: req.body?.code,
256
256
lang: req.body?.lang,
257
257
shortUrl,
···
270
270
try {
271
271
const res = await agent.com.atproto.repo.putRecord({
272
272
repo: agent.assertDid,
273
-
collection: "ovh.plonk.paste",
273
+
collection: "li.plonk.paste",
274
274
rkey,
275
275
record,
276
276
validate: false,
···
299
299
indexedAt: new Date().toISOString(),
300
300
})
301
301
.execute();
302
-
ctx.logger.info(res, "wrote back to db");
303
302
return res.redirect(`/p/${shortUrl}`);
304
303
} catch (err) {
305
304
ctx.logger.warn(
···
338
337
339
338
const rkey = TID.nextStr();
340
339
const record = {
341
-
$type: "ovh.plonk.comment",
340
+
$type: "li.plonk.comment",
342
341
content: req.body?.comment,
343
342
post: {
344
343
uri: pasteUri,
···
358
357
try {
359
358
const res = await agent.com.atproto.repo.putRecord({
360
359
repo: agent.assertDid,
361
-
collection: "ovh.plonk.comment",
360
+
collection: "li.plonk.comment",
362
361
rkey,
363
362
record,
364
363
validate: false,
···
400
399
401
400
return router;
402
401
};
403
-
404
-
// https://pds.icyphox.sh/xrpc/com.atproto.repo.getRecord?repo=did%3Aplc%3A3ft67n4xnawzq4qi7mcksxj5
405
-
// at://did:plc:3ft67n4xnawzq4qi7mcksxj5/ovh.plonk.paste/3lcs3lnslbk2d
406
-
// https://pds.icyphox.sh/xrpc/com.atproto.repo.getRecord?repo=did%3Aplc%3A3ft67n4xnawzq4qi7mcksxj5&collection=ovh.plonk.paste&rkey=3lcqt7newvc2c