13 Commits
Author SHA1 Message Date
austnv a22662f11b v0.9.2
Build and Deploy Frontend via SSH / deploy (push) Failing after 4s
2026-06-21 21:56:47 +03:00
austnv 75531a9ec3 update workflow: add auto release 2026-06-21 21:56:19 +03:00
austnv e6ab2667c9 fix: micropatch NodesStatus 2026-06-21 21:50:00 +03:00
austnv 3a38b3f7fa v0.9.1
Build and Deploy Frontend via SSH / deploy (push) Successful in 42s
2026-06-21 21:43:21 +03:00
austnv b69cc4bc4b update NodesStatus.vue 2026-06-21 21:38:23 +03:00
austnv 4b7b2bc5c6 refactor NodesStatus.vue
Build and Deploy Frontend via SSH / deploy (push) Successful in 46s
2026-06-21 20:45:40 +03:00
austnv f6af141f56 update NodesStatus 2026-06-21 17:51:54 +03:00
austnv c5c0a6614a fix: update NodesStatus
Build and Deploy Frontend via SSH / deploy (push) Has been cancelled
2026-06-21 17:42:05 +03:00
austnv acb11b43c7 fix(workflow): finish deploy.yml 2026-06-21 17:22:48 +03:00
austnv b12c1a07c9 update workflow 2026-06-21 17:20:10 +03:00
austnv 03fbbed39c change ssh key managment system 2026-06-21 17:17:21 +03:00
austnv 0c825abad2 update workflow 2026-06-21 17:16:08 +03:00
austnv 89ffe3c50e update workflow 2026-06-21 17:07:58 +03:00
4 changed files with 199 additions and 345 deletions
+36 -5
View File
@@ -4,6 +4,7 @@ on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
deploy:
@@ -23,15 +24,45 @@ jobs:
- name: Build project
run: npm run build
- name: Create Gitea Release
uses: actions/gitea-release-action@v1
with:
release_name: ${{ gitea.ref_name }}
release_notes: |
## Релиз ${{ gitea.ref_name }}
${{ (github.event.head_commit.message != '' && format('📝 {0}', github.event.head_commit.message)) || '' }}
### 📦 Что изменилось
${{ github.event.head_commit.message || 'Автоматический релиз через CI/CD' }}
---
### 🔧 Технические детали
- **Тег:** `${{ gitea.ref_name }}`
- **Ветка:** `${{ gitea.ref }}`
- **Автор:** ${{ gitea.actor }}
### 🚀 Деплой
- ✅ Сервер обновлён автоматически
---
> Релиз создан автоматически через Gitea Actions
draft: false
prerelease: false
env:
GITEA_API_KEY: ${{ secrets.ACCESS_TOKEN }}
- name: Install SSH key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
- name: Deploy via SCP
run: |
# Создаём архив собранных файлов
tar -czf frontend.tar.gz -C dist .
# Копируем архив на хост через SCP
scp -o StrictHostKeyChecking=no frontend.tar.gz ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/tmp/
# Распаковываем и перемещаем файлы на хосте
ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
mkdir -p /opt/uvpn.shop/frontend
rm -rf /opt/uvpn.shop/frontend/*
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "uvpn.shop",
"version": "0.8.0",
"name": "frontend",
"version": "0.9.2",
"private": true,
"type": "module",
"scripts": {
+132 -264
View File
@@ -1,333 +1,201 @@
<template>
<section id="nodes" class="px-6 py-20 md:px-12 max-w-7xl mx-auto">
<div class="flex justify-between items-center mb-10 flex-wrap gap-4">
<div>
<h2 class="text-3xl md:text-4xl font-bold text-gray-900 dark:text-white">
🌍 Статус серверов
<section class="px-6 py-20 md:px-12 max-w-7xl mx-auto">
<h2 class="text-3xl md:text-4xl font-bold text-center mb-14">
Статус серверов
</h2>
<p class="text-gray-500 dark:text-gray-400 mt-2">
{{ onlineCount }} из {{ nodes.length }} серверов онлайн
<span v-if="averagePing !== null" class="ml-4">
📶 Средний пинг: <span class="font-semibold text-blue-600 dark:text-blue-400">{{ averagePing }}ms</span>
</span>
</p>
</div>
<div class="flex justify-end mb-4">
<button
@click="refreshData"
:disabled="loading"
class="px-4 py-2 bg-gray-200 dark:bg-gray-700 rounded-lg text-sm font-medium text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm font-medium transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
>
<span :class="{ 'animate-spin': loading }">🔄</span>
{{ loading ? 'Обновление...' : 'Обновить' }}
<RefreshCw :size="16" :class="{ 'animate-spin': loading }" />
{{ loading ? 'Обновление...' : 'Обновить все' }}
</button>
</div>
<!-- Состояние загрузки -->
<div v-if="loading && !nodes.length" class="flex justify-center py-20">
<div v-if="loading && !hosts.length" class="flex justify-center py-12">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
<!-- Ошибка -->
<div v-else-if="error" class="text-center text-red-500 py-12">
<p class="text-lg">{{ error }}</p>
<button @click="refreshData" class="mt-4 text-blue-600 dark:text-blue-400 hover:underline">
Попробовать снова
</button>
</div>
<p v-else-if="error" class="text-center text-red-500 py-12">{{ error }}</p>
<!-- Сетка серверов -->
<div v-else class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
<div v-else class="space-y-2 max-w-3xl mx-auto">
<div
v-for="node in sortedNodes"
:key="node.name"
class="bg-white dark:bg-gray-900 rounded-xl p-5 border transition hover:shadow-lg"
:class="[
node.isOnline
? 'border-green-500/30 dark:border-green-500/20 hover:border-green-500'
: 'border-red-500/30 dark:border-red-500/20 opacity-60'
]"
v-for="host in sortedHosts"
:key="host.address"
class="flex items-center justify-between bg-white dark:bg-gray-900 rounded-xl px-4 py-2.5 border transition hover:shadow-md"
:class="host.isOnline ? 'border-green-500/30' : 'border-red-500/30 opacity-60'"
>
<!-- Шапка -->
<div class="flex items-start justify-between mb-3">
<div class="flex items-center gap-2">
<!-- Флаг из CDN -->
<div class="flex items-center gap-3">
<img
v-if="node.country_code"
:src="`https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/flags/4x3/${node.country_code.toLowerCase()}.svg`"
:alt="node.country_code.toLowerCase()"
v-if="host.countryCode"
:src="`https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/flags/4x3/${host.countryCode}.svg`"
class="h-5 w-auto rounded-sm"
/>
<div>
<h3 class="font-semibold text-gray-900 dark:text-white">
{{ node.name }}
</h3>
<span class="text-xs text-gray-500 dark:text-gray-400">
{{ node.country_code }}
</span>
</div>
</div>
<span class="font-semibold text-gray-800 dark:text-white">{{ host.name }}</span>
<span
class="text-xs px-2 py-1 rounded-full font-medium"
:class="node.isOnline
? 'bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400'
: 'bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400'"
class="text-[10px] px-2 py-0.5 rounded-full font-medium"
:class="host.isOnline ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'"
>
{{ node.isOnline ? '🟢 Онлайн' : '🔴 Офлайн' }}
{{ host.isOnline ? 'online' : 'offline' }}
</span>
</div>
<!-- IP и порт -->
<div class="text-sm text-gray-500 dark:text-gray-400 mb-3 font-mono">
{{ node.ip }}:{{ node.port }}
</div>
<!-- Статистика -->
<div class="grid grid-cols-2 gap-2 text-sm">
<div class="bg-gray-50 dark:bg-gray-800 rounded-lg p-2 text-center">
<div class="text-gray-500 dark:text-gray-400 text-xs">Пользователи</div>
<div class="font-semibold text-gray-900 dark:text-white">
{{ node.users_online }}
</div>
</div>
<div class="bg-gray-50 dark:bg-gray-800 rounded-lg p-2 text-center">
<div class="text-gray-500 dark:text-gray-400 text-xs">Uptime</div>
<div class="font-semibold text-gray-900 dark:text-white">
{{ formatUptime(node.uptime) }}
</div>
</div>
</div>
<!-- Пинг (если измерен) -->
<div v-if="node.ping !== undefined && node.ping !== null" class="mt-3 pt-3 border-t border-gray-200 dark:border-gray-700">
<div class="flex justify-between items-center text-sm">
<span class="text-gray-500 dark:text-gray-400">📶 Пинг</span>
<div class="flex items-center gap-4">
<span
class="font-semibold"
v-if="host.ping !== undefined && host.ping !== null"
class="font-mono font-semibold flex items-center gap-1 min-w-[60px] justify-end"
:class="{
'text-green-600 dark:text-green-400': node.ping < 50,
'text-yellow-600 dark:text-yellow-400': node.ping >= 50 && node.ping < 150,
'text-orange-600 dark:text-orange-400': node.ping >= 150 && node.ping < 300,
'text-red-600 dark:text-red-400': node.ping >= 300
'text-green-600': host.ping < 200,
'text-yellow-600': host.ping >= 200 && host.ping < 500,
'text-red-600': host.ping >= 500,
}"
>
{{ node.ping }}ms
<Wifi :size="14" />
{{ host.ping }}ms
</span>
</div>
<!-- Прогресс-бар пинга -->
<div class="w-full h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full mt-1 overflow-hidden">
<div
class="h-full rounded-full transition-all duration-500"
:class="{
'bg-green-500': node.ping < 50,
'bg-yellow-500': node.ping >= 50 && node.ping < 150,
'bg-orange-500': node.ping >= 150 && node.ping < 300,
'bg-red-500': node.ping >= 300
}"
:style="{ width: Math.min((node.ping / 300) * 100, 100) + '%' }"
></div>
</div>
</div>
<span v-else class="text-gray-300 min-w-[60px] text-right"></span>
<!-- Кнопка проверки пинга -->
<button
@click="pingNode(node)"
:disabled="node.pinging || !node.isOnline"
class="mt-3 w-full text-xs py-1.5 rounded-lg transition font-medium"
@click="pingSingleHost(host)"
:disabled="host.pinging"
class="text-xs px-3 py-1 rounded-lg transition font-medium"
:class="[
node.isOnline
? 'bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/30 disabled:opacity-50'
host.isOnline && !host.pinging
? 'bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600'
: 'bg-gray-100 dark:bg-gray-800 text-gray-400 cursor-not-allowed'
]"
>
{{ node.pinging ? '⏳ Измерение...' : 'Проверить пинг' }}
{{ host.pinging ? '⏳' : инг' }}
</button>
</div>
</div>
<!-- Футер с статистикой -->
<div
v-if="!loading && nodes.length"
class="mt-10 grid grid-cols-2 md:grid-cols-4 gap-4 text-center"
>
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4">
<div class="text-2xl font-bold text-gray-900 dark:text-white">
{{ nodes.length }}
</div>
<div class="text-sm text-gray-500 dark:text-gray-400">Всего серверов</div>
</div>
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4">
<div class="text-2xl font-bold text-green-600 dark:text-green-400">
{{ onlineCount }}
</div>
<div class="text-sm text-gray-500 dark:text-gray-400">Онлайн</div>
</div>
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4">
<div class="text-2xl font-bold text-red-600 dark:text-red-400">
{{ offlineCount }}
</div>
<div class="text-sm text-gray-500 dark:text-gray-400">Офлайн</div>
</div>
<div class="bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4">
<div class="text-2xl font-bold text-blue-600 dark:text-blue-400">
{{ totalUsers }}
</div>
<div class="text-sm text-gray-500 dark:text-gray-400">Всего пользователей</div>
</div>
</div>
</section>
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { Wifi, RefreshCw } from '@lucide/vue'
import { getAllCountries } from '@tw-labs/countries'
// Состояние
const nodes = ref([])
const loading = ref(false)
const hosts = ref([])
const loading = ref(true)
const error = ref(null)
let updateInterval = null
let interval = null
// Вычисляемые свойства
const sortedNodes = computed(() => {
return [...nodes.value].sort((a, b) => {
// Сначала онлайн
if (a.isOnline !== b.isOnline) {
return a.isOnline ? -1 : 1
}
// Потом по имени
return a.name.localeCompare(b.name)
})
})
const countriesList = getAllCountries()
const onlineCount = computed(() => {
return nodes.value.filter(n => n.isOnline).length
})
// Поиск страны по первому слову в названии
const findCountryByFirstWord = (name) => {
if (!name) return null
const offlineCount = computed(() => {
return nodes.value.filter(n => !n.isOnline).length
})
// Берём первое слово из названия
const firstWord = name.split(' ')[0]
if (!firstWord) return null
const totalUsers = computed(() => {
return nodes.value.reduce((sum, n) => sum + (n.users_online || 0), 0)
})
// Ищем точное совпадение
const exact = countriesList.find(c =>
c.label.toLowerCase() === firstWord.toLowerCase()
)
if (exact) return exact
const averagePing = computed(() => {
const pings = nodes.value
.filter(n => n.ping !== undefined && n.ping !== null)
.map(n => n.ping)
if (pings.length === 0) return null
return Math.round(pings.reduce((a, b) => a + b, 0) / pings.length)
})
// Методы
const formatUptime = (seconds) => {
if (!seconds) return '0м'
const days = Math.floor(seconds / 86400)
const hours = Math.floor((seconds % 86400) / 3600)
const minutes = Math.floor((seconds % 3600) / 60)
if (days > 0) return `${days}д ${hours}ч`
if (hours > 0) return `${hours}ч ${minutes}м`
return `${minutes}м`
// Ищем частичное совпадение
const partial = countriesList.find(c =>
firstWord.toLowerCase().includes(c.label.toLowerCase()) ||
c.label.toLowerCase().includes(firstWord.toLowerCase())
)
return partial || null
}
// Загрузка данных
const fetchNodes = async () => {
loading.value = true
error.value = null
// Сортировка по пингу
const sortedHosts = computed(() => {
return [...hosts.value].sort((a, b) => {
if (a.ping === null && b.ping === null) return 0
if (a.ping === null) return 1
if (b.ping === null) return -1
return a.ping - b.ping
})
})
// Пинг одного хоста
const pingSingleHost = async (host) => {
if (host.pinging || !host.isOnline) return
host.pinging = true
host.ping = null
const result = await pingHost(host)
host.ping = result
host.pinging = false
}
// Пинг через fetch
const pingHost = async (host) => {
const url = `https://${host.address}:${host.port}`
const start = performance.now()
try {
const response = await fetch('/api/v1/nodes')
if (!response.ok) {
throw new Error(`Ошибка: ${response.status}`)
await fetch(url, {
method: 'HEAD',
mode: 'no-cors',
cache: 'no-cache',
signal: AbortSignal.timeout(5000),
})
return Math.round(performance.now() - start)
} catch {
return Math.round(performance.now() - start)
}
}
const data = await response.json()
// Пинг всех хостов
const pingAllHosts = async () => {
const pings = await Promise.all(
hosts.value.map(async (h) => {
if (!h.isOnline) return null
return await pingHost(h)
})
)
hosts.value.forEach((h, i) => {
if (h.isOnline) h.ping = pings[i]
})
}
// Добавляем поле isOnline и инициализируем пинг
nodes.value = data.map(node => ({
...node,
isOnline: true, // Все ноды из бэкенда считаем онлайн
ping: undefined,
pinging: false
}))
const fetchHosts = async () => {
try {
const res = await fetch('/api/v1/hosts')
if (!res.ok) throw new Error()
const data = await res.json()
} catch (err) {
console.error('Failed to load nodes:', err)
error.value = 'Не удалось загрузить статус серверов'
hosts.value = data.map((h) => {
const country = findCountryByFirstWord(h.name)
return {
...h,
countryCode: country?.code?.toLowerCase() || null,
isOnline: true,
ping: null,
pinging: false,
}
})
await pingAllHosts()
} catch {
error.value = 'Ошибка загрузки'
} finally {
loading.value = false
}
}
// Измерение пинга через WebSocket
const pingNode = async (node) => {
if (!node.isOnline || node.pinging) return
node.pinging = true
node.ping = undefined
const startTime = performance.now()
const wsUrl = `wss://${node.ip}:${node.port}`
try {
const ws = new WebSocket(wsUrl)
const timeout = setTimeout(() => {
ws.close()
node.ping = null
node.pinging = false
}, 5000)
ws.onopen = () => {
const endTime = performance.now()
clearTimeout(timeout)
node.ping = Math.round(endTime - startTime)
node.pinging = false
ws.close()
}
ws.onerror = () => {
clearTimeout(timeout)
node.ping = null
node.pinging = false
}
} catch {
node.ping = null
node.pinging = false
}
}
// Измерение пинга для всех нод
const pingAllNodes = async () => {
const pingPromises = nodes.value.map(node => pingNode(node))
await Promise.allSettled(pingPromises)
}
// Обновление данных
const refreshData = async () => {
await fetchNodes()
// После загрузки данных измеряем пинг для онлайн нод
await pingAllNodes()
loading.value = true
await fetchHosts()
loading.value = false
}
// Жизненный цикл
onMounted(() => {
refreshData()
// Автообновление каждые 30 секунд
updateInterval = setInterval(() => {
if (!loading.value) {
refreshData()
}
}, 30000)
})
onUnmounted(() => {
if (updateInterval) {
clearInterval(updateInterval)
}
fetchHosts()
interval = setInterval(refreshData, 30000)
})
onUnmounted(() => clearInterval(interval))
</script>
+1 -46
View File
@@ -1,5 +1,4 @@
<template>
<div>
<HeroSection />
<FeaturesSection />
<CompatibilitySection />
@@ -8,7 +7,6 @@
<StepsSection />
<TestimonialsSection />
<FaqSection />
</div>
</template>
<script setup>
@@ -16,56 +14,13 @@ import HeroSection from '../components/HeroSection.vue'
import FeaturesSection from '../components/FeaturesSection.vue'
import CompatibilitySection from '../components/CompatibilitySection.vue'
import PricingSection from '../components/PricingSection.vue'
import NodesStatus from '@/components/NodesStatus.vue'
import NodesStatus from '../components/NodesStatus.vue'
import StepsSection from '../components/StepsSection.vue'
import TestimonialsSection from '../components/TestimonialsSection.vue'
import FaqSection from '../components/FaqSection.vue'
// import { useHead } from '@vueuse/head';
import { useRoute } from 'vue-router';
const route = useRoute();
// useHead({
// title: route.meta.title,
// meta: [
// {
// name: 'description',
// content: route.meta.description
// },
// {
// name: 'keywords',
// content: route.meta.keywords
// },
// // Open Graph теги для соцсетей
// {
// property: 'og:title',
// content: route.meta.title
// },
// {
// property: 'og:description',
// content: route.meta.description
// },
// {
// property: 'og:type',
// content: 'website'
// },
// {
// property: 'og:url',
// content: window.location.href // Здесь можно также задать каноничный URL
// },
// {
// property: 'og:site_name',
// content: route.meta.title
// },
// {
// property: 'telegram:channel',
// content: '@uvpn_shop'
// },
// {
// property: 'tg:site_verification',
// content: 'g7j8/rPFXfhyrq5q0QQV7EsYWv4='
// },
// ]
// });
</script>