use v1 urls (#15)

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: AkkomaGang/admin-fe#15
This commit is contained in:
floatingghost 2022-12-14 12:05:59 +00:00
parent e018d26a5b
commit 0802dc5777
14 changed files with 82 additions and 73 deletions

9
admin-fe.iml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -36,7 +36,7 @@ export async function fetchUserStatuses(id, authHost, godmode, token) {
}
export async function getPasswordResetToken(nickname, authHost, token) {
return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/pleroma/password_reset/g05lxnBJQnL' }})
return Promise.resolve({ data: { token: 'g05lxnBJQnL', link: 'http://url/api/v1/pleroma/password_reset/g05lxnBJQnL' }})
}
export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function needReboot(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/need_reboot`,
url: `/api/v1/pleroma/admin/need_reboot`,
method: 'get',
headers: authHeaders(token)
})
@ -14,7 +14,7 @@ export async function needReboot(authHost, token) {
export async function restartApp(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/restart`,
url: `/api/v1/pleroma/admin/restart`,
method: 'get',
headers: authHeaders(token)
})

View file

@ -14,7 +14,7 @@ export async function addNewEmojiFile(packName, file, shortcode, filename, host,
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/files?name=${packName}`,
url: `/api/v1/pleroma/emoji/packs/files?name=${packName}`,
method: 'post',
headers: authHeaders(token),
data
@ -28,7 +28,7 @@ export function addressOfEmojiInPack(host, packName, name) {
export async function createPack(host, token, packName) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/pack?name=${packName}`,
url: `/api/v1/pleroma/emoji/pack?name=${packName}`,
method: 'post',
headers: authHeaders(token)
})
@ -37,7 +37,7 @@ export async function createPack(host, token, packName) {
export async function deleteEmojiFile(packName, shortcode, host, token) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/files?name=${packName}&shortcode=${shortcode}`,
url: `/api/v1/pleroma/emoji/packs/files?name=${packName}&shortcode=${shortcode}`,
method: 'delete',
headers: authHeaders(token)
})
@ -46,7 +46,7 @@ export async function deleteEmojiFile(packName, shortcode, host, token) {
export async function deletePack(host, token, packName) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/pack?name=${packName}`,
url: `/api/v1/pleroma/emoji/pack?name=${packName}`,
method: 'delete',
headers: authHeaders(token)
})
@ -55,7 +55,7 @@ export async function deletePack(host, token, packName) {
export async function downloadFrom(instanceAddress, packName, as, host, token) {
return await request({
baseURL: baseName(host),
url: '/api/pleroma/emoji/packs/download',
url: '/api/v1/pleroma/emoji/packs/download',
method: 'post',
headers: authHeaders(token),
data: as.trim() === ''
@ -68,7 +68,7 @@ export async function downloadFrom(instanceAddress, packName, as, host, token) {
export async function fetchPack(packName, page, pageSize, host, token) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/pack?name=${packName}&page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/emoji/pack?name=${packName}&page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})
@ -77,7 +77,7 @@ export async function fetchPack(packName, page, pageSize, host, token) {
export async function importFromFS(host, token) {
return await request({
baseURL: baseName(host),
url: '/api/pleroma/emoji/packs/import',
url: '/api/v1/pleroma/emoji/packs/import',
method: 'get',
headers: authHeaders(token)
})
@ -86,7 +86,7 @@ export async function importFromFS(host, token) {
export async function listPacks(page, pageSize, host, token) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs?page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/emoji/packs?page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})
@ -95,7 +95,7 @@ export async function listPacks(page, pageSize, host, token) {
export async function listRemotePacks(instance, page, pageSize, host, token) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/remote?url=${baseName(instance)}&page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/emoji/packs/remote?url=${baseName(instance)}&page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})
@ -104,7 +104,7 @@ export async function listRemotePacks(instance, page, pageSize, host, token) {
export async function reloadEmoji(host, token) {
return await request({
baseURL: baseName(host),
url: '/api/pleroma/admin/reload_emoji',
url: '/api/v1/pleroma/admin/reload_emoji',
method: 'post',
headers: authHeaders(token)
})
@ -113,7 +113,7 @@ export async function reloadEmoji(host, token) {
export async function savePackMetadata(host, token, packName, metadata) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/pack?name=${packName}`,
url: `/api/v1/pleroma/emoji/pack?name=${packName}`,
method: 'patch',
headers: authHeaders(token),
data: { metadata },
@ -124,7 +124,7 @@ export async function savePackMetadata(host, token, packName, metadata) {
export async function updateEmojiFile(packName, shortcode, newShortcode, newFilename, force, host, token) {
return await request({
baseURL: baseName(host),
url: `/api/pleroma/emoji/packs/files?name=${packName}`,
url: `/api/v1/pleroma/emoji/packs/files?name=${packName}`,
method: 'patch',
headers: authHeaders(token),
data: { shortcode, new_shortcode: newShortcode, new_filename: newFilename, force }

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function generateInviteToken(max_use, expires_at, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/invite_token`,
url: `/api/v1/pleroma/admin/users/invite_token`,
method: 'post',
headers: authHeaders(token),
data: expires_at && expires_at.length > 0 ? { max_use, expires_at } : { max_use }
@ -16,7 +16,7 @@ export async function inviteViaEmail(email, name, authHost, token) {
const data = name.length > 0 ? { email, name } : { email }
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/email_invite',
url: '/api/v1/pleroma/admin/users/email_invite',
method: 'post',
headers: authHeaders(token),
data
@ -26,7 +26,7 @@ export async function inviteViaEmail(email, name, authHost, token) {
export async function listInviteTokens(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/invites`,
url: `/api/v1/pleroma/admin/users/invites`,
method: 'get',
headers: authHeaders(token)
})
@ -35,7 +35,7 @@ export async function listInviteTokens(authHost, token) {
export async function revokeToken(tokenToRevoke, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/revoke_invite`,
url: `/api/v1/pleroma/admin/users/revoke_invite`,
method: 'post',
headers: authHeaders(token),
data: { token: tokenToRevoke }

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function listBannedUrls(page, pageSize, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/media_proxy_caches?page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/admin/media_proxy_caches?page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})
@ -14,7 +14,7 @@ export async function listBannedUrls(page, pageSize, authHost, token) {
export async function purgeUrls(urls, ban, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/media_proxy_caches/purge`,
url: `/api/v1/pleroma/admin/media_proxy_caches/purge`,
method: 'post',
headers: authHeaders(token),
data: { urls, ban }
@ -24,7 +24,7 @@ export async function purgeUrls(urls, ban, authHost, token) {
export async function removeBannedUrls(urls, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/media_proxy_caches/delete`,
url: `/api/v1/pleroma/admin/media_proxy_caches/delete`,
method: 'post',
headers: authHeaders(token),
data: { urls }
@ -34,7 +34,7 @@ export async function removeBannedUrls(urls, authHost, token) {
export async function searchBannedUrls(query, page, pageSize, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/media_proxy_caches?query=${query}&page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/admin/media_proxy_caches?query=${query}&page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})

View file

@ -11,7 +11,7 @@ export async function fetchLog(authHost, token, params, page = 1) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/moderation_log?${normalizedParams}`,
url: `/api/v1/pleroma/admin/moderation_log?${normalizedParams}`,
method: 'get',
headers: authHeaders(token)
})
@ -20,7 +20,7 @@ export async function fetchLog(authHost, token, params, page = 1) {
export async function fetchAdmins(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users?filters=is_admin`,
url: `/api/v1/pleroma/admin/users?filters=is_admin`,
method: 'get',
headers: authHeaders(token)
})
@ -29,7 +29,7 @@ export async function fetchAdmins(authHost, token) {
export async function fetchModerators(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users?filters=is_moderator`,
url: `/api/v1/pleroma/admin/users?filters=is_moderator`,
method: 'get',
headers: authHeaders(token)
})

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function fetchRelays(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/relay',
url: '/api/v1/pleroma/admin/relay',
method: 'get',
headers: authHeaders(token)
})
@ -14,7 +14,7 @@ export async function fetchRelays(authHost, token) {
export async function addRelay(relay_url, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/relay',
url: '/api/v1/pleroma/admin/relay',
method: 'post',
headers: authHeaders(token),
data: { relay_url }
@ -24,7 +24,7 @@ export async function addRelay(relay_url, authHost, token) {
export async function deleteRelay(relay_url, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/relay',
url: '/api/v1/pleroma/admin/relay',
method: 'delete',
headers: authHeaders(token),
data: { relay_url }

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function changeState(reports, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/reports`,
url: `/api/v1/pleroma/admin/reports`,
method: 'patch',
headers: authHeaders(token),
data: { reports }
@ -14,8 +14,8 @@ export async function changeState(reports, authHost, token) {
export async function fetchReports(filter, page, pageSize, authHost, token) {
const url = filter.length > 0
? `/api/pleroma/admin/reports?state=${filter}&page=${page}&page_size=${pageSize}`
: `/api/pleroma/admin/reports?page=${page}&page_size=${pageSize}`
? `/api/v1/pleroma/admin/reports?state=${filter}&page=${page}&page_size=${pageSize}`
: `/api/v1/pleroma/admin/reports?page=${page}&page_size=${pageSize}`
return await request({
baseURL: baseName(authHost),
url,
@ -27,7 +27,7 @@ export async function fetchReports(filter, page, pageSize, authHost, token) {
export async function fetchSingleReport(id, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/reports/${id}`,
url: `/api/v1/pleroma/admin/reports/${id}`,
method: 'get',
headers: authHeaders(token)
})
@ -36,7 +36,7 @@ export async function fetchSingleReport(id, authHost, token) {
export async function createNote(content, reportID, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/reports/${reportID}/notes`,
url: `/api/v1/pleroma/admin/reports/${reportID}/notes`,
method: `post`,
headers: authHeaders(token),
data: { content }
@ -46,7 +46,7 @@ export async function createNote(content, reportID, authHost, token) {
export async function deleteNote(noteID, reportID, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/reports/${reportID}/notes/${noteID}`,
url: `/api/v1/pleroma/admin/reports/${reportID}/notes/${noteID}`,
method: `delete`,
headers: authHeaders(token)
})

View file

@ -6,7 +6,7 @@ import _ from 'lodash'
export async function deleteInstanceDocument(name, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instance_document/${name}`,
url: `/api/v1/pleroma/admin/instance_document/${name}`,
method: 'delete',
headers: authHeaders(token)
})
@ -33,7 +33,7 @@ export async function fetchDescription2(authHost, token) {
export async function fetchSettings(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/config`,
url: `/api/v1/pleroma/admin/config`,
method: 'get',
headers: authHeaders(token)
})
@ -42,7 +42,7 @@ export async function fetchSettings(authHost, token) {
export async function getInstanceDocument(name, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instance_document/${name}`,
url: `/api/v1/pleroma/admin/instance_document/${name}`,
method: 'get',
headers: authHeaders(token)
})
@ -51,7 +51,7 @@ export async function getInstanceDocument(name, authHost, token) {
export async function updateInstanceDocument(name, formData, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instance_document/${name}`,
url: `/api/v1/pleroma/admin/instance_document/${name}`,
method: 'patch',
data: formData,
headers: { ...authHeaders(token), 'Content-Type': 'multipart/form-data' }
@ -61,7 +61,7 @@ export async function updateInstanceDocument(name, formData, authHost, token) {
export async function updateSettings(configs, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/config`,
url: `/api/v1/pleroma/admin/config`,
method: 'post',
headers: authHeaders(token),
data: { configs }
@ -71,7 +71,7 @@ export async function updateSettings(configs, authHost, token) {
export async function removeSettings(configs, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/config`,
url: `/api/v1/pleroma/admin/config`,
method: 'post',
headers: authHeaders(token),
data: { configs }
@ -81,7 +81,7 @@ export async function removeSettings(configs, authHost, token) {
export async function fetchFrontends(authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/frontends`,
url: `/api/v1/pleroma/admin/frontends`,
method: 'get',
headers: authHeaders(token)
})
@ -91,7 +91,7 @@ export async function installFrontend(data, authHost, token) {
const filteredData = _.pickBy(data)
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/frontends/install`,
url: `/api/v1/pleroma/admin/frontends/install`,
method: 'post',
headers: authHeaders(token),
data: filteredData

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function changeStatusScope(id, sensitive, visibility, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/statuses/${id}`,
url: `/api/v1/pleroma/admin/statuses/${id}`,
method: 'put',
headers: authHeaders(token),
data: { sensitive, visibility }
@ -15,7 +15,7 @@ export async function changeStatusScope(id, sensitive, visibility, authHost, tok
export async function deleteStatus(id, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/statuses/${id}`,
url: `/api/v1/pleroma/admin/statuses/${id}`,
method: 'delete',
headers: authHeaders(token)
})
@ -24,7 +24,7 @@ export async function deleteStatus(id, authHost, token) {
export async function fetchStatus(id, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/statuses/${id}`,
url: `/api/v1/pleroma/admin/statuses/${id}`,
method: 'get',
headers: authHeaders(token)
})
@ -33,7 +33,7 @@ export async function fetchStatus(id, authHost, token) {
export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}&page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}&page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})
@ -42,7 +42,7 @@ export async function fetchStatuses({ godmode, localOnly, authHost, token, pageS
export async function fetchStatusesCount(instance, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: instance ? `/api/pleroma/admin/stats?instance=${instance}` : `/api/pleroma/admin/stats`,
url: instance ? `/api/v1/pleroma/admin/stats?instance=${instance}` : `/api/v1/pleroma/admin/stats`,
method: 'get',
headers: authHeaders(token)
})
@ -51,7 +51,7 @@ export async function fetchStatusesCount(instance, authHost, token) {
export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/instances/${instance}/statuses?page=${page}&page_size=${pageSize}`,
url: `/api/v1/pleroma/admin/instances/${instance}/statuses?page=${page}&page_size=${pageSize}`,
method: 'get',
headers: authHeaders(token)
})

View file

@ -5,7 +5,7 @@ import { baseName } from './utils'
export async function activateUsers(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/activate`,
url: `/api/v1/pleroma/admin/users/activate`,
method: 'patch',
headers: authHeaders(token),
data: { nicknames }
@ -15,7 +15,7 @@ export async function activateUsers(nicknames, authHost, token) {
export async function addRight(nicknames, right, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/permission_group/${right}`,
url: `/api/v1/pleroma/admin/users/permission_group/${right}`,
method: 'post',
headers: authHeaders(token),
data: { nicknames }
@ -25,7 +25,7 @@ export async function addRight(nicknames, right, authHost, token) {
export async function createNewAccount(nickname, email, password, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users',
url: '/api/v1/pleroma/admin/users',
method: 'post',
headers: authHeaders(token),
data: { users: [{ nickname, email, password }] }
@ -35,7 +35,7 @@ export async function createNewAccount(nickname, email, password, authHost, toke
export async function deactivateUsers(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/deactivate`,
url: `/api/v1/pleroma/admin/users/deactivate`,
method: 'patch',
headers: authHeaders(token),
data: { nicknames }
@ -45,7 +45,7 @@ export async function deactivateUsers(nicknames, authHost, token) {
export async function deleteRight(nicknames, right, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/permission_group/${right}`,
url: `/api/v1/pleroma/admin/users/permission_group/${right}`,
method: 'delete',
headers: authHeaders(token),
data: { nicknames }
@ -55,7 +55,7 @@ export async function deleteRight(nicknames, right, authHost, token) {
export async function deleteUsers(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users`,
url: `/api/v1/pleroma/admin/users`,
method: 'delete',
headers: authHeaders(token),
data: { nicknames }
@ -65,7 +65,7 @@ export async function deleteUsers(nicknames, authHost, token) {
export async function disableMfa(nickname, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/disable_mfa`,
url: `/api/v1/pleroma/admin/users/disable_mfa`,
method: 'put',
headers: authHeaders(token),
data: { nickname }
@ -75,7 +75,7 @@ export async function disableMfa(nickname, authHost, token) {
export async function fetchUser(id, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/${id}`,
url: `/api/v1/pleroma/admin/users/${id}`,
method: 'get',
headers: authHeaders(token)
})
@ -84,7 +84,7 @@ export async function fetchUser(id, authHost, token) {
export async function fetchUserCredentials(nickname, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/${nickname}/credentials`,
url: `/api/v1/pleroma/admin/users/${nickname}/credentials`,
method: 'get',
headers: authHeaders(token)
})
@ -93,7 +93,7 @@ export async function fetchUserCredentials(nickname, authHost, token) {
export async function updateUserCredentials(nickname, credentials, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/${nickname}/credentials`,
url: `/api/v1/pleroma/admin/users/${nickname}/credentials`,
method: 'patch',
headers: authHeaders(token),
data: credentials
@ -102,11 +102,11 @@ export async function updateUserCredentials(nickname, credentials, authHost, tok
export async function fetchUsers(filters, actorTypeFilters, authHost, token, page = 1) {
const url = actorTypeFilters.length === 0
? `/api/pleroma/admin/users?page=${page}&filters=${filters}`
? `/api/v1/pleroma/admin/users?page=${page}&filters=${filters}`
: actorTypeFilters.reduce((acc, filter) => {
const newAcc = acc.concat(`&actor_types[]=${filter}`)
return newAcc
}, `/api/pleroma/admin/users?page=${page}&filters=${filters}`)
}, `/api/v1/pleroma/admin/users?page=${page}&filters=${filters}`)
return await request({
baseURL: baseName(authHost),
@ -119,7 +119,7 @@ export async function fetchUsers(filters, actorTypeFilters, authHost, token, pag
export async function getPasswordResetToken(nickname, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/${nickname}/password_reset`,
url: `/api/v1/pleroma/admin/users/${nickname}/password_reset`,
method: 'get',
headers: authHeaders(token)
})
@ -128,7 +128,7 @@ export async function getPasswordResetToken(nickname, authHost, token) {
export async function forcePasswordReset(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/force_password_reset`,
url: `/api/v1/pleroma/admin/users/force_password_reset`,
method: 'patch',
headers: authHeaders(token),
data: { nicknames }
@ -137,11 +137,11 @@ export async function forcePasswordReset(nicknames, authHost, token) {
export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {
const url = actorTypeFilters.length === 0
? `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`
? `/api/v1/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`
: actorTypeFilters.reduce((acc, filter) => {
const newAcc = acc.concat(`&actor_types[]=${filter}`)
return newAcc
}, `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`)
}, `/api/v1/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`)
return await request({
baseURL: baseName(authHost),
@ -154,7 +154,7 @@ export async function searchUsers(query, filters, actorTypeFilters, authHost, to
export async function tagUser(nicknames, tags, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/tag',
url: '/api/v1/pleroma/admin/users/tag',
method: 'put',
headers: authHeaders(token),
data: { nicknames, tags }
@ -164,7 +164,7 @@ export async function tagUser(nicknames, tags, authHost, token) {
export async function untagUser(nicknames, tags, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/tag',
url: '/api/v1/pleroma/admin/users/tag',
method: 'delete',
headers: authHeaders(token),
data: { nicknames, tags }
@ -174,7 +174,7 @@ export async function untagUser(nicknames, tags, authHost, token) {
export async function fetchUserStatuses(id, authHost, godmode, token) {
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users/${id}/statuses?godmode=${godmode}`,
url: `/api/v1/pleroma/admin/users/${id}/statuses?godmode=${godmode}`,
method: 'get',
headers: authHeaders(token)
})
@ -183,7 +183,7 @@ export async function fetchUserStatuses(id, authHost, godmode, token) {
export async function approveUserAccount(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/approve',
url: '/api/v1/pleroma/admin/users/approve',
method: 'patch',
headers: authHeaders(token),
data: { nicknames }
@ -193,7 +193,7 @@ export async function approveUserAccount(nicknames, authHost, token) {
export async function confirmUserEmail(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/confirm_email',
url: '/api/v1/pleroma/admin/users/confirm_email',
method: 'patch',
headers: authHeaders(token),
data: { nicknames }
@ -203,7 +203,7 @@ export async function confirmUserEmail(nicknames, authHost, token) {
export async function resendConfirmationEmail(nicknames, authHost, token) {
return await request({
baseURL: baseName(authHost),
url: '/api/pleroma/admin/users/resend_confirmation_email',
url: '/api/v1/pleroma/admin/users/resend_confirmation_email',
method: 'patch',
headers: authHeaders(token),
data: { nicknames }

View file

@ -30,7 +30,7 @@
<div class="download-pack-button-container">
<el-link
v-if="pack.pack['can-download']"
:href="`//${host}//api/pleroma/emoji/packs/archive?name=${name}`"
:href="`//${host}//api/v1/pleroma/emoji/packs/archive?name=${name}`"
:underline="false"
type="primary"
target="_blank">

View file

@ -276,7 +276,7 @@ describe('Users actions', () => {
expect(wrapper.vm.resetPasswordDialogOpen).toBe(true)
expect(store.state.users.passwordResetToken.token).toBe('g05lxnBJQnL')
expect(store.state.users.passwordResetToken.link).toBe('http://url/api/pleroma/password_reset/g05lxnBJQnL')
expect(store.state.users.passwordResetToken.link).toBe('http://url/api/v1/pleroma/password_reset/g05lxnBJQnL')
closeDialogButton.trigger('click')
await flushPromises()