zlibproxy/app/view/index.html
2024-06-21 20:30:44 +08:00

187 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="/" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='zlibproxy/normalize.css' rel='stylesheet' type='text/css'>
<link href="https://fonts.laysense.com/css/5000/zh-cn/douyufont/douyufont.css" rel="preload" as="style" onload="this.rel='stylesheet'">
<link href="https://fonts.laysense.com/css/5000/zh-cn/harmonyossans/harmonyossans.css" rel="preload" as="style" onload="this.rel='stylesheet'">
<link id="theme_css" rel="stylesheet" href="zlibproxy/sakura.css">
<style>
.pmnet { font-family: DOUYUFont;}
html {font-family: HarmonyOSSans;}
.animbox {
margin: 50px auto;
width: 200px;
text-align: center;
}
/*设置各竖条的共有样式*/
.animbox > div {
background-color: #279fcf;
width: 4px;
height: 35px;
border-radius: 2px;
margin: 2px;
animation-fill-mode: both;
display: inline-block;
animation: anim 0.9s 0s infinite cubic-bezier(.11, .49, .38, .78);
}
/*设置动画延迟*/
.animbox > :nth-child(2), .animbox > :nth-child(4) {
animation-delay: 0.25s !important;
}
.animbox > :nth-child(1), .animbox > :nth-child(5) {
animation-delay: 0.5s !important;
}
/*定义动画*/
@keyframes anim {
0% { transform: scaley(1); }
80% { transform: scaley(0.3); }
90% { transform: scaley(1); }
}
</style>
<title>(ProxyDownload)Z-Library</title>
</head>
<body>
<script>
//切换深色模式
if(window.matchMedia('(prefers-color-scheme: dark)').matches){
document.getElementById('theme_css').href = 'zlibproxy/sakura-dark.css';
}
</script>
<main>
<center>
<div style="background-color: bisque;color: black;">
<?php
$onion='<svg style="margin-bottom: -4px;" t="1718896386758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9713" width="24" height="24"><path d="M512 597.333333C469.333333 597.333333 384 640 384 682.666667 384 768 512 768 512 768L512 725.333333C488.533333 725.333333 469.333333 706.133333 469.333333 682.666667 469.333333 659.2 488.533333 640 512 640L512 597.333333M512 810.666667C512 810.666667 341.333333 789.333333 341.333333 704 341.333333 576 469.333333 544 512 544L512 490.666667C469.333333 490.666667 298.666667 554.666667 298.666667 682.666667 298.666667 853.333333 512 853.333333 512 853.333333L512 810.666667M429.653333 299.946667 480.426667 322.56C498.773333 218.453333 547.84 149.333333 547.84 149.333333 529.493333 193.28 517.546667 229.546667 509.866667 258.133333 561.493333 151.466667 666.026667 85.333333 666.026667 85.333333 615.68 135.68 578.56 190.293333 553.386667 235.946667 620.8 164.266667 714.24 117.333333 714.24 117.333333 599.466667 190.72 547.84 307.2 535.04 339.626667L558.506667 343.04C558.506667 365.226667 558.506667 385.706667 569.173333 401.92 601.6 482.56 768 489.386667 768 682.666667 768 875.946667 596.053333 938.666667 504.746667 938.666667 413.44 938.666667 213.333333 897.28 213.333333 682.666667 213.333333 468.053333 424.533333 466.346667 462.08 380.586667 467.2 364.373333 429.653333 299.946667 429.653333 299.946667Z" p-id="9714" fill="#8a8a8a"></path></svg>';
$torstatus='<span>Off</span>';
if($tor=='true'){
$onion='<svg style="margin-bottom: -4px;" t="1718896386758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9713" width="24" height="24"><path d="M512 597.333333C469.333333 597.333333 384 640 384 682.666667 384 768 512 768 512 768L512 725.333333C488.533333 725.333333 469.333333 706.133333 469.333333 682.666667 469.333333 659.2 488.533333 640 512 640L512 597.333333M512 810.666667C512 810.666667 341.333333 789.333333 341.333333 704 341.333333 576 469.333333 544 512 544L512 490.666667C469.333333 490.666667 298.666667 554.666667 298.666667 682.666667 298.666667 853.333333 512 853.333333 512 853.333333L512 810.666667M429.653333 299.946667 480.426667 322.56C498.773333 218.453333 547.84 149.333333 547.84 149.333333 529.493333 193.28 517.546667 229.546667 509.866667 258.133333 561.493333 151.466667 666.026667 85.333333 666.026667 85.333333 615.68 135.68 578.56 190.293333 553.386667 235.946667 620.8 164.266667 714.24 117.333333 714.24 117.333333 599.466667 190.72 547.84 307.2 535.04 339.626667L558.506667 343.04C558.506667 365.226667 558.506667 385.706667 569.173333 401.92 601.6 482.56 768 489.386667 768 682.666667 768 875.946667 596.053333 938.666667 504.746667 938.666667 413.44 938.666667 213.333333 897.28 213.333333 682.666667 213.333333 468.053333 424.533333 466.346667 462.08 380.586667 467.2 364.373333 429.653333 299.946667 429.653333 299.946667Z" p-id="9714" fill="#7A5EB7"></path></svg>';
$torstatus='<span style="color:green;">On</span>';
}
?>
Zlibrary Proxy(v<?php echo(getenv('version'));?>) UserID:<?php echo($id);?> <a href='/login/switchtor?to=<?php echo($path);?>'>[<?php echo($onion);?> Tor <?php echo($torstatus);?>]</a> <a style="color: coral;" href="/login/logout">[退出账号]</a>
</div>
</center>
<div id="container">
<a href="/" target="_blank_home">[返回ZlibraryProxy]</a>
<h1>下载图书</h1>
<div id="load" class="animbox" style="display: none;">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<br />
</div>
<p id="notice"></p>
<hr />
<div id="down" style="display: none;">
<a id="downloadurl" target="_blank_downbook">
<h3 style="margin-top:15%;margin-bottom:15%">📥点此下载图书</h3><br /><p id="bookname"></p><br /><p id="booksize"></p>
</a>
<hr />
<button onclick="download()">下载内容打不开?点此重新生成文件</button>(重新生成将消耗Zlib每日次数)
</div>
<div id="start" style="display: none;">
<button onclick="download()">点此开始下载图书</button>
</div>
<div id="outdown" style="display: none;">
<button onclick="outdownload()">前往外部链接下载</button>
</div>
</div>
</main>
<script src="zlibproxy/jquery-3.6.3.min.js"></script>
<script>
var path='<?php echo($path) ?>';
$.ajax({
type: "POST",
url: '/zlibproxy/check',
data: {'path':path},
async: true,
dataType: 'json',
cache: false,
beforeSend: function () {
$('#notice').html('正在查询缓存,请稍等……');
$('#load').show();
},
success: function (data) {
if (data.code == 200) {
$('#notice').html('图书已被缓存,本次下载无需消耗Zlib每日次数');
$("#downloadurl").attr("href","/zlibproxy/get?path="+path);
$('#bookname').html(data.name);
$('#booksize').html(data.size+'MB');
$('#down').show();
}
if (data.code == 202) {
$('#notice').html('图书仍在下载中,请稍等 (5秒后刷新)');
setTimeout(function(){location.reload();},5000);
}
if (data.code == 201) {
$('#notice').html('图书暂未被缓存,本次下载需要消耗Zlib次数(请确保小于30Mb否则会浪费一次次数)');
$('#start').show();
}
if (data.code == 509) {
$('#notice').html('缺少参数或未登录');
setTimeout(function(){$(location).attr('href','/login')},1500);
}
$('#load').hide();
},
});
function download(){
$.ajax({
type: "POST",
url: '/zlibproxy/download',
data: {'path':path},
async: true,
dataType: 'json',
cache: false,
beforeSend: function () {
$('#notice').html('服务器正在通过Tor从Zlib下载图书……请耐心等待');
$('#load').show();
$('#start').hide();
},
success: function (data) {
if (data.code == 200) {
$('#notice').html('图书已获取成功,请点击下方链接下载图书');
$("#downloadurl").attr("href","/zlibproxy/get?path="+path);
$('#bookname').html(data.name);
$('#booksize').html(data.size+'MB');
$('#down').show();
$('#start').hide();
}
if (data.code == 500) {
$('#notice').html('文件过大(大于30Mb),暂时无法通过ZlibProxy下载<br />但您可以尝试从外部链接下载(可能需要梯子)');
$('#start').hide();
$('#outdown').show();
window.outurl=data.url;
}
if (data.code == 400) {
$('#notice').html('图书不存在……请尝试别的图书');
$('#start').hide();
}
if (data.code == 509) {
$('#notice').html('缺少参数或未登录');
setTimeout(function(){$(location).attr('href','/login')},1500);
}
if (data.code == 808) {
$('#notice').html('Zlib要求您前往外部链接下载(可能是因为今日次数用完,或触发风控)<br />请点击前往外部链接查看(可能需要梯子)');
$('#start').hide();
$('#outdown').show();
window.outurl=data.msg;
}
$('#load').hide();
},
});
}
function outdownload(){
window.open(window.outurl);
}
</script>
</body>
</html>