initial commit

Signed-off-by: ale <ale@manalejandro.com>
Este commit está contenido en:
ale
2025-10-24 16:28:53 +02:00
padre 0a41e47b03
commit e0f561de09
Se han modificado 23 ficheros con 2874 adiciones y 6624 borrados

30
app/api/config/route.js Archivo normal
Ver fichero

@@ -0,0 +1,30 @@
import { NextResponse } from 'next/server';
import ovhService from '@/lib/ovh-service';
export async function GET() {
try {
const config = ovhService.getConfig();
return NextResponse.json({ success: true, config });
} catch (error) {
console.error('Error fetching config:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}
export async function POST(request) {
try {
const newConfig = await request.json();
ovhService.saveConfig(newConfig);
return NextResponse.json({ success: true });
} catch (error) {
console.error('Error saving config:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

24
app/api/dns/refresh/route.js Archivo normal
Ver fichero

@@ -0,0 +1,24 @@
import { NextResponse } from 'next/server';
import ovhService from '@/lib/ovh-service';
export async function POST(request) {
try {
const { domain } = await request.json();
if (!domain) {
return NextResponse.json(
{ success: false, error: 'Domain is required' },
{ status: 400 }
);
}
await ovhService.refreshZone(domain);
return NextResponse.json({ success: true });
} catch (error) {
console.error('Error refreshing DNS zone:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

Ver fichero

@@ -0,0 +1,30 @@
import { NextResponse } from 'next/server';
import ovhService from '@/lib/ovh-service';
export async function POST(request) {
try {
const { domain, recordIds, fieldType, target, ttl } = await request.json();
if (!domain || !recordIds || recordIds.length === 0) {
return NextResponse.json(
{ success: false, error: 'Domain and record IDs are required' },
{ status: 400 }
);
}
const updateData = {};
if (fieldType) updateData.fieldType = fieldType;
if (target !== undefined) updateData.target = target;
if (ttl) updateData.ttl = ttl;
const results = await ovhService.bulkUpdateRecords(domain, recordIds, updateData);
return NextResponse.json({ success: true, results });
} catch (error) {
console.error('Error bulk updating DNS records:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

Ver fichero

@@ -0,0 +1,72 @@
import { NextResponse } from 'next/server';
import ovhService from '@/lib/ovh-service';
export async function GET(request, { params }) {
try {
const { domain } = await params;
const records = await ovhService.getDNSRecords(domain);
return NextResponse.json({ success: true, records });
} catch (error) {
console.error('Error fetching DNS records:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}
export async function POST(request, { params }) {
try {
const { domain } = await params;
const recordData = await request.json();
const record = await ovhService.createDNSRecord(domain, recordData);
return NextResponse.json({ success: true, record });
} catch (error) {
console.error('Error creating DNS record:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}
export async function PUT(request, { params }) {
try {
const { domain } = await params;
const { id, ...recordData } = await request.json();
const record = await ovhService.updateDNSRecord(domain, id, recordData);
return NextResponse.json({ success: true, record });
} catch (error) {
console.error('Error updating DNS record:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}
export async function DELETE(request, { params }) {
try {
const { domain } = await params;
const { searchParams } = new URL(request.url);
const recordId = searchParams.get('recordId');
if (!recordId) {
return NextResponse.json(
{ success: false, error: 'Record ID is required' },
{ status: 400 }
);
}
await ovhService.deleteDNSRecord(domain, recordId);
return NextResponse.json({ success: true });
} catch (error) {
console.error('Error deleting DNS record:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

15
app/api/domains/route.js Archivo normal
Ver fichero

@@ -0,0 +1,15 @@
import { NextResponse } from 'next/server';
import ovhService from '@/lib/ovh-service';
export async function GET() {
try {
const domains = await ovhService.getAllDomains();
return NextResponse.json({ success: true, domains });
} catch (error) {
console.error('Error fetching domains:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

28
app/api/ip/current/route.js Archivo normal
Ver fichero

@@ -0,0 +1,28 @@
import { NextResponse } from 'next/server';
import ipMonitorService from '@/lib/ip-monitor-service';
export async function GET() {
try {
const ips = await ipMonitorService.getCurrentIPs();
return NextResponse.json({ success: true, ips });
} catch (error) {
console.error('Error fetching current IPs:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}
export async function POST() {
try {
const result = await ipMonitorService.checkAndUpdateIPs();
return NextResponse.json({ success: true, ...result });
} catch (error) {
console.error('Error checking IPs:', error);
return NextResponse.json(
{ success: false, error: error.message },
{ status: 500 }
);
}
}

Ver fichero

@@ -22,5 +22,84 @@
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
font-family: var(--font-sans), system-ui, -apple-system, sans-serif;
}
/* Custom scrollbar styles */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Smooth transitions for all interactive elements */
button, a, input, select, textarea {
transition: all 0.2s ease-in-out;
}
/* Enhanced focus styles */
input:focus, select:focus, textarea:focus {
outline: none;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* Animation keyframes */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideIn {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
/* Apply fade-in animation to main content */
main > div {
animation: fadeIn 0.3s ease-in-out;
}
/* Custom gradient backgrounds */
.gradient-bg-1 {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.gradient-bg-2 {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.gradient-bg-3 {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

Ver fichero

@@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "OVH DNS Manager - Multi-Account DNS Management",
description: "Modern DNS manager for multiple OVH accounts with automatic IP updates",
};
export default function RootLayout({
@@ -23,7 +23,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="es">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>

Ver fichero

@@ -1,65 +1,73 @@
import Image from "next/image";
'use client';
import { useState } from 'react';
import DNSManager from '@/components/DNSManager';
import Settings from '@/components/Settings';
import { Globe, Settings as SettingsIcon } from 'lucide-react';
export default function Home() {
const [activeTab, setActiveTab] = useState<'dns' | 'settings'>('dns');
return (
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
<Image
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
To get started, edit the page.tsx file.
</h1>
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Learning
</a>{" "}
center.
</p>
<div className="min-h-screen bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50">
{/* Header */}
<header className="bg-white shadow-lg border-b border-gray-200">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<div className="flex items-center justify-between">
<div className="flex items-center">
<div className="bg-gradient-to-br from-blue-600 to-purple-600 p-3 rounded-xl mr-4 shadow-lg">
<Globe className="h-10 w-10 text-white" />
</div>
<div>
<h1 className="text-3xl font-bold text-gray-900">OVH DNS Manager</h1>
<p className="text-sm text-gray-500 mt-1">Multi-account management with automatic updates</p>
</div>
</div>
<div className="flex items-center space-x-2 bg-gray-100 rounded-xl p-1">
<button
onClick={() => setActiveTab('dns')}
className={`flex items-center px-6 py-3 rounded-lg font-medium transition-all ${
activeTab === 'dns'
? 'bg-white text-blue-600 shadow-md'
: 'text-gray-600 hover:text-gray-900'
}`}
>
<Globe className="h-5 w-5 mr-2" />
DNS Manager
</button>
<button
onClick={() => setActiveTab('settings')}
className={`flex items-center px-6 py-3 rounded-lg font-medium transition-all ${
activeTab === 'settings'
? 'bg-white text-purple-600 shadow-md'
: 'text-gray-600 hover:text-gray-900'
}`}
>
<SettingsIcon className="h-5 w-5 mr-2" />
Configuración
</button>
</div>
</div>
</div>
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
<a
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={16}
/>
Deploy Now
</a>
<a
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</header>
{/* Main Content */}
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="transition-all duration-300">
{activeTab === 'dns' && <DNSManager />}
{activeTab === 'settings' && <Settings />}
</div>
</main>
{/* Footer */}
<footer className="bg-white border-t border-gray-200 mt-12">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<div className="text-center text-sm text-gray-500">
<p>OVH DNS Manager - Gestor moderno de DNS con soporte multi-cuenta</p>
<p className="mt-1">© {new Date().getFullYear()} - Todos los derechos reservados</p>
</div>
</div>
</footer>
</div>
);
}