Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5c0a6614a | ||
|
|
acb11b43c7 | ||
|
|
b12c1a07c9 | ||
|
|
03fbbed39c | ||
|
|
0c825abad2 | ||
|
|
89ffe3c50e | ||
|
|
07229efac0 | ||
|
|
39023a66c2 | ||
|
|
20cd884718 |
@@ -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
|
||||||
Vendored
-3
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": ["Vue.volar"]
|
|
||||||
}
|
|
||||||
+2
-3
@@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "uvpn.shop",
|
"name": "uvpn.shop",
|
||||||
"version": "0.7.3",
|
"version": "0.8.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview"
|
||||||
"postbuild": "scp -r dist/* root@uvpn.shop:/opt/uvpn.shop/frontend"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lucide/vue": "^1.16.0",
|
"@lucide/vue": "^1.16.0",
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<FeaturesSection />
|
<FeaturesSection />
|
||||||
<CompatibilitySection />
|
<CompatibilitySection />
|
||||||
<PricingSection />
|
<PricingSection />
|
||||||
|
<NodesStatus />
|
||||||
<StepsSection />
|
<StepsSection />
|
||||||
<TestimonialsSection />
|
<TestimonialsSection />
|
||||||
<FaqSection />
|
<FaqSection />
|
||||||
@@ -15,6 +16,7 @@ import HeroSection from '../components/HeroSection.vue'
|
|||||||
import FeaturesSection from '../components/FeaturesSection.vue'
|
import FeaturesSection from '../components/FeaturesSection.vue'
|
||||||
import CompatibilitySection from '../components/CompatibilitySection.vue'
|
import CompatibilitySection from '../components/CompatibilitySection.vue'
|
||||||
import PricingSection from '../components/PricingSection.vue'
|
import PricingSection from '../components/PricingSection.vue'
|
||||||
|
import NodesStatus from '../components/NodesStatus.vue'
|
||||||
import StepsSection from '../components/StepsSection.vue'
|
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'
|
||||||
|
|||||||
Reference in New Issue
Block a user