Sanitize for open-source release
- Replace internal tenant name your-tenant.feishu.cn with your-tenant.feishu.cn - Replace real wiki token with placeholder WikiNodeTokenExample - Parameterize tenant via FEISHU_TENANT env var in feishu-to-md.mjs - Expand .gitignore to cover cookies, auth artifacts, IDE files
This commit is contained in:
+20
@@ -1,2 +1,22 @@
|
|||||||
|
# Dependencies
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# Output
|
||||||
output
|
output
|
||||||
|
|
||||||
|
# Cookies / sessions (auto-generated by scraper)
|
||||||
|
cookies.json
|
||||||
|
feishu-cookies.json
|
||||||
|
feishu-wiki-cookies.json
|
||||||
|
*-cookies.json
|
||||||
|
|
||||||
|
# Auth artifacts
|
||||||
|
feishu-auth-qr.png
|
||||||
|
|
||||||
|
# Local config / IDE
|
||||||
|
.claude/
|
||||||
|
.debug/
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Bundled browsers (pkg build output)
|
||||||
|
browsers/
|
||||||
|
|||||||
+13
-2
@@ -21,14 +21,25 @@ if (!argv[0] || argv[0] === '--help' || argv[0] === '-h') {
|
|||||||
|
|
||||||
示例:
|
示例:
|
||||||
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||||
node feishu-to-md.mjs WikiNodeTokenExample
|
FEISHU_TENANT=your-tenant node feishu-to-md.mjs WikiNodeTokenExample
|
||||||
`);
|
`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = argv[0].trim();
|
const input = argv[0].trim();
|
||||||
const outDir = argv[1] ? resolve(argv[1]) : resolve('./output');
|
const outDir = argv[1] ? resolve(argv[1]) : resolve('./output');
|
||||||
const wikiUrl = input.startsWith('http') ? input : `https://your-tenant.feishu.cn/wiki/${input}`;
|
let wikiUrl;
|
||||||
|
if (input.startsWith('http')) {
|
||||||
|
wikiUrl = input;
|
||||||
|
} else {
|
||||||
|
const tenant = process.env.FEISHU_TENANT;
|
||||||
|
if (!tenant) {
|
||||||
|
console.error('❌ 传入纯 token 时需设置 FEISHU_TENANT 环境变量,例如:');
|
||||||
|
console.error(' FEISHU_TENANT=your-tenant node feishu-to-md.mjs <token>');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
wikiUrl = `https://${tenant}.feishu.cn/wiki/${input}`;
|
||||||
|
}
|
||||||
|
|
||||||
// lark-cli 命令必须在 outDir 下执行(+media-preview 只接受相对路径)
|
// lark-cli 命令必须在 outDir 下执行(+media-preview 只接受相对路径)
|
||||||
process.chdir(outDir);
|
process.chdir(outDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user