12 Commits
Author SHA1 Message Date
austnv 4a0ce08338 fix: header & button
Build and Deploy Frontend via SSH / deploy (push) Successful in 43s
2026-06-21 23:16:28 +03:00
austnv 43749647ca fix: bugs in flags & autoping
Build and Deploy Frontend via SSH / deploy (push) Successful in 43s
2026-06-21 23:03:50 +03:00
austnv 3dbacb4359 feat: minify component NodesStatus
Build and Deploy Frontend via SSH / deploy (push) Successful in 44s
2026-06-21 22:50:30 +03:00
austnv d8e20754c7 dix: release author 2026-06-21 22:44:14 +03:00
austnv 4e6e0d4d48 fix deploy
Build and Deploy Frontend via SSH / deploy (push) Successful in 47s
2026-06-21 22:39:42 +03:00
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
4 changed files with 228 additions and 108 deletions
+43
View File
@@ -24,6 +24,49 @@ jobs:
- name: Build project - name: Build project
run: npm run build run: npm run build
- name: Create Gitea Release via API
run: |
# Получаем описание из тега (если есть)
TAG_MESSAGE=$(git tag -l --format='%(contents)' "${{ gitea.ref_name }}" 2>/dev/null || echo "Автоматический релиз через CI/CD")
# Экранируем кавычки и переносы для JSON
TAG_MESSAGE_ESCAPED=$(echo "$TAG_MESSAGE" | sed 's/"/\\"/g' | awk '{printf "%s\\n", $0}')
# Формируем JSON
JSON_PAYLOAD=$(cat <<EOF
{
"tag_name": "${{ gitea.ref_name }}",
"name": "Release ${{ gitea.ref_name }}",
"body": "## Релиз ${{ gitea.ref_name }}\n\n📝 ${TAG_MESSAGE_ESCAPED}\n\n---\n\n**🏷️ Тег:** \`${{ gitea.ref_name }}\`\n**👤 Автор:** @${{ gitea.actor }}\n\n✅ Автоматически собрано и развёрнуто",
"draft": false,
"prerelease": false
}
EOF
)
# Отправляем запрос
RESPONSE=$(curl -s -w "\n%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
"https://git.uvpn.shop/api/v1/repos/${{ gitea.repository }}/releases")
# Проверяем ответ
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
if [ "$HTTP_CODE" -eq 201 ]; then
echo "✅ Релиз успешно создан!"
echo "$BODY" | jq '.'
elif [ "$HTTP_CODE" -eq 409 ]; then
echo "⚠️ Релиз с таким тегом уже существует, пропускаем"
else
echo "❌ Ошибка создания релиза (HTTP $HTTP_CODE)"
echo "$BODY"
exit 1
fi
- name: Install SSH key - name: Install SSH key
uses: webfactory/ssh-agent@v0.9.0 uses: webfactory/ssh-agent@v0.9.0
with: with:
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "uvpn.shop", "name": "frontend",
"version": "0.8.1", "version": "0.9.6",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
+178 -56
View File
@@ -1,45 +1,69 @@
<template> <template>
<section class="px-6 py-12 max-w-7xl mx-auto"> <section class="px-6 py-20 md:px-12 max-w-7xl mx-auto">
<h2 class="text-2xl font-bold mb-6">🌍 Статус серверов</h2> <div class="mb-14">
<h2 class="text-3xl md:text-4xl font-bold text-center">
<div v-if="loading" class="flex justify-center py-8"> Статус серверов
<div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"></div> </h2>
</div> <div class="flex justify-center mt-6">
<button
<p v-else-if="error" class="text-red-500">{{ error }}</p> @click="refreshData"
:disabled="loading"
<div v-else class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3"> class="px-5 py-2.5 bg-blue-600 hover:bg-blue-700 text-white rounded-xl text-sm font-medium transition disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 cursor-pointer"
<div
v-for="node in nodes"
:key="node.name"
class="bg-white dark:bg-gray-900 rounded-lg p-3 border text-sm"
:class="node.isOnline ? 'border-green-400' : 'border-red-400 opacity-60'"
> >
<div class="flex items-center gap-1.5 mb-1"> <RefreshCw :size="16" :class="{ 'animate-spin': loading }" />
{{ loading ? 'Обновление...' : 'Обновить пинг' }}
</button>
</div>
</div>
<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>
<p v-else-if="error" class="text-center text-red-500 py-12">{{ error }}</p>
<div v-else class="space-y-2 max-w-3xl mx-auto">
<div
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-center gap-3">
<img <img
v-if="node.country_code.toLowerCase()" v-if="host.countryCode"
:src="`https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/flags/4x3/${node.country_code.toLowerCase()}.svg`" :src="`https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/flags/4x3/${host.countryCode}.svg`"
class="h-3.5 w-auto" class="h-5 w-auto rounded-sm"
/> />
<span class="font-semibold text-gray-800 dark:text-white">{{ node.name }}</span> <span class="font-semibold text-gray-800 dark:text-white">{{ host.name }}</span>
<span class="ml-auto text-[10px] px-1.5 py-0.5 rounded-full font-medium"
:class="node.isOnline ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'"> <!-- Индикатор состояния (вместо online/offline) -->
{{ node.isOnline ? 'online' : 'offline' }} <span class="relative flex h-3 w-3">
<span
class="animate-ping absolute inline-flex h-full w-full rounded-full opacity-75"
:class="host.isOnline ? 'bg-green-500' : 'bg-red-500'"
></span>
<span
class="relative inline-flex rounded-full h-3 w-3"
:class="host.isOnline ? 'bg-green-600' : 'bg-red-600'"
></span>
</span> </span>
</div> </div>
<div class="flex justify-between text-gray-500 dark:text-gray-400 text-xs">
<span>👤 {{ node.users_online }}</span> <div class="flex items-center gap-3">
<span> {{ formatUptime(node.uptime) }}</span> <span
<span v-if="node.ping !== undefined && node.ping !== null" class="font-mono font-semibold" v-if="host.ping !== undefined && host.ping !== null"
class="font-mono font-semibold flex items-center gap-1.5"
:class="{ :class="{
'text-green-600': node.ping < 50, 'text-green-600': host.ping < 200,
'text-yellow-600': node.ping >= 50 && node.ping < 150, 'text-yellow-600': host.ping >= 200 && host.ping < 500,
'text-orange-600': node.ping >= 150 && node.ping < 300, 'text-red-600': host.ping >= 500,
'text-red-600': node.ping >= 300 }"
}"> >
{{ node.ping }}ms <Wifi :size="14" />
{{ host.ping }}ms
</span> </span>
<span v-else class="text-gray-300"></span> <span v-else class="text-gray-300 font-mono"></span>
</div> </div>
</div> </div>
</div> </div>
@@ -47,35 +71,101 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onUnmounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { Wifi, RefreshCw } from '@lucide/vue'
import { getAllCountries } from '@tw-labs/countries'
const nodes = ref([]) const hosts = ref([])
const loading = ref(true) const loading = ref(true)
const error = ref(null) const error = ref(null)
let interval = null
const formatUptime = (s) => { const countriesList = getAllCountries()
if (!s) return '0м'
const d = Math.floor(s/86400), h = Math.floor((s%86400)/3600), m = Math.floor((s%3600)/60) // Ручной маппинг для проблемных стран
return d>0 ? `${d}д ${h}ч` : h>0 ? `${h}ч ${m}м` : `${m}м` const countryOverrides = {
'United States': 'us',
'USA': 'us',
'U.S.A.': 'us',
'America': 'us',
'United Arab Emirates': 'ae',
'UAE': 'ae',
} }
const pingNode = (node) => new Promise(resolve => { const findCountryByFirstWord = (name) => {
const start = performance.now() if (!name) return null
const ws = new WebSocket(`wss://${node.ip}:${node.port}`)
const timer = setTimeout(() => { ws.close(); resolve(null) }, 3000) // 1. Проверяем ручные override
ws.onopen = () => { clearTimeout(timer); resolve(Math.round(performance.now()-start)); ws.close() } const override = countryOverrides[name]
ws.onerror = () => { clearTimeout(timer); resolve(null) } if (override) {
return { code: override.toUpperCase() }
}
// 2. Ищем по первому слову
const firstWord = name.split(' ')[0]
if (!firstWord) return null
// Точное совпадение
const exact = countriesList.find(c =>
c.label.toLowerCase() === firstWord.toLowerCase()
)
if (exact) return exact
// Частичное совпадение
const partial = countriesList.find(c =>
firstWord.toLowerCase().includes(c.label.toLowerCase()) ||
c.label.toLowerCase().includes(firstWord.toLowerCase())
)
if (partial) return partial
// 3. Пробуем найти по полному имени
const fullMatch = countriesList.find(c =>
name.toLowerCase().includes(c.label.toLowerCase()) ||
c.label.toLowerCase().includes(name.toLowerCase())
)
return fullMatch || 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 fetchNodes = async () => { const pingHost = async (host) => {
const url = `https://${host.address}:${host.port}`
const start = performance.now()
try { try {
const res = await fetch('/api/v1/nodes') 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 fetchHosts = async () => {
try {
const res = await fetch('/api/v1/hosts')
if (!res.ok) throw new Error() if (!res.ok) throw new Error()
const data = await res.json() const data = await res.json()
nodes.value = data.map(n => ({ ...n, isOnline: true, ping: null }))
const pings = await Promise.all(nodes.value.map(n => pingNode(n))) hosts.value = data.map((h) => {
nodes.value.forEach((n, i) => n.ping = pings[i]) const country = findCountryByFirstWord(h.name)
return {
...h,
countryCode: country?.code?.toLowerCase() || null,
isOnline: true,
ping: null,
}
})
} catch { } catch {
error.value = 'Ошибка загрузки' error.value = 'Ошибка загрузки'
} finally { } finally {
@@ -83,9 +173,41 @@ const fetchNodes = async () => {
} }
} }
onMounted(() => { const refreshData = async () => {
fetchNodes() loading.value = true
interval = setInterval(fetchNodes, 30000) error.value = null
try {
const res = await fetch('/api/v1/hosts')
if (!res.ok) throw new Error()
const data = await res.json()
hosts.value = data.map((h) => {
const country = findCountryByFirstWord(h.name)
return {
...h,
countryCode: country?.code?.toLowerCase() || null,
isOnline: true,
ping: null,
}
})
const pings = await Promise.all(hosts.value.map(h => pingHost(h)))
hosts.value.forEach((h, i) => {
if (h.isOnline) h.ping = pings[i]
})
} catch {
error.value = 'Ошибка обновления'
} finally {
loading.value = false
}
}
// При первом открытии — загружаем и пингуем
onMounted(async () => {
await fetchHosts()
// Автоматический пинг только при первом открытии
await refreshData()
}) })
onUnmounted(() => clearInterval(interval))
</script> </script>
-45
View File
@@ -1,5 +1,4 @@
<template> <template>
<div>
<HeroSection /> <HeroSection />
<FeaturesSection /> <FeaturesSection />
<CompatibilitySection /> <CompatibilitySection />
@@ -8,7 +7,6 @@
<StepsSection /> <StepsSection />
<TestimonialsSection /> <TestimonialsSection />
<FaqSection /> <FaqSection />
</div>
</template> </template>
<script setup> <script setup>
@@ -21,51 +19,8 @@ import StepsSection from '../components/StepsSection.vue'
import TestimonialsSection from '../components/TestimonialsSection.vue' import TestimonialsSection from '../components/TestimonialsSection.vue'
import FaqSection from '../components/FaqSection.vue' import FaqSection from '../components/FaqSection.vue'
// import { useHead } from '@vueuse/head';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
const route = useRoute(); 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> </script>