kopia lustrzana https://github.com/nextcloud/social
migrate away from depricated OC.generateUrl
Signed-off-by: Robin Appelman <robin@icewind.nl>pull/1055/head
rodzic
6ec6fc50f1
commit
2ef6613857
|
@ -3543,6 +3543,57 @@
|
|||
"core-js": "^3.6.4"
|
||||
}
|
||||
},
|
||||
"@nextcloud/moment": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/moment/-/moment-1.1.1.tgz",
|
||||
"integrity": "sha512-lh7Xn9Ver12pLfE0rpjxE6x/ipscAV+7fw1u+7TJak1QR1T1UDRMZ9dA7z77W8mZH2C3yveTh/VEHZIflKBrng==",
|
||||
"requires": {
|
||||
"@nextcloud/l10n": "1.2.0",
|
||||
"core-js": "3.6.4",
|
||||
"jed": "^1.1.1",
|
||||
"moment": "2.24.0",
|
||||
"node-gettext": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nextcloud/l10n": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-1.2.0.tgz",
|
||||
"integrity": "sha512-aPsVAewCYMNe2h0yse3Fj7LofvnvFPimojw24K47ip1+I1gawMIsQL+BYAnN8wzlcbsDTEc7I1FxtOh+8dHHIA==",
|
||||
"requires": {
|
||||
"core-js": "^3.6.4",
|
||||
"node-gettext": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-gettext": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-3.0.0.tgz",
|
||||
"integrity": "sha512-/VRYibXmVoN6tnSAY2JWhNRhWYJ8Cd844jrZU/DwLVoI4vBI6ceYbd8i42sYZ9uOgDH3S7vslIKOWV/ZrT2YBA==",
|
||||
"requires": {
|
||||
"lodash.get": "^4.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"core-js": {
|
||||
"version": "3.6.4",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz",
|
||||
"integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw=="
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
|
||||
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||
},
|
||||
"node-gettext": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gettext/-/node-gettext-2.1.0.tgz",
|
||||
"integrity": "sha512-vsHImHl+Py0vB7M2UXcFEJ5NJ3950gcja45YclBFtYxYeZiqdfQdcu+G9s4L7jpRFSh/J/7VoS3upR4JM1nS+g==",
|
||||
"requires": {
|
||||
"lodash.get": "^4.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@nextcloud/router": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-1.2.0.tgz",
|
||||
|
@ -6963,6 +7014,7 @@
|
|||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.2",
|
||||
"is-negative-zero": "^2.0.0",
|
||||
"is-regex": "^1.1.1",
|
||||
"object-inspect": "^1.8.0",
|
||||
"object-keys": "^1.1.1",
|
||||
|
@ -6977,8 +7029,30 @@
|
|||
"integrity": "sha512-VT/cxmx5yaoHSOTSyrCygIDFco+RsibY2NM0a4RdEeY/4KgqezwFtK1yr3U67xYhqJSlASm2pKhLVzPj2lr4bA==",
|
||||
"requires": {
|
||||
"define-properties": "^1.1.3",
|
||||
"es-abstract": "^1.18.0-next.0",
|
||||
"has-symbols": "^1.0.1",
|
||||
"object-keys": "^1.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"es-abstract": {
|
||||
"version": "1.18.0-next.1",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz",
|
||||
"integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==",
|
||||
"requires": {
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-symbols": "^1.0.1",
|
||||
"is-callable": "^1.2.2",
|
||||
"is-negative-zero": "^2.0.0",
|
||||
"is-regex": "^1.1.1",
|
||||
"object-inspect": "^1.8.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.1",
|
||||
"string.prototype.trimend": "^1.0.1",
|
||||
"string.prototype.trimstart": "^1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9235,6 +9309,11 @@
|
|||
"is-path-inside": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"is-negative-zero": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz",
|
||||
"integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE="
|
||||
},
|
||||
"is-number": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz",
|
||||
|
@ -9542,6 +9621,11 @@
|
|||
"plist": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"jed": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jed/-/jed-1.1.1.tgz",
|
||||
"integrity": "sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ="
|
||||
},
|
||||
"jest": {
|
||||
"version": "26.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-26.4.2.tgz",
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"@nextcloud/axios": "^1.4.0",
|
||||
"@nextcloud/initial-state": "^1.1.2",
|
||||
"@nextcloud/logger": "^1.1.2",
|
||||
"@nextcloud/moment": "^1.1.1",
|
||||
"@nextcloud/router": "^1.2.0",
|
||||
"@nextcloud/vue": "^2.6.8",
|
||||
"he": "^1.2.0",
|
||||
|
|
|
@ -97,6 +97,7 @@ import axios from '@nextcloud/axios'
|
|||
import Search from './components/Search.vue'
|
||||
import currentuserMixin from './mixins/currentUserMixin'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
|
@ -214,7 +215,7 @@ export default {
|
|||
this.infoHidden = true
|
||||
},
|
||||
setCloudAddress() {
|
||||
axios.post(OC.generateUrl('apps/social/api/v1/config/cloudAddress'), { cloudAddress: this.cloudAddress }).then((response) => {
|
||||
axios.post(generateUrl('apps/social/api/v1/config/cloudAddress'), { cloudAddress: this.cloudAddress }).then((response) => {
|
||||
this.$store.commit('setServerDataEntry', 'setup', false)
|
||||
this.$store.commit('setServerDataEntry', 'cloudAddress', this.cloudAddress)
|
||||
})
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
<script>
|
||||
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'ActorAvatar',
|
||||
|
@ -46,7 +47,7 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
avatarUrl() {
|
||||
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
|
||||
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -397,6 +397,7 @@ import CurrentUserMixin from './../mixins/currentUserMixin'
|
|||
import FocusOnCreate from '../directives/focusOnCreate'
|
||||
import axios from '@nextcloud/axios'
|
||||
import ActorAvatar from './ActorAvatar.vue'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'Composer',
|
||||
|
@ -453,7 +454,7 @@ export default {
|
|||
key: user.preferredUsername,
|
||||
value: user.account,
|
||||
url: user.url,
|
||||
avatar: user.local ? OC.generateUrl(`/avatar/${user.preferredUsername}/32`) : OC.generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`)
|
||||
avatar: user.local ? generateUrl(`/avatar/${user.preferredUsername}/32`) : generateUrl(`apps/social/api/v1/global/actor/avatar?id=${user.id}`)
|
||||
})
|
||||
}
|
||||
cb(users)
|
||||
|
@ -474,7 +475,7 @@ export default {
|
|||
tag = item.original.value
|
||||
}
|
||||
return '<span class="hashtag" contenteditable="false">'
|
||||
+ '<a href="' + OC.generateUrl('/timeline/tags/' + tag) + '" target="_blank">#' + tag + '</a></span>'
|
||||
+ '<a href="' + generateUrl('/timeline/tags/' + tag) + '" target="_blank">#' + tag + '</a></span>'
|
||||
},
|
||||
values: (text, cb) => {
|
||||
let tags = []
|
||||
|
@ -691,7 +692,7 @@ export default {
|
|||
if (e.target.result.startsWith('data:image')) {
|
||||
img.src = e.target.result
|
||||
} else {
|
||||
img.src = OC.generateUrl('svg/core/filetypes/x-office-document?color=d8d8d8')
|
||||
img.src = generateUrl('svg/core/filetypes/x-office-document?color=d8d8d8')
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -824,10 +825,10 @@ export default {
|
|||
|
||||
},
|
||||
remoteSearchAccounts(text) {
|
||||
return axios.get(OC.generateUrl('apps/social/api/v1/global/accounts/search?search=' + text))
|
||||
return axios.get(generateUrl('apps/social/api/v1/global/accounts/search?search=' + text))
|
||||
},
|
||||
remoteSearchHashtags(text) {
|
||||
return axios.get(OC.generateUrl('apps/social/api/v1/global/tags/search?search=' + text))
|
||||
return axios.get(generateUrl('apps/social/api/v1/global/tags/search?search=' + text))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ function transformText(createElement, text) {
|
|||
to: {
|
||||
name: 'profile',
|
||||
params: { account: match[2].substr(1) }
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
[match[3]]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<masonry>
|
||||
<div v-for="(item, index) in attachments" :key="index">
|
||||
<img :src="OC.generateUrl('/apps/social/document/get/resized?id=' + item.id)" @click="showModal(index)">
|
||||
<img :src="generateUrl('/apps/social/document/get/resized?id=' + item.id)" @click="showModal(index)">
|
||||
</div>
|
||||
<modal v-show="modal" :has-previous="current > 0" :has-next="current < (attachments.length - 1)"
|
||||
size="full" @close="closeModal" @previous="showPrevious"
|
||||
|
@ -16,6 +16,7 @@
|
|||
<script>
|
||||
|
||||
import Modal from '@nextcloud/vue/dist/Components/Modal'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'PostAttachment',
|
||||
|
@ -55,7 +56,7 @@ export default {
|
|||
canvas.height = height
|
||||
ctx.drawImage(img, 0, 0, width, height)
|
||||
}
|
||||
img.src = OC.generateUrl('/apps/social/document/get?id=' + this.attachments[this.current].id)
|
||||
img.src = generateUrl('/apps/social/document/get?id=' + this.attachments[this.current].id)
|
||||
},
|
||||
showModal(idx) {
|
||||
this.current = idx
|
||||
|
|
|
@ -101,6 +101,7 @@ import serverData from '../mixins/serverData'
|
|||
import currentUser from '../mixins/currentUserMixin'
|
||||
import follow from '../mixins/follow'
|
||||
import FollowButton from './FollowButton.vue'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'ProfileInfo',
|
||||
|
@ -145,12 +146,12 @@ export default {
|
|||
return (field) => this.accountInfo.details.count ? this.accountInfo.details.count[field] : ''
|
||||
},
|
||||
avatarUrl() {
|
||||
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
|
||||
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
followRemote() {
|
||||
window.open(OC.generateUrl('/apps/social/api/v1/ostatus/followRemote/' + encodeURI(this.localUid)), 'followRemote', 'width=433,height=600toolbar=no,menubar=no,scrollbars=yes,resizable=yes')
|
||||
window.open(generateUrl('/apps/social/api/v1/ostatus/followRemote/' + encodeURI(this.localUid)), 'followRemote', 'width=433,height=600toolbar=no,menubar=no,scrollbars=yes,resizable=yes')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
import UserEntry from './UserEntry.vue'
|
||||
import axios from '@nextcloud/axios'
|
||||
import Trend from 'vuetrend'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'Search',
|
||||
|
@ -153,14 +154,14 @@ export default {
|
|||
},
|
||||
accountSearch(term) {
|
||||
this.loading = true
|
||||
return axios.get(OC.generateUrl('apps/social/api/v1/global/accounts/search?search=' + term))
|
||||
return axios.get(generateUrl('apps/social/api/v1/global/accounts/search?search=' + term))
|
||||
},
|
||||
searchQuery(term) {
|
||||
this.loading = true
|
||||
return axios.get(OC.generateUrl('apps/social/api/v1/search?search=' + term))
|
||||
return axios.get(generateUrl('apps/social/api/v1/search?search=' + term))
|
||||
},
|
||||
remoteSearch(term) {
|
||||
return axios.get(OC.generateUrl('apps/social/api/v1/global/account/info?account=' + term))
|
||||
return axios.get(generateUrl('apps/social/api/v1/global/account/info?account=' + term))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ import popoverMenu from './../mixins/popoverMenu'
|
|||
import currentUser from './../mixins/currentUserMixin'
|
||||
import PostAttachment from './PostAttachment.vue'
|
||||
import MessageContent from './MessageContent'
|
||||
import moment from '@nextcloud/moment'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
pluginMention(linkify)
|
||||
|
||||
|
@ -103,7 +105,7 @@ export default {
|
|||
return actions
|
||||
},
|
||||
relativeTimestamp() {
|
||||
return OC.Util.relativeModifiedDate(this.item.published)
|
||||
return moment(this.item.published).fromNow()
|
||||
},
|
||||
timestamp() {
|
||||
return Date.parse(this.item.published)
|
||||
|
@ -119,7 +121,7 @@ export default {
|
|||
return JSON.parse(this.item.source)
|
||||
},
|
||||
avatarUrl() {
|
||||
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
|
||||
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.item.attributedTo)
|
||||
},
|
||||
hasAttachments() {
|
||||
return (typeof this.item.attachment !== 'undefined')
|
||||
|
|
|
@ -59,6 +59,7 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
|||
import follow from '../mixins/follow'
|
||||
import currentUser from '../mixins/currentUserMixin'
|
||||
import FollowButton from './FollowButton.vue'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'UserEntry',
|
||||
|
@ -86,7 +87,7 @@ export default {
|
|||
return this.item.id
|
||||
},
|
||||
avatarUrl() {
|
||||
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.id)
|
||||
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
*/
|
||||
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
class FollowException {
|
||||
|
||||
|
@ -39,7 +40,7 @@ export default {
|
|||
methods: {
|
||||
follow() {
|
||||
this.followLoading = true
|
||||
return axios.put(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
|
||||
return axios.put(generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
|
||||
this.followLoading = false
|
||||
if (response.data.status === -1) {
|
||||
throw new FollowException()
|
||||
|
@ -54,7 +55,7 @@ export default {
|
|||
},
|
||||
unfollow() {
|
||||
this.followLoading = true
|
||||
return axios.delete(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
|
||||
return axios.delete(generateUrl('/apps/social/api/v1/current/follow?account=' + this.item.account)).then((response) => {
|
||||
this.followLoading = false
|
||||
if (response.data.status === -1) {
|
||||
throw new UnfollowException()
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
// Dynamic loading
|
||||
const Timeline = () => import('./views/Timeline.vue')
|
||||
|
@ -37,7 +38,7 @@ export default new Router({
|
|||
mode: 'history',
|
||||
// if index.php is in the url AND we got this far, then it's working:
|
||||
// let's keep using index.php in the url
|
||||
base: OC.generateUrl(''),
|
||||
base: generateUrl(''),
|
||||
linkActiveClass: 'active',
|
||||
routes: [
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
import axios from '@nextcloud/axios'
|
||||
import Vue from 'vue'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
const state = {
|
||||
currentAccount: {},
|
||||
|
@ -108,7 +109,7 @@ const getters = {
|
|||
|
||||
const actions = {
|
||||
fetchAccountInfo(context, account) {
|
||||
return axios.get(OC.generateUrl(`apps/social/api/v1/global/account/info?account=${account}`)).then((response) => {
|
||||
return axios.get(generateUrl(`apps/social/api/v1/global/account/info?account=${account}`)).then((response) => {
|
||||
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
|
||||
return response.data.result.account
|
||||
}).catch(() => {
|
||||
|
@ -116,7 +117,7 @@ const actions = {
|
|||
})
|
||||
},
|
||||
fetchPublicAccountInfo(context, uid) {
|
||||
return axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
|
||||
return axios.get(generateUrl(`apps/social/api/v1/account/${uid}/info`)).then((response) => {
|
||||
context.commit('addAccount', { actorId: response.data.result.account.id, data: response.data.result.account })
|
||||
return response.data.result.account
|
||||
}).catch(() => {
|
||||
|
@ -128,7 +129,7 @@ const actions = {
|
|||
dispatch('fetchAccountInfo', account)
|
||||
},
|
||||
followAccount(context, { currentAccount, accountToFollow }) {
|
||||
return axios.put(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + accountToFollow)).then((response) => {
|
||||
return axios.put(generateUrl('/apps/social/api/v1/current/follow?account=' + accountToFollow)).then((response) => {
|
||||
if (response.data.status === -1) {
|
||||
return Promise.reject(response)
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ const actions = {
|
|||
|
||||
},
|
||||
unfollowAccount(context, { currentAccount, accountToUnfollow }) {
|
||||
return axios.delete(OC.generateUrl('/apps/social/api/v1/current/follow?account=' + accountToUnfollow)).then((response) => {
|
||||
return axios.delete(generateUrl('/apps/social/api/v1/current/follow?account=' + accountToUnfollow)).then((response) => {
|
||||
if (response.data.status === -1) {
|
||||
return Promise.reject(response)
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ const actions = {
|
|||
// TODO: fetching followers/following information of remotes is currently not supported
|
||||
const parts = account.split('@')
|
||||
const uid = (parts.length === 2 ? parts[0] : account)
|
||||
axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/followers`)).then((response) => {
|
||||
axios.get(generateUrl(`apps/social/api/v1/account/${uid}/followers`)).then((response) => {
|
||||
context.commit('addFollowers', { account, data: response.data.result })
|
||||
})
|
||||
},
|
||||
|
@ -165,7 +166,7 @@ const actions = {
|
|||
// TODO: fetching followers/following information of remotes is currently not supported
|
||||
const parts = account.split('@')
|
||||
const uid = (parts.length === 2 ? parts[0] : account)
|
||||
axios.get(OC.generateUrl(`apps/social/api/v1/account/${uid}/following`)).then((response) => {
|
||||
axios.get(generateUrl(`apps/social/api/v1/account/${uid}/following`)).then((response) => {
|
||||
context.commit('addFollowing', { account, data: response.data.result })
|
||||
})
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
import Logger from '../logger'
|
||||
import axios from '@nextcloud/axios'
|
||||
import Vue from 'vue'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
const state = {
|
||||
timeline: {},
|
||||
|
@ -118,7 +119,7 @@ const actions = {
|
|||
},
|
||||
post(context, post) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(OC.generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
|
||||
axios.post(generateUrl('apps/social/api/v1/post'), { data: post }).then((response) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Post created with token ' + response.data.result.token)
|
||||
resolve(response)
|
||||
|
@ -130,7 +131,7 @@ const actions = {
|
|||
})
|
||||
},
|
||||
postDelete(context, post) {
|
||||
return axios.delete(OC.generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {
|
||||
return axios.delete(generateUrl(`apps/social/api/v1/post?id=${post.id}`)).then((response) => {
|
||||
context.commit('removePost', post)
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Post deleted with token ' + response.data.result.token)
|
||||
|
@ -141,7 +142,7 @@ const actions = {
|
|||
},
|
||||
postLike(context, { post, parentAnnounce }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
|
||||
axios.post(generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
|
||||
context.commit('likePost', { post, parentAnnounce })
|
||||
resolve(response)
|
||||
}).catch((error) => {
|
||||
|
@ -152,7 +153,7 @@ const actions = {
|
|||
})
|
||||
},
|
||||
postUnlike(context, { post, parentAnnounce }) {
|
||||
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
|
||||
return axios.delete(generateUrl(`apps/social/api/v1/post/like?postId=${post.id}`)).then((response) => {
|
||||
context.commit('unlikePost', { post, parentAnnounce })
|
||||
// Remove post from list if we are in the 'liked' timeline
|
||||
if (state.type === 'liked') {
|
||||
|
@ -165,7 +166,7 @@ const actions = {
|
|||
},
|
||||
postBoost(context, { post, parentAnnounce }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
|
||||
axios.post(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
|
||||
context.commit('boostPost', { post, parentAnnounce })
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Post boosted with token ' + response.data.result.token)
|
||||
|
@ -178,7 +179,7 @@ const actions = {
|
|||
})
|
||||
},
|
||||
postUnBoost(context, { post, parentAnnounce }) {
|
||||
return axios.delete(OC.generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
|
||||
return axios.delete(generateUrl(`apps/social/api/v1/post/boost?postId=${post.id}`)).then((response) => {
|
||||
context.commit('unboostPost', { post, parentAnnounce })
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Boost deleted with token ' + response.data.result.token)
|
||||
|
@ -199,13 +200,13 @@ const actions = {
|
|||
// Compute URl to get the data
|
||||
let url = ''
|
||||
if (state.type === 'account') {
|
||||
url = OC.generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
|
||||
url = generateUrl(`apps/social/api/v1/account/${state.account}/stream?limit=25&since=` + sinceTimestamp)
|
||||
} else if (state.type === 'tags') {
|
||||
url = OC.generateUrl(`apps/social/api/v1/stream/tag/${state.params.tag}?limit=25&since=` + sinceTimestamp)
|
||||
url = generateUrl(`apps/social/api/v1/stream/tag/${state.params.tag}?limit=25&since=` + sinceTimestamp)
|
||||
} else if (state.type === 'single-post') {
|
||||
url = OC.generateUrl(`apps/social/local/v1/post/replies?id=${state.params.id}&limit=5&since=` + sinceTimestamp)
|
||||
url = generateUrl(`apps/social/local/v1/post/replies?id=${state.params.id}&limit=5&since=` + sinceTimestamp)
|
||||
} else {
|
||||
url = OC.generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
|
||||
url = generateUrl(`apps/social/api/v1/stream/${state.type}?limit=25&since=` + sinceTimestamp)
|
||||
}
|
||||
|
||||
// Get the data and add them to the timeline
|
||||
|
@ -220,7 +221,7 @@ const actions = {
|
|||
// Also load replies when displaying a single post timeline
|
||||
if (state.type === 'single-post') {
|
||||
result.push(response.data)
|
||||
// axios.get(OC.generateUrl(``)).then((response) => {
|
||||
// axios.get(generateUrl(``)).then((response) => {
|
||||
// if (response.status !== -1) {
|
||||
// result.concat(response.data.result)
|
||||
// }
|
||||
|
|
|
@ -64,6 +64,7 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
|||
import axios from '@nextcloud/axios'
|
||||
import currentuserMixin from './../mixins/currentUserMixin'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
|
@ -84,7 +85,7 @@ export default {
|
|||
return this.serverData.account
|
||||
},
|
||||
avatarUrl() {
|
||||
return OC.generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
|
||||
return generateUrl('/apps/social/api/v1/global/actor/avatar?id=' + this.accountInfo.id)
|
||||
},
|
||||
accountInfo: function() {
|
||||
return this.$store.getters.getAccount(this.serverData.account)
|
||||
|
@ -124,7 +125,7 @@ export default {
|
|||
})
|
||||
},
|
||||
followRemote() {
|
||||
axios.get(OC.generateUrl(`/apps/social/api/v1/ostatus/link/${this.serverData.local}/` + encodeURI(this.remote))).then((a) => {
|
||||
axios.get(generateUrl(`/apps/social/api/v1/ostatus/link/${this.serverData.local}/` + encodeURI(this.remote))).then((a) => {
|
||||
window.location = a.data.result.url
|
||||
})
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue