зеркало из https://github.com/nextcloud/spreed.git
Fix generateOcsUrl() calls
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
1617bb1404
Коммит
2c553092fb
|
@ -165,7 +165,7 @@ export default {
|
|||
searchGroup: debounce(async function(query) {
|
||||
this.loadingGroups = true
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('cloud', 2) + 'groups/details', {
|
||||
const response = await axios.get(generateOcsUrl('cloud/groups/details'), {
|
||||
search: query,
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
|
|
|
@ -218,7 +218,7 @@ export default {
|
|||
this.requestError = ''
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await axios.post(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver', 2) + 'requesttrial', {
|
||||
const res = await axios.post(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver/requesttrial'), {
|
||||
url: this.hostedHPBNextcloudUrl,
|
||||
name: this.hostedHPBFullName,
|
||||
email: this.hostedHPBEmail,
|
||||
|
@ -239,7 +239,7 @@ export default {
|
|||
this.loading = true
|
||||
|
||||
try {
|
||||
await axios.delete(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver', 2) + 'delete')
|
||||
await axios.delete(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver/delete'))
|
||||
|
||||
this.trialAccount = []
|
||||
} catch (err) {
|
||||
|
|
|
@ -133,7 +133,7 @@ export default {
|
|||
searchGroup: debounce(async function(query) {
|
||||
this.loadingGroups = true
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('cloud', 2) + 'groups/details', {
|
||||
const response = await axios.get(generateOcsUrl('cloud/groups/details'), {
|
||||
search: query,
|
||||
limit: 20,
|
||||
offset: 0,
|
||||
|
|
|
@ -54,7 +54,7 @@ const leaveCall = async function(token) {
|
|||
}
|
||||
|
||||
const fetchPeers = async function(token, options) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + `call/${token}`, options)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }), options)
|
||||
return response
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import { CONVERSATION, SHARE } from '../constants'
|
|||
* Fetches the conversations from the server.
|
||||
*/
|
||||
const fetchConversations = async function() {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + 'room')
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room'))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ const fetchConversations = async function() {
|
|||
* @param {string} token The token of the conversation to be fetched.
|
||||
*/
|
||||
const fetchConversation = async function(token) {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}`)
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room/{token}', { token }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ const fetchConversation = async function(token) {
|
|||
* @param {object} options options
|
||||
*/
|
||||
const searchListedConversations = async function({ searchText }, options) {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + 'listed-room', Object.assign(options, {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v4/room/listed-room'), Object.assign(options, {
|
||||
params: {
|
||||
searchTerm: searchText,
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ const searchPossibleConversations = async function({ searchText, token, onlyUser
|
|||
}
|
||||
}
|
||||
|
||||
return axios.get(generateOcsUrl('core/autocomplete', 2) + `get`, Object.assign(options, {
|
||||
return axios.get(generateOcsUrl('core/autocomplete/get'), Object.assign(options, {
|
||||
params: {
|
||||
search: searchText,
|
||||
itemType: 'call',
|
||||
|
@ -91,7 +91,7 @@ const searchPossibleConversations = async function({ searchText, token, onlyUser
|
|||
*/
|
||||
const createOneToOneConversation = async function(userId) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room`, { roomType: CONVERSATION.TYPE.ONE_TO_ONE, invite: userId })
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room'), { roomType: CONVERSATION.TYPE.ONE_TO_ONE, invite: userId })
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error creating new one to one conversation: ', error)
|
||||
|
@ -105,7 +105,7 @@ const createOneToOneConversation = async function(userId) {
|
|||
*/
|
||||
const createGroupConversation = async function(invite, source) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room`, { roomType: CONVERSATION.TYPE.GROUP, invite, source: source || 'groups' })
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room'), { roomType: CONVERSATION.TYPE.GROUP, invite, source: source || 'groups' })
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error creating new group conversation: ', error)
|
||||
|
@ -118,7 +118,7 @@ const createGroupConversation = async function(invite, source) {
|
|||
*/
|
||||
const createPrivateConversation = async function(conversationName) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room`, { roomType: CONVERSATION.TYPE.GROUP, roomName: conversationName })
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room'), { roomType: CONVERSATION.TYPE.GROUP, roomName: conversationName })
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error creating new private conversation: ', error)
|
||||
|
@ -131,7 +131,7 @@ const createPrivateConversation = async function(conversationName) {
|
|||
*/
|
||||
const createPublicConversation = async function(conversationName) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room`, { roomType: CONVERSATION.TYPE.PUBLIC, roomName: conversationName })
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room'), { roomType: CONVERSATION.TYPE.PUBLIC, roomName: conversationName })
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error creating new public conversation: ', error)
|
||||
|
@ -144,7 +144,7 @@ const createPublicConversation = async function(conversationName) {
|
|||
* @param {string} password the password to be set
|
||||
*/
|
||||
const setConversationPassword = async function(token, password) {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/password`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/password', { token }), {
|
||||
password,
|
||||
})
|
||||
return response
|
||||
|
@ -156,7 +156,7 @@ const setConversationPassword = async function(token, password) {
|
|||
* @param {string} name the name to be set
|
||||
*/
|
||||
const setConversationName = async function(token, name) {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}', { token }), {
|
||||
roomName: name,
|
||||
})
|
||||
return response
|
||||
|
@ -168,7 +168,7 @@ const setConversationName = async function(token, name) {
|
|||
*/
|
||||
const deleteConversation = async function(token) {
|
||||
try {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}`)
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while deleting the conversation: ', error)
|
||||
|
@ -181,7 +181,7 @@ const deleteConversation = async function(token) {
|
|||
*/
|
||||
const addToFavorites = async function(token) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/favorite`)
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/favorite', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while adding the conversation to favorites: ', error)
|
||||
|
@ -194,7 +194,7 @@ const addToFavorites = async function(token) {
|
|||
*/
|
||||
const removeFromFavorites = async function(token) {
|
||||
try {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/favorite`)
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/favorite', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while removing the conversation from favorites: ', error)
|
||||
|
@ -208,7 +208,7 @@ const removeFromFavorites = async function(token) {
|
|||
*/
|
||||
const setNotificationLevel = async function(token, level) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/notify`, { level })
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/notify', { token }), { level })
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while setting the notification level: ', error)
|
||||
|
@ -221,7 +221,7 @@ const setNotificationLevel = async function(token, level) {
|
|||
*/
|
||||
const makePublic = async function(token) {
|
||||
try {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/public`)
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/public', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while making the conversation public: ', error)
|
||||
|
@ -234,7 +234,7 @@ const makePublic = async function(token) {
|
|||
*/
|
||||
const makePrivate = async function(token) {
|
||||
try {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/public`)
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/public', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug('Error while making the conversation private: ', error)
|
||||
|
@ -247,7 +247,7 @@ const makePrivate = async function(token) {
|
|||
* @param {int} newState The new SIP state to set
|
||||
*/
|
||||
const setSIPEnabled = async function(token, newState) {
|
||||
return axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/webinar/sip`, {
|
||||
return axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/webinar/sip', { token }), {
|
||||
state: newState,
|
||||
})
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ const setSIPEnabled = async function(token, newState) {
|
|||
*/
|
||||
const changeLobbyState = async function(token, newState, timestamp) {
|
||||
try {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/webinar/lobby`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/webinar/lobby', { token }), {
|
||||
state: newState,
|
||||
timer: timestamp,
|
||||
})
|
||||
|
@ -277,7 +277,7 @@ const changeLobbyState = async function(token, newState, timestamp) {
|
|||
*/
|
||||
const changeReadOnlyState = async function(token, readOnly) {
|
||||
try {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/read-only`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/read-only', { token }), {
|
||||
state: readOnly,
|
||||
})
|
||||
return response
|
||||
|
@ -292,14 +292,14 @@ const changeReadOnlyState = async function(token, readOnly) {
|
|||
* @param {int} listable The new listable scope to set
|
||||
*/
|
||||
const changeListable = async function(token, listable) {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/listable`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/listable', { token }), {
|
||||
scope: listable,
|
||||
})
|
||||
return response
|
||||
}
|
||||
|
||||
const setConversationDescription = async function(token, description) {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/description`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v4/room/{token}/description', { token }), {
|
||||
description,
|
||||
})
|
||||
return response
|
||||
|
|
|
@ -21,7 +21,7 @@ describe('conversationsService', () => {
|
|||
}
|
||||
)
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('core/autocomplete', 2) + 'get',
|
||||
generateOcsUrl('core/autocomplete/get'),
|
||||
{
|
||||
dummyOption: true,
|
||||
params: {
|
||||
|
|
|
@ -31,7 +31,7 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
* @returns {String} the conversation token
|
||||
*/
|
||||
const getFileConversation = async function({ fileId }, options) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `file/${fileId}`)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/file/{fileId}', { fileId }))
|
||||
return response
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ const getFileConversation = async function({ fileId }, options) {
|
|||
* @throws {Exception} if the conversation token could not be got
|
||||
*/
|
||||
const getPublicShareConversationData = async function(shareToken) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `publicshare/${shareToken}`)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/publicshare/{shareToken}', { shareToken }))
|
||||
return response.data.ocs.data
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import { showError } from '@nextcloud/dialogs'
|
|||
const shareFile = async function(path, token, referenceId) {
|
||||
try {
|
||||
return axios.post(
|
||||
generateOcsUrl('apps/files_sharing/api/v1', 2) + 'shares',
|
||||
generateOcsUrl('apps/files_sharing/api/v1/shares'),
|
||||
{
|
||||
shareType: 10, // OC.Share.SHARE_TYPE_ROOM,
|
||||
path,
|
||||
|
|
|
@ -12,7 +12,7 @@ describe('filesSharingServices', () => {
|
|||
shareFile('path/to/file', 'XXTOKENXX', 'the-reference-id')
|
||||
|
||||
expect(mockAxios.post).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/files_sharing/api/v1', 2) + 'shares',
|
||||
generateOcsUrl('apps/files_sharing/api/v1/shares'),
|
||||
{
|
||||
shareType: 10,
|
||||
shareWith: 'XXTOKENXX',
|
||||
|
|
|
@ -33,7 +33,7 @@ import {
|
|||
* @param {string} parts parts of the bridge, where it has to connect
|
||||
*/
|
||||
const editBridge = async function(token, enabled, parts) {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v1', 2) + `bridge/${token}`, {
|
||||
const response = await axios.put(generateOcsUrl('apps/spreed/api/v1/bridge/{token}', { token }), {
|
||||
token,
|
||||
enabled,
|
||||
parts,
|
||||
|
@ -46,7 +46,7 @@ const editBridge = async function(token, enabled, parts) {
|
|||
* @param {token} token the conversation token.
|
||||
*/
|
||||
const getBridge = async function(token) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `bridge/${token}`)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/bridge/{token}', { token }))
|
||||
return response
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ const getBridge = async function(token) {
|
|||
* @param {token} token the conversation token.
|
||||
*/
|
||||
const getBridgeProcessState = async function(token) {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + `bridge/${token}/process`)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/bridge/{token}/process', { token }))
|
||||
return response
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ const getBridgeProcessState = async function(token) {
|
|||
* Ask to stop all bridges (and kill all related processes)
|
||||
*/
|
||||
const stopAllBridges = async function() {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v1', 2) + 'bridge')
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v1/bridge'))
|
||||
return response
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ const enableMatterbridgeApp = async function() {
|
|||
}
|
||||
|
||||
const getMatterbridgeVersion = async function() {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1', 2) + 'bridge/version')
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/bridge/version'))
|
||||
return response
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
*/
|
||||
const searchPossibleMentions = async function(token, searchText) {
|
||||
try {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/chat', 2) + `${token}/mentions`, {
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}/mentions', { token }), {
|
||||
params: {
|
||||
search: searchText,
|
||||
includeStatus: 1,
|
||||
|
|
|
@ -35,7 +35,7 @@ import Hex from 'crypto-js/enc-hex'
|
|||
* @param {bool} includeLastKnown whether to include the last known message in the response;
|
||||
*/
|
||||
const fetchMessages = async function({ token, lastKnownMessageId, includeLastKnown }, options) {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat', 2) + token, Object.assign(options, {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), Object.assign(options, {
|
||||
params: {
|
||||
setReadMarker: 0,
|
||||
lookIntoFuture: 0,
|
||||
|
@ -54,7 +54,7 @@ const fetchMessages = async function({ token, lastKnownMessageId, includeLastKno
|
|||
* @param {int} lastKnownMessageId The id of the last message in the store.
|
||||
*/
|
||||
const lookForNewMessages = async({ token, lastKnownMessageId }, options) => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat', 2) + token, Object.assign(options, {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), Object.assign(options, {
|
||||
params: {
|
||||
setReadMarker: 0,
|
||||
lookIntoFuture: 1,
|
||||
|
@ -75,7 +75,7 @@ const lookForNewMessages = async({ token, lastKnownMessageId }, options) => {
|
|||
* @param {object} options request options
|
||||
*/
|
||||
const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent }, options) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat', 2) + token, {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}', { token }), {
|
||||
message,
|
||||
actorDisplayName,
|
||||
referenceId,
|
||||
|
@ -91,7 +91,7 @@ const postNewMessage = async function({ token, message, actorDisplayName, refere
|
|||
* @param {string} id The id of the message to be deleted
|
||||
*/
|
||||
const deleteMessage = async function({ token, id }) {
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat', 2) + token + '/' + id)
|
||||
return axios.delete(generateOcsUrl('apps/spreed/api/v1/chat/{token}/{id}', { token, id }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,7 +108,7 @@ const postRichObjectToConversation = async function(token, { objectType, objectI
|
|||
const tempId = 'richobject-' + objectType + '-' + objectId + '-' + token + '-' + (new Date().getTime())
|
||||
referenceId = Hex.stringify(SHA1(tempId))
|
||||
}
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1', 2) + `chat/${token}/share`, {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/share', { token }), {
|
||||
objectType,
|
||||
objectId,
|
||||
metaData,
|
||||
|
@ -123,7 +123,7 @@ const postRichObjectToConversation = async function(token, { objectType, objectI
|
|||
* @param {int} lastReadMessage id of the last read message to set
|
||||
*/
|
||||
const updateLastReadMessage = async function(token, lastReadMessage) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1', 2) + `chat/${token}/read`, {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/chat/{token}/read', { token }), {
|
||||
lastReadMessage,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
|
||||
{
|
||||
dummyOption: true,
|
||||
params: {
|
||||
|
@ -48,7 +48,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
|
||||
{
|
||||
dummyOption: true,
|
||||
params: {
|
||||
|
@ -70,7 +70,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
|
||||
{
|
||||
dummyOption: true,
|
||||
params: {
|
||||
|
@ -95,7 +95,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.post).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
|
||||
{
|
||||
message: 'hello world!',
|
||||
actorDisplayName: 'actor-display-name',
|
||||
|
@ -115,7 +115,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.delete).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/1234'
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/1234'),
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -128,7 +128,7 @@ describe('messagesService', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.post).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/share',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/share'),
|
||||
{
|
||||
objectType: 'deck',
|
||||
objectId: 999,
|
||||
|
@ -147,7 +147,7 @@ describe('messagesService', () => {
|
|||
|
||||
const lastReq = mockAxios.lastReqGet()
|
||||
expect(lastReq.url)
|
||||
.toBe(generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/share')
|
||||
.toBe(generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/share'))
|
||||
expect(lastReq.data.objectType).toBe('deck')
|
||||
expect(lastReq.data.objectId).toBe(999)
|
||||
expect(lastReq.data.metaData).toBe('{"x":1}')
|
||||
|
@ -158,7 +158,7 @@ describe('messagesService', () => {
|
|||
updateLastReadMessage('XXTOKENXX', 1234)
|
||||
|
||||
expect(mockAxios.post).toHaveBeenCalledWith(
|
||||
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/read',
|
||||
generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/read'),
|
||||
{
|
||||
lastReadMessage: 1234,
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import {
|
|||
* @param {bool} forceJoin whether to force join;
|
||||
*/
|
||||
const joinConversation = async({ token, forceJoin = false }, options) => {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/active`, {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }), {
|
||||
force: forceJoin,
|
||||
}, options)
|
||||
|
||||
|
@ -55,7 +55,7 @@ const joinConversation = async({ token, forceJoin = false }, options) => {
|
|||
* @param {string} token The conversation token;
|
||||
*/
|
||||
const rejoinConversation = async(token) => {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/active`)
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ const leaveConversation = async function(token) {
|
|||
// FIXME Signaling should not be synchronous
|
||||
await signalingLeaveConversation(token)
|
||||
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/active`)
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }))
|
||||
return response
|
||||
} catch (error) {
|
||||
console.debug(error)
|
||||
|
@ -82,7 +82,7 @@ const leaveConversation = async function(token) {
|
|||
* @param {string} token The conversation token;
|
||||
*/
|
||||
const leaveConversationSync = function(token) {
|
||||
axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/active`)
|
||||
axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/active', { token }))
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +92,7 @@ const leaveConversationSync = function(token) {
|
|||
* @param {string} source the source Source of the participant as returned by the autocomplete suggestion endpoint (default is users)
|
||||
*/
|
||||
const addParticipant = async function(token, newParticipant, source) {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants`, {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants', { token }), {
|
||||
newParticipant,
|
||||
source,
|
||||
})
|
||||
|
@ -105,12 +105,12 @@ const addParticipant = async function(token, newParticipant, source) {
|
|||
* @param {string} token The conversation token;
|
||||
*/
|
||||
const removeCurrentUserFromConversation = async function(token) {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/self`)
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/self', { token }))
|
||||
return response
|
||||
}
|
||||
|
||||
const removeAttendeeFromConversation = async function(token, attendeeId) {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/attendees`, {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/attendees', { token }), {
|
||||
params: {
|
||||
attendeeId,
|
||||
},
|
||||
|
@ -119,12 +119,12 @@ const removeAttendeeFromConversation = async function(token, attendeeId) {
|
|||
}
|
||||
|
||||
const promoteToModerator = async(token, options) => {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/moderators`, options)
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/moderators', { token }), options)
|
||||
return response
|
||||
}
|
||||
|
||||
const demoteFromModerator = async(token, options) => {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/moderators`, {
|
||||
const response = await axios.delete(generateOcsUrl('apps/spreed/api/v4/room/{token}/moderators', { token }), {
|
||||
params: options,
|
||||
})
|
||||
return response
|
||||
|
@ -134,12 +134,12 @@ const fetchParticipants = async(token, options) => {
|
|||
options = options || {}
|
||||
options.params = options.params || {}
|
||||
options.params.includeStatus = true
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants`, options)
|
||||
const response = await axios.get(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants', { token }), options)
|
||||
return response
|
||||
}
|
||||
|
||||
const setGuestUserName = async(token, userName) => {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1', 2) + `/guest/${token}/name`, {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1/guest/{token}/name', { token }), {
|
||||
displayName: userName,
|
||||
})
|
||||
return response
|
||||
|
@ -153,7 +153,7 @@ const setGuestUserName = async(token, userName) => {
|
|||
* @param {int} attendeeId attendee id to target, or null for all
|
||||
*/
|
||||
const resendInvitations = async(token, { attendeeId = null }) => {
|
||||
await axios.post(generateOcsUrl('apps/spreed/api/v4', 2) + `room/${token}/participants/resend-invitations`, {
|
||||
await axios.post(generateOcsUrl('apps/spreed/api/v4/room/{token}/participants/resend-invitations', { token }), {
|
||||
attendeeId,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
* @throws {Exception} if the conversation token could not be got
|
||||
*/
|
||||
const getPublicShareAuthConversationToken = async function(shareToken) {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1', 2) + `publicshareauth`, {
|
||||
const response = await axios.post(generateOcsUrl('apps/spreed/api/v1/publicshareauth'), {
|
||||
shareToken,
|
||||
})
|
||||
return response.data.ocs.data.token
|
||||
|
|
|
@ -31,7 +31,7 @@ import BrowserStorage from './BrowserStorage'
|
|||
* @returns {Object} The axios response
|
||||
*/
|
||||
const setAttachmentFolder = async function(path) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings', 2) + 'user', {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/user'), {
|
||||
key: 'attachment_folder',
|
||||
value: path,
|
||||
})
|
||||
|
@ -44,7 +44,7 @@ const setAttachmentFolder = async function(path) {
|
|||
* @returns {Object} The axios response
|
||||
*/
|
||||
const setReadStatusPrivacy = async function(privacy) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings', 2) + 'user', {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/user'), {
|
||||
key: 'read_status_privacy',
|
||||
value: privacy,
|
||||
})
|
||||
|
@ -59,7 +59,7 @@ const setReadStatusPrivacy = async function(privacy) {
|
|||
* @returns {Object} The axios response
|
||||
*/
|
||||
const setSIPSettings = async function(sipGroups, sharedSecret, dialInInfo) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings', 2) + 'sip', {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/sip'), {
|
||||
sipGroups,
|
||||
sharedSecret,
|
||||
dialInInfo,
|
||||
|
@ -69,7 +69,7 @@ const setSIPSettings = async function(sipGroups, sharedSecret, dialInInfo) {
|
|||
const setPlaySounds = async function(isGuest, enabled) {
|
||||
const savableValue = enabled ? 'yes' : 'no'
|
||||
if (!isGuest) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings', 2) + 'user', {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/settings/user'), {
|
||||
key: 'play_sounds',
|
||||
value: savableValue,
|
||||
})
|
||||
|
|
|
@ -27,7 +27,7 @@ import { generateOcsUrl } from '@nextcloud/router'
|
|||
* @param {object} options options
|
||||
*/
|
||||
const fetchSignalingSettings = async({ token }, options) => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling', 2) + 'settings', Object.assign(options, {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling/settings'), Object.assign(options, {
|
||||
params: {
|
||||
token,
|
||||
},
|
||||
|
@ -35,11 +35,11 @@ const fetchSignalingSettings = async({ token }, options) => {
|
|||
}
|
||||
|
||||
const pullSignalingMessages = async(token, options) => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling', 2) + token, options)
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling/{token}', { token }), options)
|
||||
}
|
||||
|
||||
const getWelcomeMessage = async(serverId) => {
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling', 2) + 'welcome/' + serverId)
|
||||
return axios.get(generateOcsUrl('apps/spreed/api/v2/signaling/welcome/{serverId}', { serverId }))
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
|
@ -242,7 +242,7 @@ Signaling.Base.prototype._joinCallSuccess = function(/* token */) {
|
|||
|
||||
Signaling.Base.prototype.joinCall = function(token, flags) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(generateOcsUrl('apps/spreed/api/v4/call', 2) + token, {
|
||||
axios.post(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }), {
|
||||
flags: flags,
|
||||
})
|
||||
.then(function() {
|
||||
|
@ -273,7 +273,7 @@ Signaling.Base.prototype.leaveCall = function(token, keepToken) {
|
|||
return
|
||||
}
|
||||
|
||||
axios.delete(generateOcsUrl('apps/spreed/api/v4/call', 2) + token)
|
||||
axios.delete(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }))
|
||||
.then(function() {
|
||||
this._trigger('leaveCall', [token, keepToken])
|
||||
this._leaveCallSuccess(token)
|
||||
|
@ -362,7 +362,7 @@ Signaling.Internal.prototype._sendMessageWithCallback = function(ev) {
|
|||
}
|
||||
|
||||
Signaling.Internal.prototype._sendMessages = function(messages) {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/signaling', 2) + this.currentRoomToken, {
|
||||
return axios.post(generateOcsUrl('apps/spreed/api/v1/signaling/{token}', { token: this.currentRoomToken }), {
|
||||
messages: JSON.stringify(messages),
|
||||
})
|
||||
}
|
||||
|
@ -818,7 +818,7 @@ Signaling.Standalone.prototype.sendHello = function() {
|
|||
} else {
|
||||
// Already reconnected with a new session.
|
||||
this._forceReconnect = false
|
||||
const url = generateOcsUrl('apps/spreed/api/v1/signaling', 2) + 'backend'
|
||||
const url = generateOcsUrl('apps/spreed/api/v1/signaling/backend')
|
||||
msg = {
|
||||
'type': 'hello',
|
||||
'hello': {
|
||||
|
|
|
@ -153,7 +153,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
fetchRooms() {
|
||||
axios.get(generateOcsUrl('apps/spreed/api/v4', 2) + 'room').then((response) => {
|
||||
axios.get(generateOcsUrl('apps/spreed/api/v4/room')).then((response) => {
|
||||
const rooms = response.data.ocs.data
|
||||
const importantRooms = rooms.filter((conversation) => {
|
||||
return conversation.hasCall
|
||||
|
|
|
@ -77,7 +77,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
fetchRooms() {
|
||||
axios.get(generateOcsUrl('/apps/spreed/api/v4', 2) + 'room').then((response) => {
|
||||
axios.get(generateOcsUrl('/apps/spreed/api/v4/room')).then((response) => {
|
||||
this.roomOptions = response.data.ocs.data.filter(function(room) {
|
||||
return room.readOnly === CONVERSATION.STATE.READ_WRITE
|
||||
})
|
||||
|
|
|
@ -70,7 +70,7 @@ describe('RoomSelector.vue', () => {
|
|||
const wrapper = shallowMount(RoomSelector)
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room'
|
||||
generateOcsUrl('/apps/spreed/api/v4/room')
|
||||
)
|
||||
|
||||
mockAxios.mockResponse({
|
||||
|
@ -98,7 +98,7 @@ describe('RoomSelector.vue', () => {
|
|||
})
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room'
|
||||
generateOcsUrl('/apps/spreed/api/v4/room')
|
||||
)
|
||||
|
||||
mockAxios.mockResponse({
|
||||
|
@ -121,7 +121,7 @@ describe('RoomSelector.vue', () => {
|
|||
const wrapper = shallowMount(RoomSelector)
|
||||
|
||||
expect(mockAxios.get).toHaveBeenCalledWith(
|
||||
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room'
|
||||
generateOcsUrl('/apps/spreed/api/v4/room')
|
||||
)
|
||||
|
||||
mockAxios.mockResponse({
|
||||
|
|
|
@ -112,7 +112,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
fetchRooms() {
|
||||
axios.get(generateOcsUrl('/apps/spreed/api/v4', 2) + 'room').then((response) => {
|
||||
axios.get(generateOcsUrl('/apps/spreed/api/v4/room')).then((response) => {
|
||||
this.rooms = response.data.ocs.data.sort(this.sortConversations)
|
||||
this.loading = false
|
||||
})
|
||||
|
|
Загрузка…
Ссылка в новой задаче