diff --git a/README.md b/README.md index 401be411..11f13c17 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,16 @@ ### 最新版本下载 - Windows - - 链接: [whu-library-seat-setup-1.8.2.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.2/whu-library-seat-setup-1.8.2.exe) - - 备用地址: [whu-library-seat-setup-1.8.2.exe](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.2/whu-library-seat-setup-1.8.2.exe) + - 链接: [whu-library-seat-setup-1.8.3.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.3/whu-library-seat-setup-1.8.3.exe) + - 备用地址: [whu-library-seat-setup-1.8.3.exe](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.3/whu-library-seat-setup-1.8.3.exe) - Mac OS - - 链接: [whu-library-seat-1.8.2.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.2/whu-library-seat-1.8.2.dmg) - - 备用地址: [whu-library-seat-1.8.2.dmg](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.2/whu-library-seat-1.8.2.dmg) + - 链接: [whu-library-seat-1.8.3.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.3/whu-library-seat-1.8.3.dmg) + - 备用地址: [whu-library-seat-1.8.3.dmg](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.3/whu-library-seat-1.8.3.dmg) - Linux - - 链接: [whu-library-seat-1.8.2-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.2/whu-library-seat-1.8.2-x86_64.AppImage) - - 备用地址: [whu-library-seat-1.8.2-x86_64.AppImage](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.2/whu-library-seat-1.8.2-x86_64.AppImage) + - 链接: [whu-library-seat-1.8.3-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.8.3/whu-library-seat-1.8.3-x86_64.AppImage) + - 备用地址: [whu-library-seat-1.8.3-x86_64.AppImage](https://assets.cs-tao.cc/whu-library-seat/releases/v1.8.3/whu-library-seat-1.8.3-x86_64.AppImage) ### 安装软件 diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 9a937f70..d9ee8ae7 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -46,6 +46,7 @@ module.exports = { children: [ ['', '下载安装'], ['auth', '用户认证'], + ['manualtoken', '手动申请 Token'], ['menu', '菜单'], ['settings', '软件设置'], ['reservation', '定时预约'], diff --git a/docs/specification/auth.md b/docs/specification/auth.md index e2909c03..1a750c68 100644 --- a/docs/specification/auth.md +++ b/docs/specification/auth.md @@ -1,5 +1,7 @@ # GitHub Star 认证 +> 无法连接服务器请移步[手动申请 Token](manualtoekn.html) + 请按照以下步骤登录本软件并获取永久授权 1. 点击软件下方的**钥匙**进入软件授权页面(第一次打开软件会默认进入本页面) diff --git a/docs/specification/manualtoken.md b/docs/specification/manualtoken.md new file mode 100644 index 00000000..ee562824 --- /dev/null +++ b/docs/specification/manualtoken.md @@ -0,0 +1,21 @@ +# 手动申请 Token + +> 本页面用于处理后台服务无法连接的情况,如果已经通过 GitHub 第三方登录,可以忽略本页 + +如果软件无法连接后台服务器,软件会出现如下的弹窗提醒您手动申请 Token: + +![1.png](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/ManualToken/1.png) + +请点击弹窗中的绿色文字进入 GitHub 的 [Token 申请页面](https://github.com/settings/tokens/new) + +进入页面后,在 Note 的输入框中输入任意文字,如: whu-library-seat。无需选择 scope,直接点击页面最下方的 `Generate token` 按钮,生成 Token + +![2.png](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/ManualToken/2.png) + +复制生成的 40 位 Token 字符串 + +![3.png](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/ManualToken/3.png) + +粘贴到软件弹窗的输入框中,点击确认按钮 + +![4.png](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/ManualToken/4.png) diff --git a/package.json b/package.json index 572270cf..db9b9b0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whu-library-seat", - "version": "1.8.2", + "version": "1.8.3", "author": "CS-Tao ", "description": "武汉大学图书馆抢座软件", "license": null, diff --git a/src/renderer/components/Header/Authen/index.vue b/src/renderer/components/Header/Authen/index.vue index 5a6efd22..ec380cb8 100644 --- a/src/renderer/components/Header/Authen/index.vue +++ b/src/renderer/components/Header/Authen/index.vue @@ -22,8 +22,29 @@ {{socketFailMessage}} + + 无法连接服务器,请您在 GitHub 的 + Developer settings 页面 + 手动申请 token 后粘贴到下方,以继续获取本软件授权 +
+ Tip: 进入上方链接,输入任意 Note,生成并复制 token 即可,无需任何 Scope + + + 确 定 + 取 消 + +
{{' 图标进入本软件的 GitHub 地址,点星后回到本软件,点击确定按钮即可完成授权'}} - 确 定 - 取 消 + 确 定 + 取 消 @@ -68,7 +89,8 @@ export default { workMode: workFlowModes.none, comfirmDialogVisible: false, socket: null, - socketFailMessage: null + socketFailMessage: null, + inputToken: null } }, computed: { @@ -98,6 +120,9 @@ export default { default: return 'GitHub star 永久授权' } + }, + showManualTokenDialog () { + return this.socketFailMessage !== null } }, mounted () { @@ -175,7 +200,7 @@ export default { }) this.socket.on('token', (token) => { this.disconnectSocket() - this.loginGitHubCallback((token)) + this.loginGitHubCallback(token) }) this.socket.on('cancel', (socketId) => { this.$message({ @@ -195,6 +220,7 @@ export default { }, cancelAuthen () { this.comfirmDialogVisible = false + this.socketFailMessage = null this.workMode = workFlowModes.none this.$store.commit('RESTORE_AUTH') }, @@ -206,6 +232,7 @@ export default { }, loginGitHubCallback (token) { this.workMode = workFlowModes.logined + this.socketFailMessage = null this.$store.dispatch('saveAuthToken', token) .then((token) => { return this.checkIfStared(token) @@ -235,7 +262,7 @@ export default { this.workMode = workFlowModes.staring return this.$store.dispatch('checkIfStared', {token, cursor: null}) }, - onComfirmDialogYes () { + onComfirmStarDialogYes () { this.comfirmDialogVisible = false if (this.authInfo.githubAuthToken) { this.checkIfStared(this.authInfo.githubAuthToken) @@ -268,7 +295,7 @@ export default { }) } }, - onComfirmDialogNo () { + onComfirmStarDialogNo () { this.$message({ type: 'warning', duration: '2000', @@ -276,6 +303,21 @@ export default { message: '取消授权' }) this.cancelAuthen() + }, + onComfirmInputTokenDialogYes () { + if (this.inputToken && this.inputToken.length === 40) { + this.loginGitHubCallback(this.inputToken) + } else { + this.$message({ + type: 'warning', + duration: '2000', + showClose: true, + message: '请正确输入 Token' + }) + } + }, + onComfirmInputTokenDialogNo () { + this.cancelAuthen() } } } @@ -373,6 +415,11 @@ export default { color: $button-green; } } + .tip { + font-style: italic; + font-size: $text-size-small + 1; + color: $button-yellow; + } } .comfirm-button { margin: 0 8px; diff --git a/src/renderer/components/Header/index.vue b/src/renderer/components/Header/index.vue index 89e9f96d..008d10e4 100644 --- a/src/renderer/components/Header/index.vue +++ b/src/renderer/components/Header/index.vue @@ -184,6 +184,9 @@ export default { }) }, lockAccount () { + if (!this.userInfo.account) { + return + } this.accountLocked = !this.accountLocked if (this.accountLocked) { this.$store.dispatch('saveAccount', this.userInfo.account) @@ -201,6 +204,9 @@ export default { } }, lockPasswd () { + if (!this.userInfo.passwd) { + return + } this.passwdLocked = !this.passwdLocked if (this.passwdLocked) { this.$store.dispatch('savePasswd', this.userInfo.passwd)