Skip to content

Commit

Permalink
enhance(backend): 絵文字の連合でライセンス欄を相互にやり取りするように (misskey-dev/misskey#15182)
Browse files Browse the repository at this point in the history
  • Loading branch information
samunohito authored and catsmiry committed Jan 15, 2025
1 parent 0eda58f commit 35156a1
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 @@ -188,6 +188,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 @@ -536,6 +536,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 @@ -557,6 +559,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 @@ -249,6 +249,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 35156a1

Please sign in to comment.