mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-08-25 09:47:59 +00:00
Refactor database schema and storage to support customer management and improved security.
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/71d83b03-af3d-433a-a517-e76255668e93.jpg
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import type { Express } from "express";
|
||||
import { createServer, type Server } from "http";
|
||||
import { getCurrentIpAddress, getCurrentIpv6Address } from "./utils/ip-utils";
|
||||
|
||||
export async function registerRoutes(app: Express): Promise<Server> {
|
||||
// Create HTTP server
|
||||
const httpServer = createServer(app);
|
||||
|
||||
// Add public IP endpoint for the frontend
|
||||
app.get('/api/public-ip', async (req, res) => {
|
||||
try {
|
||||
console.log('Fetching public IP addresses');
|
||||
// Get IPv4 address using our utility function
|
||||
const ipv4 = await getCurrentIpAddress();
|
||||
console.log(`Resolved IPv4: ${ipv4}`);
|
||||
|
||||
// Try to get IPv6 as well
|
||||
const ipv6 = await getCurrentIpv6Address();
|
||||
console.log(`Resolved IPv6: ${ipv6}`);
|
||||
|
||||
res.json({ ipv4, ipv6 });
|
||||
} catch (error) {
|
||||
console.error('Error getting public IP:', error);
|
||||
res.status(500).json({ error: 'Failed to get public IP address' });
|
||||
}
|
||||
});
|
||||
|
||||
return httpServer;
|
||||
}
|
||||
Reference in New Issue
Block a user