xray-code 0.1.4 → 0.1.5
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/dist/onboard.js +14 -1
- package/package.json +1 -1
package/dist/onboard.js
CHANGED
|
@@ -164,7 +164,20 @@ async function onboard(repoFilter) {
|
|
|
164
164
|
await runCommand(foxrefBin, ["snapshot", "--repo", ".", "--out", ".fox/foxref/snapshot.json"], cloneDir);
|
|
165
165
|
snapSpin.stop("done");
|
|
166
166
|
// ─── Step 6: Save project config ──────────────────────────────
|
|
167
|
-
|
|
167
|
+
// Preserve API key from prior `xray activate` — don't generate a new one
|
|
168
|
+
const existingConfig = (() => {
|
|
169
|
+
const p = (0, node_path_1.join)((0, node_os_1.homedir)(), ".xray", "config.json");
|
|
170
|
+
if ((0, node_fs_1.existsSync)(p)) {
|
|
171
|
+
try {
|
|
172
|
+
return JSON.parse((0, node_fs_1.readFileSync)(p, "utf-8"));
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return {};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {};
|
|
179
|
+
})();
|
|
180
|
+
const apiKey = existingConfig.apiKey || (0, node_child_process_1.execSync)("openssl rand -hex 32").toString().trim();
|
|
168
181
|
const webhookSecret = (0, node_child_process_1.execSync)("openssl rand -hex 32").toString().trim();
|
|
169
182
|
const configDir = (0, node_path_1.join)(cloneDir, ".xray");
|
|
170
183
|
if (!(0, node_fs_1.existsSync)(configDir))
|