Skip to content

iamwsll/open_in_atlas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Open in Atlas

Chrome 扩展 + macOS Native Messaging helper,帮助你把当前 Chrome 标签页交给 ChatGPT Atlas 打开。

核心作用就是点击拓展栏的拓展图标后,自动把当前chrome打开的网站使用atlas打开.由于本身chrome的限制,无法做到在插件商店上架.请将仓库clone到本地后按照下面的安装步骤进行操作即可.涉及到的代码您可以自行review是否有安全问题.

目录结构

  • extension/:Manifest V3 扩展,包含 action service worker(点击扩展图标即触发)。
  • native-host/open_in_atlas_host.py:本地 helper,接收 URL 并执行 open -a "ChatGPT Atlas" <url>
  • native-host/install_host.py:辅助脚本,用于生成 Native Messaging manifest。

安装步骤

  1. 准备环境

    • macOS 14.2+,已安装 ChatGPT Atlas(默认位于 /Applications/ChatGPT Atlas.app)。
    • Python 3.9+(系统自带即可)。
  2. 加载 Chrome 扩展

    • 打开 chrome://extensions,开启“开发者模式”。
    • 点击“加载已解压的扩展程序”,选择仓库内的 extension/ 目录。
    • 记下 Chrome 为该扩展分配的 ID(形如 abcdefg...)。
  3. 安装 Native Messaging host

    • 赋予 helper 执行权限(如果尚未执行过):
      chmod +x native-host/open_in_atlas_host.py
    • 运行安装脚本生成 manifest(将 <EXTENSION_ID> 替换为上一步记下的值):
      ./native-host/install_host.py <EXTENSION_ID>
    • 默认会把 manifest 写入 ~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.openinatlas.bridge.json,其内容大致如下:
      {
        "name": "com.openinatlas.bridge",
        "description": "Open current Chrome tab in ChatGPT Atlas",
        "path": "/绝对路径/native-host/open_in_atlas_host.py",
        "type": "stdio",
        "allowed_origins": [
          "chrome-extension://<EXTENSION_ID>/"
        ]
      }
    • 如果你使用的是 Beta/Enterprise 版 Chrome,或需要安装到 Chrome for Work,请通过 --dir 参数改写目标目录。
  4. 重启 Chrome 以让新的 Native Messaging host 生效。

为什么一定要执行 install_host.py

Chrome 扩展自身无法在用户电脑上创建/修改 Native Messaging manifest——Google 只允许通过本地安装器或用户脚本把 manifest 写入 NativeMessagingHosts 目录,以防扩展随意投递可执行程序。因此我们必须提供一个独立脚本来告诉 Chrome:哪个扩展 ID 被允许与本地 helper 通信、helper 在哪条路径。没有 manifest,Chrome 不会启动 helper,也就无法打开 Atlas。

使用方式

  • 点击 Chrome 工具栏中的扩展图标,service worker 会立即获取当前活动标签页的 URL 并请求 helper。
  • 扩展会在图标上短暂显示 OK / ERR 徽标提示执行结果。
  • helper 依旧使用 open -a "ChatGPT Atlas" <url>(并在必要时自动定位 Atlas 安装路径)把链接交给 Atlas;仅允许 http://https://

调试/日志

  • Native Messaging helper 会把日志写到 stderr,可在 Console.app 或用终端手动运行脚本查看。
  • 如果徽标长期显示 ERR,请确认 Atlas 位于 /Applications(或 ~/Applications),并可通过 open -a "ChatGPT Atlas" https://example.com 正常启动。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published