Просмотр исходного кода

revert(frontend): config.js 不入库,改为部署服务器本地临时目录注入

按用户要求:config.js 的 H5 Mixed Content 修复不提交 git(保留主干原始
http://cfc.iwintrue.com 默认,小程序端不受影响);修复版保存于部署服务器
/home/iwt/cfc-h5-config/config.js,由 cfc-deploy-251.sh 在 H5 构建前注入
构建快照(与 manifest.json / vue.config.js 的部署脚本 patch 机制一致)。
config.test.js 同步还原为原始 FALLBACK_HOST=http://cfc.iwintrue.com。
iwt 1 неделя назад
Родитель
Сommit
1561560581
2 измененных файлов с 3 добавлено и 15 удалено
  1. 1 3
      cfc-frontend/__tests__/config/config.test.js
  2. 2 12
      cfc-frontend/config.js

+ 1 - 3
cfc-frontend/__tests__/config/config.test.js

@@ -15,11 +15,9 @@ beforeEach(() => {
 
 // 与 config.js 保持一致:develop / trial / release 三端统一指向同一生产域名;
 // 非小程序环境、env 缺失或未知 envVersion 时,回落到模块顶部的默认值。
-// 2026-11-03 H5 Mixed Content 修复:默认值改为 https(含 H5 非小程序环境),
-//   H5 页面在浏览器中还会按 window.location.protocol 覆盖为同源 cfc.iwintrue.com。
 // 换域名时只需改这两行(对应 config.js 的 switch 分支与顶部默认值)。
 const PROD_HOST = 'https://cfc.etotem.com.cn'
-const FALLBACK_HOST = 'https://cfc.etotem.com.cn'
+const FALLBACK_HOST = 'http://cfc.iwintrue.com'
 
 describe('config.js', () => {
   beforeEach(() => {

+ 2 - 12
cfc-frontend/config.js

@@ -10,7 +10,7 @@
  * 无需手动修改任何变量,发布到对应环境自动生效。
  */
 
-let API_BASE_URL = 'https://cfc.etotem.com.cn'
+let API_BASE_URL = 'http://cfc.iwintrue.com'
 
 try {
   const accountInfo = uni.getAccountInfoSync()
@@ -32,17 +32,7 @@ try {
     }
   }
 } catch (e) {
-  // 非小程序环境(H5/dev):使用默认地址。
-  // 关键:H5 页面部署在 cfc.iwintrue.com(HTTPS 反代),若 API_BASE_URL 指向 http:// 会触发
-  // Mixed Content 被浏览器拦截;故 H5 下按页面当前协议自动选择(同源,避免跨域+CSP 问题)。
-  try {
-    if (typeof window !== 'undefined' && window.location && window.location.protocol) {
-      const proto = window.location.protocol  // 'https:' | 'http:'
-      API_BASE_URL = proto + '//cfc.iwintrue.com'
-    }
-  } catch (e2) {
-    // 保底:维持模块顶部默认值
-  }
+  // 非小程序环境(H5/dev),使用默认地址
 }
 
 export default {