Merge remote-tracking branch 'origin/develop' into themes3-grand-finale-maybe
This commit is contained in:
commit
191609c662
39 changed files with 944 additions and 37 deletions
|
|
@ -110,6 +110,8 @@ const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcemen
|
|||
const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles`
|
||||
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 PLEROMA_BOOKMARK_FOLDERS_URL = '/api/v1/pleroma/bookmark_folders'
|
||||
const PLEROMA_BOOKMARK_FOLDER_URL = id => `/api/v1/pleroma/bookmark_folders/${id}`
|
||||
|
||||
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
|
||||
const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
|
||||
|
|
@ -690,7 +692,8 @@ const fetchTimeline = ({
|
|||
tag = false,
|
||||
withMuted = false,
|
||||
replyVisibility = 'all',
|
||||
includeTypes = []
|
||||
includeTypes = [],
|
||||
bookmarkFolderId = false
|
||||
}) => {
|
||||
const timelineUrls = {
|
||||
public: MASTODON_PUBLIC_TIMELINE,
|
||||
|
|
@ -760,6 +763,9 @@ const fetchTimeline = ({
|
|||
params.push(['include_types[]', type])
|
||||
})
|
||||
}
|
||||
if (timeline === 'bookmarks' && bookmarkFolderId) {
|
||||
params.push(['folder_id', bookmarkFolderId])
|
||||
}
|
||||
|
||||
params.push(['limit', 20])
|
||||
|
||||
|
|
@ -829,11 +835,14 @@ const unretweet = ({ id, credentials }) => {
|
|||
.then((data) => parseStatus(data))
|
||||
}
|
||||
|
||||
const bookmarkStatus = ({ id, credentials }) => {
|
||||
const bookmarkStatus = ({ id, credentials, ...options }) => {
|
||||
return promisedRequest({
|
||||
url: MASTODON_BOOKMARK_STATUS_URL(id),
|
||||
headers: authHeaders(credentials),
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
payload: {
|
||||
folder_id: options.folder_id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1893,6 +1902,44 @@ const deleteEmojiFile = ({ packName, shortcode }) => {
|
|||
return fetch(`${PLEROMA_EMOJI_UPDATE_FILE_URL(packName)}&shortcode=${shortcode}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
const fetchBookmarkFolders = ({ credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDERS_URL
|
||||
return fetch(url, { headers: authHeaders(credentials) })
|
||||
.then((data) => data.json())
|
||||
}
|
||||
|
||||
const createBookmarkFolder = ({ name, emoji, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDERS_URL
|
||||
const headers = authHeaders(credentials)
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
return fetch(url, {
|
||||
headers,
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name, emoji })
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const updateBookmarkFolder = ({ folderId, name, emoji, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
|
||||
const headers = authHeaders(credentials)
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
return fetch(url, {
|
||||
headers,
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ name, emoji })
|
||||
}).then((data) => data.json())
|
||||
}
|
||||
|
||||
const deleteBookmarkFolder = ({ folderId, credentials }) => {
|
||||
const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
|
||||
return fetch(url, {
|
||||
method: 'DELETE',
|
||||
headers: authHeaders(credentials)
|
||||
})
|
||||
}
|
||||
|
||||
const apiService = {
|
||||
verifyCredentials,
|
||||
fetchTimeline,
|
||||
|
|
@ -2023,7 +2070,11 @@ const apiService = {
|
|||
updateEmojiFile,
|
||||
deleteEmojiFile,
|
||||
listRemoteEmojiPacks,
|
||||
downloadRemoteEmojiPack
|
||||
downloadRemoteEmojiPack,
|
||||
fetchBookmarkFolders,
|
||||
createBookmarkFolder,
|
||||
updateBookmarkFolder,
|
||||
deleteBookmarkFolder
|
||||
}
|
||||
|
||||
export default apiService
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ import timelineFetcher from '../timeline_fetcher/timeline_fetcher.service.js'
|
|||
import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js'
|
||||
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
|
||||
import listsFetcher from '../../services/lists_fetcher/lists_fetcher.service.js'
|
||||
import bookmarkFoldersFetcher from '../../services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js'
|
||||
|
||||
const backendInteractorService = credentials => ({
|
||||
startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, tag }) {
|
||||
return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, tag })
|
||||
startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, bookmarkFolderId = false, tag }) {
|
||||
return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, bookmarkFolderId, tag })
|
||||
},
|
||||
|
||||
fetchTimeline (args) {
|
||||
|
|
@ -29,6 +30,10 @@ const backendInteractorService = credentials => ({
|
|||
return listsFetcher.startFetching({ store, credentials })
|
||||
},
|
||||
|
||||
startFetchingBookmarkFolders ({ store }) {
|
||||
return bookmarkFoldersFetcher.startFetching({ store, credentials })
|
||||
},
|
||||
|
||||
startUserSocket ({ store }) {
|
||||
const serv = store.rootState.instance.server.replace('http', 'ws')
|
||||
const url = serv + getMastodonSocketURI({ credentials, stream: 'user' })
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import apiService from '../api/api.service.js'
|
||||
import { promiseInterval } from '../promise_interval/promise_interval.js'
|
||||
|
||||
const fetchAndUpdate = ({ store, credentials }) => {
|
||||
return apiService.fetchBookmarkFolders({ credentials })
|
||||
.then(bookmarkFolders => {
|
||||
store.commit('setBookmarkFolders', bookmarkFolders)
|
||||
}, () => {})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const startFetching = ({ credentials, store }) => {
|
||||
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
|
||||
boundFetchAndUpdate()
|
||||
return promiseInterval(boundFetchAndUpdate, 240000)
|
||||
}
|
||||
|
||||
const bookmarkFoldersFetcher = {
|
||||
startFetching
|
||||
}
|
||||
|
||||
export default bookmarkFoldersFetcher
|
||||
|
|
@ -332,6 +332,7 @@ export const parseStatus = (data) => {
|
|||
output.quote_url = pleroma.quote_url
|
||||
output.quote_visible = pleroma.quote_visible
|
||||
output.quotes_count = pleroma.quotes_count
|
||||
output.bookmark_folder_id = pleroma.bookmark_folder
|
||||
} else {
|
||||
output.text = data.content
|
||||
output.summary = data.spoiler_text
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const fetchAndUpdate = ({
|
|||
userId = false,
|
||||
listId = false,
|
||||
statusId = false,
|
||||
bookmarkFolderId = false,
|
||||
tag = false,
|
||||
until,
|
||||
since
|
||||
|
|
@ -49,6 +50,7 @@ const fetchAndUpdate = ({
|
|||
args.userId = userId
|
||||
args.listId = listId
|
||||
args.statusId = statusId
|
||||
args.bookmarkFolderId = bookmarkFolderId
|
||||
args.tag = tag
|
||||
args.withMuted = !hideMutedPosts
|
||||
if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) {
|
||||
|
|
@ -80,15 +82,16 @@ const fetchAndUpdate = ({
|
|||
})
|
||||
}
|
||||
|
||||
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, statusId = false, tag = false }) => {
|
||||
const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, statusId = false, bookmarkFolderId = false, tag = false }) => {
|
||||
const rootState = store.rootState || store.state
|
||||
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
||||
const showImmediately = timelineData.visibleStatuses.length === 0
|
||||
timelineData.userId = userId
|
||||
timelineData.listId = listId
|
||||
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, tag })
|
||||
timelineData.bookmarkFolderId = bookmarkFolderId
|
||||
fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, bookmarkFolderId, tag })
|
||||
const boundFetchAndUpdate = () =>
|
||||
fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, tag })
|
||||
fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, bookmarkFolderId, tag })
|
||||
return promiseInterval(boundFetchAndUpdate, 10000)
|
||||
}
|
||||
const timelineFetcher = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue