Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #185 from nashaofu/dev
Browse files Browse the repository at this point in the history
fix 修复文件下载bug
Closes #184
  • Loading branch information
nashaofu committed Apr 3, 2019
2 parents abf3644 + fb84a52 commit b79c5de
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "dingtalk",
"version": "2.0.13",
"version": "2.0.14",
"description": "钉钉桌面版,基于electron和钉钉网页版开发,支持Windows、Linux和macOS",
"author": "nashaofu <diaocheng@outlook.com>",
"main": "dist/main.js",
Expand Down
1 change: 1 addition & 0 deletions src/main/dingtalk.js
Expand Up @@ -42,6 +42,7 @@ export default class DingTalk {
constructor () {
if (!this.requestSingleInstanceLock()) {
this.init().then(() => {
app.setAppUserModelId('com.electron.dingtalk')
// 移除窗口菜单
Menu.setApplicationMenu(null)
this.initMainWin()
Expand Down
2 changes: 1 addition & 1 deletion src/main/mainWin.js
Expand Up @@ -12,10 +12,10 @@ let time = Date.now()
* @param {String} url
*/
function openExternal (url) {
console.log(lastUrl, url, time, Date.now() - time)
if (url === 'about:blank') return
if (url === 'https://im.dingtalk.com/') return
if (url.indexOf('https://space.dingtalk.com/auth/download') === 0) return
if (url.indexOf('https://space.dingtalk.com/attachment') === 0) return
// 防止短时间快速点击链接
if (lastUrl === url && Date.now() - time < 800) return
lastUrl = url
Expand Down
2 changes: 2 additions & 0 deletions src/preload/mainWin/open.js
Expand Up @@ -10,6 +10,8 @@ export default injector => {
window.open = function (url, ...args) {
if (url.indexOf('https://space.dingtalk.com/auth/download') === 0) {
iframe.src = url
} else if (url.indexOf('https://space.dingtalk.com/attachment') === 0) {
iframe.src = url
}
return op.call(window, url, ...args)
}
Expand Down

0 comments on commit b79c5de

Please sign in to comment.