codexapp 0.1.46 → 0.1.47
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 +34 -0
- package/dist/assets/index-DGYijDgu.css +1 -0
- package/dist/assets/index-dkC99kKB.js +1442 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +67 -25
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -3
- package/dist/assets/index-D2tyBrlG.css +0 -1
- package/dist/assets/index-ol-gi5Ys.js +0 -1428
package/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Codex Web Local</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-dkC99kKB.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DGYijDgu.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="bg-slate-950">
|
|
11
11
|
<div id="app"></div>
|
package/dist-cli/index.js
CHANGED
|
@@ -1329,10 +1329,9 @@ async function readCodexAuth() {
|
|
|
1329
1329
|
try {
|
|
1330
1330
|
const raw = await readFile2(getCodexAuthPath(), "utf8");
|
|
1331
1331
|
const auth = JSON.parse(raw);
|
|
1332
|
-
const apiKey = auth.OPENAI_API_KEY || process.env.OPENAI_API_KEY || void 0;
|
|
1333
1332
|
const token = auth.tokens?.access_token;
|
|
1334
|
-
if (!token
|
|
1335
|
-
return { accessToken: token
|
|
1333
|
+
if (!token) return null;
|
|
1334
|
+
return { accessToken: token, accountId: auth.tokens?.account_id ?? void 0 };
|
|
1336
1335
|
} catch {
|
|
1337
1336
|
return null;
|
|
1338
1337
|
}
|
|
@@ -1660,20 +1659,11 @@ function curlImpersonatePost(url, headers, body) {
|
|
|
1660
1659
|
proc.stdin.end();
|
|
1661
1660
|
});
|
|
1662
1661
|
}
|
|
1663
|
-
|
|
1664
|
-
async function tryRelay(headers, body) {
|
|
1665
|
-
try {
|
|
1666
|
-
const resp = await httpPost(TRANSCRIBE_RELAY_URL, headers, body);
|
|
1667
|
-
if (resp.status !== 0) return resp;
|
|
1668
|
-
} catch {
|
|
1669
|
-
}
|
|
1670
|
-
return null;
|
|
1671
|
-
}
|
|
1672
|
-
async function proxyTranscribe(body, contentType, authToken, accountId, apiKey) {
|
|
1662
|
+
async function proxyTranscribe(body, contentType, authToken, accountId) {
|
|
1673
1663
|
const chatgptHeaders = {
|
|
1674
1664
|
"Content-Type": contentType,
|
|
1675
1665
|
"Content-Length": body.length,
|
|
1676
|
-
Authorization: `Bearer ${authToken
|
|
1666
|
+
Authorization: `Bearer ${authToken}`,
|
|
1677
1667
|
originator: "Codex Desktop",
|
|
1678
1668
|
"User-Agent": `Codex Desktop/0.1.0 (${process.platform}; ${process.arch})`
|
|
1679
1669
|
};
|
|
@@ -1693,12 +1683,7 @@ async function proxyTranscribe(body, contentType, authToken, accountId, apiKey)
|
|
|
1693
1683
|
} catch {
|
|
1694
1684
|
}
|
|
1695
1685
|
}
|
|
1696
|
-
|
|
1697
|
-
if (relayed && relayed.status !== 403) return relayed;
|
|
1698
|
-
if (apiKey) {
|
|
1699
|
-
return httpPost("https://api.openai.com/v1/audio/transcriptions", { ...chatgptHeaders, Authorization: `Bearer ${apiKey}` }, body);
|
|
1700
|
-
}
|
|
1701
|
-
return { status: 503, body: JSON.stringify({ error: "Transcription blocked by Cloudflare. Install curl-impersonate-chrome, start relay, or set OPENAI_API_KEY." }) };
|
|
1686
|
+
return { status: 503, body: JSON.stringify({ error: "Transcription blocked by Cloudflare. Install curl-impersonate-chrome." }) };
|
|
1702
1687
|
}
|
|
1703
1688
|
return result;
|
|
1704
1689
|
}
|
|
@@ -2151,7 +2136,7 @@ function createCodexBridgeMiddleware() {
|
|
|
2151
2136
|
}
|
|
2152
2137
|
const rawBody = await readRawBody(req);
|
|
2153
2138
|
const incomingCt = req.headers["content-type"] ?? "application/octet-stream";
|
|
2154
|
-
const upstream = await proxyTranscribe(rawBody, incomingCt, auth.accessToken, auth.accountId
|
|
2139
|
+
const upstream = await proxyTranscribe(rawBody, incomingCt, auth.accessToken, auth.accountId);
|
|
2155
2140
|
res.statusCode = upstream.status;
|
|
2156
2141
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2157
2142
|
res.end(upstream.body);
|
|
@@ -2741,9 +2726,9 @@ async function createDirectoryListingHtml(localPath) {
|
|
|
2741
2726
|
const rows = items.map((item) => {
|
|
2742
2727
|
const suffix = item.isDirectory ? "/" : "";
|
|
2743
2728
|
const editAction = item.editable ? ` <a class="icon-btn" aria-label="Edit ${escapeHtml(item.name)}" href="${escapeHtml(toEditHref(item.path))}" title="Edit">\u270F\uFE0F</a>` : "";
|
|
2744
|
-
return `<li class="file-row"><a class="file-link" href="${escapeHtml(toBrowseHref(item.path))}">${escapeHtml(item.name)}${suffix}</a>${editAction}</li>`;
|
|
2729
|
+
return `<li class="file-row"><a class="file-link" href="${escapeHtml(toBrowseHref(item.path))}">${escapeHtml(item.name)}${suffix}</a><span class="row-actions">${editAction}</span></li>`;
|
|
2745
2730
|
}).join("\n");
|
|
2746
|
-
const parentLink = localPath !== parentPath ? `<
|
|
2731
|
+
const parentLink = localPath !== parentPath ? `<a href="${escapeHtml(toBrowseHref(parentPath))}">..</a>` : "";
|
|
2747
2732
|
return `<!doctype html>
|
|
2748
2733
|
<html lang="en">
|
|
2749
2734
|
<head>
|
|
@@ -2757,8 +2742,27 @@ async function createDirectoryListingHtml(localPath) {
|
|
|
2757
2742
|
ul { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
|
|
2758
2743
|
.file-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; }
|
|
2759
2744
|
.file-link { display: block; padding: 10px 12px; border: 1px solid #28405f; border-radius: 10px; background: #0f1b33; overflow-wrap: anywhere; }
|
|
2760
|
-
.
|
|
2745
|
+
.header-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
|
|
2746
|
+
.header-parent-link { color: #9ec8ff; font-size: 14px; padding: 8px 10px; border: 1px solid #2a4569; border-radius: 10px; background: #101f3a; }
|
|
2747
|
+
.header-parent-link:hover { text-decoration: none; filter: brightness(1.08); }
|
|
2748
|
+
.header-open-btn {
|
|
2749
|
+
height: 42px;
|
|
2750
|
+
padding: 0 14px;
|
|
2751
|
+
border: 1px solid #4f8de0;
|
|
2752
|
+
border-radius: 10px;
|
|
2753
|
+
background: linear-gradient(135deg, #2e6ee6 0%, #3d8cff 100%);
|
|
2754
|
+
color: #eef6ff;
|
|
2755
|
+
font-weight: 700;
|
|
2756
|
+
letter-spacing: 0.01em;
|
|
2757
|
+
cursor: pointer;
|
|
2758
|
+
box-shadow: 0 6px 18px rgba(33, 90, 199, 0.35);
|
|
2759
|
+
}
|
|
2760
|
+
.header-open-btn:hover { filter: brightness(1.08); }
|
|
2761
|
+
.header-open-btn:disabled { opacity: 0.6; cursor: default; }
|
|
2762
|
+
.row-actions { display: inline-flex; align-items: center; gap: 8px; min-width: 42px; justify-content: flex-end; }
|
|
2763
|
+
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid #36557a; border-radius: 10px; background: #162643; color: #dbe6ff; text-decoration: none; cursor: pointer; }
|
|
2761
2764
|
.icon-btn:hover { filter: brightness(1.08); text-decoration: none; }
|
|
2765
|
+
.status { margin: 10px 0 0; color: #8cc2ff; min-height: 1.25em; }
|
|
2762
2766
|
h1 { font-size: 18px; margin: 0; word-break: break-all; }
|
|
2763
2767
|
@media (max-width: 640px) {
|
|
2764
2768
|
body { margin: 12px; }
|
|
@@ -2770,8 +2774,46 @@ async function createDirectoryListingHtml(localPath) {
|
|
|
2770
2774
|
</head>
|
|
2771
2775
|
<body>
|
|
2772
2776
|
<h1>Index of ${escapeHtml(localPath)}</h1>
|
|
2773
|
-
|
|
2777
|
+
<div class="header-actions">
|
|
2778
|
+
${parentLink ? `<a class="header-parent-link" href="${escapeHtml(toBrowseHref(parentPath))}">..</a>` : ""}
|
|
2779
|
+
<button class="header-open-btn open-folder-btn" type="button" aria-label="Open current folder in Codex" title="Open folder in Codex" data-path="${escapeHtml(localPath)}">Open folder in Codex</button>
|
|
2780
|
+
</div>
|
|
2781
|
+
<p id="status" class="status"></p>
|
|
2774
2782
|
<ul>${rows}</ul>
|
|
2783
|
+
<script>
|
|
2784
|
+
const status = document.getElementById('status');
|
|
2785
|
+
document.addEventListener('click', async (event) => {
|
|
2786
|
+
const target = event.target;
|
|
2787
|
+
if (!(target instanceof Element)) return;
|
|
2788
|
+
const button = target.closest('.open-folder-btn');
|
|
2789
|
+
if (!(button instanceof HTMLButtonElement)) return;
|
|
2790
|
+
|
|
2791
|
+
const path = button.getAttribute('data-path') || '';
|
|
2792
|
+
if (!path) return;
|
|
2793
|
+
button.disabled = true;
|
|
2794
|
+
status.textContent = 'Opening folder in Codex...';
|
|
2795
|
+
try {
|
|
2796
|
+
const response = await fetch('/codex-api/project-root', {
|
|
2797
|
+
method: 'POST',
|
|
2798
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2799
|
+
body: JSON.stringify({
|
|
2800
|
+
path,
|
|
2801
|
+
createIfMissing: false,
|
|
2802
|
+
label: '',
|
|
2803
|
+
}),
|
|
2804
|
+
});
|
|
2805
|
+
if (!response.ok) {
|
|
2806
|
+
status.textContent = 'Failed to open folder.';
|
|
2807
|
+
button.disabled = false;
|
|
2808
|
+
return;
|
|
2809
|
+
}
|
|
2810
|
+
window.location.assign('/#/');
|
|
2811
|
+
} catch {
|
|
2812
|
+
status.textContent = 'Failed to open folder.';
|
|
2813
|
+
button.disabled = false;
|
|
2814
|
+
}
|
|
2815
|
+
});
|
|
2816
|
+
</script>
|
|
2775
2817
|
</body>
|
|
2776
2818
|
</html>`;
|
|
2777
2819
|
}
|