Merge branch 'api-refactor' into shigusegubu-themes3
This commit is contained in:
commit
ba810b4a2a
50 changed files with 1184 additions and 1157 deletions
86
src/api/chats.js
Normal file
86
src/api/chats.js
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
import { parseChat } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||||
|
import { paramsString, promisedRequest } from './helpers.js'
|
||||||
|
|
||||||
|
const PLEROMA_CHATS_URL = '/api/v1/pleroma/chats'
|
||||||
|
const PLEROMA_CHAT_URL = (id) => `/api/v1/pleroma/chats/by-account-id/${id}`
|
||||||
|
const PLEROMA_CHAT_MESSAGES_URL = (id, { maxId, sinceId, limit }) =>
|
||||||
|
`/api/v1/pleroma/chats/${id}/messages${paramsString({ maxId, sinceId, limit })}`
|
||||||
|
const PLEROMA_CHAT_READ_URL = (id) => `/api/v1/pleroma/chats/${id}/read`
|
||||||
|
const PLEROMA_DELETE_CHAT_MESSAGE_URL = (chatId, messageId) =>
|
||||||
|
`/api/v1/pleroma/chats/${chatId}/messages/${messageId}`
|
||||||
|
|
||||||
|
export const chats = ({ credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_CHATS_URL,
|
||||||
|
credentials,
|
||||||
|
}).then((data) => ({
|
||||||
|
chatList: data.map(parseChat).filter((c) => c),
|
||||||
|
}))
|
||||||
|
|
||||||
|
export const getOrCreateChat = ({ accountId, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_CHAT_URL(accountId),
|
||||||
|
method: 'POST',
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const chatMessages = ({
|
||||||
|
id,
|
||||||
|
credentials,
|
||||||
|
maxId,
|
||||||
|
sinceId,
|
||||||
|
limit = 20,
|
||||||
|
}) => {
|
||||||
|
return promisedRequest({
|
||||||
|
url: PLEROMA_CHAT_MESSAGES_URL(id, { maxId, sinceId, limit }),
|
||||||
|
method: 'GET',
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const sendChatMessage = ({
|
||||||
|
id,
|
||||||
|
content,
|
||||||
|
mediaId = null,
|
||||||
|
idempotencyKey,
|
||||||
|
credentials,
|
||||||
|
}) => {
|
||||||
|
const payload = {
|
||||||
|
content,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mediaId) {
|
||||||
|
payload.media_id = mediaId
|
||||||
|
}
|
||||||
|
|
||||||
|
const headers = {}
|
||||||
|
|
||||||
|
if (idempotencyKey) {
|
||||||
|
headers['idempotency-key'] = idempotencyKey
|
||||||
|
}
|
||||||
|
|
||||||
|
return promisedRequest({
|
||||||
|
url: PLEROMA_CHAT_MESSAGES_URL(id),
|
||||||
|
method: 'POST',
|
||||||
|
payload,
|
||||||
|
credentials,
|
||||||
|
headers,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const readChat = ({ id, lastReadId, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_CHAT_READ_URL(id),
|
||||||
|
method: 'POST',
|
||||||
|
payload: {
|
||||||
|
last_read_id: lastReadId,
|
||||||
|
},
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const deleteChatMessage = ({ chatId, messageId, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_DELETE_CHAT_MESSAGE_URL(chatId, messageId),
|
||||||
|
method: 'DELETE',
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
|
@ -83,9 +83,11 @@ export const promisedRequest = async ({
|
||||||
...headers,
|
...headers,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!formData) {
|
if (!formData) {
|
||||||
options.headers['Content-Type'] = 'application/json'
|
options.headers['Content-Type'] = 'application/json'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
url +=
|
url +=
|
||||||
'?' +
|
'?' +
|
||||||
|
|
@ -112,15 +114,6 @@ export const promisedRequest = async ({
|
||||||
// 204 is "No content", which fails to parse json (as you'd might think)
|
// 204 is "No content", which fails to parse json (as you'd might think)
|
||||||
if (response.ok && response.status === 204) return { _response: response }
|
if (response.ok && response.status === 204) return { _response: response }
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new StatusCodeError(
|
|
||||||
response.status,
|
|
||||||
json,
|
|
||||||
{ url, options },
|
|
||||||
response,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = await response.json()
|
const json = await response.json()
|
||||||
|
|
||||||
|
|
@ -133,6 +126,15 @@ export const promisedRequest = async ({
|
||||||
|
|
||||||
json._response = response
|
json._response = response
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new StatusCodeError(
|
||||||
|
response.status,
|
||||||
|
json,
|
||||||
|
{ url, options },
|
||||||
|
response,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return json
|
return json
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new StatusCodeError(
|
throw new StatusCodeError(
|
||||||
601
src/api/public.js
Normal file
601
src/api/public.js
Normal file
|
|
@ -0,0 +1,601 @@
|
||||||
|
import { concat, each, last, map } from 'lodash'
|
||||||
|
|
||||||
|
import {
|
||||||
|
parseAttachment,
|
||||||
|
parseChat,
|
||||||
|
parseLinkHeaderPagination,
|
||||||
|
parseNotification,
|
||||||
|
parseSource,
|
||||||
|
parseStatus,
|
||||||
|
parseUser,
|
||||||
|
} from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||||
|
import { paramsString, promisedRequest } from './helpers.js'
|
||||||
|
|
||||||
|
import { RegistrationError, StatusCodeError } from 'src/services/errors/errors'
|
||||||
|
|
||||||
|
const SUGGESTIONS_URL = '/api/v1/suggestions'
|
||||||
|
/* eslint-env browser */
|
||||||
|
const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials'
|
||||||
|
const MASTODON_REGISTRATION_URL = '/api/v1/accounts'
|
||||||
|
const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites'
|
||||||
|
const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications'
|
||||||
|
const MASTODON_FOLLOWING_URL = (
|
||||||
|
id,
|
||||||
|
{ minId, maxId, sinceId, limit, withRelationships },
|
||||||
|
) =>
|
||||||
|
`/api/v1/accounts/${id}/following${paramsString({ minId, maxId, sinceId, limit, withRelationships })}`
|
||||||
|
const MASTODON_FOLLOWERS_URL = (
|
||||||
|
id,
|
||||||
|
{ minId, maxId, sinceId, limit, withRelationships },
|
||||||
|
) =>
|
||||||
|
`/api/v1/accounts/${id}/followers${paramsString({ minId, maxId, sinceId, limit, withRelationships })}`
|
||||||
|
const MASTODON_USER_HOME_TIMELINE_URL = '/api/v1/timelines/home'
|
||||||
|
const MASTODON_LIST_TIMELINE_URL = (id) => `/api/v1/timelines/list/${id}`
|
||||||
|
const MASTODON_BOOKMARK_TIMELINE_URL = '/api/v1/bookmarks'
|
||||||
|
const MASTODON_DIRECT_MESSAGES_TIMELINE_URL = '/api/v1/timelines/direct'
|
||||||
|
const MASTODON_PUBLIC_TIMELINE = '/api/v1/timelines/public'
|
||||||
|
export const MASTODON_STATUS_URL = (id) => `/api/v1/statuses/${id}`
|
||||||
|
const MASTODON_STATUS_CONTEXT_URL = (id) => `/api/v1/statuses/${id}/context`
|
||||||
|
const MASTODON_STATUS_SOURCE_URL = (id) => `/api/v1/statuses/${id}/source`
|
||||||
|
const MASTODON_STATUS_HISTORY_URL = (id) => `/api/v1/statuses/${id}/history`
|
||||||
|
const MASTODON_USER_URL = '/api/v1/accounts'
|
||||||
|
const MASTODON_USER_LOOKUP_URL = '/api/v1/accounts/lookup'
|
||||||
|
const MASTODON_USER_TIMELINE_URL = (id) => `/api/v1/accounts/${id}/statuses`
|
||||||
|
const MASTODON_TAG_TIMELINE_URL = (tag) => `/api/v1/timelines/tag/${tag}`
|
||||||
|
const AKKOMA_BUBBLE_TIMELINE_URL = '/api/v1/timelines/bubble'
|
||||||
|
const MASTODON_POLL_URL = (id) => `/api/v1/polls/${id}`
|
||||||
|
const MASTODON_STATUS_FAVORITEDBY_URL = (id) =>
|
||||||
|
`/api/v1/statuses/${id}/favourited_by`
|
||||||
|
const MASTODON_STATUS_REBLOGGEDBY_URL = (id) =>
|
||||||
|
`/api/v1/statuses/${id}/reblogged_by`
|
||||||
|
const MASTODON_SEARCH_2 = '/api/v2/search'
|
||||||
|
const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search'
|
||||||
|
const MASTODON_STREAMING = '/api/v1/streaming'
|
||||||
|
const MASTODON_KNOWN_DOMAIN_LIST_URL = '/api/v1/instance/peers'
|
||||||
|
const MASTODON_ANNOUNCEMENTS_URL = '/api/v1/announcements'
|
||||||
|
const PLEROMA_EMOJI_REACTIONS_URL = (id) =>
|
||||||
|
`/api/v1/pleroma/statuses/${id}/reactions`
|
||||||
|
const PLEROMA_SCROBBLES_URL = (id, { maxId, sinceId, minId, limit, offset }) =>
|
||||||
|
`/api/v1/pleroma/accounts/${id}/scrobbles${paramsString({ maxId, sinceId, minId, limit, offset })}`
|
||||||
|
const PLEROMA_STATUS_QUOTES_URL = (id) =>
|
||||||
|
`/api/v1/pleroma/statuses/${id}/quotes`
|
||||||
|
const PLEROMA_USER_FAVORITES_TIMELINE_URL = (id) =>
|
||||||
|
`/api/v1/pleroma/accounts/${id}/favourites`
|
||||||
|
|
||||||
|
const EMOJI_PACKS_URL = (page, pageSize) =>
|
||||||
|
`/api/v1/pleroma/emoji/packs${paramsString({ page, pageSize })}`
|
||||||
|
|
||||||
|
// Params needed:
|
||||||
|
// nickname
|
||||||
|
// email
|
||||||
|
// fullname
|
||||||
|
// password
|
||||||
|
// password_confirm
|
||||||
|
//
|
||||||
|
// Optional
|
||||||
|
// bio
|
||||||
|
// homepage
|
||||||
|
// location
|
||||||
|
// token
|
||||||
|
// language
|
||||||
|
export const register = ({ params, credentials }) => {
|
||||||
|
const { nickname, ...rest } = params
|
||||||
|
return promisedRequest({
|
||||||
|
url: MASTODON_REGISTRATION_URL,
|
||||||
|
method: 'POST',
|
||||||
|
credentials,
|
||||||
|
payload: {
|
||||||
|
nickname,
|
||||||
|
locale: 'en_US',
|
||||||
|
agreement: true,
|
||||||
|
...rest,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getCaptcha = () =>
|
||||||
|
promisedRequest({
|
||||||
|
url: '/api/pleroma/captcha',
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchUser = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: `${MASTODON_USER_URL}/${id}`,
|
||||||
|
credentials,
|
||||||
|
}).then((data) => parseUser(data))
|
||||||
|
|
||||||
|
export const fetchUserByName = ({ name, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_USER_LOOKUP_URL,
|
||||||
|
credentials,
|
||||||
|
params: { acct: name },
|
||||||
|
})
|
||||||
|
.then((data) => data.id)
|
||||||
|
.catch((error) => {
|
||||||
|
if (error && error.statusCode === 404) {
|
||||||
|
// Either the backend does not support lookup endpoint,
|
||||||
|
// or there is no user with such name. Fallback and treat name as id.
|
||||||
|
return name
|
||||||
|
} else {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then((id) => fetchUser({ id, credentials }))
|
||||||
|
|
||||||
|
export const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_FOLLOWING_URL(id, { maxId, sinceId, limit }),
|
||||||
|
credentials,
|
||||||
|
}).then((data) => data.map(parseUser))
|
||||||
|
|
||||||
|
export const fetchFollowers = ({
|
||||||
|
id,
|
||||||
|
maxId,
|
||||||
|
sinceId,
|
||||||
|
limit = 20,
|
||||||
|
credentials,
|
||||||
|
}) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_FOLLOWERS_URL(id, {
|
||||||
|
maxId,
|
||||||
|
sinceId,
|
||||||
|
limit,
|
||||||
|
withRelationships: true,
|
||||||
|
}),
|
||||||
|
credentials,
|
||||||
|
}).then((data) => data.map(parseUser))
|
||||||
|
|
||||||
|
export const fetchConversation = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_CONTEXT_URL(id),
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
.then(({ ancestors, descendants }) => ({
|
||||||
|
ancestors: ancestors.map(parseStatus),
|
||||||
|
descendants: descendants.map(parseStatus),
|
||||||
|
}))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchStatus = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_URL(id),
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
.then((data) => parseStatus(data))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchStatusSource = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_SOURCE_URL(id),
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
.then((data) => parseSource(data))
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchStatusHistory = ({ status, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_HISTORY_URL(status.id),
|
||||||
|
credentials,
|
||||||
|
}).then((data) => {
|
||||||
|
data.reverse()
|
||||||
|
return data.map((item) => {
|
||||||
|
item.originalStatus = status
|
||||||
|
return parseStatus(item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchTimeline = ({
|
||||||
|
timeline,
|
||||||
|
credentials,
|
||||||
|
sinceId,
|
||||||
|
minId,
|
||||||
|
maxId,
|
||||||
|
userId,
|
||||||
|
listId,
|
||||||
|
statusId,
|
||||||
|
tag,
|
||||||
|
withMuted,
|
||||||
|
replyVisibility = 'all',
|
||||||
|
includeTypes = [],
|
||||||
|
bookmarkFolderId,
|
||||||
|
}) => {
|
||||||
|
const timelineUrls = {
|
||||||
|
public: MASTODON_PUBLIC_TIMELINE,
|
||||||
|
friends: MASTODON_USER_HOME_TIMELINE_URL,
|
||||||
|
dms: MASTODON_DIRECT_MESSAGES_TIMELINE_URL,
|
||||||
|
notifications: MASTODON_USER_NOTIFICATIONS_URL,
|
||||||
|
publicAndExternal: MASTODON_PUBLIC_TIMELINE,
|
||||||
|
user: MASTODON_USER_TIMELINE_URL,
|
||||||
|
media: MASTODON_USER_TIMELINE_URL,
|
||||||
|
list: MASTODON_LIST_TIMELINE_URL,
|
||||||
|
favorites: MASTODON_USER_FAVORITES_TIMELINE_URL,
|
||||||
|
publicFavorites: PLEROMA_USER_FAVORITES_TIMELINE_URL,
|
||||||
|
tag: MASTODON_TAG_TIMELINE_URL,
|
||||||
|
bookmarks: MASTODON_BOOKMARK_TIMELINE_URL,
|
||||||
|
quotes: PLEROMA_STATUS_QUOTES_URL,
|
||||||
|
bubble: AKKOMA_BUBBLE_TIMELINE_URL,
|
||||||
|
}
|
||||||
|
|
||||||
|
const isNotifications = timeline === 'notifications'
|
||||||
|
const params = {
|
||||||
|
minId,
|
||||||
|
sinceId,
|
||||||
|
maxId,
|
||||||
|
limit: 20,
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = timelineUrls[timeline]
|
||||||
|
|
||||||
|
if (timeline === 'favorites' && userId) {
|
||||||
|
url = timelineUrls.publicFavorites(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeline === 'user' || timeline === 'media') {
|
||||||
|
url = url(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeline === 'list') {
|
||||||
|
url = url(listId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeline === 'quotes') {
|
||||||
|
url = url(statusId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag) {
|
||||||
|
url = url(tag)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeline === 'media') {
|
||||||
|
params.onlyMedia = 1
|
||||||
|
}
|
||||||
|
if (timeline === 'public') {
|
||||||
|
params.local = true
|
||||||
|
}
|
||||||
|
if (timeline === 'public' || timeline === 'publicAndExternal') {
|
||||||
|
params.onlyMedia = false
|
||||||
|
}
|
||||||
|
if (timeline !== 'favorites' && timeline !== 'bookmarks') {
|
||||||
|
params.withMuted = withMuted
|
||||||
|
}
|
||||||
|
if (replyVisibility !== 'all') {
|
||||||
|
params.replyVisibility = replyVisibility
|
||||||
|
}
|
||||||
|
if (includeTypes.size > 0) {
|
||||||
|
params.includeTypes = includeTypes
|
||||||
|
}
|
||||||
|
if (timeline === 'bookmarks' && bookmarkFolderId) {
|
||||||
|
params.folderId = bookmarkFolderId
|
||||||
|
}
|
||||||
|
|
||||||
|
return promisedRequest({
|
||||||
|
url: url + paramsString(params),
|
||||||
|
credentials,
|
||||||
|
}).then(async (data) => {
|
||||||
|
const pagination = parseLinkHeaderPagination(
|
||||||
|
data._response.headers.get('Link'),
|
||||||
|
{
|
||||||
|
flakeId: timeline !== 'bookmarks' && timeline !== 'notifications',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
data: data.map(isNotifications ? parseNotification : parseStatus),
|
||||||
|
pagination,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const listEmojiPacks = ({ page, pageSize, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: EMOJI_PACKS_URL(page, pageSize),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchPinnedStatuses = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_USER_TIMELINE_URL(id) + '?pinned=true',
|
||||||
|
credentials,
|
||||||
|
}).then((data) => data.map(parseStatus))
|
||||||
|
|
||||||
|
export const verifyCredentials = ({ credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_LOGIN_URL,
|
||||||
|
credentials,
|
||||||
|
}).then((data) => (data.error ? data : parseUser(data)))
|
||||||
|
|
||||||
|
export const suggestions = ({ credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: SUGGESTIONS_URL,
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchPoll = ({ pollId, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_POLL_URL(encodeURIComponent(pollId)),
|
||||||
|
method: 'GET',
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchFavoritedByUsers = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_FAVORITEDBY_URL(id),
|
||||||
|
method: 'GET',
|
||||||
|
credentials,
|
||||||
|
}).then((users) => users.map(parseUser))
|
||||||
|
|
||||||
|
export const fetchRebloggedByUsers = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_STATUS_REBLOGGEDBY_URL(id),
|
||||||
|
method: 'GET',
|
||||||
|
credentials,
|
||||||
|
}).then((users) => users.map(parseUser))
|
||||||
|
|
||||||
|
export const fetchEmojiReactions = ({ id, credentials }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_EMOJI_REACTIONS_URL(id),
|
||||||
|
credentials,
|
||||||
|
}).then((reactions) =>
|
||||||
|
reactions.map((r) => {
|
||||||
|
r.accounts = r.accounts.map(parseUser)
|
||||||
|
return r
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
export const searchUsers = ({ credentials, query }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: MASTODON_USER_SEARCH_URL,
|
||||||
|
params: {
|
||||||
|
q: query,
|
||||||
|
resolve: true,
|
||||||
|
},
|
||||||
|
credentials,
|
||||||
|
}).then((data) => data.map(parseUser))
|
||||||
|
|
||||||
|
export const search2 = ({
|
||||||
|
credentials,
|
||||||
|
q,
|
||||||
|
resolve,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
|
following,
|
||||||
|
type,
|
||||||
|
}) => {
|
||||||
|
let url = MASTODON_SEARCH_2
|
||||||
|
const params = []
|
||||||
|
|
||||||
|
if (q) {
|
||||||
|
params.push(['q', encodeURIComponent(q)])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolve) {
|
||||||
|
params.push(['resolve', resolve])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (limit) {
|
||||||
|
params.push(['limit', limit])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset) {
|
||||||
|
params.push(['offset', offset])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (following) {
|
||||||
|
params.push(['following', true])
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type) {
|
||||||
|
params.push(['type', type])
|
||||||
|
}
|
||||||
|
|
||||||
|
params.push(['with_relationships', true])
|
||||||
|
|
||||||
|
const queryString = map(params, (param) => `${param[0]}=${param[1]}`).join(
|
||||||
|
'&',
|
||||||
|
)
|
||||||
|
url += `?${queryString}`
|
||||||
|
|
||||||
|
return promisedRequest({
|
||||||
|
url,
|
||||||
|
credentials,
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
data.accounts = data.accounts.slice(0, limit).map((u) => parseUser(u))
|
||||||
|
data.statuses = data.statuses.slice(0, limit).map((s) => parseStatus(s))
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Error fetching timeline', error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const fetchKnownDomains = ({ credentials }) =>
|
||||||
|
promisedRequest({ url: MASTODON_KNOWN_DOMAIN_LIST_URL, credentials })
|
||||||
|
|
||||||
|
export const getAnnouncements = ({ credentials }) =>
|
||||||
|
promisedRequest({ url: MASTODON_ANNOUNCEMENTS_URL, credentials })
|
||||||
|
|
||||||
|
export const getMastodonSocketURI = (
|
||||||
|
{ credentials, stream, args = {} },
|
||||||
|
base,
|
||||||
|
) => {
|
||||||
|
const url = new URL(MASTODON_STREAMING, base)
|
||||||
|
if (credentials) {
|
||||||
|
url.searchParams.append('access_token', credentials)
|
||||||
|
}
|
||||||
|
if (stream) {
|
||||||
|
url.searchParams.append('stream', stream)
|
||||||
|
}
|
||||||
|
Object.entries(args).forEach(([key, val]) => {
|
||||||
|
url.searchParams.append(key, val)
|
||||||
|
})
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
|
||||||
|
const MASTODON_STREAMING_EVENTS = new Set([
|
||||||
|
'update',
|
||||||
|
'notification',
|
||||||
|
'delete',
|
||||||
|
'filters_changed',
|
||||||
|
'status.update',
|
||||||
|
])
|
||||||
|
|
||||||
|
const PLEROMA_STREAMING_EVENTS = new Set([
|
||||||
|
'pleroma:chat_update',
|
||||||
|
'pleroma:respond',
|
||||||
|
])
|
||||||
|
|
||||||
|
// A thin wrapper around WebSocket API that allows adding a pre-processor to it
|
||||||
|
// Uses EventTarget and a CustomEvent to proxy events
|
||||||
|
export const ProcessedWS = ({
|
||||||
|
url,
|
||||||
|
preprocessor = handleMastoWS,
|
||||||
|
id = 'Unknown',
|
||||||
|
credentials,
|
||||||
|
}) => {
|
||||||
|
const eventTarget = new EventTarget()
|
||||||
|
const socket = new WebSocket(url)
|
||||||
|
if (!socket) throw new Error(`Failed to create socket ${id}`)
|
||||||
|
const proxy = (original, eventName, processor = (a) => a) => {
|
||||||
|
original.addEventListener(eventName, (eventData) => {
|
||||||
|
eventTarget.dispatchEvent(
|
||||||
|
new CustomEvent(eventName, { detail: processor(eventData) }),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
socket.addEventListener('open', (wsEvent) => {
|
||||||
|
console.debug(`[WS][${id}] Socket connected`, wsEvent)
|
||||||
|
if (credentials) {
|
||||||
|
socket.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'pleroma:authenticate',
|
||||||
|
token: credentials,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
socket.addEventListener('error', (wsEvent) => {
|
||||||
|
console.debug(`[WS][${id}] Socket errored`, wsEvent)
|
||||||
|
})
|
||||||
|
socket.addEventListener('close', (wsEvent) => {
|
||||||
|
console.debug(
|
||||||
|
`[WS][${id}] Socket disconnected with code ${wsEvent.code}`,
|
||||||
|
wsEvent,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
// Commented code reason: very spammy, uncomment to enable message debug logging
|
||||||
|
/*
|
||||||
|
socket.addEventListener('message', (wsEvent) => {
|
||||||
|
console.debug(
|
||||||
|
`[WS][${id}] Message received`,
|
||||||
|
wsEvent
|
||||||
|
)
|
||||||
|
})
|
||||||
|
/**/
|
||||||
|
|
||||||
|
const onAuthenticated = () => {
|
||||||
|
eventTarget.dispatchEvent(new CustomEvent('pleroma:authenticated'))
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy(socket, 'open')
|
||||||
|
proxy(socket, 'close')
|
||||||
|
proxy(socket, 'message', (event) => preprocessor(event, { onAuthenticated }))
|
||||||
|
proxy(socket, 'error')
|
||||||
|
|
||||||
|
// 1000 = Normal Closure
|
||||||
|
eventTarget.close = () => {
|
||||||
|
socket.close(1000, 'Shutting down socket')
|
||||||
|
}
|
||||||
|
eventTarget.getState = () => socket.readyState
|
||||||
|
eventTarget.subscribe = (stream, args = {}) => {
|
||||||
|
console.debug(`[WS][${id}] Subscribing to stream ${stream} with args`, args)
|
||||||
|
socket.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'subscribe',
|
||||||
|
stream,
|
||||||
|
...args,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
eventTarget.unsubscribe = (stream, args = {}) => {
|
||||||
|
console.debug(
|
||||||
|
`[WS][${id}] Unsubscribing from stream ${stream} with args`,
|
||||||
|
args,
|
||||||
|
)
|
||||||
|
socket.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'unsubscribe',
|
||||||
|
stream,
|
||||||
|
...args,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
export const handleMastoWS = (
|
||||||
|
wsEvent,
|
||||||
|
{
|
||||||
|
onAuthenticated = () => {
|
||||||
|
/* no-op */
|
||||||
|
},
|
||||||
|
} = {},
|
||||||
|
) => {
|
||||||
|
const { data } = wsEvent
|
||||||
|
if (!data) return
|
||||||
|
const parsedEvent = JSON.parse(data)
|
||||||
|
const { event, payload } = parsedEvent
|
||||||
|
if (
|
||||||
|
MASTODON_STREAMING_EVENTS.has(event) ||
|
||||||
|
PLEROMA_STREAMING_EVENTS.has(event)
|
||||||
|
) {
|
||||||
|
// MastoBE and PleromaBE both send payload for delete as a PLAIN string
|
||||||
|
if (event === 'delete') {
|
||||||
|
return { event, id: payload }
|
||||||
|
}
|
||||||
|
const data = payload ? JSON.parse(payload) : null
|
||||||
|
if (event === 'pleroma:respond') {
|
||||||
|
if (data.type === 'pleroma:authenticate') {
|
||||||
|
if (data.result === 'success') {
|
||||||
|
console.debug('[WS] Successfully authenticated')
|
||||||
|
onAuthenticated()
|
||||||
|
} else {
|
||||||
|
console.error('[WS] Unable to authenticate:', data.error)
|
||||||
|
wsEvent.target.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
} else if (event === 'update') {
|
||||||
|
return { event, status: parseStatus(data) }
|
||||||
|
} else if (event === 'status.update') {
|
||||||
|
return { event, status: parseStatus(data) }
|
||||||
|
} else if (event === 'notification') {
|
||||||
|
return { event, notification: parseNotification(data) }
|
||||||
|
} else if (event === 'pleroma:chat_update') {
|
||||||
|
return { event, chatUpdate: parseChat(data) }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('Unknown event', wsEvent)
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WSConnectionStatus = Object.freeze({
|
||||||
|
JOINED: 1,
|
||||||
|
CLOSED: 2,
|
||||||
|
ERROR: 3,
|
||||||
|
DISABLED: 4,
|
||||||
|
STARTING: 5,
|
||||||
|
STARTING_INITIAL: 6,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const fetchScrobbles = ({ accountId, limit = 1 }) =>
|
||||||
|
promisedRequest({
|
||||||
|
url: PLEROMA_SCROBBLES_URL(accountId, { limit }),
|
||||||
|
})
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@ import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchBookmarkFolders } from 'src/services/api/api.service.js'
|
import { fetchBookmarkFolders } from 'src/api/user.js'
|
||||||
|
|
||||||
const BookmarkFolderEdit = {
|
const BookmarkFolderEdit = {
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { mapGetters, mapState } from 'vuex'
|
||||||
import ChatMessage from 'src/components/chat_message/chat_message.vue'
|
import ChatMessage from 'src/components/chat_message/chat_message.vue'
|
||||||
import ChatTitle from 'src/components/chat_title/chat_title.vue'
|
import ChatTitle from 'src/components/chat_title/chat_title.vue'
|
||||||
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
import PostStatusForm from 'src/components/post_status_form/post_status_form.vue'
|
||||||
import { WSConnectionStatus } from '../../services/api/api.service.js'
|
import { WSConnectionStatus } from 'src/api/public.js'
|
||||||
import chatService from '../../services/chat_service/chat_service.js'
|
import chatService from '../../services/chat_service/chat_service.js'
|
||||||
import { buildFakeMessage } from '../../services/chat_utils/chat_utils.js'
|
import { buildFakeMessage } from '../../services/chat_utils/chat_utils.js'
|
||||||
import { promiseInterval } from '../../services/promise_interval/promise_interval.js'
|
import { promiseInterval } from '../../services/promise_interval/promise_interval.js'
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
chatMessages,
|
chatMessages,
|
||||||
getOrCreateChat,
|
getOrCreateChat,
|
||||||
sendChatMessage,
|
sendChatMessage,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/chats.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons'
|
import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import UserAvatar from 'src/components/user_avatar/user_avatar.vue'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { chats } from 'src/services/api/api.service.js'
|
import { chats } from 'src/api/chats.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faChevronLeft, faSearch } from '@fortawesome/free-solid-svg-icons'
|
import { faChevronLeft, faSearch } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ import { mapState } from 'vuex'
|
||||||
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
import QuickFilterSettings from 'src/components/quick_filter_settings/quick_filter_settings.vue'
|
||||||
import QuickViewSettings from 'src/components/quick_view_settings/quick_view_settings.vue'
|
import QuickViewSettings from 'src/components/quick_view_settings/quick_view_settings.vue'
|
||||||
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
import ThreadTree from 'src/components/thread_tree/thread_tree.vue'
|
||||||
import { WSConnectionStatus } from '../../services/api/api.service.js'
|
import { WSConnectionStatus } from 'src/api/public.js'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
|
|
||||||
import { fetchConversation, fetchStatus } from 'src/services/api/api.service.js'
|
import { fetchConversation, fetchStatus } from 'src/api/public.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { approveUser, denyUser } from 'src/services/api/api.service.js'
|
import { approveUser, denyUser } from 'src/api/user.js'
|
||||||
|
|
||||||
const FollowRequestCard = {
|
const FollowRequestCard = {
|
||||||
props: ['user'],
|
props: ['user'],
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||||
|
|
||||||
import { approveUser, denyUser } from 'src/services/api/api.service.js'
|
import { approveUser, denyUser } from 'src/api/user.js'
|
||||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchUser } from 'src/services/api/api.service.js'
|
import { fetchUser } from 'src/api/public.js'
|
||||||
|
|
||||||
const RemoteUserResolver = {
|
const RemoteUserResolver = {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ import {
|
||||||
addNewEmojiFile,
|
addNewEmojiFile,
|
||||||
deleteEmojiFile,
|
deleteEmojiFile,
|
||||||
updateEmojiFile,
|
updateEmojiFile,
|
||||||
} from 'src/services/api/admin.js'
|
} from 'src/api/admin.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
import UnitSetting from '../helpers/unit_setting.vue'
|
import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
import Preview from './old_theme_tab/theme_preview.vue'
|
import Preview from './old_theme_tab/theme_preview.vue'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { normalizeThemeData, useInterfaceStore } from 'src/stores/interface.js'
|
import { normalizeThemeData, useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
|
|
||||||
import { updateProfileImages } from 'src/services/api/api.service.js'
|
import { updateProfileImages } from 'src/api/user.js'
|
||||||
import { newImporter } from 'src/services/export_import/export_import.js'
|
import { newImporter } from 'src/services/export_import/export_import.js'
|
||||||
import {
|
import {
|
||||||
adoptStyleSheets,
|
adoptStyleSheets,
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
import UnitSetting from '../helpers/unit_setting.vue'
|
import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { updateProfile } from 'src/services/api/api.service.js'
|
import { updateProfile } from 'src/api/user.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
import { cacheKey, clearCache, emojiCacheKey } from 'src/services/sw/sw.js'
|
import { cacheKey, clearCache, emojiCacheKey } from 'src/services/sw/sw.js'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
importFollows,
|
importFollows,
|
||||||
importMutes,
|
importMutes,
|
||||||
listBackups,
|
listBackups,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
const DataImportExportTab = {
|
const DataImportExportTab = {
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ import FloatSetting from '../helpers/float_setting.vue'
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
import UnitSetting from '../helpers/unit_setting.vue'
|
import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { updateProfile } from 'src/services/api/api.service.js'
|
import { updateProfile } from 'src/api/user.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
||||||
const GeneralTab = {
|
const GeneralTab = {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useOAuthTokensStore } from 'src/stores/oauth_tokens.js'
|
import { useOAuthTokensStore } from 'src/stores/oauth_tokens.js'
|
||||||
|
|
||||||
import { importBlocks, importFollows } from 'src/services/api/api.service.js'
|
import { importBlocks, importFollows } from 'src/api/user.js'
|
||||||
|
|
||||||
const MutesAndBlocks = {
|
const MutesAndBlocks = {
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { updateNotificationSettings } from 'src/services/api/api.service.js'
|
import { updateNotificationSettings } from 'src/api/user.js'
|
||||||
|
|
||||||
const NotificationsTab = {
|
const NotificationsTab = {
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { updateProfile } from 'src/services/api/api.service.js'
|
import { updateProfile } from 'src/api/user.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
mfaConfirmOTP,
|
mfaConfirmOTP,
|
||||||
mfaSetupOTP,
|
mfaSetupOTP,
|
||||||
settingsMFA,
|
settingsMFA,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
const Mfa = {
|
const Mfa = {
|
||||||
data: () => ({
|
data: () => ({
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import Confirm from './confirm.vue'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { mfaDisableOTP } from 'src/services/api/api.service.js'
|
import { mfaDisableOTP } from 'src/api/user.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['settings'],
|
props: ['settings'],
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
deleteAlias,
|
deleteAlias,
|
||||||
listAliases,
|
listAliases,
|
||||||
moveAccount,
|
moveAccount,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
||||||
const SecurityTab = {
|
const SecurityTab = {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { usePostStatusStore } from 'src/stores/post_status'
|
import { usePostStatusStore } from 'src/stores/post_status'
|
||||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||||
|
|
||||||
import { updateProfile } from 'src/services/api/api.service.js'
|
import { updateProfile } from 'src/api/user.js'
|
||||||
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import UserLink from 'src/components/user_link/user_link.vue'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useReportsStore } from 'src/stores/reports.js'
|
import { useReportsStore } from 'src/stores/reports.js'
|
||||||
|
|
||||||
import { reportUser } from 'src/services/api/api.service.js'
|
import { reportUser } from 'src/api/user.js'
|
||||||
|
|
||||||
const UserReportingModal = {
|
const UserReportingModal = {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import FollowCard from 'src/components/follow_card/follow_card.vue'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchUser, suggestions } from 'src/services/api/api.service.js'
|
import { fetchUser, suggestions } from 'src/api/public.js'
|
||||||
|
|
||||||
const WhoToFollow = {
|
const WhoToFollow = {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchUser, suggestions } from 'src/services/api/api.service.js'
|
import { fetchUser, suggestions } from 'src/api/public.js'
|
||||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||||
|
|
||||||
function showWhoToFollow(panel, reply) {
|
function showWhoToFollow(panel, reply) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Socket } from 'phoenix'
|
import { Socket } from 'phoenix'
|
||||||
|
|
||||||
import { WSConnectionStatus } from '../services/api/api.service.js'
|
import { WSConnectionStatus } from 'src/api/public.js'
|
||||||
import { maybeShowChatNotification } from '../services/chat_utils/chat_utils.js'
|
import { maybeShowChatNotification } from '../services/chat_utils/chat_utils.js'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
fetchTimeline,
|
fetchTimeline,
|
||||||
getMastodonSocketURI,
|
getMastodonSocketURI,
|
||||||
ProcessedWS,
|
ProcessedWS,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/public.js'
|
||||||
import followRequestFetcher from 'src/services/follow_request_fetcher/follow_request_fetcher.service'
|
import followRequestFetcher from 'src/services/follow_request_fetcher/follow_request_fetcher.service'
|
||||||
import notificationsFetcher from 'src/services/notifications_fetcher/notifications_fetcher.service.js'
|
import notificationsFetcher from 'src/services/notifications_fetcher/notifications_fetcher.service.js'
|
||||||
import timelineFetcher from 'src/services/timeline_fetcher/timeline_fetcher.service.js'
|
import timelineFetcher from 'src/services/timeline_fetcher/timeline_fetcher.service.js'
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,7 @@ import { promiseInterval } from '../services/promise_interval/promise_interval.j
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import {
|
import { chats, deleteChatMessage, readChat } from 'src/api/chats.js'
|
||||||
chats,
|
|
||||||
deleteChatMessage,
|
|
||||||
readChat,
|
|
||||||
} from 'src/services/api/api.service.js'
|
|
||||||
|
|
||||||
const emptyChatList = () => ({
|
const emptyChatList = () => ({
|
||||||
data: [],
|
data: [],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { markNotificationsAsSeen } from '../services/api/api.service.js'
|
import { markNotificationsAsSeen } from 'src/api/user.js'
|
||||||
import {
|
import {
|
||||||
closeAllDesktopNotifications,
|
closeAllDesktopNotifications,
|
||||||
closeDesktopNotification,
|
closeDesktopNotification,
|
||||||
|
|
@ -15,7 +15,7 @@ import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useReportsStore } from 'src/stores/reports.js'
|
import { useReportsStore } from 'src/stores/reports.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { dismissNotification } from 'src/services/api/api.service.js'
|
import { dismissNotification } from 'src/api/user.js'
|
||||||
|
|
||||||
const emptyNotifications = () => ({
|
const emptyNotifications = () => ({
|
||||||
desktopNotificationSilence: true,
|
desktopNotificationSilence: true,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import {
|
import {
|
||||||
updateNotificationSettings,
|
updateNotificationSettings,
|
||||||
updateProfile,
|
updateProfile,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
const defaultApi = ({ rootState, commit }, { path, value }) => {
|
const defaultApi = ({ rootState, commit }, { path, value }) => {
|
||||||
const params = {}
|
const params = {}
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,11 @@ import {
|
||||||
slice,
|
slice,
|
||||||
} from 'lodash'
|
} from 'lodash'
|
||||||
|
|
||||||
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
bookmarkStatus,
|
|
||||||
deleteStatus,
|
|
||||||
favorite,
|
|
||||||
fetchEmojiReactions,
|
fetchEmojiReactions,
|
||||||
fetchFavoritedByUsers,
|
fetchFavoritedByUsers,
|
||||||
fetchPinnedStatuses,
|
fetchPinnedStatuses,
|
||||||
|
|
@ -25,22 +26,23 @@ import {
|
||||||
fetchStatus,
|
fetchStatus,
|
||||||
fetchStatusHistory,
|
fetchStatusHistory,
|
||||||
fetchStatusSource,
|
fetchStatusSource,
|
||||||
|
search2,
|
||||||
|
} from 'src/api/public.js'
|
||||||
|
import {
|
||||||
|
bookmarkStatus,
|
||||||
|
deleteStatus,
|
||||||
|
favorite,
|
||||||
muteConversation,
|
muteConversation,
|
||||||
pinOwnStatus,
|
pinOwnStatus,
|
||||||
reactWithEmoji,
|
reactWithEmoji,
|
||||||
retweet,
|
retweet,
|
||||||
search2,
|
|
||||||
unbookmarkStatus,
|
unbookmarkStatus,
|
||||||
unfavorite,
|
unfavorite,
|
||||||
unmuteConversation,
|
unmuteConversation,
|
||||||
unpinOwnStatus,
|
unpinOwnStatus,
|
||||||
unreactWithEmoji,
|
unreactWithEmoji,
|
||||||
unretweet,
|
unretweet,
|
||||||
} from '../services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
|
|
||||||
const emptyTl = (userId = 0) => ({
|
const emptyTl = (userId = 0) => ({
|
||||||
statuses: [],
|
statuses: [],
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import {
|
||||||
uniq,
|
uniq,
|
||||||
} from 'lodash'
|
} from 'lodash'
|
||||||
|
|
||||||
import { register } from '../services/api/api.service.js'
|
import { register } from 'src/api/public.js'
|
||||||
import oauthApi from '../services/new_api/oauth.js'
|
import oauthApi from '../services/new_api/oauth.js'
|
||||||
import {
|
import {
|
||||||
registerPushNotifications,
|
registerPushNotifications,
|
||||||
|
|
@ -32,21 +32,23 @@ import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
import { useUserHighlightStore } from 'src/stores/user_highlight.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
fetchBlocks,
|
|
||||||
fetchDomainMutes,
|
|
||||||
fetchFollowers,
|
fetchFollowers,
|
||||||
fetchFriends,
|
fetchFriends,
|
||||||
fetchMutes,
|
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchUserByName,
|
fetchUserByName,
|
||||||
|
getCaptcha,
|
||||||
|
searchUsers,
|
||||||
|
verifyCredentials,
|
||||||
|
} from 'src/api/public.js'
|
||||||
|
import {
|
||||||
|
fetchBlocks,
|
||||||
|
fetchDomainMutes,
|
||||||
|
fetchMutes,
|
||||||
fetchUserInLists,
|
fetchUserInLists,
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
followUser,
|
followUser,
|
||||||
getCaptcha,
|
|
||||||
muteUser,
|
muteUser,
|
||||||
searchUsers,
|
} from 'src/api/user.js'
|
||||||
verifyCredentials,
|
|
||||||
} from 'src/services/api/api.service.js'
|
|
||||||
|
|
||||||
// TODO: Unify with mergeOrAdd in statuses.js
|
// TODO: Unify with mergeOrAdd in statuses.js
|
||||||
export const mergeOrAdd = (arr, obj, item) => {
|
export const mergeOrAdd = (arr, obj, item) => {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
fetchUserRelationship,
|
fetchUserRelationship,
|
||||||
followUser,
|
followUser,
|
||||||
unfollowUser,
|
unfollowUser,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
const fetchRelationship = (attempt, userId, store) =>
|
const fetchRelationship = (attempt, userId, store) =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { fetchFollowRequests } from '../api/api.service.js'
|
import { fetchFollowRequests } from 'src/api/user.js'
|
||||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
||||||
|
|
||||||
const fetchAndUpdate = ({ store, credentials }) => {
|
const fetchAndUpdate = ({ store, credentials }) => {
|
||||||
return fetchFollowRequests({ credentials })
|
return fetchFollowRequests({ credentials })
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { fetchTimeline } from '../api/api.service.js'
|
import { fetchTimeline } from 'src/api/public.js'
|
||||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import {
|
||||||
postStatus as apiPostStatus,
|
postStatus as apiPostStatus,
|
||||||
setMediaDescription as apiSetMediaDescription,
|
setMediaDescription as apiSetMediaDescription,
|
||||||
uploadMedia as apiUploadMedia,
|
uploadMedia as apiUploadMedia,
|
||||||
} from '../api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
|
|
||||||
const postStatus = ({
|
const postStatus = ({
|
||||||
store,
|
store,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { camelCase } from 'lodash'
|
import { camelCase } from 'lodash'
|
||||||
|
|
||||||
import { fetchTimeline } from '../api/api.service.js'
|
import { fetchTimeline } from 'src/api/public.js'
|
||||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ import {
|
||||||
setUsersRight,
|
setUsersRight,
|
||||||
setUsersSuggestionStatus,
|
setUsersSuggestionStatus,
|
||||||
setUsersTags,
|
setUsersTags,
|
||||||
} from 'src/services/api/admin.js'
|
} from 'src/api/admin.js'
|
||||||
import { listEmojiPacks } from 'src/services/api/api.service.js'
|
import { listEmojiPacks } from 'src/api/public.js'
|
||||||
import { parseStatus } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
import { parseStatus } from 'src/services/entity_normalizer/entity_normalizer.service.js'
|
||||||
|
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
|
|
@ -551,7 +551,7 @@ export const useAdminSettingsStore = defineStore('adminSettings', {
|
||||||
listEmojiPacks(params) {
|
listEmojiPacks(params) {
|
||||||
return listEmojiPacks({
|
return listEmojiPacks({
|
||||||
...params,
|
...params,
|
||||||
credentials: useOAuthStore().token,
|
credentials: useOAuthStore().token
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
listRemoteEmojiPacks(params) {
|
listRemoteEmojiPacks(params) {
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,9 @@ import {
|
||||||
deleteAnnouncement,
|
deleteAnnouncement,
|
||||||
editAnnouncement,
|
editAnnouncement,
|
||||||
postAnnouncement,
|
postAnnouncement,
|
||||||
} from 'src/services/api/admin.js'
|
} from 'src/api/admin.js'
|
||||||
import {
|
import { getAnnouncements } from 'src/api/public.js'
|
||||||
dismissAnnouncement,
|
import { dismissAnnouncement } from 'src/api/user.js'
|
||||||
getAnnouncements,
|
|
||||||
} from 'src/services/api/api.service.js'
|
|
||||||
|
|
||||||
const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5
|
const FETCH_ANNOUNCEMENT_INTERVAL_MS = 1000 * 60 * 5
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {
|
||||||
deleteBookmarkFolder,
|
deleteBookmarkFolder,
|
||||||
fetchBookmarkFolders,
|
fetchBookmarkFolders,
|
||||||
updateBookmarkFolder,
|
updateBookmarkFolder,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
||||||
|
|
||||||
export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
export const useBookmarkFoldersStore = defineStore('bookmarkFolders', {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { merge } from 'lodash'
|
import { merge } from 'lodash'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
|
|
||||||
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
import { ensureFinalFallback } from 'src/i18n/languages.js'
|
||||||
import { listEmojiPacks } from 'src/services/api/api.service.js'
|
import { listEmojiPacks } from 'src/api/public.js'
|
||||||
|
|
||||||
import { annotationsLoader } from 'virtual:pleroma-fe/emoji-annotations'
|
import { annotationsLoader } from 'virtual:pleroma-fe/emoji-annotations'
|
||||||
|
|
||||||
|
|
@ -188,8 +188,7 @@ export const useEmojiStore = defineStore('emoji', {
|
||||||
this.adminPacksLocalLoading = true
|
this.adminPacksLocalLoading = true
|
||||||
this.adminPacksLocal = await this.getAdminPacks(
|
this.adminPacksLocal = await this.getAdminPacks(
|
||||||
useInstanceStore().server,
|
useInstanceStore().server,
|
||||||
(params) =>
|
(params) => listEmojiPacks({
|
||||||
listEmojiPacks({
|
|
||||||
...params,
|
...params,
|
||||||
credentials: useOAuthStore().token,
|
credentials: useOAuthStore().token,
|
||||||
}),
|
}),
|
||||||
|
|
@ -222,13 +221,14 @@ export const useEmojiStore = defineStore('emoji', {
|
||||||
instance,
|
instance,
|
||||||
page: i,
|
page: i,
|
||||||
pageSize,
|
pageSize,
|
||||||
}).then((pageData) => {
|
})
|
||||||
if (pageData.error !== undefined) {
|
.then((pageData) => {
|
||||||
return Promise.reject(pageData.error)
|
if (pageData.error !== undefined) {
|
||||||
}
|
return Promise.reject(pageData.error)
|
||||||
|
}
|
||||||
|
|
||||||
return pageData.packs
|
return pageData.packs
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import {
|
||||||
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
LOCAL_DEFAULT_CONFIG_DEFINITIONS,
|
||||||
validateSetting,
|
validateSetting,
|
||||||
} from '../modules/default_config_state.js'
|
} from '../modules/default_config_state.js'
|
||||||
import { fetchKnownDomains } from '../services/api/api.service.js'
|
import { fetchKnownDomains } from 'src/api/public.js'
|
||||||
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
getListAccounts,
|
getListAccounts,
|
||||||
removeAccountsFromList,
|
removeAccountsFromList,
|
||||||
updateList,
|
updateList,
|
||||||
} from 'src/services/api/api.service.js'
|
} from 'src/api/user.js'
|
||||||
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
import { promiseInterval } from 'src/services/promise_interval/promise_interval.js'
|
||||||
|
|
||||||
export const useListsStore = defineStore('lists', {
|
export const useListsStore = defineStore('lists', {
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import {
|
import { fetchOAuthTokens, revokeOAuthToken } from 'src/api/user.js'
|
||||||
fetchOAuthTokens,
|
|
||||||
revokeOAuthToken,
|
|
||||||
} from 'src/services/api/api.service.js'
|
|
||||||
|
|
||||||
export const useOAuthTokensStore = defineStore('oauthTokens', {
|
export const useOAuthTokensStore = defineStore('oauthTokens', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { fetchPoll, vote } from 'src/services/api/api.service.js'
|
import { fetchPoll } from 'src/api/public.js'
|
||||||
|
import { vote } from 'src/api/user.js'
|
||||||
|
|
||||||
export const usePollsStore = defineStore('polls', {
|
export const usePollsStore = defineStore('polls', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { defineStore } from 'pinia'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { setReportState } from 'src/services/api/admin.js'
|
import { setReportState } from 'src/api/admin.js'
|
||||||
|
|
||||||
export const useReportsStore = defineStore('reports', {
|
export const useReportsStore = defineStore('reports', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ import { toRaw } from 'vue'
|
||||||
|
|
||||||
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
import { CURRENT_UPDATE_COUNTER } from 'src/components/update_notification/update_notification.js'
|
||||||
|
|
||||||
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
|
||||||
|
|
||||||
import { storage } from 'src/lib/storage.js'
|
import { storage } from 'src/lib/storage.js'
|
||||||
import {
|
import {
|
||||||
|
|
@ -32,7 +32,7 @@ import {
|
||||||
validateSetting,
|
validateSetting,
|
||||||
} from 'src/modules/default_config_state.js'
|
} from 'src/modules/default_config_state.js'
|
||||||
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
import { oldDefaultConfigSync } from 'src/modules/old_default_config_state.js'
|
||||||
import { updateProfileJSON } from 'src/services/api/api.service.js'
|
import { updateProfileJSON } from 'src/api/user.js'
|
||||||
|
|
||||||
export const VERSION = 2
|
export const VERSION = 2
|
||||||
export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
|
export const NEW_USER_DATE = new Date('2026-03-16') // date of writing this, basically
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import { toRaw } from 'vue'
|
||||||
import { useOAuthStore } from 'src/stores/oauth.js'
|
import { useOAuthStore } from 'src/stores/oauth.js'
|
||||||
|
|
||||||
import { storage } from 'src/lib/storage.js'
|
import { storage } from 'src/lib/storage.js'
|
||||||
import { updateProfileJSON } from 'src/services/api/api.service.js'
|
import { updateProfileJSON } from 'src/api/user.js'
|
||||||
|
|
||||||
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically
|
export const NEW_USER_DATE = new Date('2022-08-04') // date of writing this, basically
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { paramsString } from 'src/services/api/helpers.js'
|
import { paramsString } from 'src/api/helpers.js'
|
||||||
|
|
||||||
describe('API Helpers', () => {
|
describe('API Helpers', () => {
|
||||||
describe.only('paramsString', () => {
|
describe.only('paramsString', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue