@codexhost/cli-darwin-x64 0.18.0-beta.5 → 0.18.0
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 +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +5 -2
- package/app/console-web.js +117 -69
- package/app/renderer-extension.js +82 -66
- package/app/web/codexhost-settings.js +75 -61
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +2 -2
- package/app/web/sw.js +40 -0
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
package/app/web/sw.js
CHANGED
|
@@ -145,6 +145,46 @@ function offlineResponse() {
|
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
async function pushRequest(method, args) {
|
|
149
|
+
const response = await fetch(new URL(`api/${method}`, self.registration.scope).href, {
|
|
150
|
+
method: "POST",
|
|
151
|
+
credentials: "same-origin",
|
|
152
|
+
headers: { "content-type": "application/json" },
|
|
153
|
+
body: JSON.stringify({
|
|
154
|
+
type: "client-request",
|
|
155
|
+
rpcId: crypto.randomUUID(),
|
|
156
|
+
method,
|
|
157
|
+
payload: { args },
|
|
158
|
+
}),
|
|
159
|
+
});
|
|
160
|
+
if (!response.ok) throw new Error(`HTTP ${String(response.status)}`);
|
|
161
|
+
const envelope = await response.json();
|
|
162
|
+
if (!envelope.result.ok) throw new Error(envelope.result.error.message);
|
|
163
|
+
return envelope.result.value;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
self.addEventListener("pushsubscriptionchange", (event) => {
|
|
167
|
+
event.waitUntil(
|
|
168
|
+
(async () => {
|
|
169
|
+
let applicationServerKey = event.oldSubscription?.options?.applicationServerKey;
|
|
170
|
+
if (!applicationServerKey) {
|
|
171
|
+
const { publicKey } = await pushRequest("codexhost/pushConfig", {});
|
|
172
|
+
const padding = "=".repeat((4 - (publicKey.length % 4)) % 4);
|
|
173
|
+
const raw = atob((publicKey + padding).replace(/-/gu, "+").replace(/_/gu, "/"));
|
|
174
|
+
applicationServerKey = Uint8Array.from(raw, (character) => character.charCodeAt(0));
|
|
175
|
+
}
|
|
176
|
+
const subscription = await self.registration.pushManager.subscribe({
|
|
177
|
+
userVisibleOnly: true,
|
|
178
|
+
applicationServerKey,
|
|
179
|
+
});
|
|
180
|
+
await pushRequest("codexhost/pushSubscribe", {
|
|
181
|
+
subscription: subscription.toJSON(),
|
|
182
|
+
userAgent: navigator.userAgent,
|
|
183
|
+
});
|
|
184
|
+
})(),
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
148
188
|
self.addEventListener("push", (event) => {
|
|
149
189
|
let message = {};
|
|
150
190
|
try {
|
package/bin/codexhost
CHANGED
|
Binary file
|
package/libexec/codexhost-shim
CHANGED
|
Binary file
|
|
Binary file
|