Spaces:
Configuration error
Configuration error
Update templates/index.html
Browse files- templates/index.html +19 -55
templates/index.html
CHANGED
@@ -1,64 +1,28 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html
|
3 |
<head>
|
4 |
-
<
|
5 |
-
<title>Поиск кода через Searchcode API</title>
|
6 |
<style>
|
7 |
-
body { font-family: Arial, sans-serif;
|
8 |
-
|
9 |
-
input
|
10 |
-
|
11 |
-
button:hover { background: #0056b3; }
|
12 |
-
.result { border-bottom: 1px solid #ddd; padding: 10px 0; }
|
13 |
-
pre { background: #eee; padding: 10px; border-radius: 4px; overflow-x: auto; }
|
14 |
</style>
|
15 |
</head>
|
16 |
<body>
|
17 |
-
<
|
18 |
-
|
19 |
-
<
|
20 |
-
|
21 |
-
|
22 |
-
<input type="text" name="lang" placeholder="Язык (например, python)">
|
23 |
-
<input type="text" name="repo" placeholder="Репозиторий (например, boyter/batf)">
|
24 |
-
<button type="submit">Поиск</button>
|
25 |
-
</form>
|
26 |
-
<div id="results" style="margin-top: 20px;"></div>
|
27 |
-
</div>
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
.then(data => {
|
38 |
-
const resultsDiv = document.getElementById("results");
|
39 |
-
resultsDiv.innerHTML = "";
|
40 |
-
|
41 |
-
if (data.results.length === 0) {
|
42 |
-
resultsDiv.innerHTML = "<p>Нет результатов.</p>";
|
43 |
-
} else {
|
44 |
-
// Выводим основные параметры ответа
|
45 |
-
resultsDiv.innerHTML = `<p><strong>Запрос:</strong> ${data.query}</p>
|
46 |
-
<p><strong>Всего результатов:</strong> ${data.total}</p>`;
|
47 |
-
|
48 |
-
data.results.forEach(item => {
|
49 |
-
const div = document.createElement("div");
|
50 |
-
div.classList.add("result");
|
51 |
-
div.innerHTML = `<strong>${item.filename || 'Нет данных'} (строка: ${item.lines ? Object.keys(item.lines)[0] : 'N/A'})</strong>
|
52 |
-
<pre>${item.lines ? Object.values(item.lines).join("\n") : 'Нет кода'}</pre>
|
53 |
-
<a href="${item.url}" target="_blank">Посмотреть в Searchcode</a>`;
|
54 |
-
resultsDiv.appendChild(div);
|
55 |
-
});
|
56 |
-
}
|
57 |
-
})
|
58 |
-
.catch(error => {
|
59 |
-
console.error("Ошибка:", error);
|
60 |
-
});
|
61 |
-
});
|
62 |
-
</script>
|
63 |
</body>
|
64 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
<head>
|
4 |
+
<title>Site Info Scanner</title>
|
|
|
5 |
<style>
|
6 |
+
body { font-family: Arial, sans-serif; margin: 40px; }
|
7 |
+
input[type=text] { width: 300px; padding: 5px; }
|
8 |
+
input[type=submit] { padding: 5px 10px; }
|
9 |
+
pre { background: #f4f4f4; padding: 10px; border: 1px solid #ccc; }
|
|
|
|
|
|
|
10 |
</style>
|
11 |
</head>
|
12 |
<body>
|
13 |
+
<h1>Site Info Scanner</h1>
|
14 |
+
<form method="post">
|
15 |
+
<input type="text" name="url" placeholder="https://example.com" required>
|
16 |
+
<input type="submit" value="Scan">
|
17 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
{% if error %}
|
20 |
+
<p style="color: red;">{{ error }}</p>
|
21 |
+
{% endif %}
|
22 |
+
|
23 |
+
{% if result %}
|
24 |
+
<h2>Scan Results:</h2>
|
25 |
+
<pre>{{ result | tojson(indent=4) }}</pre>
|
26 |
+
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
</body>
|
28 |
</html>
|