From 6005de1a8ecf2d3292cb3682fd2c9b9836f90954 Mon Sep 17 00:00:00 2001
From: li-guohao <46225881+li-guohao@users.noreply.github.com>
Date: Thu, 24 Nov 2022 23:07:43 +0800
Subject: [PATCH] add bgmtv access token config for request some private api
(#7)
---
src/api/tripartite.js | 10 +++++++-
src/views/system/SystemOptions.vue | 40 ++++++++++++++++++++++++++++--
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/src/api/tripartite.js b/src/api/tripartite.js
index 583973c..75ca7db 100644
--- a/src/api/tripartite.js
+++ b/src/api/tripartite.js
@@ -1,7 +1,8 @@
import request from '@/utils/request'
const api = {
- testQbittorrentConnect: '/tripartite/qbittorrent/connect/test'
+ testQbittorrentConnect: '/tripartite/qbittorrent/connect/test',
+ getBgmTvMe: '/tripartite/bgmtv/token/user/me'
}
export function testQbittorrentConnect () {
@@ -10,3 +11,10 @@ export function testQbittorrentConnect () {
mentions: 'get'
})
}
+
+export function getBgmTvMe () {
+ return request({
+ url: api.getBgmTvMe,
+ method: 'get'
+ })
+}
diff --git a/src/views/system/SystemOptions.vue b/src/views/system/SystemOptions.vue
index 8e5fde0..cd92716 100644
--- a/src/views/system/SystemOptions.vue
+++ b/src/views/system/SystemOptions.vue
@@ -137,10 +137,25 @@
/>
+
+
+
+
保存番组计划设置
+
+ 测试令牌
+
@@ -193,7 +208,7 @@ import { listPlaces } from '@/api/file'
import {
getOptionList, saveOptionWithRequest
} from '@/api/options'
-import { testQbittorrentConnect } from '@/api/tripartite'
+import { testQbittorrentConnect, getBgmTvMe } from '@/api/tripartite'
import { testProxyConnect } from '@/api/network'
export default {
@@ -215,7 +230,8 @@ export default {
loading: false
},
testConnectQbittorrentButtonLoading: false,
- testConnectProxyButtonLoading: false
+ testConnectProxyButtonLoading: false,
+ testBgmTvTokenButtonLoading: false
}
},
created () {
@@ -274,6 +290,7 @@ export default {
if (category === 'BGMTV') {
this.bgmtv = entity.kvMap
+ // this.$log.debug('bgmtv', this.bgmtv)
}
if (category === 'MIKAN') {
@@ -395,6 +412,25 @@ export default {
.finally(() => {
this.testConnectProxyButtonLoading = false
})
+ },
+ testBgmTvToken () {
+ this.testBgmTvTokenButtonLoading = true
+ getBgmTvMe()
+ .then(rsp => {
+ const bgmTvUserInfo = rsp.result
+ if (bgmTvUserInfo) {
+ this.$message.success('你好, ' + bgmTvUserInfo.nickname + '!')
+ } else {
+ this.$message.error('测试番组计划令牌失败')
+ }
+ })
+ .catch(error => {
+ this.$log.error('test bgmtv token fail', error)
+ this.$message.error('测试番组计划令牌失败')
+ })
+ .finally(() => {
+ this.testBgmTvTokenButtonLoading = false
+ })
}
}
}