chore: update build track.js output path

This commit is contained in:
moonrailgun 2024-02-01 01:16:45 +08:00
parent dc39a7b7cf
commit 74948ff533
2 changed files with 1 additions and 2 deletions

View File

@ -13,7 +13,7 @@ vite
formats: ['iife'], formats: ['iife'],
}, },
emptyOutDir: false, emptyOutDir: false,
outDir: resolve(__dirname, '../dist/src/server/public'), outDir: resolve(__dirname, '../src/client/public'),
}, },
}) })
.then((res) => { .then((res) => {

View File

@ -1 +0,0 @@
(function(){"use strict";(h=>{const{screen:{width:K,height:O},navigator:{language:R},location:N,localStorage:S,document:i,history:m}=h,{hostname:A,pathname:U,search:_}=N,{currentScript:g}=i;if(!g)return;const l="data-",C="false",d=g.getAttribute.bind(g),q=d(l+"website-id"),P=d(l+"host-url"),z=d(l+"auto-track")!==C,I=d(l+"do-not-track"),x=d(l+"domains")||"",J=x.split(",").map(t=>t.trim()),M=`${P?P.replace(/\/$/,""):g.src.split("/").slice(0,-1).join("/")}/api/website/send`,B=`${K}x${O}`,F=/data-tianji-event-([\w-_]+)/,E=l+"tianji-event",G=300,D=(t,r,e)=>{const n=t[r];return(...a)=>(e.apply(null,a),n.apply(t,a))},H=t=>{try{return new URL(t).pathname}catch{return t}},p=()=>({website:q,hostname:A,screen:B,language:R,title:L,url:y,referrer:k}),Q=()=>{const{doNotTrack:t,navigator:r,external:e}=h,n="msTrackingProtectionEnabled",a=()=>e&&n in e&&e[n](),c=t||r.doNotTrack||r.msDoNotTrack||a();return c=="1"||c==="yes"},$=()=>S&&S.getItem("tianji.disabled")||I&&Q()||x&&!J.includes(A),j=(t,r,e)=>{e&&(k=y,y=H(e.toString()),y!==k&&setTimeout(b,G))},V=()=>{const t=e=>{const n=e.getAttribute.bind(e),a=n(E);if(a){const c={};return e.getAttributeNames().forEach(s=>{const u=s.match(F);u&&(c[u[1]]=n(s))}),b(a,c)}return Promise.resolve()},r=e=>{const n=(s,u)=>{let o=s;for(let T=0;T<u;T++){if(o.tagName==="A")return o;if(o=o.parentElement,!o)return null}return null},a=e.target,c=a.tagName==="A"?a:n(a,10);if(c){const{href:s,target:u}=c,o=u==="_blank"||e.ctrlKey||e.shiftKey||e.metaKey||e.button&&e.button===1;if(c.getAttribute(E)&&s)return o||e.preventDefault(),t(c).then(()=>{o||(N.href=s)})}else t(a)};i.addEventListener("click",r,!0)},W=()=>{const t=([n])=>{L=n&&n.target?n.target.text:void 0},r=new MutationObserver(t),e=i.querySelector("head > title");e&&r.observe(e,{subtree:!0,characterData:!0,childList:!0})},f=(t,r="event")=>{if($())return;const e={"Content-Type":"application/json"};return typeof v<"u"&&(e["x-tianji-cache"]=v),fetch(M,{method:"POST",body:JSON.stringify({type:r,payload:t}),headers:e}).then(n=>n.text()).then(n=>v=n).catch(()=>{})},b=(t,r)=>f(typeof t=="string"?{...p(),name:t,data:typeof r=="object"?r:void 0}:typeof t=="object"?t:typeof t=="function"?t(p()):p()),X=t=>f({...p(),data:t},"identify");h.tianji||(h.tianji={track:b,identify:X});let y=`${U}${_}`,k=i.referrer,L=i.title,v,w;if(z&&!$()){m.pushState=D(m,"pushState",j),m.replaceState=D(m,"replaceState",j),V(),W();const t=()=>{i.readyState==="complete"&&!w&&(b(),w=!0)};i.addEventListener("readystatechange",t,!0),t()}})(window)})();