deepv-code 1.0.317 → 1.0.319

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.
@@ -521,10 +521,8 @@
521
521
 
522
522
  <!-- 登录按钮容器 -->
523
523
  <div id="auth-buttons-container" class="auth-buttons-container hidden">
524
- <button id="feishu-btn" class="auth-button feishu-btn hidden" onclick="startFeishuAuth()">
525
- <img class="icon" src="https://res.ainirobot.com/orics/down/v2_k005_20250904_c768e6a4/feishu.ico" alt="Feishu" />
526
- <span data-i18n="auth.feishu.button">Feishu Login</span>
527
- </button>
524
+ <!-- 飞书登录按钮区域(动态生成,支持多租户) -->
525
+ <div id="feishu-buttons-container"></div>
528
526
 
529
527
  <button class="auth-button deepvlab-btn" onclick="startDeepvlabAuth()">
530
528
  <img class="icon" src="https://res.ainirobot.com/orics/down/v2_k005_20250904_52ad718e/deepv.ico" alt="DeepV" />
@@ -825,14 +823,9 @@
825
823
  // DeepVlab登录始终可用(没有hidden类,会自动显示)
826
824
  console.log('✅ DeepVlab登录始终可用');
827
825
 
828
- // 根据权限显示飞书登录按钮
826
+ // 根据权限显示飞书登录按钮(动态获取租户列表)
829
827
  if (data.feishuLoginAllowed) {
830
- console.log('✅ 飞书登录已允许,显示飞书登录按钮');
831
- const feishuBtn = document.getElementById('feishu-btn');
832
- if (feishuBtn) {
833
- feishuBtn.classList.remove('hidden');
834
- console.log('✅ 飞书登录按钮已显示');
835
- }
828
+ loadFeishuTenants();
836
829
  } else {
837
830
  console.log('🚫 飞书登录被禁用,保持飞书按钮隐藏');
838
831
  }
@@ -888,15 +881,47 @@
888
881
  }
889
882
  }
890
883
 
891
- function startFeishuAuth() {
892
- console.log('启动飞书认证...');
893
- // 这里会调用飞书认证逻辑
894
- fetch('/start-feishu-auth', { method: 'POST' })
884
+ function loadFeishuTenants() {
885
+ fetch('/api/backend/feishu-tenants')
886
+ .then(function(resp) { return resp.json(); })
887
+ .then(function(tenants) {
888
+ renderFeishuButtons(tenants);
889
+ })
890
+ .catch(function() {
891
+ console.log('⚠️ 无法获取租户列表,显示默认飞书按钮');
892
+ renderFeishuButtons([{ appId: '', label: t('auth.feishu.button'), tenantKey: 'main' }]);
893
+ });
894
+ }
895
+
896
+ function renderFeishuButtons(tenants) {
897
+ var container = document.getElementById('feishu-buttons-container');
898
+ if (!container) return;
899
+ container.innerHTML = '';
900
+ if (!tenants || tenants.length === 0) {
901
+ tenants = [{ appId: '', label: t('auth.feishu.button'), tenantKey: 'main' }];
902
+ }
903
+ tenants.forEach(function(tenant) {
904
+ var btn = document.createElement('button');
905
+ btn.className = 'auth-button feishu-btn';
906
+ btn.innerHTML = '<img class="icon" src="https://res.ainirobot.com/orics/down/v2_k005_20250904_c768e6a4/feishu.ico" alt="Feishu" />' +
907
+ '<span>' + (tenant.label || t('auth.feishu.button')) + '</span>';
908
+ btn.onclick = function() { startFeishuAuth(tenant.appId); };
909
+ container.appendChild(btn);
910
+ });
911
+ console.log('✅ 飞书登录按钮已生成,共 ' + tenants.length + ' 个租户');
912
+ }
913
+
914
+ function startFeishuAuth(appId) {
915
+ console.log('启动飞书认证...', appId ? 'appId=' + appId : '默认');
916
+ var body = appId ? JSON.stringify({ appId: appId }) : '{}';
917
+ fetch('/start-feishu-auth', {
918
+ method: 'POST',
919
+ headers: { 'Content-Type': 'application/json' },
920
+ body: body
921
+ })
895
922
  .then(response => response.json())
896
923
  .then(data => {
897
924
  if (data.authUrl) {
898
- // 修复方案:直接替换当前页面到认证URL,避免产生额外的空白页面
899
- // 这样认证完成后只需要关闭一个页面,不会留下空白的中间页
900
925
  window.location.replace(data.authUrl);
901
926
  }
902
927
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepv-code",
3
- "version": "1.0.317",
3
+ "version": "1.0.319",
4
4
  "engines": {
5
5
  "node": ">=20.0.0"
6
6
  },