mirror of
https://github.com/databasus/databasus.git
synced 2026-04-06 00:32:03 +02:00
FIX (build): Fix building in SSR view
This commit is contained in:
5
app/blog/page.tsx
Normal file
5
app/blog/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function BlogRedirect() {
|
||||
redirect("/gone");
|
||||
}
|
||||
5
app/cloudflare-r2-storage/page.tsx
Normal file
5
app/cloudflare-r2-storage/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function CloudflareR2StorageRedirect() {
|
||||
redirect("/storages/cloudflare-r2");
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export async function GET() {
|
||||
return new NextResponse(
|
||||
`<!DOCTYPE html>
|
||||
|
||||
5
app/google-drive-storage/page.tsx
Normal file
5
app/google-drive-storage/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function GoogleDriveStorageRedirect() {
|
||||
redirect("/storages/google-drive");
|
||||
}
|
||||
5
app/notifier-slack/page.tsx
Normal file
5
app/notifier-slack/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function NotifierSlackRedirect() {
|
||||
redirect("/notifiers/slack");
|
||||
}
|
||||
5
app/notifier-teams/page.tsx
Normal file
5
app/notifier-teams/page.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function NotifierTeamsRedirect() {
|
||||
redirect("/notifiers/teams");
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import { MetadataRoute } from "next";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return {
|
||||
rules: {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { MetadataRoute } from "next";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = "https://postgresus.com";
|
||||
const currentDate = new Date().toISOString();
|
||||
|
||||
49
app/storages/google-oauth/OAuthProcessor.tsx
Normal file
49
app/storages/google-oauth/OAuthProcessor.tsx
Normal file
@@ -0,0 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function OAuthProcessor() {
|
||||
useEffect(() => {
|
||||
// Get current URL parameters
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
// Extract state and code from current URL
|
||||
const state = urlParams.get("state");
|
||||
const code = urlParams.get("code");
|
||||
|
||||
if (state && code) {
|
||||
try {
|
||||
// Parse the StorageOauthDto from the state parameter
|
||||
const oauthDto = JSON.parse(decodeURIComponent(state));
|
||||
|
||||
// Update the authCode field with the received code
|
||||
oauthDto.authCode = code;
|
||||
|
||||
// Construct the redirect URL with the updated DTO
|
||||
const redirectUrl = `${
|
||||
oauthDto.redirectUrl
|
||||
}?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`;
|
||||
|
||||
// Redirect to the constructed URL
|
||||
window.location.href = redirectUrl;
|
||||
} catch (error) {
|
||||
console.error("Error parsing state parameter:", error);
|
||||
}
|
||||
} else {
|
||||
console.error("Missing state or code parameter");
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
textAlign: "center",
|
||||
padding: "50px",
|
||||
fontFamily: "Arial, sans-serif",
|
||||
}}
|
||||
>
|
||||
<h2>Processing OAuth...</h2>
|
||||
<p>Please wait while we redirect you back to the application.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,49 +1,10 @@
|
||||
"use client";
|
||||
import type { Metadata } from "next";
|
||||
import OAuthProcessor from "./OAuthProcessor";
|
||||
|
||||
import { useEffect } from "react";
|
||||
export const metadata: Metadata = {
|
||||
robots: "noindex, nofollow",
|
||||
};
|
||||
|
||||
export default function GoogleOAuthPage() {
|
||||
useEffect(() => {
|
||||
// Get current URL parameters
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
// Extract state and code from current URL
|
||||
const state = urlParams.get("state");
|
||||
const code = urlParams.get("code");
|
||||
|
||||
if (state && code) {
|
||||
try {
|
||||
// Parse the StorageOauthDto from the state parameter
|
||||
const oauthDto = JSON.parse(decodeURIComponent(state));
|
||||
|
||||
// Update the authCode field with the received code
|
||||
oauthDto.authCode = code;
|
||||
|
||||
// Construct the redirect URL with the updated DTO
|
||||
const redirectUrl = `${
|
||||
oauthDto.redirectUrl
|
||||
}?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`;
|
||||
|
||||
// Redirect to the constructed URL
|
||||
window.location.href = redirectUrl;
|
||||
} catch (error) {
|
||||
console.error("Error parsing state parameter:", error);
|
||||
}
|
||||
} else {
|
||||
console.error("Missing state or code parameter");
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
textAlign: "center",
|
||||
padding: "50px",
|
||||
fontFamily: "Arial, sans-serif",
|
||||
}}
|
||||
>
|
||||
<h2>Processing OAuth...</h2>
|
||||
<p>Please wait while we redirect you back to the application.</p>
|
||||
</div>
|
||||
);
|
||||
return <OAuthProcessor />;
|
||||
}
|
||||
|
||||
@@ -6,38 +6,6 @@ const nextConfig: NextConfig = {
|
||||
images: {
|
||||
unoptimized: true, // Required for static export
|
||||
},
|
||||
async redirects() {
|
||||
return [
|
||||
// Old storage URLs to new structure
|
||||
{
|
||||
source: "/cloudflare-r2-storage",
|
||||
destination: "/storages/cloudflare-r2",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/google-drive-storage",
|
||||
destination: "/storages/google-drive",
|
||||
permanent: true,
|
||||
},
|
||||
// Old notifier URLs to new structure
|
||||
{
|
||||
source: "/notifier-slack",
|
||||
destination: "/notifiers/slack",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/notifier-teams",
|
||||
destination: "/notifiers/teams",
|
||||
permanent: true,
|
||||
},
|
||||
// Blog removed permanently
|
||||
{
|
||||
source: "/blog",
|
||||
destination: "/gone",
|
||||
permanent: true,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
Reference in New Issue
Block a user