Skip to content

Commit

Permalink
Merge pull request #64 from team-shahu/feat(backend)/prefer-newly-add…
Browse files Browse the repository at this point in the history
…ed-misskey-extension-license-field-to-ap-emoji

Feat(backend)/prefer newly added misskey extension license field to ap emoji
  • Loading branch information
chan-mai authored Dec 28, 2024
2 parents b15ff68 + 23585fc commit ef8b129
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- えもえもローディング画面 https://github.com/team-shahu/misskey/pull/55
- セミパブリックモードの追加 https://github.com/team-shahu/misskey/pull/57 https://github.com/team-shahu/misskey/pull/60 https://github.com/team-shahu/misskey/pull/62 https://github.com/team-shahu/misskey/pull/63
- ログイン通知周りの改良 https://github.com/team-shahu/misskey/pull/59
- 絵文字ライセンスをAPに追加 https://github.com/team-shahu/misskey/pull/64
## Special Thanks
- [Misskey](https://github.com/misskey-dev/misskey)
- [にる村](https://github.com/n1lsqn/misskey)
Expand Down
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 ef8b129

Please sign in to comment.