-
Notifications
You must be signed in to change notification settings - Fork 46
/
index.html
515 lines (511 loc) · 16.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<title>文件加速下载服务-免费</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="force-rendering" content="webkit" />
<meta name="google-site-verification" content="vOSHVItqFRN_c4ops48jpv49GA9kHJCoj87cB5NVUoY" />
<meta charset="utf-8" />
<meta name="keywords" content="文件代下载,github项目代下" />
<meta name="description"
content="海外文件加速代下载,github加速下载,无限速及文件大小限制,支持任意文件直链下载,支持命令行代下。加速文件下载速度" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0" />
<meta name="referrer" content="origin" />
</head>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
margin: 0;
height: 100%;
overflow: hidden;
background-color: rgba(34, 34, 34, 0.9);
font-size: 14px;
}
p {
word-break: break-all;
margin: 6px 0;
}
.bgdiv {
background-image: url(https://picture.zwc365.com/getbing.jpg);
background-position: center;
background-size: cover;
position: fixed;
top: 0;
width: 100%;
height: 100%;
}
.form {
position: absolute;
top: 25%;
width: 100%;
padding: 10px 15px 0px;
display: box;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-direction: column;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
-o-flex-direction: column;
align-items: center;
-webkit-align-items: center;
-moz-align-items: center;
-ms-align-items: center;
-o-align-items: center;
text-align: center;
}
h1 {
cursor: pointer;
white-space: nowrap;
padding: 0 20px;
text-align: center;
line-height: 60px;
margin-top: 15px;
margin-bottom: 15px;
color: #fff;
background: linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 25%,
rgba(0, 0, 0, 0.8) 75%,
rgba(0, 0, 0, 0) 100%
);
background: -moz-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 25%,
rgba(0, 0, 0, 0.8) 75%,
rgba(0, 0, 0, 0) 100%
);
background: -o-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 25%,
rgba(0, 0, 0, 0.8) 75%,
rgba(0, 0, 0, 0) 100%
);
z-index: 4;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: -80px;
}
@media (max-width: 375px) {
h1 {
font-size: 24px;
}
}
.url {
font-size: 18px;
padding: 10px 10px 10px 5px;
position: relative;
width: 60%;
min-width: 300px;
max-width: 600px;
border: none;
height: 50px;
/* line-height: 50px; */
border-radius: 4px;
border-bottom: 1px solid #bfbfbf;
background: #fff;
box-sizing: border-box;
z-index: 3;
}
input:focus {
outline: none;
}
.btns {
text-align: center;
margin: 10px 0;
background: linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 50%,
rgba(0, 0, 0, 0) 100%
);
background: -moz-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 50%,
rgba(0, 0, 0, 0) 100%
);
background: -o-linear-gradient(
to right,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.8) 50%,
rgba(0, 0, 0, 0) 100%
);
padding: 10px;
z-index: 4;
}
.btn {
line-height: 38px;
background-color: #00bfb3;
color: #fff;
white-space: nowrap;
text-align: center;
font-size: 14px;
border: none;
border-radius: 4px;
cursor: pointer;
padding: 5px;
width: 140px;
margin-top: 5px;
margin-right: 10px;
margin-bottom: 5px;
}
.scroll-place {
position: absolute;
width: calc(100% + 17px);
top: 0;
left: 0;
overflow-x: hidden;
overflow-y: scroll;
z-index: 2;
height: 25%;
}
.scroll-pd {
height: 200px;
}
.scroll-box {
left: 0;
position: fixed;
width: calc(100% + 17px);
/* width: 100%; */
bottom: -1px;
overflow-x: hidden;
overflow-y: scroll;
z-index: 2;
height: 75%;
}
.scroll-palceholder {
width: 100%;
height: 75%;
opacity: 0;
}
.scroll-content {
background: rgba(255, 255, 255, 0.8);
padding: 10px;
padding-right: 27px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
/* width:calc(100% - 17px); */
position: relative;
}
.arrow {
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
position: absolute;
top: -60px;
border-radius: 4px;
right: 40px;
background: rgba(34, 34, 34, 0.75);
}
.arrow img {
vertical-align: middle;
width: 20px;
height: 20px;
}
.count-box {
width: auto;
max-width: 40%;
/* min-width: 100px; */
height: auto;
max-height: 100px;
line-height: 40px;
text-align: left;
position: absolute;
top: -20px;
border-radius: 4px;
left: 20px;
background: rgba(34, 34, 34, 0.75);
transform: translateY(-100%);
color: #ffffff;
padding: 10px;
line-height: 20px;
}
.count-box-child {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-size: 12px;
}
.scroll-content .box > p {
margin-bottom: 15px;
text-align: center;
font-size: 16px;
}
.tips,
.example,
.urlexample {
color: #333;
position: relative;
align-self: flex-start;
margin-left: 3.5em;
font-size: 16px;
margin-bottom: 15px;
}
.tips > p:first-child::before {
position: absolute;
left: -3em;
content: "PS:";
color: #7b7b7b;
}
.example > p:first-child::before {
position: absolute;
left: -3em;
content: "示例:";
color: #7b7b7b;
}
.urlexample > p:first-child::before {
position: absolute;
left: -3em;
content: "URL:";
color: #7b7b7b;
}
</style>
<body>
<div class="bgdiv"></div>
<form action="./" method="get" target="_blank" class="form">
<h1 class="header-top">
<img src="https://picture.zwc365.com/2020/11/07/JcTa9pzgfKZ1yB2.png"
style="width: 1.5em; margin-right: 0.2em; vertical-align: middle" />
文件加速下载服务
</h1>
<input
class="block url" name="q" type="text" placeholder="请等待 JS 加载完成"
required id="urlinput" disabled="disabled" autocomplete="off"
onkeypress="if(event.keyCode==13){return false;}" />
<div class="btns">
<button style="display: none"></button>
<button class="btn" id="sub-btn1">CloudFlare 代下</button>
<button class="btn" id="sub-btn2">本站服务器代下</button>
</div>
</form>
<div class="scroll-place"><div class="scroll-pd"></div></div>
<div class="scroll-box">
<div class="scroll-palceholder"></div>
<div class="scroll-content">
<div class="arrow">
<img src="https://picture.zwc365.com/2020/11/15/XxkJ9SRtqz1QZsE.png"
alt="" srcset="" />
</div>
<div class="count-box">
<!-- <div>加速服务使用统计:</div> -->
<div class="count-box-child"> - 今日加速: <span class="today"></span> 次</div>
<div class="count-box-child"> - 昨日加速: <span class="yesterday"></span> 次</div>
<div class="count-box-child"> - 总加速: <span class="total"></span> 次</div>
</div>
<div class="box">
<div class="tips">
<p>使用本站服务器加速前缀: <b style="color: #000">https://pd.zwc365.com/</b></p>
<p>Cloudflare Workers 加速前缀: <b style="color: #000">https://pd.zwc365.com/cfworker/</b></p>
<p><b style="color: #000">支持命令行</b>,可在 Git Bash 中 clone,或终端 wget 代下(详情见项目说明)</p>
<p>CloudFlare 代下无速度及文件大小限制,服务器代下限制文件大小 2G</p>
<p>本站现在有 <a href="https://github.com/zwc456baby/file-proxy/tree/master/chrome-app">Chrome 扩展</a>
,安装扩展后,使用鼠标右键即可选择线路加速下载文件</p>
<p>Github 请在仓库页面点击绿色按钮: "Code" -> "Download Zip" 右键复制链接</p>
</div>
<p>
<b style="color: #000">一个小小的提示:</b>
</p>
<p>
<b style="color: #000">大量使用本站服务的用户,请部署CloudFlare下载节点,并添加节点</b>
</p>
<p>
<a href="https://zwc365.com/2020/09/24/file-proxy-download#%E5%A6%82%E4%BD%95%E9%83%A8%E7%BD%B2%E4%B8%8B%E8%BD%BD%E8%8A%82%E7%82%B9">点这里查看部署 CloudFlare 节点教程</a>
</p>
<div class="example">
<p>如果是网页使用,直接将原链接粘贴到输入框点击下载即可加速。</p>
<p>如果使用其他工具进行文件下载,则在原链接前新增加速前缀:</p>
<p>Git 项目加速:git clone https://pd.zwc365.com/< https 开头的项目地址></p>
<p>Wget 加速下载:wget https://pd.zwc365.com/<原来的文件链接></p>
<p>google 或 jcenter 仓库镜像:https://pd.zwc365.com/cfworker/<仓库地址></p>
<p>加速任意链接:https://pd.zwc365.com/<任意 http 或 https 链接></p>
</div>
<div class="urlexample">
<p>在后面拼接的URL必须是 <b style="color: #000">http://</b> 或者 <b style="color: #000">https://</b> 开头</p>
<p>合格的URL 1: https://github.com/zwc456baby/file-proxy.git</p>
<p>合格的URL 2: https://github.com/zwc456baby/file-proxy/archive/master.zip</p>
<p>不合格的示例: github.com/zwc456baby/file-proxy/archive/master.zip</p>
<p>不合格的示例: www.baidu.com</p>
</div>
<p>欢迎小伙伴们 <b style="color: #000">收藏和分享</b> 本服务</p>
<p>开源地址:<a style="color: #3294ea" href="https://github.com/zwc456baby/file-proxy">file-proxy</a>
| 更多用法或捐赠:<a href="https://zwc365.com/2020/09/24/file-proxy-download">项目说明</a>
</p>
</div>
</div>
</div>
<script type="text/javascript">
var form = document.querySelector("form")
var scrollBox = document.querySelector(".scroll-box")
var scrollPlace = document.querySelector(".scroll-place")
var scrollContent = document.querySelector(".scroll-content")
var timeId = null
var resizeTimer = null
var originOpcity = 0.8
var marginTop = 0.25
// 窗口改变和初始时的一些变量
function initData() {
var formHeight = form.offsetHeight
originFormTop = window.innerHeight * marginTop
formOffsetTop = form.offsetTop
scrollContentOffsetTop = scrollContent.offsetTop
scrollBox.style.height = window.innerHeight - formHeight + "px"
scrollPlace.style.height = formHeight + "px"
maxContentOffsetForm =
window.innerHeight -
(formHeight + formOffsetTop) -
(scrollBox.offsetHeight -
document.querySelector(".scroll-palceholder").offsetHeight) // 边界值
var maxScrollBoxScrollBox =
scrollBox.scrollHeight - scrollBox.offsetHeight
document.querySelector(".scroll-place .scroll-pd").style.height =
maxScrollBoxScrollBox + scrollPlace.offsetHeight + "px"
isTopActive = false
isBottomActive = false
}
initData()
/* 两个盒子滚动效果相互影响 */
scrollBox.addEventListener("scroll", function() {
// console.log(scrollBox.scrollTop, "scollBox")
if (!isTopActive) {
isBottomActive = true
scrollPlace.scrollTop = scrollBox.scrollTop
animate()
clearTimeout(timeId)
timeId = setTimeout(function() {
isBottomActive = false
}, 100)
}
})
scrollPlace.addEventListener("scroll", function(e) {
// console.log( scrollPlace.scrollTop,'scrollPlace')
if (!isBottomActive) {
isTopActive = true
scrollBox.scrollTop = scrollPlace.scrollTop
animate()
clearTimeout(timeId)
timeId = setTimeout(function() {
isTopActive = false
}, 100)
}
})
window.addEventListener("resize", resizeEvent)
window.addEventListener("orientationchange", resizeEvent, false)
function resizeEvent() {
clearTimeout(resizeTimer)
resizeTimer = setTimeout(function() {
form.style.top = 100 * marginTop + "%"
initData()
animate()
}, 200)
}
function animate() {
/* 表单高度距离顶部距离设 */
if (scrollBox.scrollTop >= maxContentOffsetForm) {
formTop = formOffsetTop - (scrollBox.scrollTop - maxContentOffsetForm)
if (formTop <= 0) {
formTop = 0
}
if (formTop >= originFormTop) {
form.style.formTop = originFormTop
}
form.style.top = formTop + "px"
} else {
form.style.top = originFormTop + "px"
}
/* 背景色设置 */
var opcity = (scrollBox.scrollTop / scrollContentOffsetTop) * (1 - originOpcity) + originOpcity
if (opcity > 1) {
opcity = 1
}
scrollContent.style.background = "rgba(255,255,255," + opcity + ")"
}
document.querySelector(".arrow").addEventListener("click", function() {
scrollBox.scrollTop = document.querySelector(".scroll-palceholder").offsetHeight
})
document.querySelector(".header-top").addEventListener("click", function() {
location.href = "https://zwc365.com/2020/09/24/file-proxy-download"
})
function getCount(){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304)){
var res = JSON.parse(xhr.responseText)
var totalCount = -1
document.querySelector(".yesterday").innerText = res.yesterday
document.querySelector(".today").innerText = res.today
if(res.count > 10000) {
totalCount = (res.count / 10000).toFixed(2) + " w"
} else {
totalCount = res.count
}
document.querySelector(".total").innerText = totalCount
}
}
xhr.open("GET", "/getcount", true);
xhr.send(null);
}
getCount();
setInterval(getCount, 2000);
</script>
<script type="text/javascript">
function checkUrl(instr) {
if (!instr || instr == "/" || instr.length <= 0) {
alert("请输入正确的文件链接")
return false
}
if (instr.endWith(".git")) {
alert("Git 项目请查阅项目说明中命令行Clone选项")
return false
}
return true
}
function toSubmit(e) {
return openDownloadUrl(e, "/cfdownload/")
}
function toSubmit2(e) {
return openDownloadUrl(e, "/seturl/")
}
function openDownloadUrl(e, baseUrl) {
e.preventDefault()
var inputUrl = document.getElementsByName("q")[0].value
if (checkUrl(inputUrl)) {
window.open(baseUrl + inputUrl.trim())
}
return false
}
window.addEventListener("keyup", function(e) {
var event = e || window.event
var key = event.which || event.keyCode || event.charCode
if (key == 13) {
toSubmit2(e)
}
})
document.querySelector("#sub-btn1").addEventListener("click", toSubmit)
document.querySelector("#sub-btn2").addEventListener("click", toSubmit2)
document.querySelector("#urlinput").disabled = false
document.querySelector("#urlinput").placeholder = "键入文件直链,http或https开头"
String.prototype.endWith = function(str) {
var reg = new RegExp(str + "$")
return reg.test(this)
}
</script>
</body>
</html>