Skip to content

Commit

Permalink
enhance(backend): 絵文字の連合でライセンス欄を相互にやり取りするように
Browse files Browse the repository at this point in the history
Co-authored-by: Kisaragi Marine <[email protected]>
Co-authored-by: ruruke <[email protected]>
  • Loading branch information
2 people authored and samunohito committed Dec 27, 2024
1 parent 3c81926 commit b75b7a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/backend/src/core/activitypub/ApRendererService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ export class ApRendererService {
// || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ)
url: emoji.publicUrl || emoji.originalUrl,
},
_misskey_license: {
freeText: emoji.license
},
};
}

Expand Down
4 changes: 4 additions & 0 deletions packages/backend/src/core/activitypub/models/ApNoteService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ export class ApNoteService {
originalUrl: tag.icon.url,
publicUrl: tag.icon.url,
updatedAt: new Date(),
// _misskey_license が存在しなければ `null`
license: (tag._misskey_license?.freeText ?? null)
});

const emoji = await this.emojisRepository.findOneBy({ host, name });
Expand All @@ -435,6 +437,8 @@ export class ApNoteService {
publicUrl: tag.icon.url,
updatedAt: new Date(),
aliases: [],
// _misskey_license が存在しなければ `null`
license: (tag._misskey_license?.freeText ?? null)
});
}));
}
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/core/activitypub/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ export interface IApEmoji extends IObject {
type: 'Emoji';
name: string;
updated: string;
// Misskey拡張。後方互換性のためにoptional。
// 将来の拡張性を考慮してobjectにしている
_misskey_license?: {
freeText: string | null;
};
}

export const isEmoji = (object: IObject): object is IApEmoji =>
Expand Down

0 comments on commit b75b7a7

Please sign in to comment.