remove pagespy
All checks were successful
Docker Build and Push / build-image (push) Successful in 4m56s
All checks were successful
Docker Build and Push / build-image (push) Successful in 4m56s
This commit is contained in:
parent
1b330bdd4d
commit
2fa7c7fc70
@ -12,6 +12,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-image:
|
build-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
# 关键: 显式固定 Android/OTA 后端地址, 覆盖 runner 环境里可能存在的
|
||||||
|
# 其他 VITE_API_BASE 值。否则 OTA 包里的前端可能连错后端, 导致
|
||||||
|
# "OTA 更新后登录失败/进不去内部"。与 android-build.yml 保持一致。
|
||||||
|
VITE_API_BASE: http://bh.vps.honor3.com:3001
|
||||||
steps:
|
steps:
|
||||||
- uses: https://gitea.com/actions/checkout@v4
|
- uses: https://gitea.com/actions/checkout@v4
|
||||||
|
|
||||||
|
|||||||
30
package-lock.json
generated
30
package-lock.json
generated
@ -8,7 +8,6 @@
|
|||||||
"name": "iboard",
|
"name": "iboard",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@huolala-tech/page-spy": "^1.5.7",
|
|
||||||
"@prisma/adapter-mariadb": "^7.9.1",
|
"@prisma/adapter-mariadb": "^7.9.1",
|
||||||
"@prisma/client": "^7.7.0",
|
"@prisma/client": "^7.7.0",
|
||||||
"antd-mobile": "^5.42.3",
|
"antd-mobile": "^5.42.3",
|
||||||
@ -807,20 +806,6 @@
|
|||||||
"hono": "^4"
|
"hono": "^4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@huolala-tech/page-spy": {
|
|
||||||
"version": "1.5.7",
|
|
||||||
"resolved": "https://registry.npmmirror.com/@huolala-tech/page-spy/-/page-spy-1.5.7.tgz",
|
|
||||||
"integrity": "sha512-M19WkH6K2taPpdi7gZ9Tz6v0vY/yW4ziffPXdU+p9+pdSmu1s0OhfxjcsWgERAYsaRLZNloSWqJZyWT5zsYIwA==",
|
|
||||||
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@babel/runtime": "^7.13.0",
|
|
||||||
"copy-to-clipboard": "^3.3.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@img/sharp-darwin-arm64": {
|
"node_modules/@img/sharp-darwin-arm64": {
|
||||||
"version": "0.33.5",
|
"version": "0.33.5",
|
||||||
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
|
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
|
||||||
@ -3242,15 +3227,6 @@
|
|||||||
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/copy-to-clipboard": {
|
|
||||||
"version": "3.3.3",
|
|
||||||
"resolved": "https://registry.npmmirror.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz",
|
|
||||||
"integrity": "sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"toggle-selection": "^1.0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/cors": {
|
"node_modules/cors": {
|
||||||
"version": "2.8.6",
|
"version": "2.8.6",
|
||||||
"resolved": "https://registry.npmmirror.com/cors/-/cors-2.8.6.tgz",
|
"resolved": "https://registry.npmmirror.com/cors/-/cors-2.8.6.tgz",
|
||||||
@ -6039,12 +6015,6 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/toggle-selection": {
|
|
||||||
"version": "1.0.6",
|
|
||||||
"resolved": "https://registry.npmmirror.com/toggle-selection/-/toggle-selection-1.0.6.tgz",
|
|
||||||
"integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/toidentifier": {
|
"node_modules/toidentifier": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz",
|
"resolved": "https://registry.npmmirror.com/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||||
|
|||||||
@ -27,7 +27,6 @@
|
|||||||
"publish": "bash scripts/wsl/build-apk.sh release"
|
"publish": "bash scripts/wsl/build-apk.sh release"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@huolala-tech/page-spy": "^1.5.7",
|
|
||||||
"@prisma/adapter-mariadb": "^7.9.1",
|
"@prisma/adapter-mariadb": "^7.9.1",
|
||||||
"@prisma/client": "^7.7.0",
|
"@prisma/client": "^7.7.0",
|
||||||
"antd-mobile": "^5.42.3",
|
"antd-mobile": "^5.42.3",
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
import { getApiBase, getToken } from './client.js'
|
import { getApiBase, getToken } from './client.js'
|
||||||
import { APP_VERSION, BUILD_ID } from '../version.js'
|
import { APP_VERSION, BUILD_ID } from '../version.js'
|
||||||
|
|
||||||
// 判断是否在 Tauri WebView 内 (与 src/debug/pagespy.js 同样的判定)
|
// 判断是否在 Tauri WebView 内 (有 __TAURI_INTERNALS__ 即 Tauri 环境)
|
||||||
const inTauri = typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window
|
const inTauri = typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window
|
||||||
|
|
||||||
// 拼接绝对 URL: 在 Tauri (VITE_API_BASE 有值) 时直连, 否则同源
|
// 拼接绝对 URL: 在 Tauri (VITE_API_BASE 有值) 时直连, 否则同源
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
// 仅在 Tauri WebView 内启用 PageSpy, 用于生产环境远程调试.
|
|
||||||
// web 模式 (Vite dev / 浏览器) 通过检测 window.__TAURI_INTERNALS__ 直接跳过,
|
|
||||||
// 配合 dynamic import 让 page-spy 这个 chunk 在 web 模式下完全不下载.
|
|
||||||
// VITE_PAGESPY_API 留空可关闭连接 (例如本地调试不想连远端 PageSpy 服务时).
|
|
||||||
// 加载失败不阻塞应用启动, 仅 console.warn 提示.
|
|
||||||
|
|
||||||
const PAGESPY_API = import.meta.env.VITE_PAGESPY_API || 'http://bh.vps.honor3.com:6752'
|
|
||||||
const inTauri = typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window
|
|
||||||
|
|
||||||
if (inTauri && PAGESPY_API) {
|
|
||||||
// 动态 import: 仅在 Tauri 内才下载 page-spy chunk
|
|
||||||
import('@huolala-tech/page-spy')
|
|
||||||
.then(({ default: PageSpy }) => {
|
|
||||||
// PageSpy 默认会 hook fetch / XMLHttpRequest, 自动抓取网络请求和错误
|
|
||||||
const instance = new PageSpy({ api: PAGESPY_API })
|
|
||||||
window.__IBOARD_PAGESPY__ = instance
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.warn('[PageSpy] init failed:', err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
51
src/main.jsx
51
src/main.jsx
@ -1,28 +1,25 @@
|
|||||||
// 远程调试: 仅在 Tauri WebView 内启用, web 模式自动跳过
|
// 移动端 UI 框架: 全局样式 + 主题 (antd-mobile 5)
|
||||||
import './debug/pagespy.js'
|
import 'antd-mobile/es/global'
|
||||||
|
|
||||||
// 移动端 UI 框架: 全局样式 + 主题 (antd-mobile 5)
|
import React from 'react'
|
||||||
import 'antd-mobile/es/global'
|
import ReactDOM from 'react-dom/client'
|
||||||
|
import { BrowserRouter } from 'react-router-dom'
|
||||||
import React from 'react'
|
import App from './App.jsx'
|
||||||
import ReactDOM from 'react-dom/client'
|
import { AuthProvider } from './auth/AuthContext.jsx'
|
||||||
import { BrowserRouter } from 'react-router-dom'
|
import { initOta } from './api/ota.js'
|
||||||
import App from './App.jsx'
|
import './styles/globals.css'
|
||||||
import { AuthProvider } from './auth/AuthContext.jsx'
|
|
||||||
import { initOta } from './api/ota.js'
|
// OTA 启动: 仅 Tauri 内生效
|
||||||
import './styles/globals.css'
|
// - notifyReady: 确认当前资源可用, 否则下次启动自动回滚 (hotswap 插件行为)
|
||||||
|
// - 异步执行, 不阻塞 React 挂载
|
||||||
// OTA 启动: 仅 Tauri 内生效
|
initOta()
|
||||||
// - notifyReady: 确认当前资源可用, 否则下次启动自动回滚 (hotswap 插件行为)
|
|
||||||
// - 异步执行, 不阻塞 React 挂载
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
initOta()
|
<React.StrictMode>
|
||||||
|
<BrowserRouter>
|
||||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
<AuthProvider>
|
||||||
<React.StrictMode>
|
<App />
|
||||||
<BrowserRouter>
|
</AuthProvider>
|
||||||
<AuthProvider>
|
</BrowserRouter>
|
||||||
<App />
|
</React.StrictMode>,
|
||||||
</AuthProvider>
|
|
||||||
</BrowserRouter>
|
|
||||||
</React.StrictMode>,
|
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user