mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Insert NIP-89 "client" tags when users post statuses
This commit is contained in:
parent
c8b1c2050b
commit
caf59f4078
1 changed files with 7 additions and 0 deletions
|
|
@ -17,6 +17,7 @@ import { languageSchema } from '@/schema.ts';
|
||||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||||
import { assertAuthenticated, createEvent, parseBody, updateListEvent } from '@/utils/api.ts';
|
import { assertAuthenticated, createEvent, parseBody, updateListEvent } from '@/utils/api.ts';
|
||||||
import { getCustomEmojis } from '@/utils/custom-emoji.ts';
|
import { getCustomEmojis } from '@/utils/custom-emoji.ts';
|
||||||
|
import { getInstanceMetadata } from '@/utils/instance.ts';
|
||||||
import { getInvoice, getLnurl } from '@/utils/lnurl.ts';
|
import { getInvoice, getLnurl } from '@/utils/lnurl.ts';
|
||||||
import { purifyEvent } from '@/utils/purify.ts';
|
import { purifyEvent } from '@/utils/purify.ts';
|
||||||
import { getZapSplits } from '@/utils/zap-split.ts';
|
import { getZapSplits } from '@/utils/zap-split.ts';
|
||||||
|
|
@ -25,6 +26,7 @@ import { accountFromPubkey, renderAccount } from '@/views/mastodon/accounts.ts';
|
||||||
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
|
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
|
||||||
|
|
||||||
const createStatusSchema = z.object({
|
const createStatusSchema = z.object({
|
||||||
|
disclose_client: z.boolean().nullish(),
|
||||||
in_reply_to_id: n.id().nullish(),
|
in_reply_to_id: n.id().nullish(),
|
||||||
language: languageSchema.nullish(),
|
language: languageSchema.nullish(),
|
||||||
media_ids: z.string().array().nullish(),
|
media_ids: z.string().array().nullish(),
|
||||||
|
|
@ -265,6 +267,11 @@ const createStatusController: AppController = async (c) => {
|
||||||
content += mediaUrls.join('\n');
|
content += mediaUrls.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.disclose_client) {
|
||||||
|
const { name } = await getInstanceMetadata(c.var);
|
||||||
|
tags.push(['client', name, `31990:${await conf.signer.getPublicKey()}:ditto`, conf.relay]);
|
||||||
|
}
|
||||||
|
|
||||||
const event = await createEvent({
|
const event = await createEvent({
|
||||||
kind: 1,
|
kind: 1,
|
||||||
content,
|
content,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue