pl-api: support /api/v1/akkoma/preferred_frontend

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-03 00:35:06 +02:00
parent e3d15ba6d8
commit d8a2a33306
5 changed files with 36 additions and 6 deletions

View File

@ -1406,6 +1406,30 @@ class PlApiClient {
return interactionPoliciesSchema.parse(response.json);
},
/**
* List frontend setting profiles
*
* Requires features{@link Features['preferredFrontends']}.
*/
getAvailableFrontends: async () => {
const response = await this.request('/api/v1/akkoma/preferred_frontend/available');
return z.array(z.string()).parse(response.json);
},
/**
* Update preferred frontend setting
*
* Store preferred frontend in cookies
*
* Requires features{@link Features['preferredFrontends']}.
*/
setPreferredFrontend: async (frontendName: string) => {
const response = await this.request('/api/v1/akkoma/preferred_frontend', { method: 'PUT', body: { frontend_name: frontendName } });
return z.object({ frontend_name: z.string() }).parse(response.json);
},
};
public readonly filtering = {

View File

@ -876,6 +876,12 @@ const getFeatures = (instance?: Instance) => {
v.software === GOTOSOCIAL,
]),
/**
* @see GET /api/v1/akkoma/preferred_frontend/available
* @see PUT /api/v1/akkoma/preferred_frontend
*/
preferredFrontends: v.software === PLEROMA && v.build === AKKOMA,
/**
* Can set privacy scopes on statuses.
* @see POST /api/v1/statuses

View File

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

View File

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

View File

@ -8378,10 +8378,10 @@ pkg-types@^1.0.3:
mlly "^1.2.0"
pathe "^1.1.0"
pl-api@^0.0.26:
version "0.0.26"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.26.tgz#82b20fa0500a22efaae643782ac917c725eef4ff"
integrity sha512-vbH11YmElHNpQZWM5G6nvgyQDp4q+G6IoMKqa7ek156UbuDBuZx/de2LYjlCJQ9nGtTzwNoOYRdtbLcshDKyiw==
pl-api@^0.0.27:
version "0.0.27"
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-0.0.27.tgz#8a9d52594a0d35da9364bbf769b84233827366e1"
integrity sha512-7u/mUexOcBwCa1d4LKZzhFp2bAYqGzfxVXh/RmgMVFd5+d57Kx6Itpzk3dHBJ4aHiE7NV2llEeG/SaYr7mUzuA==
dependencies:
blurhash "^2.0.5"
http-link-header "^1.1.3"