t08-probe-devserver.mjs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // 只读探针:确认 5173 上跑的是不是本仓库,以及本仓库的路由模式。
  2. // 不发任何写请求,不启动/重启服务。
  3. const BASE = 'http://127.0.0.1:5173'
  4. async function probe(path, accept) {
  5. try {
  6. const res = await fetch(BASE + path, { headers: accept ? { accept } : {} })
  7. const text = await res.text()
  8. return { status: res.status, ct: res.headers.get('content-type') || '', len: text.length, text }
  9. } catch (error) {
  10. return { status: 'ERR', error: error.message }
  11. }
  12. }
  13. const targets = [
  14. ['/src/pages/cockpit/index.vue', 'application/javascript'],
  15. ['/src/modules/cockpit/prototypes/anchor-prototype-layout.js', '*/*'],
  16. ['/src/modules/cockpit/prototypes/FogPrototype.vue', '*/*'],
  17. ['/src/common/cesiumStaticPlugin.js', '*/*'],
  18. ['/@fs/E:/City-Lifeline-Cockpit-TvT/src/modules/cockpit/prototypes/AnchorPrototype.vue', '*/*'],
  19. ]
  20. for (const [path, accept] of targets) {
  21. const r = await probe(path, accept)
  22. const looksHtml = /<!DOCTYPE html>/i.test(r.text || '')
  23. const marker = path.includes('anchor-prototype-layout') ? r.text.includes('solveAnchorLayout')
  24. : path.includes('AnchorPrototype') ? r.text.includes('AnchorPrototype')
  25. : path.includes('cockpit/index.vue') ? r.text.includes('AnchorPrototype')
  26. : null
  27. console.log(`${r.status} ct=${r.ct} len=${r.len} html=${looksHtml} marker=${marker} ${path}`)
  28. }
  29. // 这份 5173 的页面路由里有没有 cockpit?抓首页 HTML 里的路由线索
  30. const home = await probe('/', 'text/html')
  31. console.log('\n--- 首页 HTML 里的 title / 脚本 ---')
  32. console.log((home.text.match(/<title>[^<]*<\/title>/i) || ['(no title)'])[0])
  33. console.log('包含 tvt-app?', home.text.includes('tvt-app'))
  34. console.log('包含 /src/main?', /src\/main/.test(home.text))