@ttmg/cli 0.4.6 → 0.4.7
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.
- package/CHANGELOG.md +10 -2
- package/README.md +192 -15
- package/dist/index.js +6454 -2250
- package/dist/index.js.map +1 -1
- package/dist/package.json +20 -14
- package/dist/public/assets/{Card-D4FjfZC9.js → Card-BC5ydRHh.js} +1 -1
- package/dist/public/assets/Detail-DPCqXgFa.js +1 -0
- package/dist/public/assets/Detail-DPCqXgFa.js.br +0 -0
- package/dist/public/assets/MonetizationMode-BGXVb7wG.js +1 -0
- package/dist/public/assets/MonetizationModeSummary-LeYQ02Tv.js +1 -0
- package/dist/public/assets/{SectionHeader-CAuUcT9Q.js → SectionHeader-BQDU_6TX.js} +1 -1
- package/dist/public/assets/baseForm-3VpF68Sz.css +1 -0
- package/dist/public/assets/baseForm-3VpF68Sz.css.br +0 -0
- package/dist/public/assets/baseForm-dqhahTXM.js +10 -0
- package/dist/public/assets/baseForm-dqhahTXM.js.br +0 -0
- package/dist/public/assets/{compass-H7uPUHxP.js → compass-DfWJoWl3.js} +1 -1
- package/dist/public/assets/{index-CRqInRg3.js → index-3IxvKwO3.js} +1 -1
- package/dist/public/assets/index-BAmVtXgk.js +1 -0
- package/dist/public/assets/index-BAmVtXgk.js.br +0 -0
- package/dist/public/assets/index-BBHaV7vS.js +1 -0
- package/dist/public/assets/index-BIkx7MZA.js +1 -0
- package/dist/public/assets/index-BIkx7MZA.js.br +0 -0
- package/dist/public/assets/index-BT67axp7.css +1 -0
- package/dist/public/assets/index-Ba7wrRXG.js +1 -0
- package/dist/public/assets/index-Ba7wrRXG.js.br +0 -0
- package/dist/public/assets/index-BhTApVX6.js +1 -0
- package/dist/public/assets/{index-Bbsc4UYr.js → index-BkbwTqmH.js} +1 -1
- package/dist/public/assets/{index-BIZgIFOe.js → index-BmS73Skw.js} +1 -1
- package/dist/public/assets/{index-Ckp_mJJy.css → index-BoFbvk-8.css} +1 -1
- package/dist/public/assets/index-BoFbvk-8.css.br +0 -0
- package/dist/public/assets/{index-CyDpw03-.js → index-BqslPc39.js} +1 -1
- package/dist/public/assets/index-C0-lsmcf.js +1 -0
- package/dist/public/assets/index-C947zURI.js +1 -0
- package/dist/public/assets/index-C947zURI.js.br +0 -0
- package/dist/public/assets/index-CC4YJwDI.js +1 -0
- package/dist/public/assets/{index-CCX74BCm.js → index-CDxeVVlI.js} +1 -1
- package/dist/public/assets/{index-sIdIkg5O.js → index-CF4RJ3VA.js} +1 -1
- package/dist/public/assets/{index-CqDAcAbN.js → index-CSOt669g.js} +1 -1
- package/dist/public/assets/index-CbUw1wBM.js +3 -0
- package/dist/public/assets/index-CbUw1wBM.js.br +0 -0
- package/dist/public/assets/index-DLHXV9xo.css +1 -0
- package/dist/public/assets/index-DLHXV9xo.css.br +0 -0
- package/dist/public/assets/{index-ivwHgxUB.js → index-DRKEUX85.js} +1 -1
- package/dist/public/assets/index-DRKEUX85.js.br +0 -0
- package/dist/public/assets/index-DS-Ah-pZ.js +1 -0
- package/dist/public/assets/index-DcpswdR4.js +21 -0
- package/dist/public/assets/index-DcpswdR4.js.br +0 -0
- package/dist/public/assets/{index-BhswTE7o.js → index-DpCdlpoj.js} +1 -1
- package/dist/public/assets/index-FKgvaTum.js +1 -0
- package/dist/public/assets/index-FKgvaTum.js.br +0 -0
- package/dist/public/assets/index-_IVh5FZw.js +1 -0
- package/dist/public/assets/index-docEsXsM.css +1 -0
- package/dist/public/assets/index-docEsXsM.css.br +0 -0
- package/dist/public/assets/{index-CrRxN4us.js → index-ejkbZVVo.js} +1 -1
- package/dist/public/assets/{index-wTaBRIal.js → index-wGfWSqnF.js} +1 -1
- package/dist/public/assets/index-xPCWyPvk.js +2 -0
- package/dist/public/assets/{layers-Bw-W5e-K.js → layers-kzl3dc3j.js} +1 -1
- package/dist/public/assets/{list-checks-ClFMgLBy.js → list-checks-Ce0l0Ylc.js} +1 -1
- package/dist/public/assets/{sparkles-JXa7CZhS.js → sparkles-Dnyv9lnL.js} +1 -1
- package/dist/public/assets/{triangle-alert--wDqk97a.js → triangle-alert-BaPLcm_f.js} +1 -1
- package/dist/public/assets/{zap-D27jUGUv.js → zap-DyzOTCOX.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/scripts/dev-client-preview-control-smoke.js +4 -0
- package/dist/scripts/dev-remote-resources-smoke.js +8 -0
- package/dist/scripts/dev-workflow-smoke.js +15 -1
- package/dist/scripts/docs/README.md +19 -0
- package/dist/scripts/docs/capture.js +46 -3
- package/dist/scripts/docs/check.js +9 -0
- package/dist/scripts/docs/privacy-guard.js +74 -0
- package/dist/scripts/docs/privacy-guard.test.js +116 -0
- package/dist/scripts/docs/render.js +2 -2
- package/dist/scripts/docs/scenarios/devtool-guide.mjs +13 -17
- package/dist/scripts/language-route.test.js +14 -0
- package/dist/scripts/localization-process.test.js +69 -0
- package/dist/scripts/removed-features-smoke.js +42 -0
- package/dist/scripts/run-ts-test.js +3 -1
- package/dist/scripts/skills-process.test.js +48 -0
- package/dist/scripts/unity-check-process.test.js +103 -0
- package/dist/scripts/unity-report-template.html +148 -0
- package/dist/scripts/verify-agent-contract.js +28 -0
- package/dist/scripts/verify-locales.js +50 -0
- package/dist/scripts/wasm-worker.js +4 -0
- package/dist/scripts/worker.js +22 -2
- package/dist/scripts/workflow-review-smoke.js +36 -0
- package/package.json +20 -14
- package/skills/README.md +16 -0
- package/vibe-upload.md +4 -4
- package/dist/openDataContext/template/open_context.html.hbs +0 -29
- package/dist/openDataContext/template/open_context_sdk.js.hbs +0 -16
- package/dist/public/assets/Detail-m3nH8XXe.js +0 -1
- package/dist/public/assets/Detail-m3nH8XXe.js.br +0 -0
- package/dist/public/assets/MonetizationMode-1rShmN0o.js +0 -1
- package/dist/public/assets/MonetizationModeSummary-CVfWOth1.js +0 -1
- package/dist/public/assets/baseForm-BAvk37jF.css +0 -1
- package/dist/public/assets/baseForm-BAvk37jF.css.br +0 -0
- package/dist/public/assets/baseForm-C3PqJ30b.js +0 -10
- package/dist/public/assets/baseForm-C3PqJ30b.js.br +0 -0
- package/dist/public/assets/col-BXewy14r.css +0 -1
- package/dist/public/assets/col-BXewy14r.css.br +0 -0
- package/dist/public/assets/col-CcZ10DdH.js +0 -1
- package/dist/public/assets/index-B0xVTiB7.js +0 -1
- package/dist/public/assets/index-B0xVTiB7.js.br +0 -0
- package/dist/public/assets/index-BAbIp3cP.js +0 -1
- package/dist/public/assets/index-BAbIp3cP.js.br +0 -0
- package/dist/public/assets/index-BESASZaa.js +0 -1
- package/dist/public/assets/index-BFPQPvSA.css +0 -1
- package/dist/public/assets/index-BX17swkm.js +0 -1
- package/dist/public/assets/index-BX17swkm.js.br +0 -0
- package/dist/public/assets/index-BntW17GH.js +0 -1
- package/dist/public/assets/index-BswJGTPK.js +0 -1
- package/dist/public/assets/index-BswJGTPK.js.br +0 -0
- package/dist/public/assets/index-CQ3yj6IA.js +0 -1
- package/dist/public/assets/index-CQ3yj6IA.js.br +0 -0
- package/dist/public/assets/index-CYnulX57.css +0 -1
- package/dist/public/assets/index-CYnulX57.css.br +0 -0
- package/dist/public/assets/index-C_G_C9eS.js +0 -21
- package/dist/public/assets/index-C_G_C9eS.js.br +0 -0
- package/dist/public/assets/index-Ckp_mJJy.css.br +0 -0
- package/dist/public/assets/index-D8BnlF58.js +0 -1
- package/dist/public/assets/index-DAY6FKtH.js +0 -1
- package/dist/public/assets/index-DKcAZ6VY.js +0 -1
- package/dist/public/assets/index-DS5Uafh7.js +0 -1
- package/dist/public/assets/index-DdxoW9oQ.js +0 -1
- package/dist/public/assets/index-O0yoYI51.js +0 -1
- package/dist/public/assets/index-aQ98LrVv.js +0 -1
- package/dist/public/assets/index-aQ98LrVv.js.br +0 -0
- package/dist/public/assets/index-ivwHgxUB.js.br +0 -0
- package/dist/public/assets/index-vlN_-PRJ.css +0 -1
- package/src/commands/common/game/categories.test.ts +0 -38
- package/src/commands/common/game/categories.ts +0 -48
- package/src/commands/common/game/categoryCatalog.json +0 -522
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aa as v,r as m,k as w,u,l as x,g,i as t,j as e,z as b,p as f}from"./index-DcpswdR4.js";/* empty css */function j(a){return m.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},a),m.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 4c0-1.1.9-2 2-2h5a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm0 11c0-1.1.9-2 2-2h5a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5ZM15 2a2 2 0 0 0-2 2v5c0 1.1.9 2 2 2h5a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-5Zm1 12.5a1.5 1.5 0 0 1 3 0V16h1.5a1.5 1.5 0 0 1 0 3H19v1.5a1.5 1.5 0 0 1-3 0V19h-1.5a1.5 1.5 0 0 1 0-3H16v-1.5Z",fill:"currentColor"}))}const S=v(j,"customize"),N=()=>{const a=w(),{state:{user:i,gameDetail:o}}=u(),n=x(i),r=g({errorCode:o?.has_error?o.error_code:void 0,user:i}),c=r==="noPermission",l=r==="networkProxy",s=!n||c||l,p=n?c?t("wasmSplit.disabled.noPermission"):l?t("wasmSplit.disabled.networkProxy"):"":t("wasmSplit.disabled.notLoggedIn"),h=()=>{s||a("/wasm_split")},d=e.jsxs("div",{className:b("wasm-code-split","tt-wasm-entry","tt-header-chip",{"tt-wasm-entry-disabled":s}),onClick:h,"aria-disabled":s,role:"button",tabIndex:s?-1:0,children:[e.jsx("span",{className:"tt-wasm-entry-icon",children:e.jsx(S,{size:"default"})}),e.jsx("span",{className:"wasm-code-split-text",children:t("wasmSplit")})]});return s?e.jsx(f,{content:()=>e.jsx("div",{className:"wasm-code-split-disabled-tip",children:p}),children:d}):d};export{N as WasmCodeSplit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,i as a,D as _,r as o,k as Oe,u as Be,l as qe,g as Ke,h as He,P as Ve,T as r,f as z,I as V,m as Qe,B as w,n as Je,Q as pe,o as Ze,d as C}from"./index-DcpswdR4.js";import{B as We}from"./index-BqslPc39.js";import{C as he,F as me}from"./baseForm-dqhahTXM.js";import{A as Xe}from"./index-DRKEUX85.js";const Ye="https://bytedance.larkoffice.com/wiki/LkihwQCMfiBpr3khwNuceCBkn3e";function es(m){return String(m).replace(/^\s*\d+\s*[\.、]\s*/,"")}const ss=({engine:m})=>e.jsx("div",{className:"check-code-banner-list",children:[{show:!0,titleKey:"pkgSizeCheckDesc",desc:e.jsxs("div",{children:[e.jsx("span",{children:m==="unity"?a("unityPkgSizeCheckDescTip",{projectSize:"60MB"}):a("commonPkgSizeCheckDescTip",{projectSize:"30MB",mainPackageSize:"4MB",independentPackageSize:"4MB"})}),e.jsx(_,{className:"check-code-banner-doc-link",href:Ye,children:a("uploadGame.packageSizeDoc")})]})},{show:m!=="unity",titleKey:"mandatoryApiCheck",desc:a("mandatoryApiCheckDesc")},{show:!0,titleKey:"configFileCheck",desc:e.jsxs("div",{children:[e.jsx("code",{children:"game.json"}),":",a("gameJsonCheckDesc")]})}].filter(i=>i.show).map((i,h)=>e.jsxs("div",{className:"check-code-banner-section",children:[e.jsxs("div",{className:"check-code-banner-section-title",children:[e.jsx("span",{className:"check-code-banner-section-index",children:h+1}),e.jsx("strong",{children:es(a(i.titleKey))})]}),e.jsx("div",{className:"check-code-banner-section-desc",children:i.desc})]},i.titleKey))}),as=({engine:m})=>e.jsx("div",{className:"check-code-banner",role:"note",children:e.jsx(ss,{engine:m})}),rs=m=>{const{result:i}=m,h=i.every(d=>d?.passed),[l,n]=o.useState(!1);return e.jsxs("section",{className:`check-result-group ${h?"check-result-group-passed":"check-result-group-failed"}`,children:[e.jsxs("div",{className:"check-result-title",children:[e.jsx("span",{className:"check-result-status-dot"}),e.jsx("span",{className:"check-result-title-text",children:h?a("checkConfigPassed"):a("checkConfigFailed")})]}),e.jsxs("div",{className:`check-result-collapse ${l?"check-result-collapse-open":"check-result-collapse-closed"}`,children:[e.jsx(he,{collapseHeight:150,isOpen:l,children:e.jsx("div",{className:"check-result-list",children:i.map((d,k)=>e.jsxs("div",{className:`check-result-item ${d?.passed?"check-result-item-passed":"check-result-item-failed"}`,children:[e.jsx("span",{className:"check-result-tag",children:d?.file}),e.jsx("span",{className:"check-result-message",children:d?.msg}),d?.detail?.link?e.jsx(_,{className:"check-result-link",href:d.detail.link,children:d.detail.text||a("viewDoc")}):null]},k))})}),l?e.jsx("button",{className:"check-result-toggle",type:"button",onClick:()=>n(!1),children:a("closeCheckDetail")}):e.jsx("button",{className:"show-more-text-btn",type:"button",onClick:()=>n(!0),children:a("expandCheckDetail")})]})]})},ls={get project(){return a("gameProject")},get main_package(){return a("gameMainPackage")},get independent_package(){return a("independentPackage")}},ts=m=>{const{result:i}=m,h=i.every(l=>l?.passed);return e.jsxs("section",{className:`check-result-group ${h?"check-result-group-passed":"check-result-group-failed"}`,children:[e.jsxs("div",{className:"check-result-title",children:[e.jsx("span",{className:"check-result-status-dot"}),e.jsx("span",{className:"check-result-title-text",children:h?a("checkPkgSizePassed"):a("checkPkgSizeFailed")})]}),e.jsx("div",{className:"check-result-list",children:i.map((l,n)=>e.jsxs("div",{className:`check-result-item ${l?.passed?"check-result-item-passed":"check-result-item-failed"}`,children:[e.jsxs("span",{className:"check-result-tag",children:[ls[l.dimension],l.dimension==="independent_package"?`: ${l.name}`:""]}),e.jsx("span",{className:"check-result-message",children:l?.msg}),l?.detail?.link?e.jsx(_,{className:"check-result-link",href:l.detail.link,children:l.detail.text||a("viewDoc")}):null]},n))})]})},cs=m=>{const{result:i}=m;if(!Array.isArray(i)||i.length===0)return null;const h=i.every(d=>d?.passed),[l,n]=o.useState(!1);return e.jsxs("section",{className:`check-result-group ${h?"check-result-group-passed":"check-result-group-failed"}`,children:[e.jsxs("div",{className:"check-result-title",children:[e.jsx("span",{className:"check-result-status-dot"}),e.jsx("span",{className:"check-result-title-text",children:h?a("checkApiSuccess"):a("checkApiFailed")})]}),e.jsxs("div",{className:`check-result-collapse ${l?"check-result-collapse-open":"check-result-collapse-closed"}`,children:[e.jsx(he,{collapseHeight:150,isOpen:l,children:e.jsx("div",{className:"check-result-list",children:i.map((d,k)=>e.jsxs("div",{className:`check-result-item ${d?.passed?"check-result-item-passed":"check-result-item-failed"}`,children:[e.jsx("span",{className:"check-result-tag",children:d?.name}),e.jsxs("span",{className:"check-result-message",children:[a(d?.name),d?.passed?a("apiStaticDetected"):a("apiStaticNotDetected")]}),d?.detail?.link?e.jsx(_,{className:"check-result-link",href:d.detail.link,children:d.detail.text||a("viewDoc")}):null]},k))})}),l?e.jsx("button",{className:"check-result-toggle",type:"button",onClick:()=>n(!1),children:a("closeCheckDetail")}):e.jsx("button",{className:"show-more-text-btn",type:"button",onClick:()=>n(!0),children:a("expandCheckDetail")})]})]})},ds=m=>{const{result:i}=m;if(!Array.isArray(i)||i.length===0)return null;const h=i.every(l=>l?.passed);return e.jsxs("section",{className:`check-result-group ${h?"check-result-group-passed":"check-result-group-failed"}`,children:[e.jsxs("div",{className:"check-result-title",children:[e.jsx("span",{className:"check-result-status-dot"}),e.jsx("span",{className:"check-result-title-text",children:h?a("checkPerformancePassed"):a("checkPerformanceFailed")})]}),e.jsx("div",{className:"check-result-list",children:i.map((l,n)=>e.jsxs("div",{className:`check-result-item ${l?.passed?"check-result-item-passed":"check-result-item-failed"}`,children:[e.jsx("span",{className:"check-result-tag",children:a("performanceCheck")}),e.jsx("span",{className:"check-result-message",children:l?.msg}),l?.detail?.link?e.jsx(_,{className:"check-result-link",href:l.detail.link,children:l.detail.text||a("viewDoc")}):null]},n))})]})},ms=()=>{const m=Oe(),i=3e3,h=600*1e3,[l,n]=o.useState("idle"),[d,k]=o.useState(""),[A,F]=o.useState(""),[ge,R]=o.useState(""),[G,M]=o.useState([]),[v,b]=o.useState(""),[xe,Q]=o.useState({}),[J,U]=o.useState(!1),[Z,L]=o.useState(""),[je,E]=o.useState(!1),[fe,ke]=o.useState(""),[T,ve]=o.useState([]),[O,W]=o.useState(!1),[P,X]=o.useState(!0),[x,ye]=o.useState(!1),[Y,ee]=o.useState(""),[se,ae]=o.useState(!1),[B,j]=o.useState(""),re=o.useRef(null),{state:{engine:Ne,user:q,gameDetail:y}}=Be(),N=qe(q),K=Ke({errorCode:y?.has_error?y.error_code:void 0,user:q}),$=K==="noPermission",we=$||K==="networkProxy",H=s=>new Promise(t=>setTimeout(t,s)),Se=s=>s?String(s.status??s.cdn_deploy_status??s.live_status??"").toLowerCase():"",le=s=>s?String(s.status??s.cdn_deploy_status??s.live_status??""):"",D=s=>{if(Number(s?.cdn_deploy_status)===2)return"ready";const t=Se(s);return t?["ready","success","succeeded","available"].includes(t)?"ready":t.includes("fail")||t.includes("error")||t.includes("reject")?"failed":"pending":"pending"},te=s=>s==="preview"?4:s==="review"?3:s==="live"?2:1,Ge=s=>{if(!s)return[];const t=[...(s.preview_assets||[]).map(c=>({...c,source:"preview",state:D(c)})),...(s.in_review_assets||[]).map(c=>({...c,source:"review",state:D(c)})),...(s.live_assets||[]).map(c=>({...c,source:"live",state:D(c)})),...(s.assets||[]).map(c=>({...c,source:"other",state:D(c)}))].sort((c,p)=>{const f=Number(p.uploaded_at||0)-Number(c.uploaded_at||0);return f!==0?f:te(p.source)-te(c.source)}),u=new Map;return t.forEach(c=>{const p=String(c.asset_id||"");p&&!u.has(p)&&u.set(p,c)}),Array.from(u.values())},be=s=>s==="ready"?a("uploadGame.record.state.ready"):s==="failed"?a("uploadGame.record.state.failed"):a("uploadGame.record.state.pending"),Te=s=>s==="preview"?a("uploadGame.record.source.preview"):s==="review"?a("uploadGame.record.source.review"):s==="live"?a("uploadGame.record.source.live"):a("uploadGame.record.source.other"),ce=s=>s?new Date(s*1e3).toLocaleString():a("uploadGame.record.metaUnknown"),Pe=s=>{if(!s)return a("uploadGame.record.metaUnknown");const t=s/1024/1024;return`${t>=10?t.toFixed(0):t.toFixed(1)} MB`},de=s=>{if(s.version)return`v${s.version}`;const t=String(s.asset_id||"");return t?`${t.slice(0,6)}...${t.slice(-4)}`:a("uploadGame.record.metaUnknown")},De=s=>`${de(s)} · ${be(s.state)} · ${ce(s.uploaded_at)}`,Ce=s=>s?[s.preview_assets||[],s.in_review_assets||[],s.live_assets||[],s.assets||[]].flat().filter(Boolean):[],ie=async()=>{if(!N||$){M([]),b(""),L(""),U(!1);return}U(!0),L("");try{const s=await C({method:"POST",url:"/game/assets"});if(s?.code!==0||!s?.data)throw new Error(a("uploadGame.record.loadFailed"));const t=Ge(s.data);M(t);const u=(v&&t.some(c=>String(c.asset_id)===String(v))?v:"")||"";b(String(u||""))}catch(s){L(s instanceof Error?s.message:a("uploadGame.record.loadFailed"))}finally{U(!1)}},_e=async(s,t)=>{for(;Date.now()<t;){const u=await C({method:"POST",url:"/game/assets",data:{assetId:s,includePending:!0}}),p=Ce(u?.data).find(f=>String(f.asset_id)===String(s))||null;if(p){const f=le(p);f&&R(f);const ue=D(p);if(ue==="ready")return{ok:!0,asset:p};if(ue==="failed")return{ok:!1,asset:p}}await H(i)}return{ok:!1,asset:null}},oe=async(s,t)=>{for(;Date.now()<t;){const u=await C({method:"POST",url:"/game/asset/preview-url",data:{assetId:s}});if(u?.code===0&&u?.data?.preview_url)return u.data.preview_url;await H(i)}return""},Ae=()=>{X(!0),W(!1),C({url:"/game/check",method:"GET"}).then(s=>{ve(s?.data||[])}).catch(()=>{W(!0)}).finally(()=>{X(!1)})};o.useEffect(()=>{Ae()},[]),o.useEffect(()=>{if(!N||$){M([]),b(""),L(""),U(!1);return}ie()},[N,$]);const Re=T.filter(s=>s?.type==="config"),Ue=T.filter(s=>s?.type==="size"),Le=T.filter(s=>s?.type==="api"),Ee=T.filter(s=>s?.type==="performance"),ne=T.some(s=>!s?.passed),$e=s=>l==="uploading"?s===0?"current":"pending":l==="checkingAsset"?s===0?"done":s===1?"current":"pending":l==="resolvingPreview"?s<=1?"done":s===2?"current":"pending":"pending",Ie=[a("uploadGame.progress.step1"),a("uploadGame.progress.step2"),a("uploadGame.progress.step3")],ze=[a("uploadGame.guide.precheck.title"),a("uploadGame.guide.version.title"),a("uploadGame.guide.preview.title")],S=()=>{ye(s=>!s)},g=G.find(s=>String(s.asset_id)===String(v))||null,I=v&&xe[String(v)]||"";o.useEffect(()=>{if(!g||g.state!=="ready"){E(!1);return}const s=String(g.asset_id);if(I){E(!1);return}let t=!1;return(async()=>{E(!0);const c=await oe(s,Date.now()+h);t||(c&&Q(p=>({...p,[s]:c})),E(!1))})(),()=>{t=!0}},[g,I]);const Fe=()=>{if(!Y.trim()){j(a("needDesc"));return}ae(!0),n("uploading"),j(""),k(""),R(""),F(""),C({method:"POST",url:"/game/upload",headers:{"ttmg-game-desc":encodeURIComponent(Y||"--")}}).then(async s=>{if(s?.code===0){await H(500),k(s?.data?.detail||"");const t=s?.data?.asset_id?String(s.data.asset_id):"",u=Date.now()+h;if(!t){n("failure"),j(a("uploadGame.failure.missingAssetId"));return}n("checkingAsset");const c=await _e(t,u);if(!c.ok){n("failure"),j(c.asset?a("uploadGame.failure.assetStatus",{status:le(c.asset)||"-"}):a("uploadGame.failure.assetTimeout"));return}n("resolvingPreview");const p=await oe(t,u);if(!p){n("failure"),j(a("uploadGame.failure.previewTimeout"));return}Q(f=>({...f,[t]:p})),ke(t),b(""),F(p),await ie(),n("success")}else n("idle"),j(s?.error?.StatusMessage||s?.detail||a("uploadPlatformFailed"))}).catch(s=>{n("idle"),j(s?.error?.StatusMessage||s?.response?.detail||s?.message||a("uploadPlatformFailed"))}).finally(()=>{ae(!1)})},Me=()=>{n("idle"),j(""),k(""),R(""),F(""),ee(""),re.current?.formApi?.reset?.()};if(we){const s=y?.has_error?y.error_code:void 0,t=y?.has_error?y.error_msg:"",u=y?.client_key||"";return e.jsx(Xe,{errorMsg:He({errorCode:s,errorMsg:t,clientKey:u,user:q}),errorState:K})}return e.jsxs("div",{className:"upload-game-page",children:[e.jsx(Ve,{title:a("uploadGame.guide.title"),subtitle:a("uploadGame.guide.desc")}),e.jsxs("section",{className:"upload-game-hero",children:[P?e.jsxs("div",{className:"upload-game-summary-panel upload-game-summary-panel-neutral",children:[e.jsxs("div",{className:"upload-game-summary-copy",children:[e.jsx(r.Text,{strong:!0,children:a("uploadGame.summary.checkingTitle")}),e.jsx(r.Text,{style:{color:"var(--tt-text-dim)"},children:a("uploadGame.summary.checkingDesc")})]}),e.jsx(z,{size:"small"})]}):null,!P&&O?e.jsxs("div",{className:`upload-game-summary-panel upload-game-summary-panel-warn ${x?"upload-game-summary-panel-expanded":""}`,children:[e.jsxs("div",{className:"upload-game-summary-copy",children:[e.jsx(r.Text,{strong:!0,children:a("uploadGame.summary.failedTitle")}),e.jsx(r.Text,{style:{color:"var(--tt-text-dim)"},children:a("uploadGame.checkFetchFailed")})]}),e.jsxs("span",{className:"upload-game-summary-action",role:"button",tabIndex:0,onClick:S,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),S())},children:[e.jsx(V,{style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsx(r.Text,{children:a(x?"uploadGame.hideDetails":"uploadGame.showDetails")})]})]}):null,N?null:e.jsxs("div",{className:"upload-game-inline-notice",children:[e.jsx("div",{className:"upload-game-inline-notice-icon",children:e.jsx(Qe,{})}),e.jsxs("div",{className:"upload-game-inline-notice-copy",children:[e.jsx(r.Text,{strong:!0,children:a("uploadGame.loginNoticeTitle")}),e.jsx(r.Text,{children:a("loginToUpload")}),e.jsx("div",{className:"upload-game-inline-notice-action",children:e.jsx(w,{theme:"light",onClick:()=>m("/basic_debug_guide"),children:a("basicDebugGuide.entryAction")})})]})]}),!P&&!O&&ne?e.jsxs("div",{className:`upload-game-summary-panel upload-game-summary-panel-warn ${x?"upload-game-summary-panel-expanded":""}`,children:[e.jsxs("div",{className:"upload-game-summary-copy",children:[e.jsx(r.Text,{strong:!0,children:a("uploadGame.issueTitle")}),e.jsx(r.Text,{style:{color:"var(--tt-text-dim)"},children:a("uploadGame.issueDesc")})]}),e.jsxs("span",{className:"upload-game-summary-action",role:"button",tabIndex:0,onClick:S,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),S())},children:[e.jsx(V,{style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsx(r.Text,{children:a(x?"uploadGame.hideDetails":"uploadGame.showDetails")})]})]}):null,!P&&!O&&!ne?e.jsxs("div",{className:`upload-game-summary-panel upload-game-summary-panel-ok ${x?"upload-game-summary-panel-expanded":""}`,children:[e.jsxs("div",{className:"upload-game-summary-copy",children:[e.jsx(r.Text,{strong:!0,children:a("uploadGame.readyTitle")}),e.jsx(r.Text,{style:{color:"var(--tt-text-dim)"},children:a("uploadGame.readyDesc")})]}),e.jsxs("span",{className:"upload-game-summary-action",role:"button",tabIndex:0,onClick:S,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),S())},children:[e.jsx(V,{style:{transform:x?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}}),e.jsx(r.Text,{children:a(x?"uploadGame.hideDetails":"uploadGame.showDetails")})]})]}):null,x?e.jsx("div",{className:"upload-game-inline-detail",children:e.jsx("div",{className:"upload-game-check-body upload-game-detail-card",children:P?e.jsx("div",{className:"upload-game-loading",children:e.jsx(z,{})}):e.jsxs(e.Fragment,{children:[e.jsx(as,{engine:Ne}),e.jsx(ds,{result:Ee}),e.jsx(ts,{result:Ue}),e.jsx(cs,{result:Le}),e.jsx(rs,{result:Re})]})})}):null,e.jsx("div",{className:"upload-game-flow","aria-label":a("uploadGame.guide.title"),children:ze.map((s,t)=>e.jsxs("div",{className:"upload-game-flow-item",children:[e.jsx("span",{className:"upload-game-flow-index",children:t+1}),e.jsx(r.Text,{children:s})]},s))}),e.jsxs("div",{className:`upload-game-module-card upload-game-form-wrapper upload-game-form-wrapper-main ${l==="idle"?"":"upload-game-form-wrapper-stage"}`,children:[l==="idle"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"upload-game-form-head",children:[e.jsx(r.Text,{strong:!0,children:a("gameAssetDescription")}),e.jsx(r.Text,{className:"upload-game-form-head-desc",children:a("uploadGame.uploadDescHint")})]}),e.jsx(me,{ref:re,onChange:({values:s})=>{ee(s?.gameDescription||""),j("")},children:e.jsx(me.TextArea,{noLabel:!0,placeholder:a("gameAssetDescription"),field:"gameDescription",disabled:!N})}),B&&e.jsx(r.Text,{type:"danger",style:{display:"block",marginBottom:8},children:B}),e.jsx(w,{className:"upload-game-upload-action",theme:"solid",type:"primary",disabled:!N||se,loading:se,onClick:Fe,children:a("uploadToPlatform")})]}):null,l==="uploading"||l==="checkingAsset"||l==="resolvingPreview"?e.jsxs("div",{className:"upload-game-progress-card",children:[e.jsxs("div",{className:"upload-game-progress-head",children:[e.jsxs("div",{className:"upload-game-progress-badge",children:[e.jsx("span",{className:"upload-game-progress-badge-dot"}),e.jsx(r.Text,{children:l==="uploading"?a("uploadGame.progress.badgeUploading"):l==="checkingAsset"?a("uploadGame.progress.badgeChecking"):a("uploadGame.progress.badgePreview")})]}),e.jsx("div",{className:"upload-game-progress-bar"})]}),e.jsxs("div",{className:"upload-game-progress-copy",children:[e.jsx(r.Text,{strong:!0,className:"upload-game-stage-title",children:l==="uploading"?a("uploadGame.progress.title"):l==="checkingAsset"?a("uploadGame.progress.assetTitle"):a("uploadGame.progress.previewTitle")}),e.jsx(r.Paragraph,{className:"upload-game-form-head-desc",children:l==="uploading"?a("uploadGame.progress.desc"):l==="checkingAsset"?a("uploadGame.progress.assetDesc",{status:ge||a("uploadGame.progress.statusPending")}):a("uploadGame.progress.previewDesc")}),e.jsx("div",{className:"upload-game-progress-steps",children:Ie.map((s,t)=>{const u=$e(t);return e.jsxs("div",{className:`upload-game-progress-step upload-game-progress-step-${u}`,children:[e.jsx("span",{className:"upload-game-progress-step-dot",children:t+1}),e.jsx("span",{className:"upload-game-progress-step-label",children:s})]},s)})})]})]}):null,l==="success"?e.jsx("div",{className:"upload-game-success-card",children:e.jsxs("div",{className:"upload-game-success-body",children:[e.jsxs("div",{className:"upload-game-success-content",children:[e.jsxs("div",{className:"upload-game-success-heading",children:[e.jsx("span",{className:"upload-game-success-icon","aria-hidden":"true",children:e.jsx(Je,{})}),e.jsx(r.Text,{strong:!0,className:"upload-game-stage-title",children:A?a("uploadGame.success.readyTitle"):a("uploadGame.success.title")})]}),e.jsx(r.Paragraph,{className:"upload-game-form-head-desc",children:A?a("uploadGame.success.desc"):a("uploadGame.success.pendingDesc")}),e.jsxs("div",{className:"upload-game-success-actions",children:[d?e.jsx(w,{theme:"light",onClick:()=>window.open(d,"_blank"),children:a("viewOnPlatform")}):null,e.jsx(w,{theme:"solid",type:"primary",onClick:Me,children:a("uploadGame.success.uploadAnother")})]})]}),e.jsx("div",{className:"upload-game-success-qr",children:A?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"upload-game-success-qr-box",children:e.jsx(pe,{value:A,size:156})}),e.jsx(r.Text,{className:"upload-game-success-qr-caption",children:a("uploadGame.success.qrHint")})]}):e.jsx("div",{className:"upload-game-success-qr-placeholder",children:e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.success.noQr")})})})]})}):null,l==="failure"?e.jsxs("div",{className:"upload-game-failure-card",children:[e.jsx(r.Text,{strong:!0,className:"upload-game-stage-title",children:a("uploadGame.failure.title")}),e.jsx(r.Paragraph,{className:"upload-game-form-head-desc",children:B||a("uploadPlatformFailed")}),e.jsxs("div",{className:"upload-game-success-actions",children:[d?e.jsx(w,{theme:"light",onClick:()=>window.open(d,"_blank"),children:a("viewOnPlatform")}):null,e.jsx(w,{theme:"solid",type:"primary",onClick:()=>{n("idle"),j(""),k(""),R("")},children:a("uploadGame.failure.retry")})]})]}):null]}),N?e.jsxs("div",{className:"upload-game-module-card upload-game-records",children:[e.jsx("div",{className:"upload-game-records-head",children:e.jsxs("div",{className:"upload-game-records-copy",children:[e.jsx(r.Text,{children:a("uploadGame.record.title")}),e.jsx(r.Text,{className:"upload-game-form-head-desc",children:a("uploadGame.record.desc")})]})}),Z?e.jsx(We,{type:"warning",description:Z,style:{marginTop:12}}):null,J&&!G.length?e.jsxs("div",{className:"upload-game-records-empty",children:[e.jsx(z,{size:"small"}),e.jsx(r.Text,{children:a("uploadGame.record.loading")})]}):null,!J&&!G.length?e.jsx("div",{className:"upload-game-records-empty",children:e.jsx(r.Text,{children:a("uploadGame.record.empty")})}):null,G.length?e.jsxs("div",{className:"upload-game-records-layout",children:[e.jsx("div",{className:"upload-game-records-toolbar",children:e.jsx(Ze,{value:v,className:"upload-game-record-select",placeholder:a("uploadGame.record.selectPlaceholder"),showClear:!0,optionList:G.slice(0,12).map(s=>({value:String(s.asset_id),label:De(s)})),onChange:s=>b(String(s||""))})}),g?e.jsxs("div",{className:"upload-game-record-detail",children:[e.jsx("div",{className:"upload-game-record-detail-head",children:e.jsx("div",{className:"upload-game-record-detail-copy",children:e.jsx(r.Text,{strong:!0,children:a("uploadGame.record.detailTitle",{version:de(g)})})})}),e.jsxs("div",{className:"upload-game-record-detail-body",children:[e.jsxs("div",{className:"upload-game-record-detail-main",children:[e.jsxs("div",{className:"upload-game-record-detail-meta",children:[e.jsxs("div",{className:"upload-game-record-detail-row",children:[e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.record.metaUploadedAt")}),e.jsx(r.Text,{children:ce(g.uploaded_at)})]}),e.jsxs("div",{className:"upload-game-record-detail-row",children:[e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.record.metaAssetId")}),e.jsx(r.Text,{children:g.asset_id||a("uploadGame.record.metaUnknown")})]}),e.jsxs("div",{className:"upload-game-record-detail-row",children:[e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.record.metaSource")}),e.jsx(r.Text,{children:Te(g.source)})]}),e.jsxs("div",{className:"upload-game-record-detail-row",children:[e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.record.metaSize")}),e.jsx(r.Text,{children:Pe(g.file_size)})]})]}),e.jsxs("div",{className:"upload-game-record-detail-note",children:[e.jsx(r.Text,{type:"tertiary",children:a("gameAssetDescription")}),e.jsx(r.Paragraph,{children:g.note||a("uploadGame.record.noDesc")})]})]}),e.jsx("div",{className:"upload-game-record-preview",children:g.state==="ready"?I?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"upload-game-record-qr-box",children:e.jsx(pe,{value:I,size:132})}),e.jsx(r.Text,{className:"upload-game-success-qr-caption",children:a("uploadGame.record.previewHint")})]}):e.jsx("div",{className:"upload-game-record-qr-box upload-game-record-qr-box-muted",children:je?e.jsxs("div",{className:"upload-game-record-preview-loading",children:[e.jsx(z,{size:"small"}),e.jsx(r.Text,{children:a("uploadGame.record.previewLoading")})]}):e.jsx(r.Text,{type:"tertiary",children:a("uploadGame.record.previewUnavailable")})}):e.jsx("div",{className:"upload-game-record-qr-box upload-game-record-qr-box-muted",children:e.jsx(r.Text,{type:"tertiary",children:g.state==="failed"?a("uploadGame.record.failedDesc"):a("uploadGame.record.pendingDesc")})})})]}),String(g.asset_id)===String(fe)&&d?e.jsx("div",{className:"upload-game-success-actions",children:e.jsx(w,{theme:"light",onClick:()=>window.open(d,"_blank"),children:a("viewOnPlatform")})}):null]}):null]}):null]}):null]})]})};export{ms as CheckCode};
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as m,r as d,a2 as p,i as n,j as t}from"./index-DcpswdR4.js";const x=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],f=m("circle-alert",x);const w=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],b=m("circle-check",w),j=()=>{const[c,r]=d.useState({kind:"idle"}),l=d.useRef(null);if(d.useEffect(()=>{const e=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},u=({status:k,msg:g,progress:h})=>{switch(k){case"start":e(),r({kind:"uploading",progress:0});break;case"process":e(),r({kind:"uploading",progress:Math.max(0,Math.min(1,h??0))});break;case"success":e(),r({kind:"success"}),l.current=window.setTimeout(()=>{r({kind:"idle"}),l.current=null},2500);break;case"restart":e(),r({kind:"restart"});break;case"error":e(),r({kind:"error",msg:g});break}};return p.on("uploadGame",u),()=>{p.off("uploadGame",u),e()}},[]),c.kind==="idle")return null;let s="",a="",i="0%",o="uploading";switch(c.kind){case"uploading":{const e=Math.round(c.progress*100);s=n("uploadStart"),a=`${e}%`,i=`${e}%`,o="uploading";break}case"success":s=n("uploadSuccess"),a="100%",i="100%",o="success";break;case"restart":s=n("uploadStart"),a="",i="0%",o="uploading";break;case"error":s=n("uploadError"),c.msg&&(s=`${s}: ${c.msg}`),a="",i="100%",o="error";break}return t.jsxs("div",{className:`tt-wasm-upload-progress tt-wasm-upload-progress--${o}`,role:"status","aria-live":"polite",title:s,children:[t.jsxs("div",{className:"tt-wasm-upload-progress-meta",children:[t.jsx("span",{className:"tt-wasm-upload-progress-label",children:s}),a&&t.jsx("span",{className:"tt-wasm-upload-progress-percent",children:a})]}),t.jsx("div",{className:"tt-wasm-upload-progress-track",children:t.jsx("div",{className:"tt-wasm-upload-progress-fill",style:{width:i}})})]})};export{b as C,j as U,f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.semi-steps .semi-col{flex:1}.semi-steps-vertical .semi-row-flex{flex-direction:column}.semi-steps .semi-steps-item{box-sizing:border-box;display:flex;height:72px;position:relative;overflow:hidden;margin-right:16px;border:1px solid transparent;border-radius:var(--semi-border-radius-medium);padding:12px 16px;transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);transform:scale(var(--semi-transform_scale-small));transition:background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none)}.semi-steps .semi-steps-item .semi-steps-item-title{position:relative;font-size:18px;line-height:24px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:600;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--semi-color-text-0);transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none)}.semi-steps .semi-steps-item .semi-steps-item-description{font-size:14px;line-height:20px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;color:var(--semi-color-text-2);width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.semi-steps .semi-steps-item-process{background-color:var(--semi-color-primary-light-default)}.semi-steps .semi-steps-item-process .semi-steps-item-left:not(.semi-steps-item-icon){background:var(--semi-color-primary)}.semi-steps .semi-steps-item-process .semi-steps-item-title,.semi-steps .semi-steps-item-process .semi-steps-item-icon{color:var(--semi-color-primary)}.semi-steps .semi-steps-item-wait .semi-steps-item-left:not(.semi-steps-item-icon){background:var(--semi-color-text-2)}.semi-steps .semi-steps-item-wait .semi-steps-item-icon{color:var(--semi-color-text-2)}.semi-steps .semi-steps-item-finish .semi-icon,.semi-steps .semi-steps-item-finish .semi-steps-item-title{color:var(--semi-color-success)}.semi-steps .semi-steps-item-finish-hover:hover{background-color:var(--semi-color-fill-0)}.semi-steps .semi-steps-item-finish-hover:hover .semi-icon,.semi-steps .semi-steps-item-finish-hover:hover .semi-steps-item-title{color:var(--semi-color-success-hover)}.semi-steps .semi-steps-item-finish-active:active{background-color:var(--semi-color-fill-1)}.semi-steps .semi-steps-item-finish-active:active .semi-icon,.semi-steps .semi-steps-item-finish-active:active .semi-steps-item-title{color:var(--semi-color-success-active)}.semi-steps .semi-steps-item-error .semi-icon,.semi-steps .semi-steps-item-error .semi-steps-item-title{color:var(--semi-color-danger)}.semi-steps .semi-steps-item-error-hover:hover{background:var(--semi-color-fill-0)}.semi-steps .semi-steps-item-error-hover:hover .semi-icon,.semi-steps .semi-steps-item-error-hover:hover .semi-steps-item-title{color:var(--semi-color-danger-hover)}.semi-steps .semi-steps-item-error-active:active{background-color:var(--semi-color-fill-1)}.semi-steps .semi-steps-item-error-active:active .semi-icon,.semi-steps .semi-steps-item-error-active:active .semi-steps-item-title{color:var(--semi-color-danger-active)}.semi-steps .semi-steps-item-warning .semi-steps-item-title,.semi-steps .semi-steps-item-warning .semi-icon{color:var(--semi-color-warning)}.semi-steps .semi-steps-item-warning-hover:hover{background:var(--semi-color-fill-0)}.semi-steps .semi-steps-item-warning-hover:hover .semi-steps-item-title,.semi-steps .semi-steps-item-warning-hover:hover .semi-icon{color:var(--semi-color-warning-hover)}.semi-steps .semi-steps-item-warning-active:active{background-color:var(--semi-color-fill-1)}.semi-steps .semi-steps-item-warning-active:active .semi-steps-item-title,.semi-steps .semi-steps-item-warning-active:active .semi-icon{color:var(--semi-color-warning-active)}.semi-steps .semi-steps-item-clickable{cursor:pointer}.semi-steps .semi-steps-item-left{width:24px;height:24px;line-height:32px;text-align:center;border-radius:32px;display:flex;align-items:center;justify-content:center;font-size:20px;line-height:28px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:600;flex-grow:0}.semi-steps .semi-steps-item-left.semi-steps-item-plain{color:rgba(var(--semi-white),1)}.semi-steps .semi-steps-item-left-process{background:var(--semi-color-primary-light-default)}.semi-steps .semi-steps-item-content{margin-left:16px;flex:1;overflow:hidden}.semi-steps-basic.semi-steps-horizontal{display:flex;flex-flow:row nowrap}.semi-steps-basic.semi-steps-horizontal.semi-steps-hasline .semi-steps-item-title:after{content:"";position:absolute;top:50%;left:100%;display:block;width:9999px;height:1px;background:var(--semi-color-fill-2)}.semi-steps-basic.semi-steps-horizontal .semi-steps-item{padding-left:16px}.semi-steps-basic.semi-steps-horizontal .semi-steps-item:first-child{padding-left:0}.semi-steps-basic.semi-steps-horizontal .semi-steps-item:last-child{flex:none}.semi-steps-basic.semi-steps-horizontal .semi-steps-item:last-child .semi-steps-item-title{max-width:100%;padding-right:0}.semi-steps-basic.semi-steps-horizontal .semi-steps-item:last-child .semi-steps-item-title:after{display:none}.semi-steps-basic.semi-steps-horizontal .semi-steps-item-done .semi-steps-item-container .semi-steps-item-title:after{background:var(--semi-color-primary)}.semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-content{flex:1}.semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-description{font-size:12px;line-height:16px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;color:var(--semi-color-text-2);width:100%;max-width:268px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title{max-width:80%}.semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title .semi-steps-item-title-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none)}.semi-steps-basic.semi-steps-vertical{display:flex;flex-flow:column nowrap}.semi-steps-basic.semi-steps-vertical .semi-steps-item-icon{box-sizing:content-box}.semi-steps-basic.semi-steps-vertical.semi-steps-small .semi-steps-item .semi-steps-item-content{min-height:40px}.semi-steps-basic.semi-steps-vertical.semi-steps-hasline .semi-steps-item-icon:after{content:"";position:absolute;top:100%;left:50%;display:block;width:1px;height:9999px;background:var(--semi-color-fill-2)}.semi-steps-basic.semi-steps-vertical .semi-steps-item{padding-top:9px}.semi-steps-basic.semi-steps-vertical .semi-steps-item:first-child{padding-top:0}.semi-steps-basic.semi-steps-vertical .semi-steps-item:last-child .semi-steps-item-icon:after{display:none}.semi-steps-basic.semi-steps-vertical .semi-steps-item-done .semi-steps-item-icon:after{background:var(--semi-color-primary)}.semi-steps-basic.semi-steps-vertical .semi-steps-item .semi-steps-item-content{min-height:42px;padding-bottom:22px}.semi-steps-basic.semi-steps-vertical .semi-steps-item .semi-steps-item-icon{display:inline-flex;position:relative;padding-bottom:9px}.semi-steps-basic.semi-steps-vertical .semi-steps-item .semi-steps-item-description{font-size:12px;line-height:16px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;color:var(--semi-color-text-2);width:100%}.semi-steps-basic.semi-steps-vertical .semi-steps-item .semi-steps-item-title{max-width:100%}.semi-steps-basic.semi-steps-vertical .semi-steps-item .semi-steps-item-title .semi-steps-item-title-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.semi-steps-basic .semi-steps-item{box-sizing:border-box;position:relative;display:inline-block;vertical-align:top;overflow:hidden;flex:1;transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none),background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);transform:scale(var(--semi-transform_scale-small))}.semi-steps-basic .semi-steps-item-clickable{cursor:pointer}.semi-steps-basic .semi-steps-item-hover:hover .semi-steps-item-title,.semi-steps-basic .semi-steps-item-hover:hover .semi-steps-item-description{color:var(--semi-color-focus-border)}.semi-steps-basic .semi-steps-item .semi-steps-item-container{display:flex;align-items:flex-start}.semi-steps-basic .semi-steps-item .semi-steps-item-left{display:flex;justify-content:center;align-items:center;margin-right:8px}.semi-steps-basic .semi-steps-item .semi-steps-item-left .semi-steps-item-icon{display:flex;height:24px;align-items:center}.semi-steps-basic .semi-steps-item .semi-steps-item-left .semi-steps-item-number-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;font-size:16px;line-height:22px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:600;background:var(--semi-color-primary);border-radius:var(--semi-border-radius-circle);color:var(--semi-color-white);transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none)}.semi-steps-basic .semi-steps-item .semi-steps-item-title{position:relative;display:inline-block;font-size:16px;line-height:22px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;line-height:24px;font-weight:600;color:var(--semi-color-text-0);vertical-align:top;padding-right:16px;margin-bottom:4px;transition:color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none)}.semi-steps-basic .semi-steps-item-finish .semi-steps-item-left .semi-steps-item-icon{color:var(--semi-color-primary)}.semi-steps-basic .semi-steps-item-finish .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{color:var(--semi-color-white)}.semi-steps-basic .semi-steps-item-wait .semi-steps-item-title,.semi-steps-basic .semi-steps-item-wait .semi-steps-item-left .semi-steps-item-icon{color:var(--semi-color-text-2)}.semi-steps-basic .semi-steps-item-wait .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{background:var(--semi-color-fill-0);color:var(--semi-color-text-2)}.semi-steps-basic .semi-steps-item-wait-hover:hover .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{background:var(--semi-color-secondary-light-default);color:var(--semi-color-focus-border)}.semi-steps-basic .semi-steps-item-process .semi-steps-item-left .semi-steps-item-icon{color:var(--semi-color-primary)}.semi-steps-basic .semi-steps-item-process .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{color:var(--semi-color-white)}.semi-steps-basic .semi-steps-item-error .semi-steps-item-left .semi-steps-item-icon{color:var(--semi-color-danger)}.semi-steps-basic .semi-steps-item-error .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{color:var(--semi-color-primary)}.semi-steps-basic .semi-steps-item-warning .semi-steps-item-left .semi-steps-item-icon{color:var(--semi-color-warning)}.semi-steps-basic .semi-steps-item-warning .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{color:var(--semi-color-white)}.semi-steps-basic.semi-steps-small .semi-steps-item .semi-steps-item-title{font-size:14px;line-height:20px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif}.semi-steps-basic.semi-steps-small .semi-steps-item .semi-steps-item-left .semi-steps-item-icon{height:20px}.semi-steps-basic.semi-steps-small .semi-steps-item .semi-steps-item-left .semi-steps-item-icon .semi-steps-item-number-icon{font-size:12px;line-height:16px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;width:20px;height:20px}.semi-steps-nav{display:inline-flex;flex-flow:row nowrap}.semi-steps-nav .semi-steps-item{box-sizing:border-box}.semi-steps-nav .semi-steps-item:last-child{flex:none}.semi-steps-nav .semi-steps-item:last-child .semi-steps-item-content{width:auto}.semi-steps-nav .semi-steps-item .semi-steps-item-container{display:flex;align-items:center;color:var(--semi-color-text-2)}.semi-steps-nav .semi-steps-item .semi-steps-item-container .semi-steps-item-icon{display:inline-flex;flex:1;justify-content:center;color:var(--semi-grey-3);min-width:60px}.semi-steps-nav .semi-steps-item .semi-steps-item-content{flex:1;display:inline-block}.semi-steps-nav .semi-steps-item .semi-steps-item-title{font-size:16px;line-height:22px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif;max-width:17em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400}.semi-steps-nav .semi-steps-item-active .semi-steps-item-title{color:var(--semi-color-text-0);font-weight:600}.semi-steps-nav.semi-steps-small .semi-steps-item .semi-steps-item-title{font-size:14px;line-height:20px;font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif}.semi-rtl .semi-steps,.semi-portal-rtl .semi-steps{direction:rtl}.semi-rtl .semi-steps-item,.semi-portal-rtl .semi-steps-item{margin-right:auto;margin-left:16px}.semi-rtl .semi-steps-item-content,.semi-portal-rtl .semi-steps-item-content{margin-left:auto;margin-right:16px}.semi-rtl .semi-steps-basic,.semi-portal-rtl .semi-steps-basic{direction:rtl}.semi-rtl .semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title,.semi-portal-rtl .semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title{padding-left:16px}.semi-rtl .semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title:after,.semi-portal-rtl .semi-steps-basic.semi-steps-horizontal .semi-steps-item .semi-steps-item-title:after{right:100%}.semi-rtl .semi-steps-basic.semi-steps-vertical .semi-steps-item,.semi-portal-rtl .semi-steps-basic.semi-steps-vertical .semi-steps-item{margin:0}.semi-rtl .semi-steps-nav,.semi-portal-rtl .semi-steps-nav{direction:rtl}.tt-wasm-split-page{padding:0 0 32px}.tt-wasm-split-hero-strip{margin:-24px -32px 8px;padding:12px 28px 0;background:var(--tt-bg-panel)}.tt-wasm-split-hero-strip .tt-page-hero{margin:0;padding:12px 0 8px;background:transparent}.tt-wasm-split-back{display:inline-flex;align-items:center;gap:6px;padding:4px 8px 4px 6px;margin-left:-8px;font-size:var(--tt-text-meta);font-weight:500;color:var(--tt-text-dim);background:transparent;border:1px solid transparent;border-radius:var(--tt-radius-md);cursor:pointer;transition:var(--tt-hover-transition)}.tt-wasm-split-back:hover{color:var(--tt-text);background:var(--tt-overlay-soft);border-color:var(--tt-border)}.tt-wasm-split-back:focus-visible{outline:none;box-shadow:0 0 0 3px var(--tt-accent-soft)}.tt-wasm-split-section{margin-top:24px}.tt-wasm-split-empty{margin:0;font-size:var(--tt-text-body);color:var(--tt-text-dim);line-height:1.6}.tt-wasm-split-empty-card{display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px;padding:40px 32px}.tt-wasm-split-empty-icon{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--tt-warn-bg);color:var(--tt-warn-text);border:1px solid var(--tt-warn-border);margin-bottom:4px}.tt-wasm-split-empty-title{margin:0;font-size:var(--tt-text-h2);font-weight:600;color:var(--tt-text)}.tt-wasm-split-empty-card .tt-wasm-split-empty{max-width:520px}.tt-wasm-split-empty-actions{margin-top:8px}.tt-wasm-split-empty-cta{appearance:none;font:inherit;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;height:36px;padding:0 20px;border-radius:var(--tt-radius-pill);background:var(--tt-accent);border:1px solid var(--tt-accent);color:var(--tt-accent-contrast);font-size:var(--tt-text-body);font-weight:600;letter-spacing:.3px;transition:var(--tt-hover-transition)}.tt-wasm-split-empty-cta:hover{background:var(--tt-accent-hover);border-color:var(--tt-accent-hover)}.tt-wasm-split-empty-cta:focus-visible{outline:2px solid var(--tt-accent);outline-offset:2px}.tt-wasm-requirements-notice{display:flex;align-items:flex-start;gap:12px;margin-top:16px;padding:12px 14px;border:1px solid var(--tt-warn-border);border-radius:var(--tt-radius-md);background:var(--tt-warn-bg);color:var(--tt-warn-text)}.tt-wasm-requirements-notice-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex:0 0 auto;border-radius:var(--tt-radius-sm);background:var(--tt-bg-panel)}.tt-wasm-requirements-notice-copy{display:flex;min-width:0;flex-direction:column;gap:6px}.tt-wasm-requirements-notice-title{font-size:var(--tt-text-body);font-weight:600;color:var(--tt-text)}.tt-wasm-requirements-notice-list{display:flex;flex-direction:column;gap:4px;margin:0;padding:0;list-style:none}.tt-wasm-requirements-notice-list li{position:relative;padding-left:14px;font-size:var(--tt-text-meta);line-height:1.55;color:var(--tt-text-dim)}.tt-wasm-requirements-notice-list li:before{content:"";position:absolute;left:0;top:9px;width:5px;height:5px;border-radius:50%;background:var(--tt-warn-text)}.tt-wasm-requirements-notice a{color:var(--tt-warn-text);font-weight:600;text-decoration:none}.tt-wasm-requirements-notice a:hover{text-decoration:underline}.tt-wasm-split-grid{display:flex;flex-direction:column;gap:16px;margin-top:20px}.tt-wasm-split-workflow-card{min-width:0}.tt-wasm-split-steps-wrap{padding:4px 0 0}.tt-wasm-split-stage{margin-top:12px}.tt-wasm-status-row-inset{margin-top:0;margin-bottom:20px;padding:12px 14px;background:var(--tt-bg-sunken);border-radius:var(--tt-radius-md)}.tt-wasm-split-helper-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:20px;align-items:stretch}.tt-wasm-split-helper-main{min-width:0}.tt-wasm-split-helper-main .tt-section-header{align-items:center}.tt-wasm-split-helper-list{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}.tt-wasm-split-helper-list li{position:relative;padding-left:14px;font-size:var(--tt-text-meta);line-height:1.6;color:var(--tt-text-dim)}.tt-wasm-split-helper-list li:before{content:"";position:absolute;left:0;top:9px;width:5px;height:5px;border-radius:50%;background:var(--tt-accent);opacity:.7}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,
|
|
1
|
+
import{c as o,k as c,j as e,P as r,i as a}from"./index-DcpswdR4.js";import{S as t}from"./SectionHeader-BQDU_6TX.js";import{C as d,m,M as l,a as h,o as p}from"./MonetizationModeSummary-LeYQ02Tv.js";import"./index-BBHaV7vS.js";import{L as x,C as v}from"./layers-kzl3dc3j.js";import{C as y}from"./compass-DfWJoWl3.js";import"./Card-BC5ydRHh.js";const j=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],u=o("credit-card",j);const g=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],k=o("megaphone",g),N={iaa:k,iap:u,iaap:x},C=s=>a(s),A=()=>{const s=c();return e.jsxs("div",{className:"ia-page",children:[e.jsx(r,{title:a("ia.overview.title"),subtitle:a("ia.overview.desc")}),e.jsxs("section",{className:"ia-section ia-section-modes",children:[e.jsx(t,{icon:d,title:a("ia.monetization.title"),subtitle:a("ia.monetization.desc")}),e.jsx("div",{className:"ia-mode-grid",children:m.map(i=>{const n=N[i.key];return e.jsxs("button",{type:"button",className:`ia-mode-card ia-mode-card-${i.key}`,onClick:()=>s(`/integration_assistant/mode/${i.key}`),children:[e.jsxs("header",{className:"ia-mode-card-head",children:[e.jsx("span",{className:"ia-mode-card-badge","aria-hidden":"true",children:e.jsx(n,{size:17,strokeWidth:2})}),e.jsx("h4",{className:"ia-mode-card-title",children:C(i.titleKey)}),e.jsx("span",{className:"ia-mode-card-chevron","aria-hidden":"true",children:e.jsx(v,{size:14,strokeWidth:2})})]}),e.jsx(l,{mode:i,compact:!0})]},i.key)})})]}),e.jsxs("section",{className:"ia-section",children:[e.jsx(t,{icon:y,title:a("ia.overview.groups.title"),subtitle:a("ia.overview.groups.desc")}),e.jsx("div",{className:"ia-section-stack",children:e.jsx(h,{sections:p})})]})]})};export{A as IntegrationAssistant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{k as t,r as a,j as e,B as c,i as o,C as r,Z as i}from"./index-DcpswdR4.js";const d=()=>{const n=t();return a.useEffect(()=>{const s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[]),e.jsxs("div",{className:"manual-connect-container",children:[e.jsx("div",{className:"manual-connect-back",children:e.jsx(c,{className:"devtool-page-back",theme:"borderless",onClick:()=>n("/network_diagnostics"),children:o("back")})}),e.jsx(r,{title:o("netDiagManualBindEntry"),children:e.jsx(i,{onClose:()=>n("/network_diagnostics"),onSuccess:()=>n("/network_diagnostics")})})]})};export{d as ManualConnect};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,k as $,u as z,r as i,N as E,j as t,B as M,v as B}from"./index-DcpswdR4.js";import{P as H}from"./index-CDxeVVlI.js";import{T as V}from"./index-BAmVtXgk.js";import{F as N}from"./baseForm-dqhahTXM.js";const w={enableAdMock:!1,enableIAPMock:!1,enableDomainCheck:!0,enableVConsole:!0,enableDevInfoPanel:!0},Q=["scan_qrcode","search","fyf_promotion_direct_feed_play","anchor","center","ads","desktop_shortcut","dm_sharing","minis_link","inbox"];function J(){return Object.assign(new Error('Invalid launch configuration. Use schemaVersion "1", a supported scene, pkgName, unique non-reserved query keys and boolean debugSettings.'),{code:"DEV_LAUNCH_CONFIG_INVALID"})}function I(r){const c=()=>{throw J()};if(!r||typeof r!="object"||Array.isArray(r))return c();const h=r;if(Object.keys(h).some(o=>!["schemaVersion","scene","pkgName","queries","debugSettings"].includes(o))||h.schemaVersion!=="1"||Object.values(h).some(o=>o===null))return c();const b=h.scene??"scan_qrcode",y=h.pkgName??"__GAME__",p=h.queries??"";if(!Q.includes(b)||typeof y!="string"||!/^[a-zA-Z0-9_.-]{1,128}$/.test(y)||[".",".."].includes(y)||typeof p!="string"||p.length>4096)return c();const d=h.debugSettings??{};if(!d||typeof d!="object"||Array.isArray(d)||Object.entries(d).some(([o,u])=>!Object.prototype.hasOwnProperty.call(w,o)||typeof u!="boolean"))return c();const _=Object.create(null);if(p)for(const o of p.split("&")){const u=o.indexOf("=");if(u<1)return c();let f,v;try{f=decodeURIComponent(o.slice(0,u)),v=decodeURIComponent(o.slice(u+1))}catch{return c()}if(!/^[\w.!~*'()-]+$/.test(f)||Object.prototype.hasOwnProperty.call(_,f)||/^(host|port|host_list|debugMode|_tiktok_minis_params|enter_from|ttmg_init_module|__proto__|prototype|constructor)$/i.test(f)||/token|password|authorization|cookie|secret/i.test(f)||/[\x00-\x1f\x7f]/.test(v))return c();_[f]=v}return{schemaVersion:"1",scene:b,pkgName:y,queries:Object.keys(_).sort().map(o=>`${encodeURIComponent(o)}=${encodeURIComponent(_[o])}`).join("&"),debugSettings:{...w,...d}}}const Z=()=>[{label:e("scene_scan_qrcode"),value:"scan_qrcode"},{label:e("scene_search"),value:"search"},{label:e("scene_fyf_promotion_direct_feed_play"),value:"fyf_promotion_direct_feed_play"},{label:e("scene_anchor"),value:"anchor"},{label:e("scene_center"),value:"center"},{label:e("scene_ad"),value:"ads"},{label:e("scene_shortcut"),value:"desktop_shortcut"},{label:e("scene_sharing"),value:"dm_sharing"},{label:e("scene_link"),value:"minis_link"},{label:e("scene_inbox"),value:"inbox"}];function O(r){return r.id==="normal"?e("normalLaunchMode"):r.id==="created"?e("createdLaunchMode"):r.name}function K(r){return{...r,name:O(r)}}const ne=()=>{const r=$(),{state:{launchOptions:c,selectedLaunchOption:h,packages:b,debugSetting:y},setLaunchOptions:p,setSelectedLaunchOption:d,setDebugSetting:_}=z(),o=i.useRef(null),[u,f]=i.useState(null),[v,L]=i.useState(""),m=i.useRef(null),j=K(h||E),[C,k]=i.useState(j),[x,S]=i.useState(j.id),A=b.map(n=>{if(n.type==="main")return{label:e("gameMainPackage"),value:"__GAME__"};if(n.type==="independent")return{label:`${e("independentPackage")}: ${n.name}`,value:n.name}}).filter(Boolean),q=i.useCallback(n=>{const a={...C,...n};a.pkgType==="main"&&a.independentPkg!==void 0&&(a.independentPkg=void 0,m.current&&m.current.setValues({independentPkg:void 0})),k(a)},[C]),P=i.useCallback(()=>{if(!m.current)return;const n=m.current.getValues();n.pkgType==="main"&&(n.independentPkg=void 0);const a=c.findIndex(l=>l.name===n.name&&l.id!=="created"&&l.id!=="normal");let s;a!==-1?(s=[...c],n.id=c[a].id,s[a]=n):(n.id=Date.now().toString(),s=[...c.slice(0,-1),n,...c.slice(-1)]),p(s),k(n),d(n),u&&_(u),r("/")},[c,r,p,d,u,_]),D=async n=>{if(n)try{if(n.size>16384)throw new Error("size");const a=I(JSON.parse(await n.text()));if(a.pkgName!=="__GAME__"&&!b.some(l=>l.name===a.pkgName&&l.type==="independent"))throw new Error("package");const s={id:"created",name:n.name.replace(/\.json$/i,""),scene:a.scene,pkgName:a.pkgName,queries:a.queries,pkgType:a.pkgName==="__GAME__"?"main":"independent"};k(s),S("created"),m.current?.setValues(s),f(a.debugSettings),L(n.name)}catch{V.error(e("launchConfigInvalid"))}finally{o.current&&(o.current.value="")}},U=()=>{try{const n=m.current?.getValues()||C,a=I({schemaVersion:"1",scene:n.scene,pkgName:n.pkgName,queries:n.queries,debugSettings:u||y});if(a.pkgName!=="__GAME__"&&!b.some(g=>g.name===a.pkgName&&g.type==="independent"))throw new Error("package");const s=URL.createObjectURL(new Blob([JSON.stringify(a,null,2)+`
|
|
2
|
+
`],{type:"application/json"})),l=document.createElement("a");l.href=s,l.download="ttmg.launch.json",l.click(),setTimeout(()=>URL.revokeObjectURL(s),1e3)}catch{V.error(e("launchConfigInvalid"))}},F=i.useCallback(n=>{f(null),L("");const a=c.find(s=>s.id===n);if(a){S(n);const s={...a};n==="created"?s.name="":n==="normal"&&(s.name=e("normalLaunchMode")),k(s),m.current?.setValues(s)}},[c]),R=i.useCallback(()=>{const n=x;if(["normal","created"].includes(n))return;const a=c.filter(g=>g.id!==n);p(a);const s=a.find(g=>g.id==="normal")||a.find(g=>g.id==="created")||a[0]||E,l={...s,...s.id==="created"?{name:""}:{},...s.id==="normal"?{name:e("normalLaunchMode")}:{}};d(l),S(l.id),k(l),m.current?.setValues(l)},[c,x,p,d]),T=i.useCallback(()=>{k(j),m.current?.setValues(j),r("/")},[j,r]),G=c.find(n=>n.id===x);return t.jsxs("div",{className:"launch-mode-page",children:[t.jsxs("section",{className:"launch-mode-guide",children:[t.jsx("div",{className:"launch-mode-guide-marker"}),t.jsxs("div",{className:"launch-mode-guide-copy",children:[t.jsx("div",{className:"launch-mode-guide-title",children:e("launchMode")}),t.jsx("div",{className:"launch-mode-guide-desc",children:e("launchModeDesc")})]})]}),t.jsxs("section",{className:"launch-mode-form-section",children:[t.jsx("p",{children:e("launchConfigHelp")}),t.jsx("input",{ref:o,type:"file",accept:"application/json,.json",hidden:!0,onChange:n=>{D(n.target.files?.[0])}}),t.jsx(M,{onClick:()=>o.current?.click(),children:e("launchConfigImport")}),t.jsx(M,{onClick:U,style:{marginLeft:8},children:e("launchConfigExport")}),v&&t.jsxs("p",{children:[e("launchConfigPending"),": ",v]})]}),t.jsxs(N,{className:"launch-mode-form",initValues:C,onValueChange:q,getFormApi:n=>m.current=n,onSubmit:P,children:[t.jsxs("div",{className:"launch-mode-form-section launch-mode-current-section",children:[t.jsxs("div",{className:"launch-mode-section-head",children:[t.jsx("div",{className:"launch-mode-section-title",children:e("selectLaunchMode")}),t.jsx("div",{className:"launch-mode-section-desc",children:e("launchMode.currentDesc")})]}),t.jsx(N.Select,{className:"launch-mode-control",placeholder:e("selectLaunchMode"),rules:[{required:!0,message:e("selectLaunchMode")}],field:"id",noLabel:!0,optionList:c.map(n=>({label:O(n),value:n.id})),onChange:F,style:{width:"100%"},value:x})]}),t.jsxs("div",{className:"launch-mode-form-section",children:[t.jsxs("div",{className:"launch-mode-section-head",children:[t.jsx("div",{className:"launch-mode-section-title",children:e("customizeLaunchMode")}),t.jsx("div",{className:"launch-mode-section-desc",children:e("launchMode.configDesc")})]}),t.jsxs("div",{className:"launch-mode-field-grid",children:[t.jsx(N.Input,{className:"launch-mode-control",required:!0,placeholder:e("launchModeName"),field:"name",label:e("launchModeName"),rules:[{required:!0,message:e("notEmpty")}],style:{width:"100%"},trigger:"blur"}),t.jsx(N.Select,{className:"launch-mode-control",field:"pkgName",label:e("selectLaunchPkg"),placeholder:e("selectLaunchPkg"),rules:[{required:!0,message:e("notEmpty")}],optionList:A,style:{width:"100%"}}),t.jsx(N.Select,{className:"launch-mode-control",field:"scene",label:e("selectScene"),rules:[{required:!0,message:e("notEmpty")}],placeholder:e("selectScene"),optionList:Z(),style:{width:"100%"},filter:!0}),t.jsx(N.Input,{className:"launch-mode-control",field:"queries",label:e("launchQueries"),placeholder:e("launchQueriesDesc"),trigger:"blur",rules:[{validator:(n,a)=>{const{isValid:s,message:l}=B(a);return s?Promise.resolve():Promise.reject(l)}}],style:{width:"100%"}})]})]}),t.jsxs("div",{className:"launch-mode-actions",children:[["created","normal"].includes(x)?t.jsx(M,{className:"launch-mode-secondary-action",onClick:T,children:e("cancel")}):t.jsx(H,{title:e("deleteLaunchModeConfirm",{name:G?.name??""}),onConfirm:R,position:"bottomRight",children:t.jsx(M,{className:"launch-mode-danger-action",type:"danger",children:e("delete")})}),t.jsx(M,{className:"launch-mode-primary-action",htmlType:"submit",type:"primary",children:e("saveAndUse")})]})]})]})};export{ne as LaunchMode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DcpswdR4.js";const o=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c=a("chevron-right",o);const e=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],h=a("layers",e);export{c as C,h as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"./index-
|
|
1
|
+
import{c}from"./index-DcpswdR4.js";const e=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],t=c("list-checks",e);export{t as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DcpswdR4.js";const e=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],l=a("sparkles",e);export{l as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-DcpswdR4.js";const a=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],o=e("triangle-alert",a);export{o as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DcpswdR4.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z};
|
package/dist/public/index.html
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
rel="stylesheet"
|
|
13
13
|
/>
|
|
14
14
|
<title>TikTok Mini Games DevTool</title>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-DcpswdR4.js"></script>
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BoFbvk-8.css">
|
|
17
17
|
</head>
|
|
18
18
|
<!--
|
|
19
19
|
Theme attributes (`theme-mode` for Semi UI + `data-theme` for our
|
|
@@ -4,6 +4,7 @@ const net = require('node:net');
|
|
|
4
4
|
const os = require('node:os');
|
|
5
5
|
const path = require('node:path');
|
|
6
6
|
const { spawn } = require('node:child_process');
|
|
7
|
+
let testRcPath;
|
|
7
8
|
|
|
8
9
|
function runCli(args, cwd, inspectScanPage) {
|
|
9
10
|
return new Promise((resolve, reject) => {
|
|
@@ -17,6 +18,7 @@ function runCli(args, cwd, inspectScanPage) {
|
|
|
17
18
|
NO_COLOR: '1',
|
|
18
19
|
FORCE_COLOR: '0',
|
|
19
20
|
TTMG_DEV_NO_OPEN: '1',
|
|
21
|
+
TTMGRC_PATH: testRcPath,
|
|
20
22
|
},
|
|
21
23
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
22
24
|
},
|
|
@@ -76,6 +78,8 @@ function write(socket, value) {
|
|
|
76
78
|
async function run() {
|
|
77
79
|
const shortTmp = process.platform === 'win32' ? os.tmpdir() : '/tmp';
|
|
78
80
|
const root = fs.mkdtempSync(path.join(shortTmp, 'ttmg-preview-control-'));
|
|
81
|
+
testRcPath = path.join(root, 'ttmgrc.json');
|
|
82
|
+
fs.writeFileSync(testRcPath, JSON.stringify({ lang: 'en-US' }));
|
|
79
83
|
const gameDirectory = path.join(root, 'game');
|
|
80
84
|
const previewGameDirectory = path.join(
|
|
81
85
|
root,
|
|
@@ -44,6 +44,14 @@ async function run() {
|
|
|
44
44
|
const configResponse = await fetch(`${origin}/game/config`);
|
|
45
45
|
assert.equal(configResponse.status, 200);
|
|
46
46
|
const { data: config } = await configResponse.json();
|
|
47
|
+
assert.equal(config.devToolVersion, require('../package.json').version);
|
|
48
|
+
const changelogResponse = await fetch(`${origin}/game/changelog`);
|
|
49
|
+
assert.equal(changelogResponse.status, 200);
|
|
50
|
+
const changelog = await changelogResponse.json();
|
|
51
|
+
assert.equal(changelog.code, 0);
|
|
52
|
+
assert.equal(changelog.data.items[0].title, config.devToolVersion);
|
|
53
|
+
assert.equal(changelog.data.items[0].target, undefined);
|
|
54
|
+
assert.match(changelog.data.items[0].changes.optimize[0].desc['zh-CN'], /命令行真机预览的连接和更新失败提示/);
|
|
47
55
|
assert.equal(config.remoteCdnResources.base_url, 'https://remote-cdn-resources.com/');
|
|
48
56
|
assert.deepEqual(config.remoteCdnResources.resources, [{ root: 'remote', output: 'remote' }]);
|
|
49
57
|
assert.equal(new URL(config.remoteResourceBaseUrl).port, String(manifest.network.httpPort));
|
|
@@ -93,13 +93,27 @@ async function main() {
|
|
|
93
93
|
const reused = await run(start);
|
|
94
94
|
assert.equal(reused.result.sessionId, owner.sessionId);
|
|
95
95
|
assert.equal(reused.result.reused, true);
|
|
96
|
+
assert.equal(reused.result.nextAction, 'scan_then_sync');
|
|
97
|
+
const launchFile = path.join(root, 'launch.json');
|
|
98
|
+
fs.writeFileSync(launchFile, JSON.stringify({ schemaVersion: '1', scene: 'search',
|
|
99
|
+
queries: 'level=2', debugSettings: { enableAdMock: true } }));
|
|
100
|
+
const conflict = await run([...start, '--launch-config', launchFile]);
|
|
101
|
+
assert.equal(conflict.code, 1);
|
|
102
|
+
assert.equal(conflict.result.errorCode, 'DEV_SESSION_CONFLICT');
|
|
96
103
|
const otherGame = path.join(root, 'other-game');
|
|
97
104
|
fs.mkdirSync(otherGame);
|
|
98
105
|
fs.writeFileSync(path.join(otherGame, 'game.js'), 'console.log("independent game");');
|
|
99
106
|
fs.writeFileSync(path.join(otherGame, 'game.json'), '{}');
|
|
100
|
-
const second = await run(start, otherGame);
|
|
107
|
+
const second = await run([...start, '--launch-config', launchFile], otherGame);
|
|
101
108
|
assert.equal(second.code, 0, JSON.stringify(second.result));
|
|
102
109
|
secondOwner = second.result;
|
|
110
|
+
assert.equal(secondOwner.launch.configuration.scene, 'search');
|
|
111
|
+
assert.equal(secondOwner.launch.configuration.debugSettings.enableAdMock, true);
|
|
112
|
+
assert.equal(new URL(secondOwner.launch.rawUrl).searchParams.get('level'), '2');
|
|
113
|
+
const sameConfig = await run([...start, '--launch-config', launchFile], otherGame);
|
|
114
|
+
assert.equal(sameConfig.result.reused, true);
|
|
115
|
+
const changedScene = await run(start, otherGame);
|
|
116
|
+
assert.equal(changedScene.result.errorCode, 'DEV_SESSION_CONFLICT');
|
|
103
117
|
assert.notEqual(secondOwner.evidence.directory, owner.evidence.directory);
|
|
104
118
|
assert.ok(fs.existsSync(path.join(secondOwner.evidence.directory, 'build-output')));
|
|
105
119
|
fs.writeFileSync(configPath, JSON.stringify({ clientKey: 'different-global-key', lang: 'en-US' }));
|
|
@@ -37,6 +37,25 @@ npm run docs:devtool:check
|
|
|
37
37
|
|
|
38
38
|
`docs:devtool:capture` assumes the IDE is available at `http://localhost:5173`. Start or change the local DevTool URL before running it if your port is different.
|
|
39
39
|
|
|
40
|
+
### Screenshot privacy gate
|
|
41
|
+
|
|
42
|
+
The `privacy.masks` descriptions in the existing recipes are not executable masks.
|
|
43
|
+
Capture now requires every recipe to declare `privacy.policy: 'fixture-markers-v1'`
|
|
44
|
+
and explicit, visible selectors for `avatar`, `email`, `token`, and `qr` under
|
|
45
|
+
`privacy.requirements` (each with `expected: 'present'`). Only a specific local
|
|
46
|
+
HTTP origin and `docMode=1` scenario are accepted. Capture refuses unmarked
|
|
47
|
+
scenarios, masks the selected regions after sizing the page, and records mask
|
|
48
|
+
counts and screenshot hashes; the freshness check rejects older reports without
|
|
49
|
+
that evidence or files changed after capture. The capture browser blocks
|
|
50
|
+
non-loopback HTTP requests and non-local page WebSockets.
|
|
51
|
+
|
|
52
|
+
These checks cannot discover unmarked secrets or prove that the fixture is
|
|
53
|
+
complete. Audit all content and independently inspect every image before use.
|
|
54
|
+
The current recipes still contain descriptions rather than audited selectors,
|
|
55
|
+
so capture intentionally fails until matching, fully synthetic fixtures and
|
|
56
|
+
their markers are provided. Do not switch to real account or device data to
|
|
57
|
+
make this gate pass.
|
|
58
|
+
|
|
40
59
|
## Doc mode fixture
|
|
41
60
|
|
|
42
61
|
Screenshot routes append `docMode=1&docScenario=<scenario id>`. In this mode the IDE uses stable fixture data for platform and project requests, so usage-guide screenshots do not depend on the current login account, local Node connection, platform availability, or a connected device.
|
|
@@ -4,6 +4,7 @@ const crypto = require('crypto');
|
|
|
4
4
|
const { pathToFileURL } = require('url');
|
|
5
5
|
const chromeLauncher = require('chrome-launcher');
|
|
6
6
|
const CDP = require('chrome-remote-interface');
|
|
7
|
+
const { POLICY, validateOrigin, validateRequirements, createRedactionExpression } = require('./privacy-guard');
|
|
7
8
|
|
|
8
9
|
function parseArgs(argv) {
|
|
9
10
|
return argv.reduce((acc, arg) => {
|
|
@@ -220,7 +221,7 @@ async function getMeaningfulContentHeight(Runtime, viewport) {
|
|
|
220
221
|
return Number(result?.result?.value || 0);
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
async function captureFullPage(Page, Runtime, Emulation, outputPath, viewport) {
|
|
224
|
+
async function captureFullPage(Page, Runtime, Emulation, outputPath, viewport, origin, recipe) {
|
|
224
225
|
const metrics = await Page.getLayoutMetrics();
|
|
225
226
|
const width = Math.max(viewport.width, Math.ceil(metrics.contentSize.width || viewport.width));
|
|
226
227
|
const meaningfulHeight = await getMeaningfulContentHeight(Runtime, viewport);
|
|
@@ -232,6 +233,16 @@ async function captureFullPage(Page, Runtime, Emulation, outputPath, viewport) {
|
|
|
232
233
|
|
|
233
234
|
await setViewport(Emulation, width, safeHeight);
|
|
234
235
|
|
|
236
|
+
// Evaluate after resizing: the full-page viewport can change element layout.
|
|
237
|
+
const redaction = await Runtime.evaluate({
|
|
238
|
+
expression: createRedactionExpression(origin, recipe),
|
|
239
|
+
returnByValue: true,
|
|
240
|
+
awaitPromise: true,
|
|
241
|
+
});
|
|
242
|
+
if (redaction.exceptionDetails || !redaction.result?.value?.covers) {
|
|
243
|
+
throw new Error(`Privacy redaction failed for ${recipe.id}; refusing screenshot`);
|
|
244
|
+
}
|
|
245
|
+
|
|
235
246
|
const screenshot = await Page.captureScreenshot({
|
|
236
247
|
format: 'png',
|
|
237
248
|
fromSurface: true,
|
|
@@ -246,6 +257,7 @@ async function captureFullPage(Page, Runtime, Emulation, outputPath, viewport) {
|
|
|
246
257
|
});
|
|
247
258
|
|
|
248
259
|
fs.writeFileSync(outputPath, screenshot.data, 'base64');
|
|
260
|
+
return redaction.result.value;
|
|
249
261
|
}
|
|
250
262
|
|
|
251
263
|
async function loadRecipes(recipesPath) {
|
|
@@ -308,6 +320,10 @@ async function main() {
|
|
|
308
320
|
if (fs.existsSync(reportPath)) {
|
|
309
321
|
fs.rmSync(reportPath);
|
|
310
322
|
}
|
|
323
|
+
// Descriptive privacy.masks strings are not proof of actual redaction.
|
|
324
|
+
// Reject the entire run before opening a browser if any recipe is unaudited.
|
|
325
|
+
const origin = validateOrigin(baseUrl);
|
|
326
|
+
for (const recipe of recipes) validateRequirements(recipe);
|
|
311
327
|
const captureReport = {
|
|
312
328
|
schemaVersion: 1,
|
|
313
329
|
title: guideTitle,
|
|
@@ -335,15 +351,40 @@ async function main() {
|
|
|
335
351
|
let client;
|
|
336
352
|
try {
|
|
337
353
|
client = await CDP({ port: chrome.port });
|
|
338
|
-
const { Page, Runtime, Network, Emulation } = client;
|
|
354
|
+
const { Page, Runtime, Network, Emulation, Fetch } = client;
|
|
339
355
|
await Promise.all([
|
|
340
356
|
Page.enable(),
|
|
341
357
|
Runtime.enable(),
|
|
342
358
|
Network.enable(),
|
|
359
|
+
Fetch.enable({ patterns: [{ urlPattern: '*' }] }),
|
|
343
360
|
Emulation.setDefaultBackgroundColorOverride({
|
|
344
361
|
color: { r: 255, g: 255, b: 255, a: 1 },
|
|
345
362
|
}),
|
|
346
363
|
]);
|
|
364
|
+
// Documentation fixtures must not fetch account or platform data.
|
|
365
|
+
Fetch.requestPaused(async event => {
|
|
366
|
+
try {
|
|
367
|
+
if (new URL(event.request.url).origin === origin) {
|
|
368
|
+
await Fetch.continueRequest({ requestId: event.requestId });
|
|
369
|
+
} else {
|
|
370
|
+
await Fetch.failRequest({ requestId: event.requestId, errorReason: 'BlockedByClient' });
|
|
371
|
+
}
|
|
372
|
+
} catch (_) {
|
|
373
|
+
try { await Fetch.failRequest({ requestId: event.requestId, errorReason: 'BlockedByClient' }); } catch (_) {}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
await Page.addScriptToEvaluateOnNewDocument({ source: `(() => {
|
|
377
|
+
const Original = window.WebSocket;
|
|
378
|
+
window.WebSocket = class extends Original {
|
|
379
|
+
constructor(url, ...args) {
|
|
380
|
+
const target = new URL(url, location.href);
|
|
381
|
+
if (!['localhost', '127.0.0.1'].includes(target.hostname) || target.host !== location.host) {
|
|
382
|
+
throw new Error('External WebSocket blocked during documentation capture');
|
|
383
|
+
}
|
|
384
|
+
super(url, ...args);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
})();` });
|
|
347
388
|
|
|
348
389
|
for (const locale of normalizedLocales) {
|
|
349
390
|
const baseHeaders = {
|
|
@@ -378,7 +419,7 @@ async function main() {
|
|
|
378
419
|
|
|
379
420
|
const fileName = `${recipe.id}.${locale}.png`;
|
|
380
421
|
const outputPath = path.join(assetsDir, fileName);
|
|
381
|
-
await captureFullPage(Page, Runtime, Emulation, outputPath, viewport);
|
|
422
|
+
const redaction = await captureFullPage(Page, Runtime, Emulation, outputPath, viewport, origin, recipe);
|
|
382
423
|
const stats = fs.statSync(outputPath);
|
|
383
424
|
captureReport.screenshots.push({
|
|
384
425
|
id: `${recipe.id}.${locale}`,
|
|
@@ -389,6 +430,8 @@ async function main() {
|
|
|
389
430
|
viewport,
|
|
390
431
|
path: `assets/${fileName}`,
|
|
391
432
|
bytes: stats.size,
|
|
433
|
+
sha256: crypto.createHash('sha256').update(fs.readFileSync(outputPath)).digest('hex'),
|
|
434
|
+
privacy: { policy: POLICY, counts: redaction.counts, covers: redaction.covers },
|
|
392
435
|
capturedAt: new Date().toISOString(),
|
|
393
436
|
});
|
|
394
437
|
console.log(`[ttmg-docs] captured ${fileName}`);
|
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const crypto = require('crypto');
|
|
4
4
|
const { pathToFileURL } = require('url');
|
|
5
|
+
const { CATEGORIES, POLICY, validateRequirements } = require('./privacy-guard');
|
|
5
6
|
|
|
6
7
|
function parseArgs(argv) {
|
|
7
8
|
return argv.reduce((acc, arg) => {
|
|
@@ -149,6 +150,7 @@ async function main() {
|
|
|
149
150
|
const capturedById = new Map((report.screenshots || []).map(item => [item.id, item]));
|
|
150
151
|
const expectedIds = [];
|
|
151
152
|
for (const recipe of recipes) {
|
|
153
|
+
validateRequirements(recipe);
|
|
152
154
|
for (const locale of locales) {
|
|
153
155
|
expectedIds.push(`${recipe.id}.${locale}`);
|
|
154
156
|
}
|
|
@@ -167,6 +169,13 @@ async function main() {
|
|
|
167
169
|
if (stats.size < 1024) {
|
|
168
170
|
fail(`Screenshot file looks invalid or empty: ${item.path}`);
|
|
169
171
|
}
|
|
172
|
+
if (item.privacy?.policy !== POLICY ||
|
|
173
|
+
CATEGORIES.some(name => !Number.isSafeInteger(item.privacy?.counts?.[name]) || item.privacy.counts[name] < 1) ||
|
|
174
|
+
item.privacy.covers !== CATEGORIES.reduce((sum, name) => sum + item.privacy.counts[name], 0)) {
|
|
175
|
+
fail(`Missing privacy redaction evidence for screenshot: ${id}`);
|
|
176
|
+
}
|
|
177
|
+
const digest = crypto.createHash('sha256').update(fs.readFileSync(screenshotPath)).digest('hex');
|
|
178
|
+
if (digest !== item.sha256) fail(`Screenshot has changed after capture: ${id}`);
|
|
170
179
|
assertFileFreshAgainstRecipe(screenshotPath, recipesPath);
|
|
171
180
|
assertScreenshotFreshAgainstArtifact(screenshotPath, manifestPath);
|
|
172
181
|
assertScreenshotFreshAgainstArtifact(screenshotPath, screenshotIndexPath);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Fixture-only screenshot guard. These checks are necessary, not sufficient:
|
|
2
|
+
// callers must independently review that every sensitive element is marked.
|
|
3
|
+
const CATEGORIES = ['avatar', 'email', 'token', 'qr'];
|
|
4
|
+
const POLICY = 'fixture-markers-v1';
|
|
5
|
+
|
|
6
|
+
function validateOrigin(origin) {
|
|
7
|
+
const url = new URL(origin);
|
|
8
|
+
if (url.protocol !== 'http:' || !['localhost', '127.0.0.1'].includes(url.hostname) ||
|
|
9
|
+
!url.port || url.origin !== origin || url.username || url.password) {
|
|
10
|
+
throw new Error('Screenshot capture requires a specific loopback HTTP origin and port');
|
|
11
|
+
}
|
|
12
|
+
return url.origin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function validateRequirements(recipe) {
|
|
16
|
+
const privacy = recipe && recipe.privacy;
|
|
17
|
+
if (!privacy || privacy.policy !== POLICY || !privacy.requirements) {
|
|
18
|
+
throw new Error(`Missing ${POLICY} privacy requirements for ${recipe?.id || 'recipe'}`);
|
|
19
|
+
}
|
|
20
|
+
const requirements = privacy.requirements;
|
|
21
|
+
for (const name of CATEGORIES) {
|
|
22
|
+
const item = requirements[name];
|
|
23
|
+
if (!item || typeof item.selector !== 'string' || !item.selector.trim() || item.expected !== 'present') {
|
|
24
|
+
throw new Error(`Missing explicit ${name} marker requirement for ${recipe.id}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const url = new URL(recipe.route, 'http://localhost:1');
|
|
28
|
+
const scenario = url.searchParams.get('docScenario');
|
|
29
|
+
if (url.origin !== 'http://localhost:1' || url.searchParams.get('docMode') !== '1' || !scenario) {
|
|
30
|
+
throw new Error(`Invalid documentation fixture route for ${recipe.id}`);
|
|
31
|
+
}
|
|
32
|
+
return { scenario, requirements };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function createRedactionExpression(expectedOrigin, recipe) {
|
|
36
|
+
const origin = validateOrigin(expectedOrigin);
|
|
37
|
+
const { scenario, requirements } = validateRequirements(recipe);
|
|
38
|
+
return `(${redact.toString()})(${JSON.stringify(origin)}, ${JSON.stringify(scenario)}, ${JSON.stringify(requirements)})`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function redact(origin, scenario, requirements) {
|
|
42
|
+
const params = new URLSearchParams(location.search);
|
|
43
|
+
if (location.origin !== origin || params.get('docMode') !== '1' || params.get('docScenario') !== scenario) {
|
|
44
|
+
throw new Error('Refusing a non-isolated or non-documentation page');
|
|
45
|
+
}
|
|
46
|
+
if (document.querySelector('[data-privacy-overlay]')) throw new Error('Page already redacted; reload first');
|
|
47
|
+
const elements = [];
|
|
48
|
+
const counts = {};
|
|
49
|
+
for (const name of ['avatar', 'email', 'token', 'qr']) {
|
|
50
|
+
const matches = [...document.querySelectorAll(requirements[name].selector)];
|
|
51
|
+
if (!matches.length) throw new Error(`Missing privacy marker: ${name}`);
|
|
52
|
+
counts[name] = matches.length;
|
|
53
|
+
for (const element of matches) {
|
|
54
|
+
const rect = element.getBoundingClientRect();
|
|
55
|
+
if (!(rect.width > 0 && rect.height > 0) || !Number.isFinite(rect.left) || !Number.isFinite(rect.top)) {
|
|
56
|
+
throw new Error(`Privacy marker has no visible geometry: ${name}`);
|
|
57
|
+
}
|
|
58
|
+
elements.push({element, name, left: rect.left + scrollX, top: rect.top + scrollY, width: rect.width, height: rect.height});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const item of elements) {
|
|
62
|
+
item.element.style.setProperty('visibility', 'hidden', 'important');
|
|
63
|
+
const cover = document.createElement('div');
|
|
64
|
+
cover.setAttribute('data-privacy-overlay', item.name);
|
|
65
|
+
Object.assign(cover.style, {
|
|
66
|
+
position: 'absolute', left: `${item.left}px`, top: `${item.top}px`, width: `${item.width}px`,
|
|
67
|
+
height: `${item.height}px`, background: '#3f4549', zIndex: '2147483647', pointerEvents: 'none',
|
|
68
|
+
});
|
|
69
|
+
document.body.appendChild(cover);
|
|
70
|
+
}
|
|
71
|
+
return {counts, covers: elements.length};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = { CATEGORIES, POLICY, validateOrigin, validateRequirements, createRedactionExpression };
|