9 Commits
Author SHA1 Message Date
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
austnv 07229efac0 add NodesStatus.vue & v0.8.0
Build and Deploy Frontend via SSH / deploy (push) Failing after 35s
2026-06-21 17:02:02 +03:00
austnv 39023a66c2 add workflow 2026-06-21 16:33:44 +03:00
austnv 20cd884718 Delete directory '.vscode' 2026-06-21 15:57:35 +03:00
5 changed files with 136 additions and 6 deletions
+41
View File
@@ -0,0 +1,41 @@
name: Build and Deploy Frontend via SSH
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- 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 -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/*
tar -xzf /tmp/frontend.tar.gz -C /opt/uvpn.shop/frontend
rm /tmp/frontend.tar.gz
EOF
-3
View File
@@ -1,3 +0,0 @@
{
"recommendations": ["Vue.volar"]
}
+2 -3
View File
@@ -1,13 +1,12 @@
{
"name": "uvpn.shop",
"version": "0.7.3",
"version": "0.8.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"postbuild": "scp -r dist/* root@uvpn.shop:/opt/uvpn.shop/frontend"
"preview": "vite preview"
},
"dependencies": {
"@lucide/vue": "^1.16.0",
+91
View File
@@ -0,0 +1,91 @@
<template>
<section class="px-6 py-12 max-w-7xl mx-auto">
<h2 class="text-2xl font-bold mb-6">🌍 Статус серверов</h2>
<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>
</div>
<p v-else-if="error" class="text-red-500">{{ error }}</p>
<div v-else class="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3">
<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">
<img
v-if="node.country_code.toLowerCase()"
:src="`https://cdn.jsdelivr.net/npm/flag-icons@7.2.3/flags/4x3/${node.country_code.toLowerCase()}.svg`"
class="h-3.5 w-auto"
/>
<span class="font-semibold text-gray-800 dark:text-white">{{ node.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'">
{{ node.isOnline ? 'online' : 'offline' }}
</span>
</div>
<div class="flex justify-between text-gray-500 dark:text-gray-400 text-xs">
<span>👤 {{ node.users_online }}</span>
<span> {{ formatUptime(node.uptime) }}</span>
<span v-if="node.ping !== undefined && node.ping !== null" class="font-mono font-semibold"
:class="{
'text-green-600': node.ping < 50,
'text-yellow-600': node.ping >= 50 && node.ping < 150,
'text-orange-600': node.ping >= 150 && node.ping < 300,
'text-red-600': node.ping >= 300
}">
{{ node.ping }}ms
</span>
<span v-else class="text-gray-300"></span>
</div>
</div>
</div>
</section>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
const nodes = ref([])
const loading = ref(true)
const error = ref(null)
let interval = null
const formatUptime = (s) => {
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 pingNode = (node) => new Promise(resolve => {
const start = performance.now()
const ws = new WebSocket(`wss://${node.ip}:${node.port}`)
const timer = setTimeout(() => { ws.close(); resolve(null) }, 3000)
ws.onopen = () => { clearTimeout(timer); resolve(Math.round(performance.now()-start)); ws.close() }
ws.onerror = () => { clearTimeout(timer); resolve(null) }
})
const fetchNodes = async () => {
try {
const res = await fetch('/api/v1/nodes')
if (!res.ok) throw new Error()
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)))
nodes.value.forEach((n, i) => n.ping = pings[i])
} catch {
error.value = 'Ошибка загрузки'
} finally {
loading.value = false
}
}
onMounted(() => {
fetchNodes()
interval = setInterval(fetchNodes, 30000)
})
onUnmounted(() => clearInterval(interval))
</script>
+2
View File
@@ -4,6 +4,7 @@
<FeaturesSection />
<CompatibilitySection />
<PricingSection />
<NodesStatus />
<StepsSection />
<TestimonialsSection />
<FaqSection />
@@ -15,6 +16,7 @@ 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 StepsSection from '../components/StepsSection.vue'
import TestimonialsSection from '../components/TestimonialsSection.vue'
import FaqSection from '../components/FaqSection.vue'