diff --git a/index.html b/index.html index 6fdae1fe..a0fa74b9 100644 --- a/index.html +++ b/index.html @@ -62,18 +62,6 @@ s.parentNode.insertBefore(hm, s); })(); - (function () { - var umami = document.createElement("script"); - umami.src = 'https://typewords.cc/s.js' - if (location.href.includes('vercel') || location.href.includes('tw')) { - umami.setAttribute("data-website-id", "f630eefc-8b91-4e20-b890-106e6c7bcc10"); - } else { - umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6"); - } - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(umami, s); - })(); - (function () { var umami2 = document.createElement("script"); umami2.src = 'https://stat.typewords.cc/script.js' diff --git a/public/migrate.html b/public/migrate.html index 67960858..27b34936 100644 --- a/public/migrate.html +++ b/public/migrate.html @@ -80,8 +80,6 @@ window.close(); }, 500); }); - - diff --git a/public/s.js b/public/s.js deleted file mode 100644 index 5f207329..00000000 --- a/public/s.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";(t=>{const{screen:{width:e,height:a},navigator:{language:n,doNotTrack:i,msDoNotTrack:r},location:o,document:s,history:c,top:u,doNotTrack:d}=t,{currentScript:l,referrer:h}=s;if(!l)return;const{hostname:f,href:m,origin:p}=o,y=m.startsWith("data:")?void 0:t.localStorage,g="data-",b="true",v=l.getAttribute.bind(l),w=v(g+"website-id"),S=v(g+"host-url"),k=v(g+"before-send"),N=v(g+"tag")||void 0,T="false"!==v(g+"auto-track"),A=v(g+"do-not-track")===b,j=v(g+"exclude-search")===b,x=v(g+"exclude-hash")===b,$=v(g+"domains")||"",E=$.split(",").map(t=>t.trim()),K=`${(S||"https://api-gateway.umami.dev"||l.src.split("/").slice(0,-1).join("/")).replace(/\/$/,"")}/api/send`,L=`${e}x${a}`,O=/data-umami-event-([\w-_]+)/,_=g+"umami-event",D=300,U=()=>({website:w,screen:L,language:n,title:s.title,hostname:f,url:z,referrer:F,tag:N,id:q||void 0}),W=(t,e,a)=>{a&&(F=z,z=new URL(a,o.href),j&&(z.search=""),x&&(z.hash=""),z=z.toString(),z!==F&&setTimeout(J,D))},B=()=>H||!w||y&&y.getItem("umami.disabled")||$&&!E.includes(f)||A&&(()=>{const t=d||i||r;return 1===t||"1"===t||"yes"===t})(),C=async(e,a="event")=>{if(B())return;const n=t[k];if("function"==typeof n&&(e=n(a,e)),e)try{const t=await fetch(K,{keepalive:!0,method:"POST",body:JSON.stringify({type:a,payload:e}),headers:{"Content-Type":"application/json",...void 0!==R&&{"x-umami-cache":R}},credentials:"omit"}),n=await t.json();n&&(H=!!n.disabled,R=n.cache)}catch(t){}},I=()=>{G||(G=!0,J(),(()=>{const t=(t,e,a)=>{const n=t[e];return(...e)=>(a.apply(null,e),n.apply(t,e))};c.pushState=t(c,"pushState",W),c.replaceState=t(c,"replaceState",W)})(),(()=>{const t=async t=>{const e=t.getAttribute(_);if(e){const a={};return t.getAttributeNames().forEach(e=>{const n=e.match(O);n&&(a[n[1]]=t.getAttribute(e))}),J(e,a)}};s.addEventListener("click",async e=>{const a=e.target,n=a.closest("a,button");if(!n)return t(a);const{href:i,target:r}=n;if(n.getAttribute(_)){if("BUTTON"===n.tagName)return t(n);if("A"===n.tagName&&i){const a="_blank"===r||e.ctrlKey||e.shiftKey||e.metaKey||e.button&&1===e.button;return a||e.preventDefault(),t(n).then(()=>{a||(("_top"===r?u.location:o).href=i)})}}},!0)})())},J=(t,e)=>C("string"==typeof t?{...U(),name:t,data:e}:"object"==typeof t?{...t}:"function"==typeof t?t(U()):U()),P=(t,e)=>("string"==typeof t&&(q=t),R="",C({...U(),data:"object"==typeof t?t:e},"identify"));t.umami||(t.umami={track:J,identify:P});let R,q,z=m,F=h.startsWith(p)?"":h,G=!1,H=!1;T&&!B()&&("complete"===s.readyState?I():s.addEventListener("readystatechange",I,!0))})(window)}(); diff --git a/src/App.vue b/src/App.vue index 761479f2..8a93dde9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -78,7 +78,6 @@ async function init() { onMounted(init) - //迁移数据 let showTransfer = $ref(false) onMounted(() => { @@ -122,5 +121,8 @@ onMounted(() => { - + \ No newline at end of file diff --git a/src/pages/MigrateDialog.vue b/src/pages/MigrateDialog.vue index d8c35c4b..683ce4f9 100644 --- a/src/pages/MigrateDialog.vue +++ b/src/pages/MigrateDialog.vue @@ -10,6 +10,8 @@ const Dialog = defineAsyncComponent(() => import('@/components/dialog/Dialog.vue const model = defineModel() +const emit = defineEmits<{ ok: [] }>() + async function migrateFromOldSite() { return new Promise(async (resolve, reject) => { // 旧域名地址 @@ -79,6 +81,8 @@ async function transfer() { console.log('迁移完成'); Toast.success('迁移完成') model.value = false + emit('ok') + } catch (e) { Toast.error('迁移失败:' + e) console.error('迁移失败', e); @@ -93,7 +97,7 @@ async function transfer() { 本网站已启用新域名 {{ Origin }}

- 由于浏览器安全限制,新老网站数据无法互通,需要您手动点击转移数据 + 老域名即将停用,由于浏览器安全限制,新老网站数据无法互通,需要您手动点击转移数据