@mkterswingman/5mghost-yonder 0.0.3 → 0.0.4
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/cli/setup.d.ts +3 -0
- package/dist/cli/setup.js +24 -7
- package/package.json +1 -1
package/dist/cli/setup.d.ts
CHANGED
package/dist/cli/setup.js
CHANGED
|
@@ -85,12 +85,29 @@ function prompt(question) {
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
+
export function getNoBrowserSessionNotice() {
|
|
89
|
+
return " ℹ️ 当前安装会话无法自动拉起浏览器 — 使用 PAT 模式\n";
|
|
90
|
+
}
|
|
91
|
+
export function getNoBrowserPatHint(authUrl) {
|
|
92
|
+
return [
|
|
93
|
+
" 🔗 请在当前这台运行安装器的桌面环境浏览器中打开此链接获取 PAT token:",
|
|
94
|
+
` ${authUrl}/pat/login`,
|
|
95
|
+
"",
|
|
96
|
+
" ⚠️ 如果你在云桌面上运行,请在云桌面的浏览器中完成登录,不要在本地电脑打开。"
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
export function getCookieSetupDeferredHint() {
|
|
100
|
+
return [
|
|
101
|
+
" ⏭️ Skipped (current session can't open a browser automatically — subtitle verification deferred)",
|
|
102
|
+
" 💡 在当前这台机器或云桌面的交互终端里运行:npx @mkterswingman/5mghost-yonder setup-cookies"
|
|
103
|
+
];
|
|
104
|
+
}
|
|
88
105
|
export async function runSetup() {
|
|
89
106
|
console.log("\n🚀 yt-mcp setup\n");
|
|
90
107
|
ensureConfigDir();
|
|
91
108
|
const hasBrowser = canOpenBrowser();
|
|
92
109
|
if (!hasBrowser) {
|
|
93
|
-
console.log(
|
|
110
|
+
console.log(getNoBrowserSessionNotice());
|
|
94
111
|
}
|
|
95
112
|
// ── Step 1: Runtime check ──
|
|
96
113
|
console.log("Step 1/5: Checking required runtimes...");
|
|
@@ -184,10 +201,9 @@ export async function runSetup() {
|
|
|
184
201
|
}
|
|
185
202
|
else {
|
|
186
203
|
// Cloud/headless — can't open browser, PAT only
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
console.log("");
|
|
204
|
+
for (const line of getNoBrowserPatHint(config.auth_url)) {
|
|
205
|
+
console.log(line);
|
|
206
|
+
}
|
|
191
207
|
const patInput = await prompt(" 粘贴你的 PAT token (pat_xxx), 或直接回车跳过: ");
|
|
192
208
|
if (patInput) {
|
|
193
209
|
await tokenManager.savePAT(patInput);
|
|
@@ -201,8 +217,9 @@ export async function runSetup() {
|
|
|
201
217
|
// ── Step 4: YouTube Cookies ──
|
|
202
218
|
console.log("Step 4/5: YouTube cookies...");
|
|
203
219
|
if (!hasBrowser) {
|
|
204
|
-
|
|
205
|
-
|
|
220
|
+
for (const line of getCookieSetupDeferredHint()) {
|
|
221
|
+
console.log(line);
|
|
222
|
+
}
|
|
206
223
|
}
|
|
207
224
|
else if (hasSIDCookies(PATHS.cookiesTxt)) {
|
|
208
225
|
console.log(" ✅ Cookies already present");
|