0%
console.error('LeanCloud Counter Error', error); }); } let { app_id, app_key, server_url } = {"enable":true,"app_id":"yfARgKiui8DR7BoNi68lfbYL-gzGzoHsz","app_key":"HJz7JU1ns2et4L8CXjBwnzR8","server_url":null,"security":false}; function fetchData(api_server) { var Counter = (method, url, data) => { return fetch(`${api_server}/1.1${url}`, { method, headers: { 'X-LC-Id' : app_id, 'X-LC-Key' : app_key, 'Content-Type': 'application/json', }, body: JSON.stringify(data) }); }; if (CONFIG.page.isPost) { if (CONFIG.hostname !== location.hostname) return; addCount(Counter); } else if (document.querySelectorAll('.post-title-link').length >= 1) { showTime(Counter); } } let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`; if (api_server) { fetchData(api_server); } else { fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id) .then(response => response.json()) .then(({ api_server }) => { fetchData('https://' + api_server); }); } })();