MOMO0302-02 ef6f73ae27 fix(macos): register the login item through Service Management
`checkAutoRun` / `enableAutoRun` / `disableAutoRun` drove macOS auto start by
sending Apple events to System Events (`osascript -e 'tell application "System
Events" ...'`). That path fails in several ways that all look identical to the
user, because the switch state is re-read from `checkAutoRun` right after the
write and simply snaps back with no error:

- The app ships with `hardenedRuntime: true` but neither the
  `com.apple.security.automation.apple-events` entitlement
  (`build/entitlements.mac.plist`) nor `NSAppleEventsUsageDescription`
  (`electron-builder.yml` `mac.extendInfo`), so the Automation request against
  System Events can be denied outright instead of prompting.
- `checkAutoRun` matched the login item by
  `exePath().split('.app')[0].replace('/Applications/', '')` against a list of
  login item *names*. Outside `/Applications` the needle is an absolute path and
  can never match, so the switch stays off even after the item was created.
- `disableAutoRun` deleted the item by that same guessed name and threw when it
  did not exist.

Use Electron's own login item API instead, which goes through
`SMAppService` on macOS 13+ and `LSSharedFileList` below that. No Apple event,
no name guessing, and the read-back state comes from the OS. Registration
failures now surface the `SMAppService` status instead of silently doing
nothing.

Login items written by earlier versions through System Events are not managed by
Service Management, so they are cleaned up (best effort) when the user toggles
auto start, otherwise the app would launch twice at login.

Closes #1302
Closes #1102

(cherry picked from commit 3784139f951896c4818add5374e2cf8a858644fd)
2026-09-12 14:38:25 +08:00
2026-07-01 08:46:41 +08:00
2026-04-01 08:18:15 +08:00
2026-04-01 08:18:15 +08:00
2024-08-07 09:48:27 +08:00
2026-07-01 08:46:41 +08:00
2024-08-07 09:48:27 +08:00
2024-08-07 09:48:59 +08:00
2026-09-09 12:17:51 +08:00
2024-08-07 09:48:27 +08:00
2026-07-01 08:46:41 +08:00
2026-07-01 08:46:41 +08:00

Another Mihomo GUI

本项目认证稳定机场推荐:“狗狗加速

狗狗加速 —— 技术流机场 Doggygo VPN
  • 高性能海外机场,稳定首选,海外团队,无跑路风险
  • Clash Party专属8折优惠码party仅有500份
  • Party专属链接注册送 3 天,每天 1G 流量 免费试用
  • 优惠套餐每月仅需 15.8 元160G 流量,年付 8 折
  • 全球首家支持Hysteria1/2 协议集群负载均衡设计高速专线基于最新UDP quic技术极低延迟无视晚高峰4K 秒开配合Clash Party食用更省心
  • 解锁流媒体及 ChatGPT
  • 官网:https://狗狗加速.com

特性

  • 一键 Smart Core 规则覆写,基于 AI 模型自动选择最优节点 详细介绍请看 这里
  • 开箱即用,无需服务模式的 Tun
  • 多种配色主题可选UI 焕然一新
  • 支持大部分 Mihomo(Clash Meta) 常用配置修改
  • 内置 Smart内核 与 Mihomo(Clash Meta) 内核
  • 通过 WebDAV 一键备份和恢复配置
  • 强大的覆写功能,任意修订配置文件
  • 深度集成 Sub-Store轻松管理订阅

安装/使用指南见 官方文档

Description
No description provided
Readme GPL-3.0 41 MiB
Languages
TypeScript 89.5%
JavaScript 8.9%
Shell 1.2%
CSS 0.2%
NSIS 0.1%