Code Monkey home page Code Monkey logo

Comments (4)

Ericwyn avatar Ericwyn commented on June 1, 2024 2

electron-lark/src/main.js

Lines 82 to 111 in f470033

// feishu.cn/calendar/ 日历
// feishu.cn/space/home/ 文档
// console.log("打开 url " + url)
event.preventDefault()
// hack 所有新页面的打开
// 如果是跳转外部连接的话, 用默认浏览器打开
if(url.indexOf("https://security.feishu.cn/link/safety?target=") == 0){
url = url.replace("https://security.feishu.cn/link/safety?target=", "")
url = decodeURIComponent(url);
shell.openExternal(url)
return;
} else {
// 如果不是跳转到外部的链接
// 将所有打开的新页面的 user agent 也重新设置,避免提示浏览器错误
const win = new BrowserWindow({
width: 1200,
height: 600,
webContents: options.webContents,
show: false
})
win.once('ready-to-show', () => win.show())
if (!options.webContents) {
win.loadURL(url,{
userAgent : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36"
})
}
event.newGuest = win;
}

修改成

            url = decodeURIComponent(url);
            shell.openExternal(url)
            return;

应该就可以了

from electron-lark.

Ericwyn avatar Ericwyn commented on June 1, 2024

当前的逻辑是如果 url 是飞书内部链接的话,就在窗口打开,否则使用浏览器打开

之前发现如果飞书内部有外链的话,链接之前会加https://security.feishu.cn/link/safety?target= 这样的前缀
所以当前就是以这个前缀来判断是否是外部链接,如果包含该前缀的话,去除前缀之后的链接会调用浏览器打开
否则会使用内部窗口打开

之所以这样做是为了在内部窗口打开文档/日历,避免了外部 chrome 打开时候还需要重新登录

你能提供以下你聊天记录当中的链接么?看看格式

from electron-lark.

Cqjn-zyk avatar Cqjn-zyk commented on June 1, 2024

http://gerrit.xxxxxxxcn/#/c/66666/ 没有固定的链接,我希望都在chrome打开,你能告诉我在哪里改下吗

from electron-lark.

Cqjn-zyk avatar Cqjn-zyk commented on June 1, 2024

可以了,多谢

from electron-lark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.