mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-23 10:57:31 +08:00
feat: expose rss feed endpoint
This commit is contained in:
@@ -268,6 +268,7 @@ const postReactions = ref([])
|
||||
const comments = ref([])
|
||||
const status = ref('PUBLISHED')
|
||||
const pinnedAt = ref(null)
|
||||
const rssExcluded = ref(false)
|
||||
const isWaitingPostingComment = ref(false)
|
||||
const postTime = ref('')
|
||||
const postItems = ref([])
|
||||
@@ -356,6 +357,11 @@ const articleMenuItems = computed(() => {
|
||||
} else {
|
||||
items.push({ text: '置顶', onClick: () => pinPost() })
|
||||
}
|
||||
if (rssExcluded.value) {
|
||||
items.push({ text: '取消rss不推荐', onClick: () => includeRss() })
|
||||
} else {
|
||||
items.push({ text: 'rss不推荐', onClick: () => excludeRss() })
|
||||
}
|
||||
}
|
||||
if (isAdmin.value && status.value === 'PENDING') {
|
||||
items.push({ text: '通过审核', onClick: () => approvePost() })
|
||||
@@ -480,6 +486,7 @@ watchEffect(() => {
|
||||
subscribed.value = !!data.subscribed
|
||||
status.value = data.status
|
||||
pinnedAt.value = data.pinnedAt
|
||||
rssExcluded.value = data.rssExcluded
|
||||
postTime.value = TimeManager.format(data.createdAt)
|
||||
lottery.value = data.lottery || null
|
||||
if (lottery.value && lottery.value.endTime) startCountdown()
|
||||
@@ -645,6 +652,36 @@ const unpinPost = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const excludeRss = async () => {
|
||||
const token = getToken()
|
||||
if (!token) return
|
||||
const res = await fetch(`${API_BASE_URL}/api/admin/posts/${postId}/rss-exclude`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (res.ok) {
|
||||
rssExcluded.value = true
|
||||
toast.success('已标记为rss不推荐')
|
||||
} else {
|
||||
toast.error('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
const includeRss = async () => {
|
||||
const token = getToken()
|
||||
if (!token) return
|
||||
const res = await fetch(`${API_BASE_URL}/api/admin/posts/${postId}/rss-include`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (res.ok) {
|
||||
rssExcluded.value = false
|
||||
toast.success('已取消rss不推荐')
|
||||
} else {
|
||||
toast.error('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
const editPost = () => {
|
||||
navigateTo(`/posts/${postId}/edit`, { replace: true })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user