Compare commits

...

16 Commits

Author SHA1 Message Date
93f60c4e36 Merged main into release while building v2.0.13 2025-10-28 17:56:06 +06:00
3e143ee7a1 Исправления в ветке main 2025-10-28 17:56:03 +06:00
8cdb31d96d Merged main into release while building v2.0.12 2025-10-28 17:37:25 +06:00
96a8060afb Исправления в ветке main 2025-10-28 17:37:22 +06:00
a20fb846f0 Merged main into release while building v2.0.11 2025-10-28 17:30:35 +06:00
99b1a74034 Исправления в ветке main 2025-10-28 17:30:30 +06:00
90cfc6fb0c Merged main into release while building v2.0.11 2025-10-28 16:58:58 +06:00
89d15bfdc9 Исправления в ветке main 2025-10-28 16:58:54 +06:00
114146f4d2 Merged main into release while building v2.0.10 2025-10-28 16:07:20 +06:00
5c672ecc39 Исправления в ветке main 2025-10-28 16:07:17 +06:00
b4b902cb4c Merged main into release while building v2.0.7 2025-10-28 15:12:13 +06:00
164f32dbaf Исправления в ветке main 2025-10-28 15:12:10 +06:00
7933abe62d Merged main into release while building v2.0.7 2025-10-28 14:52:58 +06:00
1545fe2508 Исправления в ветке main 2025-10-28 14:52:55 +06:00
d213de7a95 Merged main into release while building v2.0.5 2025-10-28 14:42:21 +06:00
deb80f2b37 Исправления в ветке main 2025-10-28 14:42:17 +06:00
20 changed files with 401 additions and 96 deletions

View File

@@ -1 +1 @@
v2.0.6
v2.0.13

View File

@@ -17,6 +17,7 @@ data:
LCG_NO_HISTORY: "false"
LCG_ALLOW_EXECUTION: "false"
LCG_DEBUG: "true"
LCG_PROVIDER: "proxy"
# Настройки аутентификации
LCG_SERVER_REQUIRE_AUTH: "true"

View File

@@ -14,8 +14,7 @@ spec:
template:
metadata:
labels:
app: lcg
version: ${VERSION}
app: lcg
spec:
containers:
- name: lcg

View File

@@ -198,14 +198,7 @@ log "🔍 Проверка образа:"
echo " docker run --rm $REPOSITORY:$VERSION /app/lcg --version"
echo ""
log "📝 Команды для использования:"
echo " kubectl apply -k kustomize"
echo " kubectl get pods"
echo " kubectl get services"
echo " kubectl get ingress"
echo " kubectl get hpa"
echo " kubectl get servicemonitor"
echo " kubectl get pods"
echo " kubectl get services"
echo " kubectl get ingress"
echo " kubectl get hpa"
echo " kubectl get servicemonitor"

View File

@@ -1 +1 @@
v2.0.6
v2.0.13

View File

@@ -4,8 +4,7 @@ metadata:
name: lcg-route
namespace: lcg
labels:
app: lcg
version: ${VERSION}
app: lcg
spec:
entryPoints:
- websecure

View File

@@ -13,13 +13,13 @@ resources:
- ingress-route.yaml
# Common labels
commonLabels:
app: lcg
version: ${VERSION}
managed-by: kustomize
# commonLabels:
# app: lcg
# version: ${VERSION}
# managed-by: kustomize
# Images
images:
- name: lcg
newName: ${REPOSITORY}
newTag: ${VERSION}
# images:
# - name: lcg
# newName: ${REPOSITORY}
# newTag: ${VERSION}

View File

@@ -4,8 +4,7 @@ metadata:
name: lcg
namespace: lcg
labels:
app: lcg
version: ${VERSION}
app: lcg
spec:
type: ClusterIP
ports:
@@ -14,5 +13,4 @@ spec:
protocol: TCP
name: http
selector:
app: lcg
version: ${VERSION}
app: lcg

View File

@@ -5,7 +5,7 @@ metadata:
namespace: lcg
data:
# Основные настройки
LCG_VERSION: "v2.0.6"
LCG_VERSION: "v2.0.13"
LCG_BASE_PATH: "/lcg"
LCG_SERVER_HOST: "0.0.0.0"
LCG_SERVER_PORT: "8080"
@@ -17,6 +17,7 @@ data:
LCG_NO_HISTORY: "false"
LCG_ALLOW_EXECUTION: "false"
LCG_DEBUG: "true"
LCG_PROVIDER: "proxy"
# Настройки аутентификации
LCG_SERVER_REQUIRE_AUTH: "true"

View File

@@ -5,7 +5,7 @@ metadata:
namespace: lcg
labels:
app: lcg
version: v2.0.6
version: v2.0.13
spec:
replicas: 1
selector:
@@ -14,12 +14,11 @@ spec:
template:
metadata:
labels:
app: lcg
version: v2.0.6
app: lcg
spec:
containers:
- name: lcg
image: kuznetcovay/lcg:v2.0.6
image: kuznetcovay/lcg:v2.0.13
imagePullPolicy: Always
ports:
- containerPort: 8080

View File

@@ -4,8 +4,7 @@ metadata:
name: lcg-route
namespace: lcg
labels:
app: lcg
version: v2.0.6
app: lcg
spec:
entryPoints:
- websecure

View File

@@ -13,13 +13,13 @@ resources:
- ingress-route.yaml
# Common labels
commonLabels:
app: lcg
version: v2.0.6
managed-by: kustomize
# commonLabels:
# app: lcg
# version: v2.0.13
# managed-by: kustomize
# Images
images:
- name: lcg
newName: kuznetcovay/lcg
newTag: v2.0.6
# images:
# - name: lcg
# newName: kuznetcovay/lcg
# newTag: v2.0.13

View File

@@ -4,8 +4,7 @@ metadata:
name: lcg
namespace: lcg
labels:
app: lcg
version: v2.0.6
app: lcg
spec:
type: ClusterIP
ports:
@@ -14,5 +13,4 @@ spec:
protocol: TCP
name: http
selector:
app: lcg
version: v2.0.6
app: lcg

17
main.go
View File

@@ -156,9 +156,12 @@ lcg [опции] <описание команды>
Debug: c.Bool("debug"),
}
disableHistory = config.AppConfig.MainFlags.NoHistory || config.AppConfig.IsNoHistoryEnabled()
config.AppConfig.MainFlags.Debug = config.AppConfig.MainFlags.Debug || config.GetEnvBool("LCG_DEBUG", false)
fmt.Println("Debug:", config.AppConfig.MainFlags.Debug)
fmt.Println("LCG_DEBUG:", config.GetEnvBool("LCG_DEBUG", false))
args := c.Args().Slice()
if len(args) == 0 {
@@ -178,7 +181,7 @@ lcg [опции] <описание команды>
}
}
if CompileConditions.NoServe {
if CompileConditions.NoServe {
if len(args) > 1 && args[0] == "serve" {
printColored("❌ Error: serve command is disabled in this build\n", colorRed)
os.Exit(1)
@@ -569,11 +572,9 @@ func getCommands() []*cli.Command {
host := c.String("host")
openBrowser := c.Bool("browser")
// Пробрасываем глобальный флаг debug для web-сервера
// Позволяет запускать: lcg -d serve -p ...
if c.Bool("debug") {
config.AppConfig.MainFlags.Debug = true
}
// Пробрасываем debug: флаг или переменная окружения LCG_DEBUG
// Позволяет запускать: LCG_DEBUG=1 lcg serve ... или lcg -d serve ...
config.AppConfig.MainFlags.Debug = c.Bool("debug") || config.GetEnvBool("LCG_DEBUG", false)
// Обновляем конфигурацию сервера с новыми параметрами
config.AppConfig.Server.Host = host

View File

@@ -39,11 +39,12 @@ func generateAbbreviation(appName string) string {
// FileInfo содержит информацию о файле
type FileInfo struct {
Name string
Size string
ModTime string
Preview template.HTML
Content string // Полное содержимое для поиска
Name string
DisplayName string
Size string
ModTime string
Preview template.HTML
Content string // Полное содержимое для поиска
}
// handleResultsPage обрабатывает главную страницу со списком файлов
@@ -133,11 +134,12 @@ func getResultFiles() ([]FileInfo, error) {
}
files = append(files, FileInfo{
Name: entry.Name(),
Size: formatFileSize(info.Size()),
ModTime: info.ModTime().Format("02.01.2006 15:04"),
Preview: template.HTML(preview),
Content: fullContent,
Name: entry.Name(),
DisplayName: formatFileDisplayName(entry.Name()),
Size: formatFileSize(info.Size()),
ModTime: info.ModTime().Format("02.01.2006 15:04"),
Preview: template.HTML(preview),
Content: fullContent,
})
}
@@ -167,24 +169,91 @@ func formatFileSize(size int64) string {
return fmt.Sprintf("%.1f %cB", float64(size)/float64(div), "KMGTPE"[exp])
}
// formatFileDisplayName преобразует имя файла вида
// gpt_request_GigaChat-2-Max_2025-10-22_13-50-13.md
// в "Gpt Request GigaChat 2 Max — 2025-10-22 13:50:13"
func formatFileDisplayName(filename string) string {
name := strings.TrimSuffix(filename, ".md")
// Разделим на части по '_'
parts := strings.Split(name, "_")
if len(parts) == 0 {
return filename
}
// Первая часть может быть префиксом gpt/request — заменим '_' на пробел и приведем регистр
var words []string
for _, p := range parts {
if p == "" {
continue
}
// Заменяем '-' на пробел в словах модели/текста
p = strings.ReplaceAll(p, "-", " ")
// Разбиваем по пробелам и капитализуем каждое слово
for _, w := range strings.Fields(p) {
if w == "" {
continue
}
r := []rune(w)
r[0] = unicode.ToUpper(r[0])
words = append(words, string(r))
}
}
// Попробуем распознать хвост как дату и время
// Ищем шаблон YYYY-MM-DD_HH-MM-SS в исходном имени
var pretty string
// ожидаем последние две части — дата и время
if len(parts) >= 3 {
datePart := parts[len(parts)-2]
timePart := parts[len(parts)-1]
// заменить '-' в времени на ':'
timePretty := strings.ReplaceAll(timePart, "-", ":")
if len(datePart) == 10 && len(timePart) == 8 { // примитивная проверка
// Собираем текст до датных частей
text := strings.Join(words[:len(words)-2], " ")
pretty = strings.TrimSpace(text)
if pretty != "" {
pretty += " — " + datePart + " " + timePretty
} else {
pretty = datePart + " " + timePretty
}
return pretty
}
}
if len(words) > 0 {
pretty = strings.Join(words, " ")
return pretty
}
return filename
}
// handleFileView обрабатывает просмотр конкретного файла
func handleFileView(w http.ResponseWriter, r *http.Request) {
filename := strings.TrimPrefix(r.URL.Path, "/file/")
// Учитываем BasePath при извлечении имени файла
basePath := config.AppConfig.Server.BasePath
var filename string
if basePath != "" && basePath != "/" {
basePath = strings.TrimSuffix(basePath, "/")
filename = strings.TrimPrefix(r.URL.Path, basePath+"/file/")
} else {
filename = strings.TrimPrefix(r.URL.Path, "/file/")
}
if filename == "" {
http.NotFound(w, r)
renderNotFound(w, "Файл не указан", getBasePath())
return
}
// Проверяем, что файл существует и находится в папке результатов
filePath := filepath.Join(config.AppConfig.ResultFolder, filename)
if !strings.HasPrefix(filePath, config.AppConfig.ResultFolder) {
http.NotFound(w, r)
renderNotFound(w, "Запрошенный файл недоступен", getBasePath())
return
}
content, err := os.ReadFile(filePath)
if err != nil {
http.NotFound(w, r)
renderNotFound(w, "Файл не найден или был удален", getBasePath())
return
}
@@ -195,9 +264,11 @@ func handleFileView(w http.ResponseWriter, r *http.Request) {
data := struct {
Filename string
Content template.HTML
BasePath string
}{
Filename: filename,
Content: template.HTML(htmlContent),
BasePath: getBasePath(),
}
// Парсим и выполняем шаблон
@@ -221,22 +292,30 @@ func handleDeleteFile(w http.ResponseWriter, r *http.Request) {
return
}
filename := strings.TrimPrefix(r.URL.Path, "/delete/")
// Учитываем BasePath при извлечении имени файла
basePath := config.AppConfig.Server.BasePath
var filename string
if basePath != "" && basePath != "/" {
basePath = strings.TrimSuffix(basePath, "/")
filename = strings.TrimPrefix(r.URL.Path, basePath+"/delete/")
} else {
filename = strings.TrimPrefix(r.URL.Path, "/delete/")
}
if filename == "" {
http.NotFound(w, r)
renderNotFound(w, "Файл не указан", getBasePath())
return
}
// Проверяем, что файл существует и находится в папке результатов
filePath := filepath.Join(config.AppConfig.ResultFolder, filename)
if !strings.HasPrefix(filePath, config.AppConfig.ResultFolder) {
http.NotFound(w, r)
renderNotFound(w, "Запрошенный файл недоступен", getBasePath())
return
}
// Проверяем, что файл существует
if _, err := os.Stat(filePath); os.IsNotExist(err) {
http.NotFound(w, r)
renderNotFound(w, "Файл не найден или уже удален", getBasePath())
return
}

View File

@@ -3,11 +3,13 @@ package serve
import (
"crypto/tls"
"fmt"
"html/template"
"net/http"
"os"
"strings"
"github.com/direct-dev-ru/linux-command-gpt/config"
"github.com/direct-dev-ru/linux-command-gpt/serve/templates"
"github.com/direct-dev-ru/linux-command-gpt/ssl"
)
@@ -48,6 +50,18 @@ func StartResultServer(host, port string) error {
return fmt.Errorf("failed to initialize CSRF manager: %v", err)
}
// Гарантируем наличие папки результатов и файла истории
if _, err := os.Stat(config.AppConfig.ResultFolder); os.IsNotExist(err) {
if mkErr := os.MkdirAll(config.AppConfig.ResultFolder, 0755); mkErr != nil {
return fmt.Errorf("failed to create results folder: %v", mkErr)
}
}
if _, err := os.Stat(config.AppConfig.ResultHistory); os.IsNotExist(err) {
if writeErr := Write(config.AppConfig.ResultHistory, []HistoryEntry{}); writeErr != nil {
return fmt.Errorf("failed to create history file: %v", writeErr)
}
}
addr := fmt.Sprintf("%s:%s", host, port)
// Проверяем, нужно ли использовать HTTPS
@@ -138,15 +152,21 @@ func registerHTTPSRoutes() {
// Регистрируем все маршруты кроме главной страницы
registerRoutesExceptHome()
// Регистрируем главную страницу с проверкой HTTPS
// Регистрируем главную страницу (строго по BasePath) с проверкой HTTPS
http.HandleFunc(makePath("/"), func(w http.ResponseWriter, r *http.Request) {
// Проверяем, пришел ли запрос по HTTP (не HTTPS)
if r.TLS == nil {
handleHTTPSRedirect(w, r)
return
}
// Если уже HTTPS, обрабатываем как обычно
AuthMiddleware(handleResultsPage)(w, r)
// Обрабатываем только точные пути: BasePath или BasePath/
bp := getBasePath()
p := r.URL.Path
if (bp == "" && (p == "/" || p == "")) || (bp != "" && (p == bp || p == bp+"/")) {
AuthMiddleware(handleResultsPage)(w, r)
return
}
renderNotFound(w, "Страница не найдена", bp)
})
// Регистрируем главную страницу без слэша в конце для BasePath
@@ -163,6 +183,13 @@ func registerHTTPSRoutes() {
AuthMiddleware(handleResultsPage)(w, r)
})
}
// Catch-all 404 для любых незарегистрированных путей (только когда BasePath задан)
if getBasePath() != "" {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
renderNotFound(w, "Страница не найдена", getBasePath())
})
}
}
// registerRoutesExceptHome регистрирует все маршруты кроме главной страницы
@@ -203,6 +230,13 @@ func registerRoutesExceptHome() {
// API для сохранения результатов и истории
http.HandleFunc(makePath("/api/save-result"), AuthMiddleware(CSRFMiddleware(handleSaveResult)))
http.HandleFunc(makePath("/api/add-to-history"), AuthMiddleware(CSRFMiddleware(handleAddToHistory)))
// Catch-all 404 для любых незарегистрированных путей (только когда BasePath задан)
if getBasePath() != "" {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
renderNotFound(w, "Страница не найдена", getBasePath())
})
}
}
// registerRoutes регистрирует все маршруты сервера
@@ -215,8 +249,17 @@ func registerRoutes() {
http.HandleFunc(makePath("/api/logout"), handleLogout)
http.HandleFunc(makePath("/api/validate-token"), handleValidateToken)
// Главная страница и файлы
http.HandleFunc(makePath("/"), AuthMiddleware(handleResultsPage))
// Главная страница (строго по BasePath) и файлы
http.HandleFunc(makePath("/"), func(w http.ResponseWriter, r *http.Request) {
// Обрабатываем только точные пути: BasePath или BasePath/
bp := getBasePath()
p := r.URL.Path
if (bp == "" && (p == "/" || p == "")) || (bp != "" && (p == bp || p == bp+"/")) {
AuthMiddleware(handleResultsPage)(w, r)
return
}
renderNotFound(w, "Страница не найдена", bp)
})
http.HandleFunc(makePath("/file/"), AuthMiddleware(handleFileView))
http.HandleFunc(makePath("/delete/"), AuthMiddleware(handleDeleteFile))
@@ -251,4 +294,30 @@ func registerRoutes() {
basePath = strings.TrimSuffix(basePath, "/")
http.HandleFunc(basePath, AuthMiddleware(handleResultsPage))
}
// Catch-all 404 для любых незарегистрированных путей (только когда BasePath задан)
if getBasePath() != "" {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
renderNotFound(w, "Страница не найдена", getBasePath())
})
}
}
// renderNotFound рендерит кастомную страницу 404
func renderNotFound(w http.ResponseWriter, message, basePath string) {
w.WriteHeader(http.StatusNotFound)
data := struct {
Message string
BasePath string
}{
Message: message,
BasePath: basePath,
}
tmpl, err := template.New("not_found").Parse(templates.NotFoundTemplate)
if err != nil {
http.Error(w, "404 Not Found", http.StatusNotFound)
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_ = tmpl.Execute(w, data)
}

View File

@@ -126,7 +126,7 @@ const FileViewTemplate = `
<div class="container">
<div class="header">
<h1>📄 {{.Filename}}</h1>
<a href="/" class="back-btn">← Назад к списку</a>
<a href="{{.BasePath}}/" class="back-btn">← Назад к списку</a>
</div>
<div class="content">
{{.Content}}

View File

@@ -111,19 +111,26 @@ const HistoryPageTemplate = `
font-size: 0.9em;
color: #2d5016;
border-left: 3px solid #2d5016;
max-height: 72px; /* ~4 строки */
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
}
.delete-btn {
background: #e74c3c;
color: white;
background: transparent;
color: #ef9a9a; /* бледно-красный */
border: none;
padding: 6px 12px;
padding: 2px 6px;
border-radius: 4px;
cursor: pointer;
font-size: 0.8em;
transition: background 0.3s ease;
font-size: 18px;
line-height: 1;
transition: color 0.2s ease, transform 0.2s ease;
}
.delete-btn:hover {
background: #c0392b;
color: rgb(171, 27, 24); /* ярче при ховере */
transform: translateY(-1px);
}
.empty-state {
text-align: center;
@@ -180,7 +187,7 @@ const HistoryPageTemplate = `
<span class="history-index">#{{.Index}}</span>
<span class="history-timestamp">{{.Timestamp}}</span>
</div>
<button class="delete-btn" onclick="event.stopPropagation(); deleteHistoryEntry({{.Index}})">🗑️ Удалить</button>
<button class="delete-btn" onclick="event.stopPropagation(); deleteHistoryEntry({{.Index}})"></button>
</div>
<div class="history-command">{{.Command}}</div>
<div class="history-response">{{.Response}}</div>

View File

@@ -0,0 +1,147 @@
package templates
// NotFoundTemplate современная страница 404
const NotFoundTemplate = `
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Страница не найдена — 404</title>
<style>
:root {
--bg: #1a0b0b; /* глубокий темно-красный фон */
--bg2: #2a0f0f; /* второй оттенок фона */
--fg: #ffeaea; /* светлый текст с красным оттенком */
--accent: #ff3b30; /* основной красный (iOS red) */
--accent2: #ff6f61; /* дополнительный коралловый */
--accentGlow: rgba(255,59,48,0.35);
--accentGlow2: rgba(255,111,97,0.30);
}
* { box-sizing: border-box; }
body {
margin: 0;
min-height: 100vh;
display: grid;
place-items: center;
background:
radial-gradient(1200px 600px at 10% 10%, rgba(255,59,48,0.12), transparent),
radial-gradient(1200px 600px at 90% 90%, rgba(255,111,97,0.12), transparent),
linear-gradient(135deg, var(--bg), var(--bg2));
color: var(--fg);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
overflow: hidden;
}
.glow {
position: absolute;
inset: -20%;
background:
radial-gradient(700px 340px at 20% 30%, rgba(255,59,48,0.22), transparent 60%),
radial-gradient(700px 340px at 80% 70%, rgba(255,111,97,0.20), transparent 60%);
filter: blur(40px);
z-index: 0;
}
.card {
position: relative;
z-index: 1;
width: min(720px, 92vw);
padding: 32px;
border-radius: 20px;
background: rgba(255,255,255,0.03);
border: 1px solid rgba(255,255,255,0.08);
box-shadow: 0 10px 40px rgba(80,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.03);
backdrop-filter: blur(10px);
text-align: center;
}
.code {
font-size: clamp(48px, 12vw, 120px);
line-height: 0.9;
font-weight: 800;
letter-spacing: -2px;
background: linear-gradient(90deg, var(--accent), var(--accent2));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
margin: 8px 0 12px 0;
text-shadow: 0 8px 40px var(--accentGlow);
}
.title {
font-size: clamp(18px, 3.2vw, 28px);
font-weight: 600;
opacity: 0.95;
margin-bottom: 8px;
}
.desc {
font-size: 15px;
opacity: 0.75;
margin: 0 auto 20px auto;
max-width: 60ch;
}
.btns {
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
margin-top: 8px;
}
.btn {
appearance: none;
border: none;
cursor: pointer;
padding: 12px 18px;
border-radius: 12px;
font-weight: 600;
color: white;
background: linear-gradient(135deg, var(--accent), #c62828);
box-shadow: 0 6px 18px var(--accentGlow);
transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 8px;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn.secondary { background: linear-gradient(135deg, #e65100, var(--accent2)); box-shadow: 0 6px 18px var(--accentGlow2); }
.hint { margin-top: 16px; font-size: 13px; opacity: 0.6; }
</style>
<script>
function goHome() {
window.location.href = '{{.BasePath}}/';
}
function bindEsc() {
const handler = (e) => { if (e.key === 'Escape' || e.key === 'Esc') { e.preventDefault(); goHome(); } };
window.addEventListener('keydown', handler);
document.addEventListener('keydown', handler);
// фокус на body для гарантии получения клавиш
if (document && document.body) {
document.body.setAttribute('tabindex', '-1');
document.body.focus({ preventScroll: true });
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', bindEsc);
} else {
bindEsc();
}
</script>
<meta http-equiv="refresh" content="30">
<meta name="robots" content="noindex">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><text y='50%' x='50%' dominant-baseline='middle' text-anchor='middle' font-size='42'>🚫</text></svg>">
</head>
<body>
<div class="glow"></div>
<div class="card">
<div class="code">404</div>
<div class="title">Страница не найдена</div>
<p class="desc">{{.Message}}</p>
<div class="btns">
<a class="btn" href="{{.BasePath}}/">🏠 На главную</a>
<a class="btn secondary" href="{{.BasePath}}/run">🚀 К выполнению</a>
</div>
<div class="hint">Нажмите Esc, чтобы вернуться на главную</div>
</div>
</body>
</html>
`

View File

@@ -73,8 +73,10 @@ const ResultsPageTemplate = `
}
.files-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
align-items: stretch;
grid-auto-rows: auto;
}
.file-card {
background: white;
@@ -91,32 +93,36 @@ const ResultsPageTemplate = `
}
.file-card-content {
cursor: pointer;
padding-left: 28px;
}
.file-actions {
position: absolute;
top: 10px;
right: 10px;
left: 10px;
display: flex;
gap: 8px;
}
.delete-btn {
background: #e74c3c;
color: white;
background: transparent;
color: #ef9a9a; /* бледно-красный */
border: none;
padding: 6px 12px;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
font-size: 0.8em;
transition: background 0.3s ease;
font-size: 18px;
line-height: 1;
transition: color 0.2s ease, transform 0.2s ease;
}
.delete-btn:hover {
background: #c0392b;
color:rgb(171, 27, 24); /* чуть ярче при ховере */
transform: translateY(-1px);
}
.file-name {
font-weight: 600;
color: #333;
margin-bottom: 8px;
font-size: 1.1em;
padding-right: 10px;
}
.file-info {
color: #666;
@@ -165,16 +171,25 @@ const ResultsPageTemplate = `
body { padding: 10px; }
.container { margin: 0; border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.header { padding: 20px; }
.header h1 { font-size: 2em; }
.header h1 { font-size: 1.9em; }
.content { padding: 20px; }
.files-grid { grid-template-columns: 1fr; }
/* Стили карточек как в истории */
.file-card { background: #f0f8f0; border: 1px solid #a8e6cf; padding: 15px; }
.file-card:hover { border-color: #2d5016; box-shadow: 0 8px 25px rgba(45,80,22,0.2); transform: translateY(-2px); }
.file-name { color: #333; margin-bottom: 8px; }
.file-info { color: #666; font-size: 0.9em; }
.file-preview { background: #f8f9fa; border-left: 3px solid #2d5016; font-size: 0.85em; }
.file-actions { top: 8px; left: 8px; }
.delete-btn { padding: 2px 6px; font-size: 16px; }
.stats { grid-template-columns: 1fr 1fr; }
.nav-buttons { flex-direction: column; gap: 8px; }
.nav-btn, .nav-button { text-align: center; padding: 12px 16px; font-size: 14px; }
.search-container input { font-size: 16px; width: 96% !important; }
}
@media (max-width: 480px) {
.header h1 { font-size: 1.8em; }
.header h1 { font-size: 1.6em; }
.content { padding: 16px; }
.stats { grid-template-columns: 1fr; }
}
</style>
@@ -216,10 +231,10 @@ const ResultsPageTemplate = `
{{range .Files}}
<div class="file-card" data-content="{{.Content}}">
<div class="file-actions">
<button class="delete-btn" onclick="deleteFile('{{.Name}}')" title="Удалить файл">🗑️</button>
<button class="delete-btn" onclick="deleteFile('{{.Name}}')" title="Удалить файл"></button>
</div>
<div class="file-card-content" onclick="window.location.href='{{$.BasePath}}/file/{{.Name}}'">
<div class="file-name">{{.Name}}</div>
<div class="file-name">{{.DisplayName}}</div>
<div class="file-info">
📅 {{.ModTime}} | 📏 {{.Size}}
</div>