Support custom emojis on mitra

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-16 23:06:19 +02:00
parent 640a406499
commit bbd524f074
5 changed files with 11 additions and 9 deletions

View File

@ -2056,7 +2056,7 @@ class PlApiClient {
const apiVersions = this.#instance.api_versions;
let response;
if (apiVersions['emoji_reactions.pleroma.pl-api'] >= 1) {
if (apiVersions['emoji_reactions.pleroma.pl-api'] >= 1 || this.features.version.software === MITRA) {
response = await this.request(`/api/v1/pleroma/statuses/${statusId}/reactions/${encodeURIComponent(emoji)}`, { method: 'PUT' });
} else {
response = await this.request(`/api/v1/statuses/${statusId}/react/${encodeURIComponent(emoji)}`, { method: 'POST' });
@ -2075,7 +2075,7 @@ class PlApiClient {
const apiVersions = this.#instance.api_versions;
let response;
if (apiVersions['emoji_reactions.pleroma.pl-api'] >= 1) {
if (apiVersions['emoji_reactions.pleroma.pl-api'] >= 1 || this.features.version.software === MITRA) {
response = await this.request(`/api/v1/pleroma/statuses/${statusId}/reactions/${emoji}`, { method: 'DELETE' });
} else {
response = await this.request(`/api/v1/statuses/${statusId}/unreact/${encodeURIComponent(emoji)}`, { method: 'POST' });

View File

@ -257,6 +257,7 @@ const getFeatures = (instance: Instance) => {
v.software === ICESHRIMP,
v.software === FRIENDICA,
v.software === MASTODON,
v.software === MITRA && gte(v.version, '3.3.0'),
v.software === PIXELFED,
v.software === PLEROMA,
v.software === TAKAHE && gte(v.version, '0.9.0'),
@ -353,7 +354,7 @@ const getFeatures = (instance: Instance) => {
*/
customEmojiReacts: any([
instance.api_versions['custom_emoji_reactions.pleroma.pl-api'] >= 1,
v.software === PLEROMA && gte(v.version, '2.6.0'),
v.software === MITRA && gte(v.version, '3.4.0'),
]),
/**
@ -429,6 +430,7 @@ const getFeatures = (instance: Instance) => {
* @see POST /v1/statuses/:id/unreact/:emoji
*/
emojiReacts: any([
v.software === MITRA && gte(v.version, '2.21.0'),
v.software === PLEROMA,
instance ? instance.configuration.reactions.max_reactions > 0 : false,
]),

View File

@ -1,6 +1,6 @@
{
"name": "pl-api",
"version": "0.0.33",
"version": "0.0.34",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-api",
"repository": {

View File

@ -134,7 +134,7 @@
"multiselect-react-dropdown": "^2.0.25",
"object-to-formdata": "^4.5.1",
"path-browserify": "^1.0.1",
"pl-api": "^0.0.33",
"pl-api": "^0.0.34",
"postcss": "^8.4.29",
"process": "^0.11.10",
"punycode": "^2.1.1",

View File

@ -8240,10 +8240,10 @@ pkg-types@^1.0.3:
mlly "^1.2.0"
pathe "^1.1.0"
pl-api@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.33.tgz#2afa795f7c708683b512d37d19045a91b9ab6663"
integrity sha512-pA6G6mB+KjOmJxqXoGLpWNqpfPWwZ2Rlu6H8rHdCv9lPXjrnZRqXFEy7cYJAIMdaKo5m224CQqXVFCMg5RYXdg==
pl-api@^0.0.34:
version "0.0.34"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.34.tgz#76c1c17401c4201802f81f33e77a35f22b964289"
integrity sha512-JMxGcaVUXpd2oxLpw2f1ScYvv3q+P2HETJ1u22FAHHF3c3Gt9uQkHAtCvw2aLMi1tlQKPiSmMK4BDElwdcmAig==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"