assets-only test panel
Browse files- api-test.html +15 -154
api-test.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<style>
|
| 8 |
:root{
|
| 9 |
--bg:#0f1115; --panel:#161a22; --panel2:#1c212b; --border:#2a3040;
|
|
@@ -20,29 +20,25 @@
|
|
| 20 |
header .sub{color:var(--muted);font-size:13px}
|
| 21 |
.base{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap}
|
| 22 |
.base label{color:var(--muted);font-size:13px}
|
| 23 |
-
main{padding:24px;
|
| 24 |
-
gap:20px;align-items:start}
|
| 25 |
.card{background:var(--panel);border:1px solid var(--border);border-radius:12px;
|
| 26 |
padding:16px;display:flex;flex-direction:column;gap:12px}
|
| 27 |
.card h2{font-size:14px;margin:0;letter-spacing:.02em;display:flex;
|
| 28 |
align-items:center;gap:8px}
|
| 29 |
.method{font-family:var(--mono);font-size:11px;padding:2px 8px;border-radius:6px;
|
| 30 |
font-weight:600}
|
| 31 |
-
.get{background:rgba(79,140,255,.15);color:#7aa9ff}
|
| 32 |
.post{background:rgba(52,211,153,.15);color:#5eead4}
|
| 33 |
.path{font-family:var(--mono);font-size:12px;color:var(--muted)}
|
| 34 |
.field{display:flex;flex-direction:column;gap:5px}
|
| 35 |
.field label{font-size:12px;color:var(--muted)}
|
| 36 |
.row{display:flex;gap:10px;flex-wrap:wrap}
|
| 37 |
-
.row .field{flex:1;min-width:140px}
|
| 38 |
-
input,select,button{
|
| 39 |
-
background:var(--panel2);color:var(--text);border:1px solid var(--border);
|
| 40 |
-
border-radius:8px;padding:8px 10px;font-size:13px;font-family:inherit;outline:none}
|
| 41 |
-
input:focus,select:focus{border-color:var(--accent)}
|
| 42 |
-
input[type=text],input[type=url]{width:100%}
|
| 43 |
.check{flex-direction:row;align-items:center;gap:8px}
|
| 44 |
.check input{accent-color:var(--accent);width:16px;height:16px}
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
.actions{display:flex;gap:8px;align-items:center;margin-top:2px}
|
| 47 |
button.run{background:var(--accent);color:#fff;border:none;font-weight:600;cursor:pointer}
|
| 48 |
button.run:hover{filter:brightness(1.08)}
|
|
@@ -54,18 +50,19 @@
|
|
| 54 |
.status.wait{color:var(--muted)}
|
| 55 |
pre.js{background:#0a0d12;border:1px solid var(--border);border-radius:8px;
|
| 56 |
padding:12px;font-family:var(--mono);font-size:12px;overflow:auto;
|
| 57 |
-
max-height:
|
| 58 |
-
.
|
| 59 |
-
.
|
|
|
|
|
|
|
|
|
|
| 60 |
font-size:12px;word-break:break-all}
|
| 61 |
-
.
|
| 62 |
-
.meta{font-size:12px;color:var(--muted)}
|
| 63 |
-
.title{color:var(--text);font-weight:600}
|
| 64 |
</style>
|
| 65 |
</head>
|
| 66 |
<body>
|
| 67 |
<header>
|
| 68 |
-
<h1>
|
| 69 |
<div class="base">
|
| 70 |
<label for="base">API base</label>
|
| 71 |
<input type="url" id="base" value="https://lljz66-api.hf.space" style="width:320px" spellcheck="false">
|
|
@@ -73,15 +70,6 @@
|
|
| 73 |
</header>
|
| 74 |
|
| 75 |
<main>
|
| 76 |
-
<!-- /health -->
|
| 77 |
-
<section class="card">
|
| 78 |
-
<h2><span class="method get">GET</span><span class="path">/health</span></h2>
|
| 79 |
-
<div class="actions"><button class="run" id="healthRun">Run</button></div>
|
| 80 |
-
<div class="status wait" id="healthStatus">not run</div>
|
| 81 |
-
<pre class="js" id="healthOut">—</pre>
|
| 82 |
-
</section>
|
| 83 |
-
|
| 84 |
-
<!-- /assets -->
|
| 85 |
<section class="card">
|
| 86 |
<h2><span class="method post">POST</span><span class="path">/assets</span></h2>
|
| 87 |
<div class="field"><label>url</label>
|
|
@@ -93,56 +81,6 @@
|
|
| 93 |
<div class="title" id="a_title"></div>
|
| 94 |
<pre class="js" id="aOut">—</pre>
|
| 95 |
</section>
|
| 96 |
-
|
| 97 |
-
<!-- /map -->
|
| 98 |
-
<section class="card">
|
| 99 |
-
<h2><span class="method get">GET</span><span class="path">/map</span></h2>
|
| 100 |
-
<div class="row">
|
| 101 |
-
<div class="field"><label>url</label>
|
| 102 |
-
<input type="text" id="map_url" value="https://example.com" spellcheck="false"></div>
|
| 103 |
-
<div class="field"><label>search (optional)</label>
|
| 104 |
-
<input type="text" id="map_search" placeholder="filter keyword" spellcheck="false"></div>
|
| 105 |
-
</div>
|
| 106 |
-
<div class="row">
|
| 107 |
-
<div class="field"><label>sitemap</label>
|
| 108 |
-
<select id="map_sitemap">
|
| 109 |
-
<option value="include" selected>include</option>
|
| 110 |
-
<option value="skip">skip</option>
|
| 111 |
-
<option value="only">only</option>
|
| 112 |
-
</select></div>
|
| 113 |
-
<div class="field"><label>limit</label>
|
| 114 |
-
<input type="number" id="map_limit" value="100" min="1" max="5000"></div>
|
| 115 |
-
<div class="field check"><input type="checkbox" id="map_sub" checked>
|
| 116 |
-
<label for="map_sub">include subdomains</label></div>
|
| 117 |
-
</div>
|
| 118 |
-
<div class="actions"><button class="run" id="mapRun">Run</button></div>
|
| 119 |
-
<div class="status" id="map_status">not run</div>
|
| 120 |
-
<div class="meta" id="map_meta"></div>
|
| 121 |
-
<div class="links" id="map_links"></div>
|
| 122 |
-
<pre class="js" id="mapOut" style="display:none">—</pre>
|
| 123 |
-
</section>
|
| 124 |
-
|
| 125 |
-
<!-- /scrape -->
|
| 126 |
-
<section class="card">
|
| 127 |
-
<h2><span class="method post">POST</span><span class="path">/scrape</span></h2>
|
| 128 |
-
<div class="field"><label>url</label>
|
| 129 |
-
<input type="url" id="s_url" value="https://example.com" spellcheck="false"></div>
|
| 130 |
-
<div class="actions"><button class="run" id="sRun">Run</button></div>
|
| 131 |
-
<div class="status" id="s_status">not run</div>
|
| 132 |
-
<div class="title" id="s_title"></div>
|
| 133 |
-
<pre class="js" id="sOut">—</pre>
|
| 134 |
-
</section>
|
| 135 |
-
|
| 136 |
-
<!-- /favicon -->
|
| 137 |
-
<section class="card">
|
| 138 |
-
<h2><span class="method get">GET</span><span class="path">/favicon</span></h2>
|
| 139 |
-
<div class="field"><label>url</label>
|
| 140 |
-
<input type="url" id="f_url" value="https://example.com" spellcheck="false"></div>
|
| 141 |
-
<div class="actions"><button class="run" id="fRun">Run</button></div>
|
| 142 |
-
<div class="status" id="f_status">not run</div>
|
| 143 |
-
<div id="f_icon" class="meta" style="display:flex;align-items:center;gap:10px"></div>
|
| 144 |
-
<pre class="js" id="fOut" style="display:none">—</pre>
|
| 145 |
-
</section>
|
| 146 |
</main>
|
| 147 |
|
| 148 |
<script>
|
|
@@ -157,17 +95,6 @@
|
|
| 157 |
function showStatus(el, kind, msg){ el.className='status '+kind; el.textContent=msg; }
|
| 158 |
const fmt = o => JSON.stringify(o,null,2);
|
| 159 |
|
| 160 |
-
async function runHealth(){
|
| 161 |
-
const st=$('healthStatus'), out=$('healthOut'), btn=$('healthRun');
|
| 162 |
-
btn.disabled=true; showStatus(st,'wait','loading…'); out.textContent='—';
|
| 163 |
-
try{
|
| 164 |
-
const r=await req('/health');
|
| 165 |
-
out.textContent=fmt(r.body);
|
| 166 |
-
showStatus(st, r.ok?'ok':'err', 'HTTP '+r.status + (r.ok?' · healthy':''));
|
| 167 |
-
}catch(e){ showStatus(st,'err','network error: '+e.message); }
|
| 168 |
-
btn.disabled=false;
|
| 169 |
-
}
|
| 170 |
-
|
| 171 |
async function runAssets(){
|
| 172 |
const st=$('a_status'), ti=$('a_title'), out=$('aOut'), btn=$('aRun');
|
| 173 |
btn.disabled=true;
|
|
@@ -186,74 +113,8 @@
|
|
| 186 |
btn.disabled=false;
|
| 187 |
}
|
| 188 |
|
| 189 |
-
async function runMap(){
|
| 190 |
-
const st=$('map_status'), out=$('mapOut'), meta=$('map_meta'), links=$('map_links'), btn=$('mapRun');
|
| 191 |
-
btn.disabled=true;
|
| 192 |
-
showStatus(st,'wait','crawling…'); meta.textContent=''; links.innerHTML=''; out.style.display='none';
|
| 193 |
-
const params=new URLSearchParams();
|
| 194 |
-
params.set('url',$('map_url').value.trim());
|
| 195 |
-
if($('map_search').value.trim()) params.set('search',$('map_search').value.trim());
|
| 196 |
-
params.set('sitemap',$('map_sitemap').value);
|
| 197 |
-
params.set('include_subdomains',$('map_sub').checked);
|
| 198 |
-
params.set('limit',$('map_limit').value);
|
| 199 |
-
try{
|
| 200 |
-
const r=await req('/map?'+params.toString());
|
| 201 |
-
out.style.display='block'; out.textContent=fmt(r.body);
|
| 202 |
-
if(r.ok){
|
| 203 |
-
const arr=r.body.links||[];
|
| 204 |
-
showStatus(st,'ok','HTTP '+r.status+' · total '+r.body.total);
|
| 205 |
-
meta.textContent=arr.length+' links shown';
|
| 206 |
-
links.innerHTML=arr.map(u=>'<a href="'+u.replace(/"/g,'')+'" target="_blank" rel="noopener">'+u+'</a>').join('');
|
| 207 |
-
}else{
|
| 208 |
-
showStatus(st,'err','HTTP '+r.status+' · '+((r.body&&r.body.detail)?r.body.detail:''));
|
| 209 |
-
}
|
| 210 |
-
}catch(e){ showStatus(st,'err','network error: '+e.message); }
|
| 211 |
-
btn.disabled=false;
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
async function runScrape(){
|
| 215 |
-
const st=$('s_status'), ti=$('s_title'), co=$('sOut'), btn=$('sRun');
|
| 216 |
-
btn.disabled=true;
|
| 217 |
-
showStatus(st,'wait','scraping…'); ti.textContent=''; co.textContent='—';
|
| 218 |
-
try{
|
| 219 |
-
const r=await req('/scrape',{method:'POST',headers:{'Content-Type':'application/json'},
|
| 220 |
-
body:JSON.stringify({url:$('s_url').value.trim()})});
|
| 221 |
-
if(r.ok){
|
| 222 |
-
showStatus(st,'ok','HTTP '+r.status);
|
| 223 |
-
ti.textContent = r.body.title? 'Title: '+r.body.title : '';
|
| 224 |
-
co.textContent = r.body.content || '(empty content)';
|
| 225 |
-
}else{
|
| 226 |
-
showStatus(st,'err','HTTP '+r.status+' · '+((r.body&&r.body.detail)?r.body.detail:JSON.stringify(r.body)));
|
| 227 |
-
co.textContent='';
|
| 228 |
-
}
|
| 229 |
-
}catch(e){ showStatus(st,'err','network error: '+e.message); }
|
| 230 |
-
btn.disabled=false;
|
| 231 |
-
}
|
| 232 |
-
|
| 233 |
-
async function runFavicon(){
|
| 234 |
-
const st=$('f_status'), icon=$('f_icon'), pre=$('fOut'), btn=$('fRun');
|
| 235 |
-
btn.disabled=true;
|
| 236 |
-
showStatus(st,'wait','looking up…'); icon.innerHTML=''; pre.style.display='none';
|
| 237 |
-
try{
|
| 238 |
-
const r=await req('/favicon?url='+encodeURIComponent($('f_url').value.trim()));
|
| 239 |
-
pre.style.display='block'; pre.textContent=fmt(r.body);
|
| 240 |
-
if(r.ok){
|
| 241 |
-
showStatus(st,'ok','HTTP '+r.status);
|
| 242 |
-
icon.innerHTML='<img src="'+r.body.icon_url+'" alt="favicon" width="24" height="24"> <span>'+r.body.domain+'</span>';
|
| 243 |
-
}else showStatus(st,'err','HTTP '+r.status);
|
| 244 |
-
}catch(e){ showStatus(st,'err','network error: '+e.message); }
|
| 245 |
-
btn.disabled=false;
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
$('healthRun').onclick=runHealth;
|
| 249 |
$('aRun').onclick=runAssets;
|
| 250 |
-
$('mapRun').onclick=runMap;
|
| 251 |
-
$('sRun').onclick=runScrape;
|
| 252 |
-
$('fRun').onclick=runFavicon;
|
| 253 |
$('a_url').addEventListener('keydown',e=>{if(e.key==='Enter')runAssets();});
|
| 254 |
-
$('map_url').addEventListener('keydown',e=>{if(e.key==='Enter')runMap();});
|
| 255 |
-
$('s_url').addEventListener('keydown',e=>{if(e.key==='Enter')runScrape();});
|
| 256 |
-
$('f_url').addEventListener('keydown',e=>{if(e.key==='Enter')runFavicon();});
|
| 257 |
</script>
|
| 258 |
</body>
|
| 259 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Asset Extractor API — Test Panel</title>
|
| 7 |
<style>
|
| 8 |
:root{
|
| 9 |
--bg:#0f1115; --panel:#161a22; --panel2:#1c212b; --border:#2a3040;
|
|
|
|
| 20 |
header .sub{color:var(--muted);font-size:13px}
|
| 21 |
.base{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap}
|
| 22 |
.base label{color:var(--muted);font-size:13px}
|
| 23 |
+
main{padding:24px;max-width:860px;margin:0 auto;display:flex;flex-direction:column;gap:20px}
|
|
|
|
| 24 |
.card{background:var(--panel);border:1px solid var(--border);border-radius:12px;
|
| 25 |
padding:16px;display:flex;flex-direction:column;gap:12px}
|
| 26 |
.card h2{font-size:14px;margin:0;letter-spacing:.02em;display:flex;
|
| 27 |
align-items:center;gap:8px}
|
| 28 |
.method{font-family:var(--mono);font-size:11px;padding:2px 8px;border-radius:6px;
|
| 29 |
font-weight:600}
|
|
|
|
| 30 |
.post{background:rgba(52,211,153,.15);color:#5eead4}
|
| 31 |
.path{font-family:var(--mono);font-size:12px;color:var(--muted)}
|
| 32 |
.field{display:flex;flex-direction:column;gap:5px}
|
| 33 |
.field label{font-size:12px;color:var(--muted)}
|
| 34 |
.row{display:flex;gap:10px;flex-wrap:wrap}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
.check{flex-direction:row;align-items:center;gap:8px}
|
| 36 |
.check input{accent-color:var(--accent);width:16px;height:16px}
|
| 37 |
+
input,button{
|
| 38 |
+
background:var(--panel2);color:var(--text);border:1px solid var(--border);
|
| 39 |
+
border-radius:8px;padding:8px 10px;font-size:13px;font-family:inherit;outline:none}
|
| 40 |
+
input:focus{border-color:var(--accent)}
|
| 41 |
+
input[type=url]{width:100%}
|
| 42 |
.actions{display:flex;gap:8px;align-items:center;margin-top:2px}
|
| 43 |
button.run{background:var(--accent);color:#fff;border:none;font-weight:600;cursor:pointer}
|
| 44 |
button.run:hover{filter:brightness(1.08)}
|
|
|
|
| 50 |
.status.wait{color:var(--muted)}
|
| 51 |
pre.js{background:#0a0d12;border:1px solid var(--border);border-radius:8px;
|
| 52 |
padding:12px;font-family:var(--mono);font-size:12px;overflow:auto;
|
| 53 |
+
max-height:400px;margin:0;white-space:pre-wrap;word-break:break-word}
|
| 54 |
+
.group{display:flex;flex-direction:column;gap:6px}
|
| 55 |
+
.group h3{font-size:12px;margin:0;color:var(--muted);text-transform:uppercase;
|
| 56 |
+
letter-spacing:.05em}
|
| 57 |
+
.group .links{display:flex;flex-direction:column;gap:2px}
|
| 58 |
+
.group a{color:#7aa9ff;text-decoration:none;font-family:var(--mono);
|
| 59 |
font-size:12px;word-break:break-all}
|
| 60 |
+
.group a:hover{text-decoration:underline}
|
|
|
|
|
|
|
| 61 |
</style>
|
| 62 |
</head>
|
| 63 |
<body>
|
| 64 |
<header>
|
| 65 |
+
<h1>Asset Extractor API <span class="sub">· test panel</span></h1>
|
| 66 |
<div class="base">
|
| 67 |
<label for="base">API base</label>
|
| 68 |
<input type="url" id="base" value="https://lljz66-api.hf.space" style="width:320px" spellcheck="false">
|
|
|
|
| 70 |
</header>
|
| 71 |
|
| 72 |
<main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
<section class="card">
|
| 74 |
<h2><span class="method post">POST</span><span class="path">/assets</span></h2>
|
| 75 |
<div class="field"><label>url</label>
|
|
|
|
| 81 |
<div class="title" id="a_title"></div>
|
| 82 |
<pre class="js" id="aOut">—</pre>
|
| 83 |
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
</main>
|
| 85 |
|
| 86 |
<script>
|
|
|
|
| 95 |
function showStatus(el, kind, msg){ el.className='status '+kind; el.textContent=msg; }
|
| 96 |
const fmt = o => JSON.stringify(o,null,2);
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
async function runAssets(){
|
| 99 |
const st=$('a_status'), ti=$('a_title'), out=$('aOut'), btn=$('aRun');
|
| 100 |
btn.disabled=true;
|
|
|
|
| 113 |
btn.disabled=false;
|
| 114 |
}
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
$('aRun').onclick=runAssets;
|
|
|
|
|
|
|
|
|
|
| 117 |
$('a_url').addEventListener('keydown',e=>{if(e.key==='Enter')runAssets();});
|
|
|
|
|
|
|
|
|
|
| 118 |
</script>
|
| 119 |
</body>
|
| 120 |
</html>
|