codex-overleaf-link 1.9.6 → 1.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/extension/bootstrap/manifest.template.json +1 -1
- package/extension/bootstrap/update.css +366 -0
- package/extension/bootstrap/update.html +55 -0
- package/extension/bootstrap/update.js +334 -0
- package/extension/src/popup.js +21 -2
- package/extension/src/shared/compatibility.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1>Codex Overleaf Link</h1>
|
|
4
4
|
<p><strong>Empower Overleaf with Codex.</strong></p>
|
|
5
5
|
<p>
|
|
6
|
-
<img src="https://img.shields.io/badge/version-1.9.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.9.7-blue" alt="version">
|
|
7
7
|
<img src="https://img.shields.io/badge/platform-macOS%20%2F%20Windows%20%2F%20Linux-lightgrey" alt="platform">
|
|
8
8
|
<img src="https://img.shields.io/badge/chrome-MV3-green" alt="chrome manifest v3">
|
|
9
9
|
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node version">
|
|
@@ -38,14 +38,14 @@ One command installs the managed native host **and** managed extension runtime.
|
|
|
38
38
|
macOS / Linux:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
CODEX_OVERLEAF_REF=v1.9.
|
|
41
|
+
CODEX_OVERLEAF_REF=v1.9.7 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.7/install.sh)"
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Windows PowerShell:
|
|
45
45
|
|
|
46
46
|
```powershell
|
|
47
|
-
iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.
|
|
48
|
-
$env:CODEX_OVERLEAF_REF='v1.9.
|
|
47
|
+
iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.7/install.ps1 -OutFile install.ps1
|
|
48
|
+
$env:CODEX_OVERLEAF_REF='v1.9.7'
|
|
49
49
|
powershell -ExecutionPolicy Bypass -File install.ps1
|
|
50
50
|
```
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@ Then, in the `chrome://extensions` tab the script opened: enable **Developer mod
|
|
|
56
56
|
`npm exec` installs the same managed native host and extension runtime without keeping a source checkout. Use it if you prefer a pinned npm package.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
59
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- install-managed
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Then, in `chrome://extensions`, enable **Developer mode**, click **Load unpacked**, and select the managed extension path printed by the command. The Release extension zip remains available for explicitly unmanaged/manual installations.
|
|
@@ -86,9 +86,9 @@ npm installs, updates, and uninstalls the coordinated managed extension/native p
|
|
|
86
86
|
|
|
87
87
|
| Action | Command |
|
|
88
88
|
|--------|---------|
|
|
89
|
-
| Install / update | `npm exec --yes codex-overleaf-link@1.9.
|
|
90
|
-
| Diagnose | `npm exec --yes codex-overleaf-link@1.9.
|
|
91
|
-
| Uninstall | `npm exec --yes codex-overleaf-link@1.9.
|
|
89
|
+
| Install / update | `npm exec --yes codex-overleaf-link@1.9.7 -- install-managed` |
|
|
90
|
+
| Diagnose | `npm exec --yes codex-overleaf-link@1.9.7 -- doctor` |
|
|
91
|
+
| Uninstall | `npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed` |
|
|
92
92
|
|
|
93
93
|
Use `--extension-id <chrome-extension-id>` only for a custom/dev unpacked extension id that differs from the official bundled id.
|
|
94
94
|
|
|
@@ -98,13 +98,13 @@ Managed installations discover signed stable updates automatically and apply the
|
|
|
98
98
|
|
|
99
99
|
## GitHub Release Artifacts
|
|
100
100
|
|
|
101
|
-
The v1.9.
|
|
101
|
+
The v1.9.7 GitHub Release contains:
|
|
102
102
|
|
|
103
|
-
- `codex-overleaf-link-extension-v1.9.
|
|
104
|
-
- `codex-overleaf-native-host-v1.9.
|
|
105
|
-
- `codex-overleaf-link-1.9.
|
|
106
|
-
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v1.9.
|
|
107
|
-
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.
|
|
103
|
+
- `codex-overleaf-link-extension-v1.9.7.zip`: loadable Chrome extension package for manual unpacked installation.
|
|
104
|
+
- `codex-overleaf-native-host-v1.9.7.tar.gz`: native host runtime files used by the installer and release verification.
|
|
105
|
+
- `codex-overleaf-link-1.9.7.tgz`: npm native host CLI package for pinned install, doctor, and uninstall flows.
|
|
106
|
+
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v1.9.7` when run directly from the release artifact.
|
|
107
|
+
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.7` when run directly from the release artifact.
|
|
108
108
|
- `uninstall-native-host.mjs`: native host uninstaller that removes the Chrome Native Messaging manifest, bridge executable, and runtime copy.
|
|
109
109
|
- `nativeHostPlatform.js`, `manifest.js`, `runtimeInstaller.js`: helper files required by the loose uninstaller asset.
|
|
110
110
|
- `SHA256SUMS` and `release-manifest.json`: checksum and artifact metadata for release verification.
|
|
@@ -115,7 +115,7 @@ The v1.9.6 GitHub Release contains:
|
|
|
115
115
|
Remove the native host (use `--browser chromium` on Linux Chromium):
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
118
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
The same command works on Windows PowerShell. If you installed from a manual checkout or source installer, you can also run `npm run uninstall:native` inside the repo, use `node ~/.codex-overleaf/source/scripts/uninstall-native-host.mjs` on macOS / Linux, or use `node $env:LOCALAPPDATA\CodexOverleaf\source\scripts\uninstall-native-host.mjs` on Windows PowerShell.
|
|
@@ -150,13 +150,13 @@ Then remove the extension from `chrome://extensions`. To delete local data: on m
|
|
|
150
150
|
Linux Chromium install or update:
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
CODEX_OVERLEAF_REF=v1.9.
|
|
153
|
+
CODEX_OVERLEAF_REF=v1.9.7 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.7/install.sh)" -- --browser chromium
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
Linux Chromium uninstall:
|
|
157
157
|
|
|
158
158
|
```bash
|
|
159
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
159
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed --browser chromium
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
## Features
|
|
@@ -291,7 +291,7 @@ Composer attachments are turn-scoped Codex context. Limits are 8 attachments per
|
|
|
291
291
|
Re-run any [native host installer](#install), reload the extension in `chrome://extensions`, then refresh the Overleaf tab. This also fixes extension/native version mismatch and native protocol mismatch.
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
294
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- install-managed
|
|
295
295
|
```
|
|
296
296
|
|
|
297
297
|
**The Windows popup or panel shows a Bash recovery command**
|
|
@@ -340,8 +340,8 @@ Use this matrix for release-candidate signoff and compatibility reports. Record
|
|
|
340
340
|
| Browser/channel/version | Google Chrome channel and version. | Google Chrome channel and version. | Google Chrome channel and version. | Chromium channel/package and version. |
|
|
341
341
|
| Install mode | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout; native host installed with `--browser chromium`. |
|
|
342
342
|
| Extension id | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. |
|
|
343
|
-
| Installer/update command | `npm exec --yes codex-overleaf-link@1.9.
|
|
344
|
-
| Uninstall command | `npm exec --yes codex-overleaf-link@1.9.
|
|
343
|
+
| Installer/update command | `npm exec --yes codex-overleaf-link@1.9.7 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- install-managed --browser chromium` |
|
|
344
|
+
| Uninstall command | `npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-managed --browser chromium` |
|
|
345
345
|
| Manifest/registry path | `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.codex.overleaf.json` | `HKCU\Software\Google\Chrome\NativeMessagingHosts\com.codex.overleaf` -> `%LOCALAPPDATA%\CodexOverleaf\native-host-runtime\com.codex.overleaf.json` | `~/.config/google-chrome/NativeMessagingHosts/com.codex.overleaf.json` | `~/.config/chromium/NativeMessagingHosts/com.codex.overleaf.json` |
|
|
346
346
|
| Bridge/runtime/source path | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. | Bridge `%LOCALAPPDATA%\CodexOverleaf\codex-overleaf-bridge.cmd`; runtime `%LOCALAPPDATA%\CodexOverleaf\native-host-runtime`; source `%LOCALAPPDATA%\CodexOverleaf\source`. | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. |
|
|
347
347
|
| Node/Git/Codex/TeX | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. |
|
|
@@ -377,7 +377,7 @@ Contributions are welcome. Please open an issue before submitting large changes
|
|
|
377
377
|
The recommended v1.9 installation owns one stable unpacked-extension directory and a versioned native-host directory:
|
|
378
378
|
|
|
379
379
|
```bash
|
|
380
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
380
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- install-managed
|
|
381
381
|
```
|
|
382
382
|
|
|
383
383
|
Load the printed extension path once from `chrome://extensions`. Starting with the next signed stable release, Codex Overleaf Link checks GitHub Releases automatically, downloads and verifies the coordinated extension/native-host bundle, waits until every connected Overleaf tab is saved and idle, and then updates both components together. A failed health check restores the previous version automatically.
|
|
@@ -387,11 +387,11 @@ The stable updater ignores drafts and prereleases, performs no telemetry, and ca
|
|
|
387
387
|
The legacy native-only installer remains available for source or unmanaged extension directories:
|
|
388
388
|
|
|
389
389
|
```bash
|
|
390
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
390
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- install-native
|
|
391
391
|
```
|
|
392
392
|
|
|
393
393
|
Legacy native-only installations can be removed with:
|
|
394
394
|
|
|
395
395
|
```bash
|
|
396
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
396
|
+
npm exec --yes codex-overleaf-link@1.9.7 -- uninstall-native
|
|
397
397
|
```
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: dark;
|
|
3
|
+
--canvas: #101310;
|
|
4
|
+
--surface: #171b17;
|
|
5
|
+
--line: rgba(215, 230, 217, 0.13);
|
|
6
|
+
--line-strong: rgba(215, 230, 217, 0.24);
|
|
7
|
+
--text: #f1f4ef;
|
|
8
|
+
--muted: #a4aca4;
|
|
9
|
+
--quiet: #747d75;
|
|
10
|
+
--green: #86dc94;
|
|
11
|
+
--blue: #6eb5ff;
|
|
12
|
+
--amber: #e2bc70;
|
|
13
|
+
--red: #f28b82;
|
|
14
|
+
--shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
|
|
15
|
+
font-family: "Avenir Next", "Segoe UI", sans-serif;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
* {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
html,
|
|
23
|
+
body {
|
|
24
|
+
min-width: 390px;
|
|
25
|
+
min-height: 500px;
|
|
26
|
+
margin: 0;
|
|
27
|
+
background:
|
|
28
|
+
radial-gradient(circle at 88% 5%, rgba(70, 131, 105, 0.17), transparent 34%),
|
|
29
|
+
radial-gradient(circle at 8% 88%, rgba(53, 100, 151, 0.13), transparent 38%),
|
|
30
|
+
var(--canvas);
|
|
31
|
+
color: var(--text);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
button {
|
|
39
|
+
font: inherit;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.update-shell {
|
|
43
|
+
width: min(100%, 440px);
|
|
44
|
+
min-height: 500px;
|
|
45
|
+
margin: 0 auto;
|
|
46
|
+
padding: 26px 26px 22px;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
animation: shell-enter 180ms ease-out both;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.update-header {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: flex-start;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
gap: 20px;
|
|
57
|
+
padding-bottom: 22px;
|
|
58
|
+
border-bottom: 1px solid var(--line);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.eyebrow,
|
|
62
|
+
.update-kind,
|
|
63
|
+
.version-route,
|
|
64
|
+
.update-detail,
|
|
65
|
+
.persistence-note {
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.eyebrow {
|
|
70
|
+
color: var(--text);
|
|
71
|
+
font-size: 15px;
|
|
72
|
+
font-weight: 700;
|
|
73
|
+
letter-spacing: -0.01em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.update-kind {
|
|
77
|
+
margin-top: 3px;
|
|
78
|
+
color: var(--muted);
|
|
79
|
+
font-size: 12px;
|
|
80
|
+
letter-spacing: 0.08em;
|
|
81
|
+
text-transform: uppercase;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.status-badge {
|
|
85
|
+
min-height: 26px;
|
|
86
|
+
padding: 5px 9px;
|
|
87
|
+
border: 1px solid var(--line-strong);
|
|
88
|
+
border-radius: 999px;
|
|
89
|
+
color: var(--muted);
|
|
90
|
+
background: rgba(255, 255, 255, 0.025);
|
|
91
|
+
font-size: 11px;
|
|
92
|
+
font-weight: 700;
|
|
93
|
+
letter-spacing: 0.02em;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.status-badge[data-tone="success"] {
|
|
98
|
+
border-color: rgba(134, 220, 148, 0.34);
|
|
99
|
+
color: var(--green);
|
|
100
|
+
background: rgba(72, 143, 84, 0.11);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.status-badge[data-tone="active"] {
|
|
104
|
+
border-color: rgba(110, 181, 255, 0.34);
|
|
105
|
+
color: var(--blue);
|
|
106
|
+
background: rgba(60, 115, 170, 0.12);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.status-badge[data-tone="warning"] {
|
|
110
|
+
border-color: rgba(226, 188, 112, 0.34);
|
|
111
|
+
color: var(--amber);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.status-badge[data-tone="error"] {
|
|
115
|
+
border-color: rgba(242, 139, 130, 0.38);
|
|
116
|
+
color: var(--red);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.update-summary {
|
|
120
|
+
padding: 27px 0 18px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.version-route {
|
|
124
|
+
color: var(--green);
|
|
125
|
+
font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
126
|
+
letter-spacing: 0.01em;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
h1 {
|
|
130
|
+
margin: 8px 0 8px;
|
|
131
|
+
max-width: 350px;
|
|
132
|
+
font-size: 27px;
|
|
133
|
+
line-height: 1.13;
|
|
134
|
+
letter-spacing: -0.035em;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.update-detail {
|
|
138
|
+
max-width: 370px;
|
|
139
|
+
color: var(--muted);
|
|
140
|
+
font-size: 13px;
|
|
141
|
+
line-height: 1.55;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.progress-track {
|
|
145
|
+
position: relative;
|
|
146
|
+
width: 100%;
|
|
147
|
+
height: 3px;
|
|
148
|
+
margin: 1px 0 24px;
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
border-radius: 999px;
|
|
151
|
+
background: rgba(255, 255, 255, 0.09);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.progress-fill {
|
|
155
|
+
display: block;
|
|
156
|
+
width: 0;
|
|
157
|
+
height: 100%;
|
|
158
|
+
border-radius: inherit;
|
|
159
|
+
background: linear-gradient(90deg, var(--blue), var(--green));
|
|
160
|
+
box-shadow: 0 0 15px rgba(110, 181, 255, 0.38);
|
|
161
|
+
transition: width 240ms ease;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.progress-track[data-indeterminate="true"] .progress-fill {
|
|
165
|
+
width: 36%;
|
|
166
|
+
animation: progress-scan 1.25s ease-in-out infinite;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.update-stages {
|
|
170
|
+
margin: 0;
|
|
171
|
+
padding: 0;
|
|
172
|
+
list-style: none;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.update-stages li {
|
|
176
|
+
position: relative;
|
|
177
|
+
display: grid;
|
|
178
|
+
grid-template-columns: 28px 1fr;
|
|
179
|
+
gap: 12px;
|
|
180
|
+
min-height: 62px;
|
|
181
|
+
color: var(--quiet);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.update-stages li:not(:last-child)::after {
|
|
185
|
+
content: "";
|
|
186
|
+
position: absolute;
|
|
187
|
+
top: 27px;
|
|
188
|
+
bottom: 1px;
|
|
189
|
+
left: 13px;
|
|
190
|
+
width: 1px;
|
|
191
|
+
background: var(--line-strong);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.stage-marker {
|
|
195
|
+
position: relative;
|
|
196
|
+
z-index: 1;
|
|
197
|
+
display: grid;
|
|
198
|
+
place-items: center;
|
|
199
|
+
width: 27px;
|
|
200
|
+
height: 27px;
|
|
201
|
+
border: 1px solid var(--line-strong);
|
|
202
|
+
border-radius: 50%;
|
|
203
|
+
background: var(--canvas);
|
|
204
|
+
color: var(--quiet);
|
|
205
|
+
font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.update-stages strong,
|
|
209
|
+
.update-stages small {
|
|
210
|
+
display: block;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.update-stages strong {
|
|
214
|
+
padding-top: 2px;
|
|
215
|
+
color: inherit;
|
|
216
|
+
font-size: 13px;
|
|
217
|
+
line-height: 1.25;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.update-stages small {
|
|
221
|
+
margin-top: 4px;
|
|
222
|
+
color: var(--quiet);
|
|
223
|
+
font-size: 11px;
|
|
224
|
+
line-height: 1.35;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.update-stages li[data-state="active"] {
|
|
228
|
+
color: var(--text);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.update-stages li[data-state="active"] .stage-marker {
|
|
232
|
+
border-color: var(--blue);
|
|
233
|
+
color: var(--canvas);
|
|
234
|
+
background: var(--blue);
|
|
235
|
+
box-shadow: 0 0 0 4px rgba(110, 181, 255, 0.1);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.update-stages li[data-state="done"] {
|
|
239
|
+
color: var(--green);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.update-stages li[data-state="done"] .stage-marker {
|
|
243
|
+
border-color: rgba(134, 220, 148, 0.5);
|
|
244
|
+
color: var(--green);
|
|
245
|
+
background: rgba(82, 155, 94, 0.14);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.update-stages li[data-state="error"] {
|
|
249
|
+
color: var(--red);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.update-stages li[data-state="error"] .stage-marker {
|
|
253
|
+
border-color: rgba(242, 139, 130, 0.62);
|
|
254
|
+
color: var(--red);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.persistence-note {
|
|
258
|
+
margin-top: 5px;
|
|
259
|
+
padding: 12px 0 15px;
|
|
260
|
+
border-top: 1px solid var(--line);
|
|
261
|
+
color: var(--muted);
|
|
262
|
+
font-size: 11px;
|
|
263
|
+
line-height: 1.45;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.technical-details {
|
|
267
|
+
margin: 0 0 14px;
|
|
268
|
+
color: var(--muted);
|
|
269
|
+
font-size: 11px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.technical-details summary {
|
|
273
|
+
cursor: pointer;
|
|
274
|
+
color: var(--muted);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.technical-details pre {
|
|
278
|
+
max-height: 100px;
|
|
279
|
+
margin: 9px 0 0;
|
|
280
|
+
padding: 10px;
|
|
281
|
+
overflow: auto;
|
|
282
|
+
border-radius: 8px;
|
|
283
|
+
background: rgba(0, 0, 0, 0.24);
|
|
284
|
+
color: #cbd1cb;
|
|
285
|
+
font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
286
|
+
white-space: pre-wrap;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.update-actions {
|
|
290
|
+
display: flex;
|
|
291
|
+
justify-content: flex-end;
|
|
292
|
+
gap: 9px;
|
|
293
|
+
margin-top: auto;
|
|
294
|
+
padding-top: 4px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.update-actions button {
|
|
298
|
+
min-height: 36px;
|
|
299
|
+
padding: 0 15px;
|
|
300
|
+
border: 1px solid var(--line-strong);
|
|
301
|
+
border-radius: 8px;
|
|
302
|
+
color: var(--text);
|
|
303
|
+
background: rgba(255, 255, 255, 0.035);
|
|
304
|
+
font-size: 12px;
|
|
305
|
+
font-weight: 700;
|
|
306
|
+
cursor: pointer;
|
|
307
|
+
transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.update-actions button:hover {
|
|
311
|
+
border-color: rgba(215, 230, 217, 0.38);
|
|
312
|
+
background: rgba(255, 255, 255, 0.075);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.update-actions button:active {
|
|
316
|
+
transform: translateY(1px);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.update-actions button:focus-visible,
|
|
320
|
+
.technical-details summary:focus-visible {
|
|
321
|
+
outline: 2px solid var(--blue);
|
|
322
|
+
outline-offset: 2px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.update-actions button[data-kind="primary"] {
|
|
326
|
+
border-color: #4f9ce5;
|
|
327
|
+
color: #08131e;
|
|
328
|
+
background: linear-gradient(180deg, #77bdff, #5aa8ee);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.update-actions button[data-kind="primary"]:hover {
|
|
332
|
+
border-color: #8bc9ff;
|
|
333
|
+
background: linear-gradient(180deg, #87c7ff, #67b1f3);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.update-actions button[data-kind="quiet"] {
|
|
337
|
+
border-color: transparent;
|
|
338
|
+
color: var(--muted);
|
|
339
|
+
background: transparent;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.update-actions button:disabled {
|
|
343
|
+
opacity: 0.5;
|
|
344
|
+
cursor: default;
|
|
345
|
+
transform: none;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@keyframes shell-enter {
|
|
349
|
+
from { opacity: 0; transform: translateY(5px); }
|
|
350
|
+
to { opacity: 1; transform: translateY(0); }
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
@keyframes progress-scan {
|
|
354
|
+
from { transform: translateX(-120%); }
|
|
355
|
+
to { transform: translateX(380%); }
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
@media (prefers-reduced-motion: reduce) {
|
|
359
|
+
*,
|
|
360
|
+
*::before,
|
|
361
|
+
*::after {
|
|
362
|
+
animation-duration: 0.01ms !important;
|
|
363
|
+
animation-iteration-count: 1 !important;
|
|
364
|
+
transition-duration: 0.01ms !important;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Codex Overleaf Link Update</title>
|
|
7
|
+
<link rel="stylesheet" href="update.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<main class="update-shell" aria-labelledby="update-title">
|
|
11
|
+
<header class="update-header">
|
|
12
|
+
<div>
|
|
13
|
+
<p class="eyebrow">Codex Overleaf Link</p>
|
|
14
|
+
<p class="update-kind">Stable Update</p>
|
|
15
|
+
</div>
|
|
16
|
+
<span id="status-badge" class="status-badge" data-tone="neutral">Ready</span>
|
|
17
|
+
</header>
|
|
18
|
+
|
|
19
|
+
<section class="update-summary" aria-live="polite" aria-atomic="true">
|
|
20
|
+
<p id="version-route" class="version-route">Checking installed version</p>
|
|
21
|
+
<h1 id="update-title">Checking for updates</h1>
|
|
22
|
+
<p id="update-detail" class="update-detail">Reading the latest saved update state.</p>
|
|
23
|
+
</section>
|
|
24
|
+
|
|
25
|
+
<div id="progress-track" class="progress-track" role="progressbar" aria-label="Update progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" hidden>
|
|
26
|
+
<span id="progress-fill" class="progress-fill"></span>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<ol id="update-stages" class="update-stages" aria-label="Update stages">
|
|
30
|
+
<li data-stage="download">
|
|
31
|
+
<span class="stage-marker" aria-hidden="true">1</span>
|
|
32
|
+
<span><strong>Download and verify</strong><small>Fetch the signed stable release and verify its manifest.</small></span>
|
|
33
|
+
</li>
|
|
34
|
+
<li data-stage="safe-point">
|
|
35
|
+
<span class="stage-marker" aria-hidden="true">2</span>
|
|
36
|
+
<span><strong>Wait for a safe point</strong><small>Protect active Overleaf work before changing runtime files.</small></span>
|
|
37
|
+
</li>
|
|
38
|
+
<li data-stage="restart">
|
|
39
|
+
<span class="stage-marker" aria-hidden="true">3</span>
|
|
40
|
+
<span><strong>Restart and health check</strong><small>Activate Extension and Native Host together, then verify both.</small></span>
|
|
41
|
+
</li>
|
|
42
|
+
</ol>
|
|
43
|
+
|
|
44
|
+
<p id="persistence-note" class="persistence-note">This window can stay open while work continues elsewhere. Progress is saved automatically.</p>
|
|
45
|
+
|
|
46
|
+
<details id="technical-details" class="technical-details" hidden>
|
|
47
|
+
<summary>Technical details</summary>
|
|
48
|
+
<pre id="technical-message"></pre>
|
|
49
|
+
</details>
|
|
50
|
+
|
|
51
|
+
<footer id="update-actions" class="update-actions" aria-label="Update actions"></footer>
|
|
52
|
+
</main>
|
|
53
|
+
<script src="update.js"></script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const MESSAGE_TYPES = Object.freeze({
|
|
5
|
+
get: 'codex-overleaf/consent-update-get-state',
|
|
6
|
+
check: 'codex-overleaf/consent-update-check',
|
|
7
|
+
install: 'codex-overleaf/consent-update-install',
|
|
8
|
+
later: 'codex-overleaf/consent-update-later',
|
|
9
|
+
retry: 'codex-overleaf/consent-update-check'
|
|
10
|
+
});
|
|
11
|
+
const ACTIVE_PHASES = new Set([
|
|
12
|
+
'checking',
|
|
13
|
+
'downloading',
|
|
14
|
+
'staged',
|
|
15
|
+
'waiting',
|
|
16
|
+
'waiting_for_idle',
|
|
17
|
+
'waiting_for_safe_point',
|
|
18
|
+
'applying',
|
|
19
|
+
'awaiting_health',
|
|
20
|
+
'awaiting_health_check',
|
|
21
|
+
'health_checking'
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const elements = {
|
|
25
|
+
badge: document.getElementById('status-badge'),
|
|
26
|
+
title: document.getElementById('update-title'),
|
|
27
|
+
route: document.getElementById('version-route'),
|
|
28
|
+
detail: document.getElementById('update-detail'),
|
|
29
|
+
progressTrack: document.getElementById('progress-track'),
|
|
30
|
+
progressFill: document.getElementById('progress-fill'),
|
|
31
|
+
stages: Array.from(document.querySelectorAll('#update-stages > li')),
|
|
32
|
+
note: document.getElementById('persistence-note'),
|
|
33
|
+
details: document.getElementById('technical-details'),
|
|
34
|
+
technicalMessage: document.getElementById('technical-message'),
|
|
35
|
+
actions: document.getElementById('update-actions')
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
let currentView = {};
|
|
39
|
+
let pollTimer = null;
|
|
40
|
+
let refreshTimer = null;
|
|
41
|
+
let actionPending = false;
|
|
42
|
+
|
|
43
|
+
function asObject(value) {
|
|
44
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function unwrapResponse(response) {
|
|
48
|
+
const root = asObject(response) || {};
|
|
49
|
+
if (root.ok === false) {
|
|
50
|
+
const error = new Error(root.error?.message || root.message || 'Update action failed.');
|
|
51
|
+
error.code = root.error?.code || root.code || 'update_failed';
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
const candidates = [
|
|
55
|
+
root.view,
|
|
56
|
+
root.result?.view,
|
|
57
|
+
root.result,
|
|
58
|
+
root.updateConsent,
|
|
59
|
+
root.updateState,
|
|
60
|
+
root.state
|
|
61
|
+
];
|
|
62
|
+
return candidates.find(asObject) || root;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function request(action) {
|
|
66
|
+
const type = MESSAGE_TYPES[action];
|
|
67
|
+
if (!type) throw new Error(`Unsupported update action: ${action}`);
|
|
68
|
+
return unwrapResponse(await chrome.runtime.sendMessage({ type }));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function phaseOf(view) {
|
|
72
|
+
const value = view.phase || view.status || view.state || view.lifecycle || 'idle';
|
|
73
|
+
return typeof value === 'string' ? value.toLowerCase().replace(/[- ]+/g, '_') : 'idle';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function versionOf(view, candidates, fallback = '') {
|
|
77
|
+
for (const key of candidates) {
|
|
78
|
+
const value = view[key];
|
|
79
|
+
if (typeof value === 'string' && value.trim()) return value.trim().replace(/^v/i, '');
|
|
80
|
+
}
|
|
81
|
+
return fallback;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function presentationFor(view) {
|
|
85
|
+
const phase = phaseOf(view);
|
|
86
|
+
const presentations = {
|
|
87
|
+
idle: ['Stable updates', 'Automatically checks signed stable releases.', 'Ready', 'neutral'],
|
|
88
|
+
up_to_date: ['Everything is up to date', 'Extension and Native Host are on the latest stable release.', 'Up to date', 'success'],
|
|
89
|
+
checking: ['Checking for updates', 'Reading the latest signed stable release.', 'Checking', 'active'],
|
|
90
|
+
update_available: ['A stable update is ready', 'Review the target version, then update when convenient.', 'Available', 'success'],
|
|
91
|
+
downloading: ['Downloading the signed release', 'The package is being fetched and verified before any files change.', 'Downloading', 'active'],
|
|
92
|
+
staged: ['Update verified', 'The signed package is ready and waiting for a safe installation point.', 'Verified', 'active'],
|
|
93
|
+
waiting: ['Waiting for a safe point', 'Active Overleaf work will finish before the runtime changes.', 'Waiting', 'warning'],
|
|
94
|
+
waiting_for_idle: ['Waiting for a safe point', 'Active Overleaf work will finish before the runtime changes.', 'Waiting', 'warning'],
|
|
95
|
+
waiting_for_safe_point: ['Waiting for a safe point', 'Active Overleaf work will finish before the runtime changes.', 'Waiting', 'warning'],
|
|
96
|
+
applying: ['Installing the update', 'Extension and Native Host are being switched as one managed unit.', 'Installing', 'active'],
|
|
97
|
+
awaiting_health: ['Verifying the installation', 'The updated components are restarting and reconnecting.', 'Verifying', 'active'],
|
|
98
|
+
awaiting_health_check: ['Verifying the installation', 'The updated components are restarting and reconnecting.', 'Verifying', 'active'],
|
|
99
|
+
health_checking: ['Verifying the installation', 'The updated components are restarting and reconnecting.', 'Verifying', 'active'],
|
|
100
|
+
committed: ['Update complete', 'Extension and Native Host passed the post-update health check.', 'Complete', 'success'],
|
|
101
|
+
failed: ['Update could not continue', 'No further update steps will run until the failure is retried.', 'Needs attention', 'error'],
|
|
102
|
+
rolled_back: ['Previous version restored', 'The health check failed, so the managed update was rolled back safely.', 'Rolled back', 'warning'],
|
|
103
|
+
deferred: ['Update paused', 'The available update will remain ready for a later installation.', 'Later', 'neutral']
|
|
104
|
+
};
|
|
105
|
+
const [title, detail, badge, tone] = presentations[phase] || presentations.idle;
|
|
106
|
+
return { phase, title, detail, badge, tone };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function progressFor(view, phase) {
|
|
110
|
+
const raw = asObject(view.progress)?.percent ?? view.progressPercent ?? view.progress;
|
|
111
|
+
if (Number.isFinite(Number(raw))) {
|
|
112
|
+
const numeric = Number(raw);
|
|
113
|
+
return Math.max(0, Math.min(100, numeric <= 1 ? numeric * 100 : numeric));
|
|
114
|
+
}
|
|
115
|
+
const fallback = {
|
|
116
|
+
checking: 8,
|
|
117
|
+
update_available: 0,
|
|
118
|
+
downloading: 25,
|
|
119
|
+
staged: 48,
|
|
120
|
+
waiting: 55,
|
|
121
|
+
waiting_for_idle: 55,
|
|
122
|
+
waiting_for_safe_point: 55,
|
|
123
|
+
applying: 75,
|
|
124
|
+
awaiting_health: 90,
|
|
125
|
+
awaiting_health_check: 90,
|
|
126
|
+
health_checking: 90,
|
|
127
|
+
committed: 100,
|
|
128
|
+
rolled_back: 100
|
|
129
|
+
};
|
|
130
|
+
return fallback[phase] ?? 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function activeStageFor(phase) {
|
|
134
|
+
if (['downloading'].includes(phase)) return 0;
|
|
135
|
+
if (['staged', 'waiting', 'waiting_for_idle', 'waiting_for_safe_point'].includes(phase)) return 1;
|
|
136
|
+
if (['applying', 'awaiting_health', 'awaiting_health_check', 'health_checking'].includes(phase)) return 2;
|
|
137
|
+
if (phase === 'committed') return 3;
|
|
138
|
+
return -1;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function errorStageFor(view, phase) {
|
|
142
|
+
if (!['failed', 'rolled_back'].includes(phase)) return -1;
|
|
143
|
+
const stage = String(view.failureStage || view.error?.stage || '').toLowerCase();
|
|
144
|
+
if (/download|verify|signature|manifest/.test(stage)) return 0;
|
|
145
|
+
if (/idle|safe|wait/.test(stage)) return 1;
|
|
146
|
+
return 2;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function technicalText(view) {
|
|
150
|
+
const value = view.technicalDetail || view.error?.technicalDetail || view.error?.message || view.error || view.message;
|
|
151
|
+
if (!value) return '';
|
|
152
|
+
if (typeof value === 'string') return value;
|
|
153
|
+
try {
|
|
154
|
+
return JSON.stringify(value, null, 2);
|
|
155
|
+
} catch {
|
|
156
|
+
return String(value);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function actionDefinitions(phase) {
|
|
161
|
+
if (phase === 'update_available') {
|
|
162
|
+
return [
|
|
163
|
+
{ id: 'later', label: 'Later', kind: 'quiet' },
|
|
164
|
+
{ id: 'install', label: 'Update now', kind: 'primary' }
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
if (['failed', 'rolled_back'].includes(phase)) {
|
|
168
|
+
return [
|
|
169
|
+
{ id: 'close', label: 'Close', kind: 'quiet' },
|
|
170
|
+
{ id: 'retry', label: 'Retry', kind: 'primary' }
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
if (phase === 'committed') {
|
|
174
|
+
return [{ id: 'close', label: 'Done', kind: 'primary' }];
|
|
175
|
+
}
|
|
176
|
+
if (ACTIVE_PHASES.has(phase)) {
|
|
177
|
+
return [{ id: 'close', label: 'Close window', kind: 'quiet' }];
|
|
178
|
+
}
|
|
179
|
+
return [
|
|
180
|
+
{ id: 'close', label: 'Close', kind: 'quiet' },
|
|
181
|
+
{ id: 'check', label: 'Check latest', kind: 'primary' }
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function renderActions(phase) {
|
|
186
|
+
elements.actions.replaceChildren(...actionDefinitions(phase).map(action => {
|
|
187
|
+
const button = document.createElement('button');
|
|
188
|
+
button.type = 'button';
|
|
189
|
+
button.dataset.action = action.id;
|
|
190
|
+
button.dataset.kind = action.kind;
|
|
191
|
+
button.textContent = action.label;
|
|
192
|
+
button.disabled = actionPending;
|
|
193
|
+
return button;
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function render(view) {
|
|
198
|
+
currentView = asObject(view) || {};
|
|
199
|
+
const presentation = presentationFor(currentView);
|
|
200
|
+
const installed = versionOf(currentView, ['currentVersion', 'installedVersion', 'extensionVersion'], chrome.runtime.getManifest().version);
|
|
201
|
+
const target = versionOf(currentView, ['latestVersion', 'targetVersion', 'availableVersion'], 'latest stable');
|
|
202
|
+
const hasTarget = target && target !== 'latest stable' && target !== installed;
|
|
203
|
+
elements.route.textContent = hasTarget ? `v${installed} → v${target}` : `Installed v${installed}`;
|
|
204
|
+
elements.title.textContent = presentation.title;
|
|
205
|
+
elements.detail.textContent = typeof currentView.detail === 'string' && currentView.detail.trim()
|
|
206
|
+
? currentView.detail.trim()
|
|
207
|
+
: presentation.detail;
|
|
208
|
+
elements.badge.textContent = presentation.badge;
|
|
209
|
+
elements.badge.dataset.tone = presentation.tone;
|
|
210
|
+
|
|
211
|
+
const progress = progressFor(currentView, presentation.phase);
|
|
212
|
+
const showProgress = ACTIVE_PHASES.has(presentation.phase) || ['committed', 'rolled_back'].includes(presentation.phase);
|
|
213
|
+
elements.progressTrack.hidden = !showProgress;
|
|
214
|
+
elements.progressTrack.dataset.indeterminate = presentation.phase === 'checking' ? 'true' : 'false';
|
|
215
|
+
elements.progressTrack.setAttribute('aria-valuenow', String(Math.round(progress)));
|
|
216
|
+
elements.progressFill.style.width = `${progress}%`;
|
|
217
|
+
|
|
218
|
+
const activeStage = activeStageFor(presentation.phase);
|
|
219
|
+
const errorStage = errorStageFor(currentView, presentation.phase);
|
|
220
|
+
elements.stages.forEach((stage, index) => {
|
|
221
|
+
let state = 'pending';
|
|
222
|
+
if (index < activeStage || activeStage === 3) state = 'done';
|
|
223
|
+
if (index === activeStage) state = 'active';
|
|
224
|
+
if (index === errorStage) state = 'error';
|
|
225
|
+
stage.dataset.state = state;
|
|
226
|
+
const marker = stage.querySelector('.stage-marker');
|
|
227
|
+
marker.textContent = state === 'done' ? '✓' : String(index + 1);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const restarting = ['applying', 'awaiting_health', 'awaiting_health_check', 'health_checking'].includes(presentation.phase);
|
|
231
|
+
elements.note.textContent = restarting
|
|
232
|
+
? 'The extension may restart briefly. This window will reconnect and restore the saved progress.'
|
|
233
|
+
: 'This window can stay open while work continues elsewhere. Progress is saved automatically.';
|
|
234
|
+
|
|
235
|
+
const technical = technicalText(currentView);
|
|
236
|
+
elements.details.hidden = !technical || !['failed', 'rolled_back'].includes(presentation.phase);
|
|
237
|
+
elements.technicalMessage.textContent = technical;
|
|
238
|
+
renderActions(presentation.phase);
|
|
239
|
+
schedulePolling(presentation.phase);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function renderReconnecting() {
|
|
243
|
+
elements.title.textContent = 'Reconnecting after restart';
|
|
244
|
+
elements.detail.textContent = 'The saved update state will return when the extension is available again.';
|
|
245
|
+
elements.badge.textContent = 'Reconnecting';
|
|
246
|
+
elements.badge.dataset.tone = 'active';
|
|
247
|
+
elements.progressTrack.hidden = false;
|
|
248
|
+
elements.progressTrack.dataset.indeterminate = 'true';
|
|
249
|
+
elements.actions.replaceChildren();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function renderLocalFailure(error) {
|
|
253
|
+
render({
|
|
254
|
+
...currentView,
|
|
255
|
+
phase: 'failed',
|
|
256
|
+
detail: error?.message || 'Update action failed.',
|
|
257
|
+
technicalDetail: `${error?.code || 'update_failed'}: ${error?.message || 'Update action failed.'}`
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function isTransientContextError(error) {
|
|
262
|
+
return /context invalidated|receiving end does not exist|message port closed|could not establish connection/i.test(String(error?.message || error));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async function refresh() {
|
|
266
|
+
try {
|
|
267
|
+
render(await request('get'));
|
|
268
|
+
} catch (error) {
|
|
269
|
+
if (isTransientContextError(error)) {
|
|
270
|
+
renderReconnecting();
|
|
271
|
+
window.setTimeout(() => window.location.reload(), 900);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
renderLocalFailure(error);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function scheduleRefresh() {
|
|
279
|
+
window.clearTimeout(refreshTimer);
|
|
280
|
+
refreshTimer = window.setTimeout(refresh, 80);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function schedulePolling(phase) {
|
|
284
|
+
window.clearTimeout(pollTimer);
|
|
285
|
+
pollTimer = null;
|
|
286
|
+
if (!ACTIVE_PHASES.has(phase)) return;
|
|
287
|
+
pollTimer = window.setTimeout(async () => {
|
|
288
|
+
await refresh();
|
|
289
|
+
}, 1100);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
async function runAction(action) {
|
|
293
|
+
if (actionPending) return;
|
|
294
|
+
if (action === 'close') {
|
|
295
|
+
window.close();
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
actionPending = true;
|
|
299
|
+
renderActions(phaseOf(currentView));
|
|
300
|
+
try {
|
|
301
|
+
render(await request(action));
|
|
302
|
+
if (action === 'later') window.close();
|
|
303
|
+
} catch (error) {
|
|
304
|
+
if (isTransientContextError(error)) {
|
|
305
|
+
renderReconnecting();
|
|
306
|
+
window.setTimeout(() => window.location.reload(), 900);
|
|
307
|
+
} else {
|
|
308
|
+
renderLocalFailure(error);
|
|
309
|
+
}
|
|
310
|
+
} finally {
|
|
311
|
+
actionPending = false;
|
|
312
|
+
if (document.visibilityState !== 'unloaded') renderActions(phaseOf(currentView));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
elements.actions.addEventListener('click', event => {
|
|
317
|
+
const button = event.target.closest('button[data-action]');
|
|
318
|
+
if (button) runAction(button.dataset.action);
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
try {
|
|
322
|
+
chrome.storage.onChanged.addListener((_changes, areaName) => {
|
|
323
|
+
if (areaName === 'local') scheduleRefresh();
|
|
324
|
+
});
|
|
325
|
+
} catch {
|
|
326
|
+
renderReconnecting();
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const requestedAction = new URLSearchParams(window.location.search).get('action');
|
|
330
|
+
window.history.replaceState(null, '', window.location.pathname);
|
|
331
|
+
refresh().then(() => {
|
|
332
|
+
if (requestedAction && ['install', 'retry'].includes(requestedAction)) runAction(requestedAction);
|
|
333
|
+
});
|
|
334
|
+
})();
|
package/extension/src/popup.js
CHANGED
|
@@ -303,8 +303,27 @@
|
|
|
303
303
|
return section;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
function openUpdateCenter(action = '') {
|
|
307
|
+
const url = new URL(chrome.runtime.getURL('bootstrap/update.html'));
|
|
308
|
+
if (action) url.searchParams.set('action', action);
|
|
309
|
+
const opened = window.open(
|
|
310
|
+
url.href,
|
|
311
|
+
'codex-overleaf-update-center',
|
|
312
|
+
'popup,width=420,height=540,resizable=yes,scrollbars=yes'
|
|
313
|
+
);
|
|
314
|
+
if (opened) {
|
|
315
|
+
opened.focus();
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
window.location.assign(url.href);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
async function sendConsentAction(action) {
|
|
322
|
+
if (action === 'install' || action === 'retry' || action === 'center') {
|
|
323
|
+
openUpdateCenter(action === 'center' ? '' : action);
|
|
324
|
+
action = 'get';
|
|
325
|
+
}
|
|
326
|
+
const type = {
|
|
308
327
|
get: 'codex-overleaf/consent-update-get-state',
|
|
309
328
|
check: 'codex-overleaf/consent-update-check',
|
|
310
329
|
install: 'codex-overleaf/consent-update-install',
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const MIN_NATIVE_VERSION = '1.0.0';
|
|
13
13
|
const MIN_COMPATIBLE_NATIVE_VERSION = '1.0.0';
|
|
14
14
|
const MIN_COMPATIBLE_EXTENSION_VERSION = '1.0.0';
|
|
15
|
-
const BUILD_TARGET_VERSION = '1.9.
|
|
15
|
+
const BUILD_TARGET_VERSION = '1.9.7';
|
|
16
16
|
const DEFAULT_CHROME_EXTENSION_ID = 'illdpneeeopfffmiepaejglgmhpmdhdc';
|
|
17
17
|
const REQUIRED_CAPABILITIES = Object.freeze([
|
|
18
18
|
'bridgePing',
|