Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
CS-Tao committed Sep 16, 2019
2 parents 8f3fcf3 + bf946ce commit 6089ca9
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 14 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

### 安装软件

Expand Down
1 change: 1 addition & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ module.exports = {
children: [
['', '下载安装'],
['auth', '用户认证'],
['manualtoken', '手动申请 Token'],
['menu', '菜单'],
['settings', '软件设置'],
['reservation', '定时预约'],
Expand Down
2 changes: 2 additions & 0 deletions docs/specification/auth.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GitHub Star 认证

> 无法连接服务器请移步[手动申请 Token](manualtoekn.html)
请按照以下步骤登录本软件并获取永久授权

1. 点击软件下方的**钥匙**进入软件授权页面(第一次打开软件会默认进入本页面)
Expand Down
21 changes: 21 additions & 0 deletions docs/specification/manualtoken.md
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whu-library-seat",
"version": "1.8.2",
"version": "1.8.3",
"author": "CS-Tao <whucstao@qq.com>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down
61 changes: 54 additions & 7 deletions src/renderer/components/Header/Authen/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,29 @@
</div>
<span v-if="socketFailMessage" class="socket-err-msg">{{socketFailMessage}}</span>
<div class="help-link-wrap">
<a class="help-link" href="javascript:void(0)" @click="$openLink('https://home.cs-tao.cc/whu-library-seat/specification/auth.html')">了解授权机制</a>
<a class="help-link" href="javascript:void(0)" @click="$openLink('https://home.cs-tao.cc/whu-library-seat/specification/auth.html')">了解授权方法</a>
</div>
<el-dialog
title="GitHub Token"
:visible.sync="showManualTokenDialog"
:modal-append-to-body="false"
:close-on-press-escape="false"
:show-close="false"
:close-on-click-modal="false"
width="70%"
top="30%"
center>
<span>无法连接服务器,请您在 GitHub 的</span>
<a class="help-link" href="javascript:void(0)" @click="$openLink('https://github.com/settings/tokens/new')">Developer settings 页面</a>
<span>手动申请 token 后粘贴到下方,以继续获取本软件授权</span>
<br/>
<span class="tip">Tip: 进入上方链接,输入任意 Note,生成并复制 token 即可,无需任何 Scope</span>
<el-input v-model="inputToken" placeholder="Ctrl + V to paste your token" style="margin-top: 8px;"/>
<span slot="footer" class="dialog-footer">
<el-button class="comfirm-button" @click="onComfirmInputTokenDialogYes()">确 定</el-button>
<el-button class="cancel-button" @click="onComfirmInputTokenDialogNo()">取 消</el-button>
</span>
</el-dialog>
<el-dialog
title="通过 Github Star 授权"
:visible.sync="comfirmDialogVisible"
Expand All @@ -40,8 +61,8 @@
</i>
<span>{{'&nbsp;图标进入本软件的 GitHub 地址,点星后回到本软件,点击确定按钮即可完成授权'}}</span>
<span slot="footer" class="dialog-footer">
<el-button class="comfirm-button" @click="onComfirmDialogYes()">确 定</el-button>
<el-button class="cancel-button" @click="onComfirmDialogNo()">取 消</el-button>
<el-button class="comfirm-button" @click="onComfirmStarDialogYes()">确 定</el-button>
<el-button class="cancel-button" @click="onComfirmStarDialogNo()">取 消</el-button>
</span>
</el-dialog>
</div>
Expand All @@ -68,7 +89,8 @@ export default {
workMode: workFlowModes.none,
comfirmDialogVisible: false,
socket: null,
socketFailMessage: null
socketFailMessage: null,
inputToken: null
}
},
computed: {
Expand Down Expand Up @@ -98,6 +120,9 @@ export default {
default:
return 'GitHub star 永久授权'
}
},
showManualTokenDialog () {
return this.socketFailMessage !== null
}
},
mounted () {
Expand Down Expand Up @@ -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({
Expand All @@ -195,6 +220,7 @@ export default {
},
cancelAuthen () {
this.comfirmDialogVisible = false
this.socketFailMessage = null
this.workMode = workFlowModes.none
this.$store.commit('RESTORE_AUTH')
},
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -268,14 +295,29 @@ export default {
})
}
},
onComfirmDialogNo () {
onComfirmStarDialogNo () {
this.$message({
type: 'warning',
duration: '2000',
showClose: true,
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()
}
}
}
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/Header/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 6089ca9

Please sign in to comment.