Sanitize for open-source release
- Replace internal tenant name yitanger.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:
+14
-3
@@ -20,15 +20,26 @@ if (!argv[0] || argv[0] === '--help' || argv[0] === '-h') {
|
||||
用法:node feishu-to-md.mjs <wiki_url_or_token> [输出目录]
|
||||
|
||||
示例:
|
||||
node feishu-to-md.mjs https://yitanger.feishu.cn/wiki/R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-to-md.mjs R9NywV2i9izjuqkPd63cWuafn4g
|
||||
node feishu-to-md.mjs https://your-tenant.feishu.cn/wiki/WikiNodeTokenExample
|
||||
FEISHU_TENANT=your-tenant node feishu-to-md.mjs WikiNodeTokenExample
|
||||
`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const input = argv[0].trim();
|
||||
const outDir = argv[1] ? resolve(argv[1]) : resolve('./output');
|
||||
const wikiUrl = input.startsWith('http') ? input : `https://yitanger.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 只接受相对路径)
|
||||
process.chdir(outDir);
|
||||
|
||||
Reference in New Issue
Block a user