|
16 | 16 | <meta name="apple-mobile-web-app-title" content="Codeit"> |
17 | 17 |
|
18 | 18 | <meta charset="utf-8"> |
19 | | - <meta name="description" content=""> |
20 | 19 |
|
21 | 20 | <meta name="referrer" content="default"> |
22 | 21 | <link rel="canonical" href="https://codeit.codes/"> |
23 | 22 | <meta name="next-head-count" content="24"> |
24 | 23 | <meta name="robots" content="noindex"> |
25 | | - |
| 24 | + |
26 | 25 | <link rel="shortcut icon" href="https://codeit.codes/icons/android-app-512.png"> |
27 | 26 | <link rel="apple-touch-icon" href="https://codeit.codes/icons/iphone-app-180.png"> |
28 | 27 |
|
29 | | - <script src="/api-link-parser.js"></script> |
| 28 | +</head> |
| 29 | +<body> |
| 30 | + |
| 31 | +<script src="/api-link-parser.js"></script> |
| 32 | + |
| 33 | +<script> |
| 34 | + |
| 35 | +// decode link |
| 36 | + |
| 37 | +const url = new URL(window.location.href).searchParams; |
30 | 38 |
|
31 | | - <script> |
| 39 | +let link = url.get('url'); |
| 40 | + |
| 41 | +const notLiveView = (url.get('live') === 'false' || url.get('l') === 'f'); |
| 42 | + |
| 43 | +const isDev = (window.location.hostname === 'dev.codeit.codes'); |
32 | 44 |
|
33 | | - // decode link |
| 45 | + |
| 46 | +if (link && link.startsWith('https://codeit.codes/api/link?url=')) { |
34 | 47 |
|
35 | | - const url = new URL(window.location.href).searchParams; |
36 | | - |
37 | | - let link = url.get('url'); |
| 48 | + link = link.replace('https://codeit.codes/api/link?url=', 'https://cde.run/'); |
| 49 | + |
| 50 | +} |
| 51 | + |
38 | 52 |
|
39 | | - const notLiveView = (url.get('live') === 'false' || url.get('l') === 'f'); |
| 53 | +if (link && link.includes('https:/github.com')) { |
40 | 54 |
|
41 | | - const isDev = (window.location.hostname === 'dev.codeit.codes'); |
| 55 | + link = link.replace('https:/github.com', 'https://github.com'); |
42 | 56 |
|
43 | | - if (link && link.startsWith('https://codeit.codes/api/link?url=')) { |
44 | | - |
45 | | - link = link.replace('https://codeit.codes/api/link?url=', 'https://cde.run/'); |
46 | | - |
47 | | - } |
| 57 | +} |
| 58 | + |
| 59 | + |
| 60 | +if (link && !link.startsWith('https://cde.run') |
| 61 | + && !link.startsWith('https://dev.cde.run')) { |
48 | 62 |
|
49 | | - if (link && link.includes('https:/github.com')) { |
50 | | - |
51 | | - link = link.replace('https:/github.com', 'https://github.com'); |
52 | | - |
53 | | - } |
| 63 | + if (!isDev) link = 'https://cde.run/' + link; |
| 64 | + else link = 'https://dev.cde.run/' + link; |
54 | 65 |
|
55 | | - if (link && !link.startsWith('https://cde.run') |
56 | | - && !link.startsWith('https://dev.cde.run')) { |
57 | | - |
58 | | - if (!isDev) link = 'https://cde.run/' + link; |
59 | | - else link = 'https://dev.cde.run/' + link; |
60 | | - |
61 | | - } |
| 66 | +} |
| 67 | + |
| 68 | + |
| 69 | +if (link && link.startsWith('https://cde.run/github.com/')) { |
62 | 70 |
|
63 | | - if (link && notLiveView) { |
64 | | - |
65 | | - link += '?live=false'; |
66 | | - |
67 | | - } |
| 71 | + link = link.replace('https://cde.run/github.com/', 'https://cde.run/'); |
68 | 72 |
|
69 | | - if (link) { |
70 | | - |
71 | | - const resp = decodeLink(link); |
| 73 | +} |
72 | 74 |
|
73 | | - // redirect to decoded URL |
74 | | - window.location.replace(resp); |
75 | | - |
76 | | - } else { |
77 | | - |
78 | | - window.location.replace(window.location.origin); |
79 | | - |
80 | | - } |
| 75 | +if (link && link.startsWith('https://dev.cde.run/github.com/')) { |
| 76 | + |
| 77 | + link = link.replace('https://dev.cde.run/github.com/', 'https://dev.cde.run/'); |
| 78 | + |
| 79 | +} |
81 | 80 |
|
82 | | - </script> |
| 81 | + |
| 82 | +if (link && notLiveView) { |
83 | 83 |
|
84 | | -</head> |
| 84 | + link += '?live=false'; |
| 85 | + |
| 86 | +} |
| 87 | + |
| 88 | +if (link) { |
| 89 | + |
| 90 | + const resp = decodeLink(link); |
| 91 | + |
| 92 | + // redirect to decoded URL |
| 93 | + window.location.replace(resp); |
| 94 | + |
| 95 | +} else { |
| 96 | + |
| 97 | + window.location.replace(window.location.origin); |
| 98 | + |
| 99 | +} |
| 100 | + |
| 101 | +</script> |
| 102 | + |
| 103 | +</body> |
85 | 104 | </html> |
| 105 | + |
0 commit comments