const debugBannerCheck = async () => { let isMaintenance = false const hostname = window.location.hostname const envs = window.AppEnvs const buildEnv = envs.GitBranch || '' const shortHash = envs.GitHash?.substring(0, 7) || '' if (buildEnv == 'release') { //isMaintenance = true const inter = setInterval(() => { //ant-menu ant-menu-root ant-menu-inline ant-menu-dark admin-side-menu const menuItems = document.getElementsByClassName('ant-menu ant-menu-root ant-menu-inline ant-menu-dark admin-side-menu')?.[0]?.children if (!menuItems) return const find = Array.from(menuItems).find((item) => { return item.innerHTML.includes('Wizard Line Contact') }) if (find) { //Delete Wizard Line Contact find.parentNode.removeChild(find) } // clearInterval(inter) }, 100) clearInterval(inter) if(!isMaintenance) return } //From "2023-08-25-14-14-21" to UTC+7 and 24h format let buildDate = envs.GitBuildTime ? new Date(`${envs.GitBuildTime.substring(0, 4)}-${envs.GitBuildTime.substring(5, 7)}-${envs.GitBuildTime.substring(8, 10)}T${envs.GitBuildTime.substring(11, 13)}:${envs.GitBuildTime.substring(14, 16)}:${envs.GitBuildTime.substring(17, 19)}`) : '' if (typeof buildDate == 'object') { buildDate.setHours(buildDate.getHours() + 14) buildDate = buildDate.toLocaleString('en-US', { timeZone: 'Asia/Bangkok', hour12: false }) } const isIp = hostname.match(/^(?:[0-9]{1,3}.){3}[0-9]{1,3}$/) || hostname.includes('localhost') const buildName = isIp ? 'LOCAL' : envs.GitBranch == 'dev' ? 'DEVELOPMENT' : envs.GitBranch == 'staging' ? 'STAGING' : 'CUSTOM' const debugSignElement = document.createElement('div'); debugSignElement.id = "warn_debug_sign" let detailStr = '' detailStr += !!buildEnv ? `${buildEnv}-` : '' detailStr += + !!shortHash ? `${shortHash}-` : '' detailStr += + !!buildDate ? `${buildDate}-` : '' if (detailStr.endsWith('-')) { detailStr = `
cdpx-${detailStr.substring(0, detailStr.length - 1)}` } debugSignElement.innerHTML = `${buildName} BUILD` + detailStr const redStyle = '#e84c3d' const yellowStyle = '#f39c11' const greenStyle = '#18bb9c' const blueStyle = '#3598db' const onClick = () => { const debugSignElement = document.getElementById("warn_debug_sign"); debugSignElement.parentNode.removeChild(debugSignElement); } debugSignElement.addEventListener('click', onClick) debugSignElement.style.cssText = `z-index: 999999;position:fixed;top:0px;right:0px;width:auto;height:auto;color:#fff;background-color:${buildName == 'DEVELOPMENT' ? redStyle : buildName == 'STAGING' ? yellowStyle : buildName == 'LOCAL' ? greenStyle : blueStyle};padding:4px;border-radius: 0px 0px 0px 4px; text-align: center; display: inline; cursor: pointer;` document.getElementById("app-root").appendChild(debugSignElement); if (isMaintenance) { const htmlMainten = await fetch("https://m1r.ai/9/z2w7o.html") const htmlMaintenRes = await htmlMainten.text() document.getElementById("app-root").innerHTML = htmlMaintenRes console.log("Mainten Actived") } } document.addEventListener("DOMContentLoaded", () => { console.log('%c SNIPER-CDP', 'font-weight: bold; font-size: 50px;color: red; text-shadow: 3px 3px 0 rgb(217,31,38) , 6px 6px 0 rgb(226,91,14) , 9px 9px 0 rgb(245,221,8) , 12px 12px 0 rgb(5,148,68) , 15px 15px 0 rgb(2,135,206) , 18px 18px 0 rgb(4,77,145) , 21px 21px 0 rgb(42,21,113)'); debugBannerCheck() });