pl-api: Fix feature detection for v1/instance
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
e7a9669e55
commit
6a9921a409
5 changed files with 10 additions and 8 deletions
|
@ -5,7 +5,7 @@ import { accountSchema } from './account';
|
|||
import { ruleSchema } from './rule';
|
||||
import { coerceObject, filteredArray, mimeSchema } from './utils';
|
||||
|
||||
const getApiVersions = (instance: any) => ({
|
||||
const getApiVersions = (instance: any): Record<string, number> => ({
|
||||
...Object.fromEntries(instance.pleroma?.metadata?.features?.map((feature: string) => {
|
||||
let string = `${feature}.pleroma.pl-api`;
|
||||
if (string.startsWith('pleroma:') || string.startsWith('pleroma_')) string = string.slice(8);
|
||||
|
@ -306,7 +306,7 @@ const instanceSchema = v.pipe(
|
|||
|
||||
if (data.domain) return { account_domain: data.domain, ...data, api_versions: apiVersions };
|
||||
|
||||
return instanceV1ToV2({ ...data, api_versions: apiVersions });
|
||||
return { ...instanceV1ToV2(data), api_versions: apiVersions };
|
||||
}),
|
||||
coerceObject({
|
||||
account_domain: v.fallback(v.string(), ''),
|
||||
|
|
|
@ -656,6 +656,8 @@ const getFeatures = (instance: Instance) => {
|
|||
*/
|
||||
groups: instance.api_versions['groups.pleroma.pl-api'] >= 1,
|
||||
|
||||
groupsSlugs: instance.api_versions['groups.pleroma.pl-api'] >= 1,
|
||||
|
||||
/**
|
||||
* Can hide follows/followers lists and counts.
|
||||
* @see PATCH /api/v1/accounts/update_credentials
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pl-api",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.11",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
"multiselect-react-dropdown": "^2.0.25",
|
||||
"mutative": "^1.0.11",
|
||||
"path-browserify": "^1.0.1",
|
||||
"pl-api": "^0.1.10",
|
||||
"pl-api": "^0.1.11",
|
||||
"postcss": "^8.4.47",
|
||||
"process": "^0.11.10",
|
||||
"punycode": "^2.1.1",
|
||||
|
|
|
@ -7614,10 +7614,10 @@ pkg-dir@^4.1.0:
|
|||
dependencies:
|
||||
find-up "^4.0.0"
|
||||
|
||||
pl-api@^0.1.10:
|
||||
version "0.1.10"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.1.10.tgz#f4abbc6b2b175a0acd2bc97fcf4019f094f386c8"
|
||||
integrity sha512-KXUbCGLhlck5nBHFpbxUnNA1+b4WENO3+pq1YRK+4bi+L8sRRrF6OTN3A86v6ltBJxcZSOyMQUu34Nfp6CCFYw==
|
||||
pl-api@^0.1.11:
|
||||
version "0.1.11"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.1.11.tgz#35044f703bd213a5a5d17d16824653588a64d29e"
|
||||
integrity sha512-KASKZuAateAflNoG2jgAXK6yMVaImcZDsSWOAojFoLi/lDI7tJFwty9C1a7BsuFhWtIwwA9YtLidVxrBGBvGpw==
|
||||
dependencies:
|
||||
blurhash "^2.0.5"
|
||||
http-link-header "^1.1.3"
|
||||
|
|
Loading…
Reference in a new issue