1
0
Fork 0

Update vue components, namespace v1 api

This commit is contained in:
Daniel Supernault 2019-09-15 18:06:04 -06:00
parent a791219d20
commit 3c306c5e17
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
9 changed files with 38 additions and 102 deletions

View File

@ -115,7 +115,7 @@ export default {
methods: {
fetchNotifications() {
axios.get('/api/v1/notifications')
axios.get('/api/pixelfed/v1/notifications')
.then(res => {
let data = res.data.filter(n => {
if(n.type == 'share' && !status) {
@ -136,7 +136,7 @@ export default {
$state.complete();
return;
}
axios.get('/api/v1/notifications', {
axios.get('/api/pixelfed/v1/notifications', {
params: {
page: this.notificationCursor
}

View File

@ -125,7 +125,7 @@ export default {
methods: {
fetchCurrentUser() {
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.owner = this.currentUser.id == this.profileId;
});

View File

@ -201,7 +201,7 @@ export default {
},
fetchRecentPosts() {
axios.get('/api/v1/accounts/' + this.profileId + '/statuses', {
axios.get('/api/local/accounts/' + this.profileId + '/statuses', {
params: {
only_media: true,
min_id: 1,

View File

@ -295,7 +295,7 @@ export default {
methods: {
fetchProfile() {
axios.get('/api/v1/accounts/verify_credentials').then(res => {
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
this.profile = res.data;
if(res.data.locked == true) {
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) {
self.uploadProgress = 100;
self.ids.push(e.data.id);
@ -373,7 +373,7 @@ export default {
return;
}
let id = this.media[this.carouselCursor].id;
axios.delete('/api/v1/media', {
axios.delete('/api/pixelfed/v1/media', {
params: {
id: id
}

View File

@ -400,7 +400,7 @@ export default {
methods: {
fetchProfile() {
axios.get('/api/v1/accounts/verify_credentials').then(res => {
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
this.profile = res.data;
window.pixelfed.currentUser = res.data;
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) {
self.uploadProgress = 100;
self.ids.push(e.data.id);
@ -516,7 +516,7 @@ export default {
return;
}
let id = this.media[this.carouselCursor].id;
axios.delete('/api/v1/media', {
axios.delete('/api/pixelfed/v1/media', {
params: {
id: id
}

View File

@ -81,7 +81,7 @@
methods: {
fetchNotifications() {
axios.get('/api/v1/notifications')
axios.get('/api/pixelfed/v1/notifications')
.then(res => {
let data = res.data.filter(n => {
if(n.type == 'share' && !status) {
@ -103,7 +103,7 @@
$state.complete();
return;
}
axios.get('/api/v1/notifications', {
axios.get('/api/pixelfed/v1/notifications', {
params: {
page: this.notificationCursor
}
@ -171,7 +171,7 @@
let interval = this.notifications.length > 5 ? 15000 : 120000;
let self = this;
setInterval(function() {
axios.get('/api/v1/notifications')
axios.get('/api/pixelfed/v1/notifications')
.then(res => {
let data = res.data.filter(n => {
if(n.type == 'share' || self.notificationMaxId >= n.id) {

View File

@ -1106,7 +1106,7 @@ export default {
this.fetchData();
return;
} else {
axios.get('/api/v1/accounts/relationships', {
axios.get('/api/pixelfed/v1/accounts/relationships', {
params: {
'id[]': this.statusProfileId
}

View File

@ -583,7 +583,7 @@
this.followingModal();
}
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;
});
}
@ -595,7 +595,7 @@
methods: {
fetchProfile() {
axios.get('/api/v1/accounts/' + this.profileId).then(res => {
axios.get('/api/pixelfed/v1/accounts/' + this.profileId).then(res => {
this.profile = res.data;
}).then(res => {
this.fetchPosts();
@ -603,7 +603,7 @@
},
fetchPosts() {
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
axios.get(apiUrl, {
params: {
only_media: true,
@ -641,7 +641,7 @@
$state.complete();
return;
}
let apiUrl = '/api/v1/accounts/' + this.profileId + '/statuses';
let apiUrl = '/api/pixelfed/v1/accounts/' + this.profileId + '/statuses';
axios.get(apiUrl, {
params: {
only_media: true,
@ -800,7 +800,7 @@
if(document.querySelectorAll('body')[0].classList.contains('loggedIn') == false) {
return;
}
axios.get('/api/v1/accounts/relationships', {
axios.get('/api/pixelfed/v1/accounts/relationships', {
params: {
'id[]': this.profileId
}
@ -935,7 +935,7 @@
this.$refs.followingModal.show();
return;
} else {
axios.get('/api/v1/accounts/'+this.profileId+'/following', {
axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/following', {
params: {
page: this.followingCursor
}
@ -964,7 +964,7 @@
this.$refs.followerModal.show();
return;
} else {
axios.get('/api/v1/accounts/'+this.profileId+'/followers', {
axios.get('/api/pixelfed/v1/accounts/'+this.profileId+'/followers', {
params: {
page: this.followerCursor
}
@ -986,7 +986,7 @@
window.location.href = encodeURI('/login?next=/' + this.profile.username + '/');
return;
}
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
params: {
page: this.followingCursor
}
@ -1007,7 +1007,7 @@
if($('body').hasClass('loggedIn') == false) {
return;
}
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
params: {
page: this.followerCursor
}

View File

@ -343,7 +343,7 @@
<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/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 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>
@ -353,70 +353,6 @@
</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"
id="ctx-modal"
hide-header
@ -630,7 +566,7 @@
methods: {
fetchProfile() {
axios.get('/api/v1/accounts/verify_credentials').then(res => {
axios.get('/api/pixelfed/v1/accounts/verify_credentials').then(res => {
this.profile = res.data;
if(this.profile.is_admin == true) {
this.modes.mod = true;
@ -652,15 +588,15 @@
let apiUrl = false;
switch(this.scope) {
case 'home':
apiUrl = '/api/v1/timelines/home';
apiUrl = '/api/pixelfed/v1/timelines/home';
break;
case 'local':
apiUrl = '/api/v1/timelines/public';
apiUrl = '/api/pixelfed/v1/timelines/public';
break;
case 'network':
apiUrl = '/api/v1/timelines/network';
apiUrl = '/api/pixelfed/v1/timelines/network';
break;
}
axios.get(apiUrl, {
@ -695,15 +631,15 @@
let apiUrl = false;
switch(this.scope) {
case 'home':
apiUrl = '/api/v1/timelines/home';
apiUrl = '/api/pixelfed/v1/timelines/home';
break;
case 'local':
apiUrl = '/api/v1/timelines/public';
apiUrl = '/api/pixelfed/v1/timelines/public';
break;
case 'network':
apiUrl = '/api/v1/timelines/network';
apiUrl = '/api/pixelfed/v1/timelines/network';
break;
}
axios.get(apiUrl, {
@ -736,8 +672,8 @@
},
loadMore(event) {
let homeTimeline = '/api/v1/timelines/home';
let localTimeline = '/api/v1/timelines/public';
let homeTimeline = '/api/pixelfed/v1/timelines/home';
let localTimeline = '/api/pixelfed/v1/timelines/public';
let apiUrl = this.scope == 'home' ? homeTimeline : localTimeline;
event.target.innerText = 'Loading...';
axios.get(apiUrl, {
@ -1068,7 +1004,7 @@
this.$refs.followingModal.show();
return;
}
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
params: {
page: this.followingCursor
}
@ -1088,7 +1024,7 @@
this.$refs.followerModal.show();
return;
}
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
params: {
page: this.followerCursor
}
@ -1104,7 +1040,7 @@
},
followingLoadMore() {
axios.get('/api/v1/accounts/'+this.profile.id+'/following', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/following', {
params: {
page: this.followingCursor
}
@ -1121,7 +1057,7 @@
},
followersLoadMore() {
axios.get('/api/v1/accounts/'+this.profile.id+'/followers', {
axios.get('/api/pixelfed/v1/accounts/'+this.profile.id+'/followers', {
params: {
page: this.followerCursor
}
@ -1297,7 +1233,7 @@
if(status.account.id == this.profile.id) {
this.$refs.ctxModal.show();
} else {
axios.get('/api/v1/accounts/relationships', {
axios.get('/api/pixelfed/v1/accounts/relationships', {
params: {
'id[]': status.account.id
}