-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathindex.html
More file actions
339 lines (296 loc) · 11.3 KB
/
index.html
File metadata and controls
339 lines (296 loc) · 11.3 KB
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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>drpyS 媒体代理服务</title>
<style>
:root {
--primary-color: #4f46e5;
--primary-hover: #4338ca;
--bg-color: #f3f4f6;
--card-bg: #ffffff;
--text-main: #1f2937;
--text-muted: #6b7280;
--border-color: #e5e7eb;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem 1rem;
}
.container {
width: 100%;
max-width: 800px;
background: var(--card-bg);
border-radius: 1rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
padding: 2rem;
margin-top: 2vh;
}
header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1.5rem;
border-bottom: 1px solid var(--border-color);
}
h1 {
font-size: 1.875rem;
font-weight: 700;
color: var(--primary-color);
margin-bottom: 0.5rem;
}
.subtitle {
color: var(--text-muted);
font-size: 1.1rem;
}
.form-group {
margin-bottom: 1.5rem;
}
label {
display: block;
font-weight: 600;
margin-bottom: 0.5rem;
color: var(--text-main);
}
input[type="text"],
input[type="number"],
textarea {
width: 100%;
padding: 0.75rem;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
font-size: 1rem;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}
.row {
display: flex;
gap: 1rem;
margin-bottom: 1.5rem;
}
.col {
flex: 1;
}
button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 0.75rem 1.5rem;
font-size: 1.1rem;
font-weight: 600;
border-radius: 0.5rem;
cursor: pointer;
width: 100%;
transition: background-color 0.15s ease-in-out;
}
button:hover {
background-color: var(--primary-hover);
}
.result-box {
margin-top: 2rem;
padding: 1.5rem;
background-color: #f8fafc;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
display: none;
}
.result-box.active {
display: block;
animation: fadeIn 0.3s ease-in-out;
}
.result-url {
word-break: break-all;
font-family: monospace;
background: #e0e7ff;
padding: 1rem;
border-radius: 0.375rem;
color: #3730a3;
margin-bottom: 1rem;
border: 1px solid #c7d2fe;
}
.copy-btn {
background-color: #10b981;
width: auto;
}
.copy-btn:hover {
background-color: #059669;
}
.help-section {
margin-top: 3rem;
padding-top: 2rem;
border-top: 1px solid var(--border-color);
}
.help-section h2 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.help-list {
list-style-type: none;
}
.help-list li {
margin-bottom: 0.75rem;
padding-left: 1.5rem;
position: relative;
}
.help-list li::before {
content: "•";
color: var(--primary-color);
font-weight: bold;
position: absolute;
left: 0;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(-10px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
.row {
flex-direction: column;
gap: 0;
}
.container {
padding: 1.5rem;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>drpyS 多线程媒体代理服务</h1>
<p class="subtitle">欢迎使用,由道长于 2026 年开发</p>
</header>
<div class="form-group">
<label for="url">目标视频直链 (URL) *</label>
<textarea id="url" rows="3" placeholder="例如: https://example.com/video.mp4" required></textarea>
</div>
<div class="row">
<div class="col form-group">
<label for="thread">线程数 (thread)</label>
<input type="number" id="thread" placeholder="留空自动分配, 默认 1" min="1" max="32">
</div>
<div class="col form-group">
<label for="chunkSize">分片大小 (size/chunkSize)</label>
<input type="text" id="chunkSize" placeholder="例如: 256K, 1M (默认 128K)">
</div>
</div>
<div class="row">
<div class="col form-group">
<label for="auth">认证密钥 (auth)</label>
<input type="text" id="auth" placeholder="如果服务端设置了 auth,则必须填写">
</div>
<div class="col form-group">
<label for="form">数据格式 (form)</label>
<select id="form" style="width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 0.5rem; font-size: 1rem; background: white;">
<option value="">普通文本 (默认)</option>
<option value="base64">Base64编码</option>
</select>
</div>
</div>
<div class="form-group">
<label for="headers">自定义请求头 (headers) [JSON 格式]</label>
<textarea id="headers" rows="2" placeholder='例如: {"User-Agent": "Mozilla/5.0", "Referer": "https://..."}'></textarea>
</div>
<button id="generateBtn">生成代理地址</button>
<div class="result-box" id="resultBox">
<label>生成的代理链接:</label>
<div class="result-url" id="resultUrl"></div>
<button class="copy-btn" id="copyBtn">复制链接</button>
</div>
<div class="help-section">
<h2>使用帮助</h2>
<ul class="help-list">
<li><strong>目标视频直链:</strong> 必须提供。即你想要通过代理加速播放的原始视频地址。</li>
<li><strong>线程数 (thread):</strong> 代理拉取视频时使用的并发连接数。留空则根据文件大小自动分配(最大限制32)。</li>
<li><strong>分片大小 (size):</strong> 每个线程每次请求的数据块大小。支持单位 K、M,或纯数字(默认K)。限制范围:32KB ~ 10MB。</li>
<li><strong>认证密钥 (auth):</strong> 如果代理服务端启动时加了 <code>-auth</code> 参数,则必须在此填写对应的密钥。</li>
<li><strong>数据格式 (form):</strong> 可选 <code>base64</code>,用于将 URL 和 Headers 进行 Base64 编码,防止特殊字符导致解析错误。</li>
<li><strong>自定义请求头 (headers):</strong> 某些防盗链视频需要提供特定的 User-Agent 或 Referer,请使用 JSON 格式填入。</li>
<li><strong>兼容性:</strong> 本代理对 ExoPlayer、IjkPlayer、MPV 进行了深度优化,支持完美拖拽与秒播。</li>
</ul>
</div>
</div>
<script>
document.getElementById('generateBtn').addEventListener('click', function() {
let url = document.getElementById('url').value.trim();
const thread = document.getElementById('thread').value.trim();
const chunkSize = document.getElementById('chunkSize').value.trim();
const auth = document.getElementById('auth').value.trim();
const form = document.getElementById('form').value;
let headers = document.getElementById('headers').value.trim();
if (!url) {
alert('请输入目标视频直链!');
return;
}
// 获取当前域名和端口
const baseUrl = window.location.protocol + '//' + window.location.host + '/proxy?';
const params = new URLSearchParams();
if (form === 'base64') {
params.append('form', 'base64');
url = btoa(unescape(encodeURIComponent(url)));
}
params.append('url', url);
if (thread) {
params.append('thread', thread);
}
if (chunkSize) {
params.append('size', chunkSize);
}
if (auth) {
params.append('auth', auth);
}
if (headers) {
try {
// 验证是否是合法的 JSON
JSON.parse(headers);
if (form === 'base64') {
headers = btoa(unescape(encodeURIComponent(headers)));
}
params.append('headers', headers);
} catch (e) {
alert('自定义请求头格式错误,必须是合法的 JSON 格式!');
return;
}
}
const finalUrl = baseUrl + params.toString();
const resultBox = document.getElementById('resultBox');
const resultUrl = document.getElementById('resultUrl');
resultUrl.textContent = finalUrl;
resultBox.classList.add('active');
});
document.getElementById('copyBtn').addEventListener('click', function() {
const textToCopy = document.getElementById('resultUrl').textContent;
navigator.clipboard.writeText(textToCopy).then(function() {
const btn = document.getElementById('copyBtn');
const originalText = btn.textContent;
btn.textContent = '已复制!';
btn.style.backgroundColor = '#047857';
setTimeout(() => {
btn.textContent = originalText;
btn.style.backgroundColor = '';
}, 2000);
}).catch(function(err) {
alert('复制失败,请手动复制');
});
});
</script>
</body>
</html>