2019-10-03 21:20:48 +00:00
|
|
|
import request from '@/utils/request'
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
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}`,
|
|
|
|
method: 'put',
|
|
|
|
headers: authHeaders(token),
|
|
|
|
data: { sensitive, visibility }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function deleteStatus(id, authHost, token) {
|
|
|
|
return await request({
|
|
|
|
baseURL: baseName(authHost),
|
|
|
|
url: `/api/pleroma/admin/statuses/${id}`,
|
|
|
|
method: 'delete',
|
|
|
|
headers: authHeaders(token)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-05-07 22:54:32 +00:00
|
|
|
export async function fetchStatus(id, authHost, token) {
|
|
|
|
return await request({
|
|
|
|
baseURL: baseName(authHost),
|
|
|
|
url: `/api/pleroma/admin/statuses/${id}`,
|
|
|
|
method: 'get',
|
|
|
|
headers: authHeaders(token)
|
|
|
|
})
|
2020-05-01 20:43:38 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 20:08:38 +00:00
|
|
|
export async function fetchStatuses({ godmode, localOnly, authHost, token, pageSize, page }) {
|
2020-02-27 19:25:50 +00:00
|
|
|
return await request({
|
|
|
|
baseURL: baseName(authHost),
|
2020-03-02 20:08:38 +00:00
|
|
|
url: `/api/pleroma/admin/statuses?godmode=${godmode}&local_only=${localOnly}&page=${page}&page_size=${pageSize}`,
|
2020-02-27 19:25:50 +00:00
|
|
|
method: 'get',
|
|
|
|
headers: authHeaders(token)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-05-10 15:49:11 +00:00
|
|
|
export async function fetchStatusesCount(instance, authHost, token) {
|
2020-03-16 23:20:51 +00:00
|
|
|
return await request({
|
|
|
|
baseURL: baseName(authHost),
|
2020-05-10 15:49:11 +00:00
|
|
|
url: instance ? `/api/pleroma/admin/stats?instance=${instance}` : `/api/pleroma/admin/stats`,
|
2020-03-16 23:20:51 +00:00
|
|
|
method: 'get',
|
|
|
|
headers: authHeaders(token)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-02-01 13:02:12 +00:00
|
|
|
export async function fetchStatusesByInstance({ instance, authHost, token, pageSize, page }) {
|
2019-11-14 13:42:56 +00:00
|
|
|
return await request({
|
|
|
|
baseURL: baseName(authHost),
|
2019-11-15 03:54:33 +00:00
|
|
|
url: `/api/pleroma/admin/instances/${instance}/statuses?page=${page}&page_size=${pageSize}`,
|
2019-11-14 13:42:56 +00:00
|
|
|
method: 'get',
|
|
|
|
headers: authHeaders(token)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-10-03 21:20:48 +00:00
|
|
|
const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
|