forked from mirror/pixelfed
Update vue components, namespace v1 api
This commit is contained in:
parent
a791219d20
commit
3c306c5e17
|
@ -115,7 +115,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchNotifications() {
|
fetchNotifications() {
|
||||||
axios.get('/api/v1/notifications')
|
axios.get('/api/pixelfed/v1/notifications')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let data = res.data.filter(n => {
|
let data = res.data.filter(n => {
|
||||||
if(n.type == 'share' && !status) {
|
if(n.type == 'share' && !status) {
|
||||||
|
@ -136,7 +136,7 @@ export default {
|
||||||
$state.complete();
|
$state.complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/notifications', {
|
axios.get('/api/pixelfed/v1/notifications', {
|
||||||
params: {
|
params: {
|
||||||
page: this.notificationCursor
|
page: this.notificationCursor
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
fetchCurrentUser() {
|
fetchCurrentUser() {
|
||||||
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
||||||
axios.get('/api/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.currentUser = res.data;
|
this.currentUser = res.data;
|
||||||
this.owner = this.currentUser.id == this.profileId;
|
this.owner = this.currentUser.id == this.profileId;
|
||||||
});
|
});
|
||||||
|
|
|
@ -201,7 +201,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchRecentPosts() {
|
fetchRecentPosts() {
|
||||||
axios.get('/api/v1/accounts/' + this.profileId + '/statuses', {
|
axios.get('/api/local/accounts/' + this.profileId + '/statuses', {
|
||||||
params: {
|
params: {
|
||||||
only_media: true,
|
only_media: true,
|
||||||
min_id: 1,
|
min_id: 1,
|
||||||
|
|
|
@ -295,7 +295,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
axios.get('/api/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
if(res.data.locked == true) {
|
if(res.data.locked == true) {
|
||||||
this.visibility = 'private';
|
this.visibility = 'private';
|
||||||
|
@ -341,7 +341,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
axios.post('/api/v1/media', form, xhrConfig)
|
axios.post('/api/pixelfed/v1/media', form, xhrConfig)
|
||||||
.then(function(e) {
|
.then(function(e) {
|
||||||
self.uploadProgress = 100;
|
self.uploadProgress = 100;
|
||||||
self.ids.push(e.data.id);
|
self.ids.push(e.data.id);
|
||||||
|
@ -373,7 +373,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let id = this.media[this.carouselCursor].id;
|
let id = this.media[this.carouselCursor].id;
|
||||||
axios.delete('/api/v1/media', {
|
axios.delete('/api/pixelfed/v1/media', {
|
||||||
params: {
|
params: {
|
||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
axios.get('/api/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
window.pixelfed.currentUser = res.data;
|
window.pixelfed.currentUser = res.data;
|
||||||
if(res.data.locked == true) {
|
if(res.data.locked == true) {
|
||||||
|
@ -454,7 +454,7 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
axios.post('/api/v1/media', form, xhrConfig)
|
axios.post('/api/pixelfed/v1/media', form, xhrConfig)
|
||||||
.then(function(e) {
|
.then(function(e) {
|
||||||
self.uploadProgress = 100;
|
self.uploadProgress = 100;
|
||||||
self.ids.push(e.data.id);
|
self.ids.push(e.data.id);
|
||||||
|
@ -516,7 +516,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let id = this.media[this.carouselCursor].id;
|
let id = this.media[this.carouselCursor].id;
|
||||||
axios.delete('/api/v1/media', {
|
axios.delete('/api/pixelfed/v1/media', {
|
||||||
params: {
|
params: {
|
||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchNotifications() {
|
fetchNotifications() {
|
||||||
axios.get('/api/v1/notifications')
|
axios.get('/api/pixelfed/v1/notifications')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let data = res.data.filter(n => {
|
let data = res.data.filter(n => {
|
||||||
if(n.type == 'share' && !status) {
|
if(n.type == 'share' && !status) {
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
$state.complete();
|
$state.complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/notifications', {
|
axios.get('/api/pixelfed/v1/notifications', {
|
||||||
params: {
|
params: {
|
||||||
page: this.notificationCursor
|
page: this.notificationCursor
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
let interval = this.notifications.length > 5 ? 15000 : 120000;
|
let interval = this.notifications.length > 5 ? 15000 : 120000;
|
||||||
let self = this;
|
let self = this;
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
axios.get('/api/v1/notifications')
|
axios.get('/api/pixelfed/v1/notifications')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let data = res.data.filter(n => {
|
let data = res.data.filter(n => {
|
||||||
if(n.type == 'share' || self.notificationMaxId >= n.id) {
|
if(n.type == 'share' || self.notificationMaxId >= n.id) {
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ export default {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
axios.get('/api/v1/accounts/relationships', {
|
axios.get('/api/pixelfed/v1/accounts/relationships', {
|
||||||
params: {
|
params: {
|
||||||
'id[]': this.statusProfileId
|
'id[]': this.statusProfileId
|
||||||
}
|
}
|
||||||
|
|
|
@ -583,7 +583,7 @@
|
||||||
this.followingModal();
|
this.followingModal();
|
||||||
}
|
}
|
||||||
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == true) {
|
||||||
axios.get('/api/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.user = res.data;
|
this.user = res.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
axios.get('/api/v1/accounts/' + this.profileId).then(res => {
|
axios.get('/api/pixelfed/v1/accounts/' + this.profileId).then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.fetchPosts();
|
this.fetchPosts();
|
||||||
|
@ -603,7 +603,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchPosts() {
|
fetchPosts() {
|
||||||
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
|
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
params: {
|
params: {
|
||||||
only_media: true,
|
only_media: true,
|
||||||
|
@ -641,7 +641,7 @@
|
||||||
$state.complete();
|
$state.complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
|
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
params: {
|
params: {
|
||||||
only_media: true,
|
only_media: true,
|
||||||
|
@ -800,7 +800,7 @@
|
||||||
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
|
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/accounts/relationships', {
|
axios.get('/api/pixelfed/v1/accounts/relationships', {
|
||||||
params: {
|
params: {
|
||||||
'id[]': this.profileId
|
'id[]': this.profileId
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@
|
||||||
this.$refs.followingModal.show();
|
this.$refs.followingModal.show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
axios.get('/api/v1/accounts/'+this.profileId+'/following', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/following', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followingCursor
|
page: this.followingCursor
|
||||||
}
|
}
|
||||||
|
@ -964,7 +964,7 @@
|
||||||
this.$refs.followerModal.show();
|
this.$refs.followerModal.show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
axios.get('/api/v1/accounts/'+this.profileId+'/followers', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/followers', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followerCursor
|
page: this.followerCursor
|
||||||
}
|
}
|
||||||
|
@ -986,7 +986,7 @@
|
||||||
window.location.href = encodeURI('/login?next=/' + this.profile.username + '/');
|
window.location.href = encodeURI('/login?next=/' + this.profile.username + '/');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followingCursor
|
page: this.followingCursor
|
||||||
}
|
}
|
||||||
|
@ -1007,7 +1007,7 @@
|
||||||
if($('body').hasClass('loggedIn') == false) {
|
if($('body').hasClass('loggedIn') == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followerCursor
|
page: this.followerCursor
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@
|
||||||
<a href="/site/language" class="text-dark pr-2">Language</a>
|
<a href="/site/language" class="text-dark pr-2">Language</a>
|
||||||
<a href="/site/terms" class="text-dark pr-2">Terms</a>
|
<a href="/site/terms" class="text-dark pr-2">Terms</a>
|
||||||
<a href="/site/privacy" class="text-dark pr-2">Privacy</a>
|
<a href="/site/privacy" class="text-dark pr-2">Privacy</a>
|
||||||
<a href="/site/platform" class="text-dark pr-2">API</a>
|
<a href="/discover/places" class="text-dark pr-2">Places</a>
|
||||||
</p>
|
</p>
|
||||||
<p class="mb-0 text-uppercase font-weight-bold text-muted small">
|
<p class="mb-0 text-uppercase font-weight-bold text-muted small">
|
||||||
<a href="http://pixelfed.org" class="text-muted" rel="noopener" title="" data-toggle="tooltip">Powered by Pixelfed</a>
|
<a href="http://pixelfed.org" class="text-muted" rel="noopener" title="" data-toggle="tooltip">Powered by Pixelfed</a>
|
||||||
|
@ -353,70 +353,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <b-modal ref="followingModal"
|
|
||||||
id="following-modal"
|
|
||||||
hide-footer
|
|
||||||
centered
|
|
||||||
title="Following"
|
|
||||||
body-class="list-group-flush p-0">
|
|
||||||
<div class="list-group">
|
|
||||||
<div class="list-group-item border-0" v-for="(user, index) in following" :key="'following_'+index">
|
|
||||||
<div class="media">
|
|
||||||
<a :href="user.url">
|
|
||||||
<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
|
|
||||||
</a>
|
|
||||||
<div class="media-body">
|
|
||||||
<p class="mb-0" style="font-size: 14px">
|
|
||||||
<a :href="user.url" class="font-weight-bold text-dark">
|
|
||||||
{{user.username}}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<p class="text-muted mb-0" style="font-size: 14px">
|
|
||||||
{{user.display_name}}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<a class="btn btn-outline-secondary btn-sm" href="#" @click.prevent="followModalAction(user.id, index, 'following')">Unfollow</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="following.length == 0" class="list-group-item border-0">
|
|
||||||
<div class="list-group-item border-0">
|
|
||||||
<p class="p-3 text-center mb-0 lead">You are not following anyone.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="following.length != 0 && followingMore" class="list-group-item text-center" v-on:click="followingLoadMore()">
|
|
||||||
<p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</b-modal>
|
|
||||||
<b-modal ref="followerModal"
|
|
||||||
id="follower-modal"
|
|
||||||
hide-footer
|
|
||||||
centered
|
|
||||||
title="Followers"
|
|
||||||
body-class="list-group-flush p-0">
|
|
||||||
<div class="list-group">
|
|
||||||
<div class="list-group-item border-0" v-for="(user, index) in followers" :key="'follower_'+index">
|
|
||||||
<div class="media">
|
|
||||||
<a :href="user.url">
|
|
||||||
<img class="mr-3 rounded-circle box-shadow" :src="user.avatar" :alt="user.username + '’s avatar'" width="30px">
|
|
||||||
</a>
|
|
||||||
<div class="media-body">
|
|
||||||
<p class="mb-0" style="font-size: 14px">
|
|
||||||
<a :href="user.url" class="font-weight-bold text-dark">
|
|
||||||
{{user.username}}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<p class="text-muted mb-0" style="font-size: 14px">
|
|
||||||
{{user.display_name}}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="followerMore" class="list-group-item text-center" v-on:click="followersLoadMore()">
|
|
||||||
<p class="mb-0 small text-muted font-weight-light cursor-pointer">Load more</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</b-modal> -->
|
|
||||||
<b-modal ref="ctxModal"
|
<b-modal ref="ctxModal"
|
||||||
id="ctx-modal"
|
id="ctx-modal"
|
||||||
hide-header
|
hide-header
|
||||||
|
@ -630,7 +566,7 @@
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchProfile() {
|
fetchProfile() {
|
||||||
axios.get('/api/v1/accounts/verify_credentials').then(res => {
|
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
|
||||||
this.profile = res.data;
|
this.profile = res.data;
|
||||||
if(this.profile.is_admin == true) {
|
if(this.profile.is_admin == true) {
|
||||||
this.modes.mod = true;
|
this.modes.mod = true;
|
||||||
|
@ -652,15 +588,15 @@
|
||||||
let apiUrl = false;
|
let apiUrl = false;
|
||||||
switch(this.scope) {
|
switch(this.scope) {
|
||||||
case 'home':
|
case 'home':
|
||||||
apiUrl = '/api/v1/timelines/home';
|
apiUrl = '/api/pixelfed/v1/timelines/home';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'local':
|
case 'local':
|
||||||
apiUrl = '/api/v1/timelines/public';
|
apiUrl = '/api/pixelfed/v1/timelines/public';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'network':
|
case 'network':
|
||||||
apiUrl = '/api/v1/timelines/network';
|
apiUrl = '/api/pixelfed/v1/timelines/network';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
|
@ -695,15 +631,15 @@
|
||||||
let apiUrl = false;
|
let apiUrl = false;
|
||||||
switch(this.scope) {
|
switch(this.scope) {
|
||||||
case 'home':
|
case 'home':
|
||||||
apiUrl = '/api/v1/timelines/home';
|
apiUrl = '/api/pixelfed/v1/timelines/home';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'local':
|
case 'local':
|
||||||
apiUrl = '/api/v1/timelines/public';
|
apiUrl = '/api/pixelfed/v1/timelines/public';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'network':
|
case 'network':
|
||||||
apiUrl = '/api/v1/timelines/network';
|
apiUrl = '/api/pixelfed/v1/timelines/network';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
|
@ -736,8 +672,8 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
loadMore(event) {
|
loadMore(event) {
|
||||||
let homeTimeline = '/api/v1/timelines/home';
|
let homeTimeline = '/api/pixelfed/v1/timelines/home';
|
||||||
let localTimeline = '/api/v1/timelines/public';
|
let localTimeline = '/api/pixelfed/v1/timelines/public';
|
||||||
let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline;
|
let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline;
|
||||||
event.target.innerText = 'Loading...';
|
event.target.innerText = 'Loading...';
|
||||||
axios.get(apiUrl, {
|
axios.get(apiUrl, {
|
||||||
|
@ -1068,7 +1004,7 @@
|
||||||
this.$refs.followingModal.show();
|
this.$refs.followingModal.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followingCursor
|
page: this.followingCursor
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1024,7 @@
|
||||||
this.$refs.followerModal.show();
|
this.$refs.followerModal.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followerCursor
|
page: this.followerCursor
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1040,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
followingLoadMore() {
|
followingLoadMore() {
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followingCursor
|
page: this.followingCursor
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1057,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
followersLoadMore() {
|
followersLoadMore() {
|
||||||
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
|
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
|
||||||
params: {
|
params: {
|
||||||
page: this.followerCursor
|
page: this.followerCursor
|
||||||
}
|
}
|
||||||
|
@ -1297,7 +1233,7 @@
|
||||||
if(status.account.id == this.profile.id) {
|
if(status.account.id == this.profile.id) {
|
||||||
this.$refs.ctxModal.show();
|
this.$refs.ctxModal.show();
|
||||||
} else {
|
} else {
|
||||||
axios.get('/api/v1/accounts/relationships', {
|
axios.get('/api/pixelfed/v1/accounts/relationships', {
|
||||||
params: {
|
params: {
|
||||||
'id[]': status.account.id
|
'id[]': status.account.id
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue