Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-05-19 13:27:18 +02:00
Родитель 1617bb1404
Коммит 2c553092fb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
22 изменённых файлов: 81 добавлений и 81 удалений

Просмотреть файл

@ -165,7 +165,7 @@ export default {
searchGroup: debounce(async function(query) { searchGroup: debounce(async function(query) {
this.loadingGroups = true this.loadingGroups = true
try { try {
const response = await axios.get(generateOcsUrl('cloud', 2) + 'groups/details', { const response = await axios.get(generateOcsUrl('cloud/groups/details'), {
search: query, search: query,
limit: 20, limit: 20,
offset: 0, offset: 0,

Просмотреть файл

@ -218,7 +218,7 @@ export default {
this.requestError = '' this.requestError = ''
this.loading = true this.loading = true
try { 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, url: this.hostedHPBNextcloudUrl,
name: this.hostedHPBFullName, name: this.hostedHPBFullName,
email: this.hostedHPBEmail, email: this.hostedHPBEmail,
@ -239,7 +239,7 @@ export default {
this.loading = true this.loading = true
try { try {
await axios.delete(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver', 2) + 'delete') await axios.delete(generateOcsUrl('apps/spreed/api/v1/hostedsignalingserver/delete'))
this.trialAccount = [] this.trialAccount = []
} catch (err) { } catch (err) {

Просмотреть файл

@ -133,7 +133,7 @@ export default {
searchGroup: debounce(async function(query) { searchGroup: debounce(async function(query) {
this.loadingGroups = true this.loadingGroups = true
try { try {
const response = await axios.get(generateOcsUrl('cloud', 2) + 'groups/details', { const response = await axios.get(generateOcsUrl('cloud/groups/details'), {
search: query, search: query,
limit: 20, limit: 20,
offset: 0, offset: 0,

Просмотреть файл

@ -54,7 +54,7 @@ const leaveCall = async function(token) {
} }
const fetchPeers = async function(token, options) { 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 return response
} }

Просмотреть файл

@ -28,7 +28,7 @@ import { CONVERSATION, SHARE } from '../constants'
* Fetches the conversations from the server. * Fetches the conversations from the server.
*/ */
const fetchConversations = async function() { 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. * @param {string} token The token of the conversation to be fetched.
*/ */
const fetchConversation = async function(token) { 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 * @param {object} options options
*/ */
const searchListedConversations = async function({ searchText }, 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: { params: {
searchTerm: searchText, 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: { params: {
search: searchText, search: searchText,
itemType: 'call', itemType: 'call',
@ -91,7 +91,7 @@ const searchPossibleConversations = async function({ searchText, token, onlyUser
*/ */
const createOneToOneConversation = async function(userId) { const createOneToOneConversation = async function(userId) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error creating new one to one conversation: ', 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) { const createGroupConversation = async function(invite, source) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error creating new group conversation: ', error) console.debug('Error creating new group conversation: ', error)
@ -118,7 +118,7 @@ const createGroupConversation = async function(invite, source) {
*/ */
const createPrivateConversation = async function(conversationName) { const createPrivateConversation = async function(conversationName) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error creating new private conversation: ', error) console.debug('Error creating new private conversation: ', error)
@ -131,7 +131,7 @@ const createPrivateConversation = async function(conversationName) {
*/ */
const createPublicConversation = async function(conversationName) { const createPublicConversation = async function(conversationName) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error creating new public conversation: ', 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 * @param {string} password the password to be set
*/ */
const setConversationPassword = async function(token, password) { 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, password,
}) })
return response return response
@ -156,7 +156,7 @@ const setConversationPassword = async function(token, password) {
* @param {string} name the name to be set * @param {string} name the name to be set
*/ */
const setConversationName = async function(token, name) { 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, roomName: name,
}) })
return response return response
@ -168,7 +168,7 @@ const setConversationName = async function(token, name) {
*/ */
const deleteConversation = async function(token) { const deleteConversation = async function(token) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while deleting the conversation: ', error) console.debug('Error while deleting the conversation: ', error)
@ -181,7 +181,7 @@ const deleteConversation = async function(token) {
*/ */
const addToFavorites = async function(token) { const addToFavorites = async function(token) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while adding the conversation to favorites: ', 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) { const removeFromFavorites = async function(token) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while removing the conversation from favorites: ', 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) { const setNotificationLevel = async function(token, level) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while setting the notification level: ', 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) { const makePublic = async function(token) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while making the conversation public: ', error) console.debug('Error while making the conversation public: ', error)
@ -234,7 +234,7 @@ const makePublic = async function(token) {
*/ */
const makePrivate = async function(token) { const makePrivate = async function(token) {
try { 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 return response
} catch (error) { } catch (error) {
console.debug('Error while making the conversation private: ', 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 * @param {int} newState The new SIP state to set
*/ */
const setSIPEnabled = async function(token, newState) { 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, state: newState,
}) })
} }
@ -260,7 +260,7 @@ const setSIPEnabled = async function(token, newState) {
*/ */
const changeLobbyState = async function(token, newState, timestamp) { const changeLobbyState = async function(token, newState, timestamp) {
try { 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, state: newState,
timer: timestamp, timer: timestamp,
}) })
@ -277,7 +277,7 @@ const changeLobbyState = async function(token, newState, timestamp) {
*/ */
const changeReadOnlyState = async function(token, readOnly) { const changeReadOnlyState = async function(token, readOnly) {
try { 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, state: readOnly,
}) })
return response return response
@ -292,14 +292,14 @@ const changeReadOnlyState = async function(token, readOnly) {
* @param {int} listable The new listable scope to set * @param {int} listable The new listable scope to set
*/ */
const changeListable = async function(token, listable) { 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, scope: listable,
}) })
return response return response
} }
const setConversationDescription = async function(token, description) { 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, description,
}) })
return response return response

Просмотреть файл

@ -21,7 +21,7 @@ describe('conversationsService', () => {
} }
) )
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('core/autocomplete', 2) + 'get', generateOcsUrl('core/autocomplete/get'),
{ {
dummyOption: true, dummyOption: true,
params: { params: {

Просмотреть файл

@ -31,7 +31,7 @@ import { generateOcsUrl } from '@nextcloud/router'
* @returns {String} the conversation token * @returns {String} the conversation token
*/ */
const getFileConversation = async function({ fileId }, options) { 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 return response
} }
@ -43,7 +43,7 @@ const getFileConversation = async function({ fileId }, options) {
* @throws {Exception} if the conversation token could not be got * @throws {Exception} if the conversation token could not be got
*/ */
const getPublicShareConversationData = async function(shareToken) { 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 return response.data.ocs.data
} }

Просмотреть файл

@ -33,7 +33,7 @@ import { showError } from '@nextcloud/dialogs'
const shareFile = async function(path, token, referenceId) { const shareFile = async function(path, token, referenceId) {
try { try {
return axios.post( 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, shareType: 10, // OC.Share.SHARE_TYPE_ROOM,
path, path,

Просмотреть файл

@ -12,7 +12,7 @@ describe('filesSharingServices', () => {
shareFile('path/to/file', 'XXTOKENXX', 'the-reference-id') shareFile('path/to/file', 'XXTOKENXX', 'the-reference-id')
expect(mockAxios.post).toHaveBeenCalledWith( expect(mockAxios.post).toHaveBeenCalledWith(
generateOcsUrl('apps/files_sharing/api/v1', 2) + 'shares', generateOcsUrl('apps/files_sharing/api/v1/shares'),
{ {
shareType: 10, shareType: 10,
shareWith: 'XXTOKENXX', shareWith: 'XXTOKENXX',

Просмотреть файл

@ -33,7 +33,7 @@ import {
* @param {string} parts parts of the bridge, where it has to connect * @param {string} parts parts of the bridge, where it has to connect
*/ */
const editBridge = async function(token, enabled, parts) { 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, token,
enabled, enabled,
parts, parts,
@ -46,7 +46,7 @@ const editBridge = async function(token, enabled, parts) {
* @param {token} token the conversation token. * @param {token} token the conversation token.
*/ */
const getBridge = async function(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 return response
} }
@ -55,7 +55,7 @@ const getBridge = async function(token) {
* @param {token} token the conversation token. * @param {token} token the conversation token.
*/ */
const getBridgeProcessState = async function(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 return response
} }
@ -63,7 +63,7 @@ const getBridgeProcessState = async function(token) {
* Ask to stop all bridges (and kill all related processes) * Ask to stop all bridges (and kill all related processes)
*/ */
const stopAllBridges = async function() { 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 return response
} }
@ -73,7 +73,7 @@ const enableMatterbridgeApp = async function() {
} }
const getMatterbridgeVersion = 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 return response
} }

Просмотреть файл

@ -30,7 +30,7 @@ import { generateOcsUrl } from '@nextcloud/router'
*/ */
const searchPossibleMentions = async function(token, searchText) { const searchPossibleMentions = async function(token, searchText) {
try { 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: { params: {
search: searchText, search: searchText,
includeStatus: 1, 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; * @param {bool} includeLastKnown whether to include the last known message in the response;
*/ */
const fetchMessages = async function({ token, lastKnownMessageId, includeLastKnown }, options) { 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: { params: {
setReadMarker: 0, setReadMarker: 0,
lookIntoFuture: 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. * @param {int} lastKnownMessageId The id of the last message in the store.
*/ */
const lookForNewMessages = async({ token, lastKnownMessageId }, options) => { 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: { params: {
setReadMarker: 0, setReadMarker: 0,
lookIntoFuture: 1, lookIntoFuture: 1,
@ -75,7 +75,7 @@ const lookForNewMessages = async({ token, lastKnownMessageId }, options) => {
* @param {object} options request options * @param {object} options request options
*/ */
const postNewMessage = async function({ token, message, actorDisplayName, referenceId, parent }, 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, message,
actorDisplayName, actorDisplayName,
referenceId, referenceId,
@ -91,7 +91,7 @@ const postNewMessage = async function({ token, message, actorDisplayName, refere
* @param {string} id The id of the message to be deleted * @param {string} id The id of the message to be deleted
*/ */
const deleteMessage = async function({ token, id }) { 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()) const tempId = 'richobject-' + objectType + '-' + objectId + '-' + token + '-' + (new Date().getTime())
referenceId = Hex.stringify(SHA1(tempId)) 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, objectType,
objectId, objectId,
metaData, metaData,
@ -123,7 +123,7 @@ const postRichObjectToConversation = async function(token, { objectType, objectI
* @param {int} lastReadMessage id of the last read message to set * @param {int} lastReadMessage id of the last read message to set
*/ */
const updateLastReadMessage = async function(token, lastReadMessage) { 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, lastReadMessage,
}) })
} }

Просмотреть файл

@ -25,7 +25,7 @@ describe('messagesService', () => {
}) })
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
{ {
dummyOption: true, dummyOption: true,
params: { params: {
@ -48,7 +48,7 @@ describe('messagesService', () => {
}) })
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
{ {
dummyOption: true, dummyOption: true,
params: { params: {
@ -70,7 +70,7 @@ describe('messagesService', () => {
}) })
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
{ {
dummyOption: true, dummyOption: true,
params: { params: {
@ -95,7 +95,7 @@ describe('messagesService', () => {
}) })
expect(mockAxios.post).toHaveBeenCalledWith( expect(mockAxios.post).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX'),
{ {
message: 'hello world!', message: 'hello world!',
actorDisplayName: 'actor-display-name', actorDisplayName: 'actor-display-name',
@ -115,7 +115,7 @@ describe('messagesService', () => {
}) })
expect(mockAxios.delete).toHaveBeenCalledWith( 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( expect(mockAxios.post).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/share', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/share'),
{ {
objectType: 'deck', objectType: 'deck',
objectId: 999, objectId: 999,
@ -147,7 +147,7 @@ describe('messagesService', () => {
const lastReq = mockAxios.lastReqGet() const lastReq = mockAxios.lastReqGet()
expect(lastReq.url) 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.objectType).toBe('deck')
expect(lastReq.data.objectId).toBe(999) expect(lastReq.data.objectId).toBe(999)
expect(lastReq.data.metaData).toBe('{"x":1}') expect(lastReq.data.metaData).toBe('{"x":1}')
@ -158,7 +158,7 @@ describe('messagesService', () => {
updateLastReadMessage('XXTOKENXX', 1234) updateLastReadMessage('XXTOKENXX', 1234)
expect(mockAxios.post).toHaveBeenCalledWith( expect(mockAxios.post).toHaveBeenCalledWith(
generateOcsUrl('apps/spreed/api/v1/chat', 2) + 'XXTOKENXX/read', generateOcsUrl('apps/spreed/api/v1/chat/XXTOKENXX/read'),
{ {
lastReadMessage: 1234, lastReadMessage: 1234,
} }

Просмотреть файл

@ -38,7 +38,7 @@ import {
* @param {bool} forceJoin whether to force join; * @param {bool} forceJoin whether to force join;
*/ */
const joinConversation = async({ token, forceJoin = false }, options) => { 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, force: forceJoin,
}, options) }, options)
@ -55,7 +55,7 @@ const joinConversation = async({ token, forceJoin = false }, options) => {
* @param {string} token The conversation token; * @param {string} token The conversation token;
*/ */
const rejoinConversation = async(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 // FIXME Signaling should not be synchronous
await signalingLeaveConversation(token) 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 return response
} catch (error) { } catch (error) {
console.debug(error) console.debug(error)
@ -82,7 +82,7 @@ const leaveConversation = async function(token) {
* @param {string} token The conversation token; * @param {string} token The conversation token;
*/ */
const leaveConversationSync = function(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) * @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 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, newParticipant,
source, source,
}) })
@ -105,12 +105,12 @@ const addParticipant = async function(token, newParticipant, source) {
* @param {string} token The conversation token; * @param {string} token The conversation token;
*/ */
const removeCurrentUserFromConversation = async function(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 return response
} }
const removeAttendeeFromConversation = async function(token, attendeeId) { 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: { params: {
attendeeId, attendeeId,
}, },
@ -119,12 +119,12 @@ const removeAttendeeFromConversation = async function(token, attendeeId) {
} }
const promoteToModerator = async(token, options) => { 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 return response
} }
const demoteFromModerator = async(token, options) => { 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, params: options,
}) })
return response return response
@ -134,12 +134,12 @@ const fetchParticipants = async(token, options) => {
options = options || {} options = options || {}
options.params = options.params || {} options.params = options.params || {}
options.params.includeStatus = true 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 return response
} }
const setGuestUserName = async(token, userName) => { 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, displayName: userName,
}) })
return response return response
@ -153,7 +153,7 @@ const setGuestUserName = async(token, userName) => {
* @param {int} attendeeId attendee id to target, or null for all * @param {int} attendeeId attendee id to target, or null for all
*/ */
const resendInvitations = async(token, { attendeeId = null }) => { 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, attendeeId,
}) })
} }

Просмотреть файл

@ -30,7 +30,7 @@ import { generateOcsUrl } from '@nextcloud/router'
* @throws {Exception} if the conversation token could not be got * @throws {Exception} if the conversation token could not be got
*/ */
const getPublicShareAuthConversationToken = async function(shareToken) { 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, shareToken,
}) })
return response.data.ocs.data.token return response.data.ocs.data.token

Просмотреть файл

@ -31,7 +31,7 @@ import BrowserStorage from './BrowserStorage'
* @returns {Object} The axios response * @returns {Object} The axios response
*/ */
const setAttachmentFolder = async function(path) { 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', key: 'attachment_folder',
value: path, value: path,
}) })
@ -44,7 +44,7 @@ const setAttachmentFolder = async function(path) {
* @returns {Object} The axios response * @returns {Object} The axios response
*/ */
const setReadStatusPrivacy = async function(privacy) { 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', key: 'read_status_privacy',
value: privacy, value: privacy,
}) })
@ -59,7 +59,7 @@ const setReadStatusPrivacy = async function(privacy) {
* @returns {Object} The axios response * @returns {Object} The axios response
*/ */
const setSIPSettings = async function(sipGroups, sharedSecret, dialInInfo) { 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, sipGroups,
sharedSecret, sharedSecret,
dialInInfo, dialInInfo,
@ -69,7 +69,7 @@ const setSIPSettings = async function(sipGroups, sharedSecret, dialInInfo) {
const setPlaySounds = async function(isGuest, enabled) { const setPlaySounds = async function(isGuest, enabled) {
const savableValue = enabled ? 'yes' : 'no' const savableValue = enabled ? 'yes' : 'no'
if (!isGuest) { 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', key: 'play_sounds',
value: savableValue, value: savableValue,
}) })

Просмотреть файл

@ -27,7 +27,7 @@ import { generateOcsUrl } from '@nextcloud/router'
* @param {object} options options * @param {object} options options
*/ */
const fetchSignalingSettings = async({ token }, 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: { params: {
token, token,
}, },
@ -35,11 +35,11 @@ const fetchSignalingSettings = async({ token }, options) => {
} }
const pullSignalingMessages = 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) => { 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 { export {

Просмотреть файл

@ -242,7 +242,7 @@ Signaling.Base.prototype._joinCallSuccess = function(/* token */) {
Signaling.Base.prototype.joinCall = function(token, flags) { Signaling.Base.prototype.joinCall = function(token, flags) {
return new Promise((resolve, reject) => { 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, flags: flags,
}) })
.then(function() { .then(function() {
@ -273,7 +273,7 @@ Signaling.Base.prototype.leaveCall = function(token, keepToken) {
return return
} }
axios.delete(generateOcsUrl('apps/spreed/api/v4/call', 2) + token) axios.delete(generateOcsUrl('apps/spreed/api/v4/call/{token}', { token }))
.then(function() { .then(function() {
this._trigger('leaveCall', [token, keepToken]) this._trigger('leaveCall', [token, keepToken])
this._leaveCallSuccess(token) this._leaveCallSuccess(token)
@ -362,7 +362,7 @@ Signaling.Internal.prototype._sendMessageWithCallback = function(ev) {
} }
Signaling.Internal.prototype._sendMessages = function(messages) { 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), messages: JSON.stringify(messages),
}) })
} }
@ -818,7 +818,7 @@ Signaling.Standalone.prototype.sendHello = function() {
} else { } else {
// Already reconnected with a new session. // Already reconnected with a new session.
this._forceReconnect = false this._forceReconnect = false
const url = generateOcsUrl('apps/spreed/api/v1/signaling', 2) + 'backend' const url = generateOcsUrl('apps/spreed/api/v1/signaling/backend')
msg = { msg = {
'type': 'hello', 'type': 'hello',
'hello': { 'hello': {

Просмотреть файл

@ -153,7 +153,7 @@ export default {
methods: { methods: {
fetchRooms() { 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 rooms = response.data.ocs.data
const importantRooms = rooms.filter((conversation) => { const importantRooms = rooms.filter((conversation) => {
return conversation.hasCall return conversation.hasCall

Просмотреть файл

@ -77,7 +77,7 @@ export default {
}, },
methods: { methods: {
fetchRooms() { 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) { this.roomOptions = response.data.ocs.data.filter(function(room) {
return room.readOnly === CONVERSATION.STATE.READ_WRITE return room.readOnly === CONVERSATION.STATE.READ_WRITE
}) })

Просмотреть файл

@ -70,7 +70,7 @@ describe('RoomSelector.vue', () => {
const wrapper = shallowMount(RoomSelector) const wrapper = shallowMount(RoomSelector)
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room' generateOcsUrl('/apps/spreed/api/v4/room')
) )
mockAxios.mockResponse({ mockAxios.mockResponse({
@ -98,7 +98,7 @@ describe('RoomSelector.vue', () => {
}) })
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room' generateOcsUrl('/apps/spreed/api/v4/room')
) )
mockAxios.mockResponse({ mockAxios.mockResponse({
@ -121,7 +121,7 @@ describe('RoomSelector.vue', () => {
const wrapper = shallowMount(RoomSelector) const wrapper = shallowMount(RoomSelector)
expect(mockAxios.get).toHaveBeenCalledWith( expect(mockAxios.get).toHaveBeenCalledWith(
generateOcsUrl('/apps/spreed/api/v4', 2) + 'room' generateOcsUrl('/apps/spreed/api/v4/room')
) )
mockAxios.mockResponse({ mockAxios.mockResponse({

Просмотреть файл

@ -112,7 +112,7 @@ export default {
}, },
methods: { methods: {
fetchRooms() { 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.rooms = response.data.ocs.data.sort(this.sortConversations)
this.loading = false this.loading = false
}) })