Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a38b3f7fa | ||
|
|
b69cc4bc4b | ||
|
|
4b7b2bc5c6 | ||
|
|
f6af141f56 | ||
|
|
c5c0a6614a | ||
|
|
acb11b43c7 | ||
|
|
b12c1a07c9 | ||
|
|
03fbbed39c | ||
|
|
0c825abad2 | ||
|
|
89ffe3c50e | ||
|
|
07229efac0 | ||
|
|
39023a66c2 | ||
|
|
20cd884718 | ||
|
|
1e4882379a |
@@ -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"]
|
|
||||||
}
|
|
||||||
+3
-4
@@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "uvpn.shop",
|
"name": "frontend",
|
||||||
"version": "0.7.2",
|
"version": "0.9.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",
|
||||||
|
|||||||
@@ -22,11 +22,7 @@
|
|||||||
Попробовать бесплатно
|
Попробовать бесплатно
|
||||||
</a>
|
</a>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<IpSecurity />
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import IpSecurity from './IpSecurity.vue';
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
|
<IpSecurity />
|
||||||
|
|
||||||
<section id="hero" class="relative overflow-hidden px-6 py-16 md:py-24 md:px-12">
|
<section id="hero" class="relative overflow-hidden px-6 py-16 md:py-24 md:px-12">
|
||||||
<!-- Контейнер для параллакс-фона -->
|
<!-- Контейнер для параллакс-фона -->
|
||||||
<div class="parallax-bg absolute inset-0 z-0"></div>
|
<div class="parallax-bg absolute inset-0 z-0"></div>
|
||||||
@@ -38,6 +41,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { Zap } from '@lucide/vue'
|
import { Zap } from '@lucide/vue'
|
||||||
import Hero3D from './Hero3D.vue'
|
import Hero3D from './Hero3D.vue'
|
||||||
|
import IpSecurity from './IpSecurity.vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
<template>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<div class="flex justify-end mb-4">
|
||||||
|
<button
|
||||||
|
@click="refreshData"
|
||||||
|
:disabled="loading"
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
<RefreshCw :size="16" :class="{ 'animate-spin': loading }" />
|
||||||
|
{{ loading ? 'Обновление...' : 'Обновить все' }}
|
||||||
|
</button>
|
||||||
|
</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
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
<span class="font-semibold text-gray-800 dark:text-white">{{ host.name }}</span>
|
||||||
|
<span
|
||||||
|
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'"
|
||||||
|
>
|
||||||
|
{{ host.isOnline ? 'online' : 'offline' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<!-- Пинг -->
|
||||||
|
<span
|
||||||
|
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': host.ping < 200,
|
||||||
|
'text-yellow-600': host.ping >= 200 && host.ping < 500,
|
||||||
|
'text-red-600': host.ping >= 500,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<Wifi :size="14" />
|
||||||
|
{{ host.ping }}ms
|
||||||
|
</span>
|
||||||
|
<span v-else class="text-gray-300 min-w-[60px] text-right">—</span>
|
||||||
|
|
||||||
|
<!-- Кнопка пинга -->
|
||||||
|
<button
|
||||||
|
@click="pingSingleHost(host)"
|
||||||
|
:disabled="host.pinging"
|
||||||
|
class="text-xs px-3 py-1 rounded-lg transition font-medium"
|
||||||
|
:class="[
|
||||||
|
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'
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{ host.pinging ? '⏳' : 'Пинг' }}
|
||||||
|
</button>
|
||||||
|
</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 hosts = ref([])
|
||||||
|
const loading = ref(true)
|
||||||
|
const error = ref(null)
|
||||||
|
let interval = null
|
||||||
|
|
||||||
|
const countriesList = getAllCountries()
|
||||||
|
|
||||||
|
const findCountryByName = (countryName) => {
|
||||||
|
if (!countryName) return null
|
||||||
|
const found = countriesList.find(c => c.label.toLowerCase() === countryName.toLowerCase())
|
||||||
|
if (found) return found
|
||||||
|
const partial = countriesList.find(c =>
|
||||||
|
countryName.toLowerCase().includes(c.label.toLowerCase()) ||
|
||||||
|
c.label.toLowerCase().includes(countryName.toLowerCase())
|
||||||
|
)
|
||||||
|
return partial || null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Сортировка по пингу (меньше -> выше)
|
||||||
|
const sortedHosts = computed(() => {
|
||||||
|
return [...hosts.value].sort((a, b) => {
|
||||||
|
// Если пинг null -> в конец
|
||||||
|
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 {
|
||||||
|
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 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]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchHosts = async () => {
|
||||||
|
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 = findCountryByName(h.name)
|
||||||
|
return {
|
||||||
|
...h,
|
||||||
|
countryCode: country?.code?.toLowerCase() || null,
|
||||||
|
isOnline: true,
|
||||||
|
ping: null,
|
||||||
|
pinging: false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
await pingAllHosts()
|
||||||
|
} catch {
|
||||||
|
error.value = 'Ошибка загрузки'
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const refreshData = async () => {
|
||||||
|
loading.value = true
|
||||||
|
await fetchHosts()
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchHosts()
|
||||||
|
interval = setInterval(refreshData, 30000)
|
||||||
|
})
|
||||||
|
onUnmounted(() => clearInterval(interval))
|
||||||
|
</script>s
|
||||||
+2
-45
@@ -1,13 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
|
||||||
<HeroSection />
|
<HeroSection />
|
||||||
<FeaturesSection />
|
<FeaturesSection />
|
||||||
<CompatibilitySection />
|
<CompatibilitySection />
|
||||||
<PricingSection />
|
<PricingSection />
|
||||||
|
<NodesStatus />
|
||||||
<StepsSection />
|
<StepsSection />
|
||||||
<TestimonialsSection />
|
<TestimonialsSection />
|
||||||
<FaqSection />
|
<FaqSection />
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -15,55 +14,13 @@ 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'
|
||||||
|
|
||||||
// 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>
|
||||||
|
|||||||
Reference in New Issue
Block a user