aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2021-12-28 18:30:34 -0500
committerTusooa Zhu <tusooa@kazv.moe>2022-07-01 13:03:45 -0400
commit5cd18be47b53d62c3f5bc6587a04ae3e0479d23c (patch)
tree0e5e94e2494ed094dbdee36af12d9b4ddb92ad2e /src
parent56501e95c42859a826ad0f0b11de4e6b189b9f92 (diff)
Enable anonymous users to interact with statuses remotely
Diffstat (limited to 'src')
-rw-r--r--src/components/favorite_button/favorite_button.js5
-rw-r--r--src/components/favorite_button/favorite_button.vue10
-rw-r--r--src/components/reply_button/reply_button.js3
-rw-r--r--src/components/reply_button/reply_button.vue10
-rw-r--r--src/components/retweet_button/retweet_button.js3
-rw-r--r--src/components/retweet_button/retweet_button.vue10
-rw-r--r--src/modules/instance.js14
7 files changed, 48 insertions, 7 deletions
diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js
index 5cd05f73..d15699f7 100644
--- a/src/components/favorite_button/favorite_button.js
+++ b/src/components/favorite_button/favorite_button.js
@@ -31,7 +31,10 @@ const FavoriteButton = {
}
},
computed: {
- ...mapGetters(['mergedConfig'])
+ ...mapGetters(['mergedConfig']),
+ remoteInteractionLink () {
+ return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
+ }
}
}
diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue
index dce25e24..7d23572e 100644
--- a/src/components/favorite_button/favorite_button.vue
+++ b/src/components/favorite_button/favorite_button.vue
@@ -13,13 +13,19 @@
:spin="animated"
/>
</button>
- <span v-else>
+ <a
+ v-else
+ class="button-unstyled interactive"
+ target="_blank"
+ role="button"
+ :href="remoteInteractionLink"
+ >
<FAIcon
class="fa-scale-110 fa-old-padding"
:title="$t('tool_tip.favorite')"
:icon="['far', 'star']"
/>
- </span>
+ </a>
<span
v-if="!mergedConfig.hidePostStats && status.fave_num > 0"
class="action-counter"
diff --git a/src/components/reply_button/reply_button.js b/src/components/reply_button/reply_button.js
index c7bd2a2b..fb1c43cf 100644
--- a/src/components/reply_button/reply_button.js
+++ b/src/components/reply_button/reply_button.js
@@ -9,6 +9,9 @@ const ReplyButton = {
computed: {
loggedIn () {
return !!this.$store.state.users.currentUser
+ },
+ remoteInteractionLink () {
+ return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
}
}
}
diff --git a/src/components/reply_button/reply_button.vue b/src/components/reply_button/reply_button.vue
index c17041da..ab493311 100644
--- a/src/components/reply_button/reply_button.vue
+++ b/src/components/reply_button/reply_button.vue
@@ -12,13 +12,19 @@
icon="reply"
/>
</button>
- <span v-else>
+ <a
+ v-else
+ class="button-unstyled interactive"
+ target="_blank"
+ role="button"
+ :href="remoteInteractionLink"
+ >
<FAIcon
icon="reply"
class="fa-scale-110 fa-old-padding"
:title="$t('tool_tip.reply')"
/>
- </span>
+ </a>
<span
v-if="status.replies_count > 0"
class="action-counter"
diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js
index 2103fd0b..dfc18ef8 100644
--- a/src/components/retweet_button/retweet_button.js
+++ b/src/components/retweet_button/retweet_button.js
@@ -26,6 +26,9 @@ const RetweetButton = {
computed: {
mergedConfig () {
return this.$store.getters.mergedConfig
+ },
+ remoteInteractionLink () {
+ return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
}
}
}
diff --git a/src/components/retweet_button/retweet_button.vue b/src/components/retweet_button/retweet_button.vue
index 859ce499..6e5980ac 100644
--- a/src/components/retweet_button/retweet_button.vue
+++ b/src/components/retweet_button/retweet_button.vue
@@ -20,13 +20,19 @@
:title="$t('timeline.no_retweet_hint')"
/>
</span>
- <span v-else>
+ <a
+ v-else
+ class="button-unstyled interactive"
+ target="_blank"
+ role="button"
+ :href="remoteInteractionLink"
+ >
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="retweet"
:title="$t('tool_tip.repeat')"
/>
- </span>
+ </a>
<span
v-if="!mergedConfig.hidePostStats && status.repeat_num > 0"
class="no-event"
diff --git a/src/modules/instance.js b/src/modules/instance.js
index 220463ca..6a657533 100644
--- a/src/modules/instance.js
+++ b/src/modules/instance.js
@@ -3,6 +3,8 @@ import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js'
import apiService from '../services/api/api.service.js'
import { instanceDefaultProperties } from './config.js'
+const REMOTE_INTERACTION_URL = '/main/ostatus'
+
const defaultState = {
// Stuff from apiConfig
name: 'Pleroma FE',
@@ -116,6 +118,18 @@ const instance = {
},
instanceDomain (state) {
return new URL(state.server).hostname
+ },
+ remoteInteractionLink (state) {
+ const server = state.server.endsWith('/') ? state.server.slice(0, -1) : state.server
+ const link = server + REMOTE_INTERACTION_URL
+
+ return ({ statusId, nickname }) => {
+ if (statusId) {
+ return `${link}?status_id=${statusId}`
+ } else {
+ return `${link}?nickname=${nickname}`
+ }
+ }
}
},
actions: {