diff --git a/old version/quickcommand-2.2.0.upx b/old version/quickcommand-2.2.0.upx
index c6a2b79..eeeb2dc 100644
Binary files a/old version/quickcommand-2.2.0.upx and b/old version/quickcommand-2.2.0.upx differ
diff --git a/src/assets/index.js b/src/assets/index.js
index 94334a4..5a10620 100644
--- a/src/assets/index.js
+++ b/src/assets/index.js
@@ -625,7 +625,7 @@
`
$("#options").append(sidebar + featureList + footer)
+ checkSharedQc()
}
// 显示新建命令界面
@@ -744,6 +745,19 @@
})
}
+ let checkSharedQc = async () => {
+ let localShares = getDB(CFG_PREFIX + 'sharedQcCounts')[window.processPlatform] || 0
+ let remoteShares = await getDocsFromYuQue()
+ if (!remoteShares) return
+ let updates = remoteShares.length - localShares
+ if (updates == 0) {
+ $('.circle').hide()
+ return
+ }
+ if (updates > 99) updates = 99
+ $('.circle').text(updates).show()
+ }
+
let getSelect2Option = (data, width, dropdownAutoWidth = false) => {
var options = {
data: data,
@@ -1337,12 +1351,15 @@
}
}
- let getSharedQCFromYuQue = async () => {
- $('#options').hide()
- let extraInfo = getDB(CFG_PREFIX + 'extraInfo')
+ let getDocsFromYuQue = async () => {
+ let res, extraInfo = getDB(CFG_PREFIX + 'extraInfo')
if (extraInfo.yuQueToken) yuQueClient.defaults.headers['X-Auth-Token'] = extraInfo.yuQueToken
- let res = await yuQueClient(`repos/${yuQueShareVars.releaseRepo}/docs`)
- let description, platform = window.processPlatform
+ try {
+ res = await yuQueClient(`repos/${yuQueShareVars.releaseRepo}/docs`)
+ } catch (error) {
+ return false
+ }
+ let platform = window.processPlatform
let docs = res.data.data
.filter(d => {
try {
@@ -1351,8 +1368,21 @@
console.log(error)
}
})
+ return docs
+ }
+
+ let getSharedQCFromYuQue = async () => {
+ $('#options').hide()
+ let description
+ let docs = await getDocsFromYuQue()
+ if (!docs) return
+ let sharedQcCounts = getDB(CFG_PREFIX + 'sharedQcCounts')
+ sharedQcCounts[window.processPlatform] = docs.length
+ putDB(sharedQcCounts, CFG_PREFIX + 'sharedQcCounts')
+ $('.circle').hide()
+ docs = docs
.sort((x, y) => {
- if (y.updated_at > x.updated_at) return 1
+ if (y.published_at > x.published_at) return 1
else return -1
})
.map(d => {
diff --git a/src/assets/style/options.css b/src/assets/style/options.css
index cca0022..801d6ea 100644
--- a/src/assets/style/options.css
+++ b/src/assets/style/options.css
@@ -952,3 +952,13 @@ li.CodeMirror-hint {
.swal2-input {
text-align: center;
}
+
+.circle {
+ position: absolute;
+ background: red;
+ border-radius: 50%;
+ padding: 1px;
+ top: -8px;
+ right: 160px;
+ display: none;
+}