|
2 | 2 | <html lang="en">
|
3 | 3 | <head>
|
4 | 4 | <meta charset="UTF-8" />
|
5 |
| - <link href="/src/assets/favicon.ico" rel="icon" type="image/svg+xml" /> |
| 5 | + |
| 6 | + <link href="/favicon.png" rel="icon" type="image/svg+xml" /> |
6 | 7 | <meta
|
7 | 8 | name="viewport"
|
8 | 9 | content="width=device-width, initial-scale=1.0, maximum-scale=1"
|
|
19 | 20 | />
|
20 | 21 | <link href="/public/font-family/Fira-code/fira_code.css" rel="stylesheet" />
|
21 | 22 | <link href="/public/font-family/Inter/inter.css" rel="stylesheet" />
|
22 |
| - <title> |
23 |
| - ILLA Builder - An open-source low-code Platform for Developers. |
24 |
| - </title> |
| 23 | + <title>Loading...</title> |
| 24 | + <script> |
| 25 | + function createFavicon() { |
| 26 | + const newFavicon = document.createElement("link") |
| 27 | + newFavicon.rel = "icon" |
| 28 | + document.getElementsByTagName("head")[0].appendChild(newFavicon) |
| 29 | + return newFavicon |
| 30 | + } |
| 31 | + |
| 32 | + function setFavicon(faviconHref) { |
| 33 | + const linkElements = document.getElementsByTagName("link") |
| 34 | + |
| 35 | + const faviconElements = [] |
| 36 | + |
| 37 | + for (let i = 0; i < linkElements.length; i++) { |
| 38 | + const link = linkElements[i] |
| 39 | + if (link.rel.toLowerCase() === "icon") { |
| 40 | + faviconElements.push(link) |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + if (faviconElements.length === 0) { |
| 45 | + const element = createFavicon() |
| 46 | + element.href = faviconHref |
| 47 | + } else { |
| 48 | + faviconElements.forEach((faviconElement) => { |
| 49 | + faviconElement.href = faviconHref |
| 50 | + }) |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + async function validateCustomDomain() { |
| 55 | + const origin = location.origin |
| 56 | + if (origin !== "%ILLA_BUILDER_URL%") { |
| 57 | + window.customDomain = location.host |
| 58 | + try { |
| 59 | + const response = await fetch( |
| 60 | + `https://%ILLA_API_BASE_URL%/supervisor/api/v1/domain/validate`, |
| 61 | + { |
| 62 | + method: "POST", |
| 63 | + headers: { |
| 64 | + "Content-Type": "application/json", |
| 65 | + }, |
| 66 | + body: JSON.stringify({ customDomain: location.host }), |
| 67 | + }, |
| 68 | + ) |
| 69 | + const data = await response.json() |
| 70 | + window.currentTeamIdentifier = data.teamIdentifier |
| 71 | + if (!data.customDomainAvaliable) { |
| 72 | + const redirectURL = window.location.href.replace( |
| 73 | + `https://${window.location.host}/cloud`, |
| 74 | + "%ILLA_CLOUD_URL%", |
| 75 | + ) |
| 76 | + window.location.href = `%ILLA_CLOUD_URL%/redirect-expired?redirectURL=${redirectURL}` |
| 77 | + return |
| 78 | + } |
| 79 | + if (data.favicon) { |
| 80 | + setFavicon(data.favicon) |
| 81 | + } else { |
| 82 | + setFavicon("/ILLAFavicon.ico") |
| 83 | + } |
| 84 | + } catch { |
| 85 | + setFavicon("/ILLAFavicon.ico") |
| 86 | + } |
| 87 | + } else { |
| 88 | + setFavicon("/ILLAFavicon.ico") |
| 89 | + } |
| 90 | + } |
| 91 | + validateCustomDomain() |
| 92 | + </script> |
25 | 93 | </head>
|
26 | 94 | <body>
|
27 | 95 | <div id="root"></div>
|
|
0 commit comments