Ah777ed's picture
Update index.html
74fa399 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>inclusionAI/Ring-1T-preview-free-unlimited-chatbot</title>
<!-- Prevent caching -->
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<!-- Improved styling -->
<style>
/* Reset */
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #4e54c8, #8f94fb);
color: #fff;
display: flex;
flex-direction: column;
}
/* Loading overlay */
#loading {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: center;
align-items: center;
font-size: 26px;
font-weight: bold;
z-index: 1000;
text-align: center;
letter-spacing: 1px;
}
/* Iframe styling */
iframe {
flex: 1;
width: 100%;
border: none;
box-shadow: 0 0 20px rgba(0,0,0,0.3);
border-radius: 10px;
margin: 10px 0;
}
/* Footer signature */
footer {
text-align: center;
font-size: 14px;
opacity: 0.8;
margin-bottom: 5px;
}
footer span {
font-weight: bold;
color: #ffd700;
}
</style>
</head>
<body>
<div id="loading">Please wait... Selecting the optimal Mives Team server 🌐</div>
<iframe id="streamlit-frame"></iframe>
<footer>Powered by <span>Mives Team</span> | Programming by @Ah777ed_said</footer>
<script>
const VERSION = "v2";
const SERVERS = [
"https://ring-alibaba-1t-preview-ziv7yrwvanrpmly3tk6ilw.streamlit.app/?embed=true",
"https://ring-alibaba-1t-preview-ziv7yrwvanrpmly3tk6ilw.streamlit.app/?embed=true"
];
async function checkServerSpeed(url) {
const start = performance.now();
try {
const response = await Promise.race([
fetch(url, { method: 'HEAD', mode: 'no-cors' }),
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), 5000))
]);
const end = performance.now();
return end - start;
} catch (error) {
console.error(`Error checking ${url}:`, error);
return Infinity;
}
}
async function chooseServer() {
const speeds = await Promise.all(SERVERS.map(checkServerSpeed));
const fastestIndex = speeds.indexOf(Math.min(...speeds));
return SERVERS[fastestIndex];
}
async function loadStreamlit() {
const loadingElement = document.getElementById('loading');
const iframe = document.getElementById('streamlit-frame');
const storageKey = `streamlitUrl_${VERSION}`;
let chosenUrl = sessionStorage.getItem(storageKey);
if (!chosenUrl) {
chosenUrl = await chooseServer();
sessionStorage.setItem(storageKey, chosenUrl);
}
const cacheBuster = new Date().getTime();
iframe.src = `${chosenUrl}&cb=${cacheBuster}`;
iframe.onload = () => {
loadingElement.style.display = 'none';
};
iframe.onerror = async () => {
console.warn('Iframe load failed, rechoosing server...');
sessionStorage.removeItem(storageKey);
chosenUrl = await chooseServer();
sessionStorage.setItem(storageKey, chosenUrl);
iframe.src = `${chosenUrl}&cb=${new Date().getTime()}`;
};
}
window.onload = loadStreamlit;
</script>
</body>
</html>