初始化:私有维护版 Gemini-in-Chrome 安装脚本

从 appsail/Gemini-in-Chrome 下载后重写 install.sh / install.ps1:
- 原脚本用正则/sed 做“仅替换已存在字段”,字段本不存在时静默不生效
- 改为 JSON 感知读写(jq 优先,探测/自动装失败时降级为 sed+awk 零依赖兜底)
- 修复过程中实测发现并修掉的坑:BSD sed 不支持 GNU 的 0,/re/ 插入语法、
  正则不容忍冒号后空格导致插入重复 key、macOS 系统自带 bash 3.2 在脚本文件模式下
  中文紧跟未加花括号的 $VAR 会解析错位丢字节
- 新增 test-fixtures/ 下完全人工构造(非真实数据脱敏)的多 profile 测试样本
This commit is contained in:
Shunzhi Jiang
2026-08-16 13:18:27 +08:00
commit ebcebac22a
6 changed files with 615 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
# Gemini in Chrome
One-click script to enable Chrome's built-in Gemini AI features for non-US users.
## Quick Start
### macOS / Linux
```bash
curl -fsSL https://raw.githubusercontent.com/appsail/Gemini-in-Chrome/main/install.sh | bash
```
### Windows
Open PowerShell and run:
```powershell
irm https://raw.githubusercontent.com/appsail/Gemini-in-Chrome/main/install.ps1 | iex
```
## What It Does
1. ✅ Checks if Chrome is running (prompts you to close it)
2. 💾 Backs up your config (`Local State.bak`)
3. 🔧 Patches these settings:
- `is_glic_eligible`: `false``true`
- `variations_country`: → `us`
- `variations_permanent_consistency_country`: → `us`
4. ✓ Verifies changes were applied
## Restore Original Config
**macOS:**
```bash
mv ~/Library/Application\ Support/Google/Chrome/Local\ State.bak \
~/Library/Application\ Support/Google/Chrome/Local\ State
```
**Linux:**
```bash
mv ~/.config/google-chrome/Local\ State.bak \
~/.config/google-chrome/Local\ State
```
**Windows PowerShell:**
```powershell
Move-Item -Path "$env:LOCALAPPDATA\Google\Chrome\User Data\Local State.bak" `
-Destination "$env:LOCALAPPDATA\Google\Chrome\User Data\Local State" -Force
```
## Safety
- Original config is backed up before any changes
- Only modifies local Chrome settings
- No data uploaded, no network access (except downloading the script)
- Easily reversible
- Unofficial, open source, use at your own risk
## Config Paths
| OS | Path |
|----|------|
| macOS | `~/Library/Application Support/Google/Chrome/Local State` |
| Linux | `~/.config/google-chrome/Local State` |
| Windows | `%LOCALAPPDATA%\Google\Chrome\User Data\Local State` |
## Issues
Found a bug? [Open an issue](https://github.com/appsail/Gemini-in-Chrome/issues).
## License
MIT