From e018d26a5b1099bb65ce42d0998a3fce12f843ca Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sun, 13 Nov 2022 23:15:37 +0000 Subject: [PATCH 1/2] normalise timeout --- src/store/modules/normalizers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index d9e0a0b8..43622ae9 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -77,6 +77,7 @@ export const parseTuples = (tuples, key) => { (item.tuple[0] === ':groups' || item.tuple[0] === ':replace' || item.tuple[0] === ':retries' || + item.tuple[0] === ':timeout' || (item.tuple[0] === ':headers' && key === 'Pleroma.Web.MediaProxy.Invalidation.Http') || item.tuple[0] === ':crontab' || item.tuple[0] === ':transparency_exclusions' || From 0802dc5777e722d5df8bc595e025a6124eb02837 Mon Sep 17 00:00:00 2001 From: floatingghost Date: Wed, 14 Dec 2022 12:05:59 +0000 Subject: [PATCH 2/2] use v1 urls (#15) Co-authored-by: FloatingGhost Reviewed-on: https://akkoma.dev/AkkomaGang/admin-fe/pulls/15 --- admin-fe.iml | 9 +++++ src/api/__mocks__/users.js | 2 +- src/api/app.js | 4 +-- src/api/emojiPacks.js | 24 +++++++------- src/api/invites.js | 8 ++--- src/api/mediaProxyCache.js | 8 ++--- src/api/moderationLog.js | 6 ++-- src/api/relays.js | 6 ++-- src/api/reports.js | 12 +++---- src/api/settings.js | 16 ++++----- src/api/status.js | 12 +++---- src/api/users.js | 44 ++++++++++++------------- src/views/emojiPacks/LocalEmojiPack.vue | 2 +- test/views/users/index.test.js | 2 +- 14 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 admin-fe.iml diff --git a/admin-fe.iml b/admin-fe.iml new file mode 100644 index 00000000..8021953e --- /dev/null +++ b/admin-fe.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/api/__mocks__/users.js b/src/api/__mocks__/users.js index a0122f16..da8d2a3c 100644 --- a/src/api/__mocks__/users.js +++ b/src/api/__mocks__/users.js @@ -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) { diff --git a/src/api/app.js b/src/api/app.js index 0d32fb25..70be85bd 100644 --- a/src/api/app.js +++ b/src/api/app.js @@ -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) }) diff --git a/src/api/emojiPacks.js b/src/api/emojiPacks.js index 2fba5e6b..5e53dbb7 100644 --- a/src/api/emojiPacks.js +++ b/src/api/emojiPacks.js @@ -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 } diff --git a/src/api/invites.js b/src/api/invites.js index a303ac17..ce843cd8 100644 --- a/src/api/invites.js +++ b/src/api/invites.js @@ -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 } diff --git a/src/api/mediaProxyCache.js b/src/api/mediaProxyCache.js index 30b63798..b15008c0 100644 --- a/src/api/mediaProxyCache.js +++ b/src/api/mediaProxyCache.js @@ -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) }) diff --git a/src/api/moderationLog.js b/src/api/moderationLog.js index b866df33..025e8dd5 100644 --- a/src/api/moderationLog.js +++ b/src/api/moderationLog.js @@ -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) }) diff --git a/src/api/relays.js b/src/api/relays.js index 7891917e..1bbb455c 100644 --- a/src/api/relays.js +++ b/src/api/relays.js @@ -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 } diff --git a/src/api/reports.js b/src/api/reports.js index 4f41f956..55899e98 100644 --- a/src/api/reports.js +++ b/src/api/reports.js @@ -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) }) diff --git a/src/api/settings.js b/src/api/settings.js index 28397d13..b97ca2d1 100644 --- a/src/api/settings.js +++ b/src/api/settings.js @@ -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 diff --git a/src/api/status.js b/src/api/status.js index 0f3455c7..e261232d 100644 --- a/src/api/status.js +++ b/src/api/status.js @@ -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) }) diff --git a/src/api/users.js b/src/api/users.js index 55021477..0759036b 100644 --- a/src/api/users.js +++ b/src/api/users.js @@ -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 } diff --git a/src/views/emojiPacks/LocalEmojiPack.vue b/src/views/emojiPacks/LocalEmojiPack.vue index 17833eb3..0c677bdd 100644 --- a/src/views/emojiPacks/LocalEmojiPack.vue +++ b/src/views/emojiPacks/LocalEmojiPack.vue @@ -30,7 +30,7 @@
diff --git a/test/views/users/index.test.js b/test/views/users/index.test.js index 8c486cdf..35ee8dae 100644 --- a/test/views/users/index.test.js +++ b/test/views/users/index.test.js @@ -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()