Files
hubproxy/web/index.html
NewName 3274630325 1
2024-11-09 16:49:39 +08:00

160 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Docker 镜像加速</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0/dist/themes/light.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.0.0/dist/shoelace.js"></script>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
h1 {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 1rem;
}
.domain-container {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 2rem;
}
.domain-item {
display: flex;
align-items: center;
justify-content: center;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
padding: 1rem 2rem;
margin-bottom: 1rem;
width: 300px;
}
.domain-text {
flex-grow: 1;
font-size: 1.2rem;
font-weight: bold;
}
.copy-button {
font-size: 1rem;
padding: 0.2rem 0.5rem;
margin-left: 0.5rem;
color: #393e42;
background-color: transparent;
border: none;
cursor: pointer;
}
.copy-button:focus {
outline: none;
}
.footer {
font-size: 0.9rem;
color: #555;
}
.github-icon {
position: fixed;
bottom: 15px;
text-align: center;
width: 100%;
}
.github-icon a {
color: #333;
text-decoration: none;
}
.github-icon a:hover {
color: #555;
}
</style>
</head>
<body>
<!-- 添加标题 -->
<h1>Docker 镜像加速(多种仓库)</h1>
<div class="domain-container">
<div class="domain-item">
<div class="domain-text">docker.<span id="domain-base"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">ghcr.<span id="domain-base"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">gcr.<span id="domain-base"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">k8sgcr.<span id="domain-base"></span></div>
<button class="copy-button">复制</button>
</div>
<div class="domain-item">
<div class="domain-text">registryk8s.<span id="domain-base"></span></div>
<button class="copy-button">复制</button>
</div>
</div>
<div class="footer">
🔔个人使用,请勿分享!
</div>
<div class="footer">
✨根据对应的仓库使用对应的加速域名。
</div>
<div class="footer">
🎈如果要拉取官方镜像请将镜像用户名替换为library
</div>
<div class="github-icon">
<a href="https://github.com/sky22333/docker-proxy" target="_blank">
<sl-icon name="github" size="24"></sl-icon>
</a>
</div>
<script>
const domainBase = new URL(window.location.href).hostname.replace(/^www\./, '');
document.querySelectorAll('#domain-base').forEach(el => {
el.textContent = domainBase;
});
document.querySelectorAll('.copy-button').forEach(button => {
button.addEventListener('click', async () => {
const domainText = button.previousElementSibling.textContent;
try {
await navigator.clipboard.writeText(domainText);
if (button.dataset.copied) return;
button.dataset.copied = true;
const originalText = button.textContent;
button.textContent = '已复制';
setTimeout(() => {
button.textContent = originalText;
delete button.dataset.copied;
}, 1000);
} catch (err) {
console.error('复制失败', err);
}
});
});
</script>
</body>
</html>