Skip to content

Commit ac77912

Browse files
FIX (build): Fix building in SSR view
1 parent 0a3bb68 commit ac77912

File tree

11 files changed

+86
-77
lines changed

11 files changed

+86
-77
lines changed

app/blog/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from "next/navigation";
2+
3+
export default function BlogRedirect() {
4+
redirect("/gone");
5+
}

app/cloudflare-r2-storage/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from "next/navigation";
2+
3+
export default function CloudflareR2StorageRedirect() {
4+
redirect("/storages/cloudflare-r2");
5+
}

app/gone/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { NextResponse } from "next/server";
22

3+
export const dynamic = "force-static";
4+
35
export async function GET() {
46
return new NextResponse(
57
`<!DOCTYPE html>

app/google-drive-storage/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from "next/navigation";
2+
3+
export default function GoogleDriveStorageRedirect() {
4+
redirect("/storages/google-drive");
5+
}

app/notifier-slack/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from "next/navigation";
2+
3+
export default function NotifierSlackRedirect() {
4+
redirect("/notifiers/slack");
5+
}

app/notifier-teams/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from "next/navigation";
2+
3+
export default function NotifierTeamsRedirect() {
4+
redirect("/notifiers/teams");
5+
}

app/robots.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { MetadataRoute } from "next";
22

3+
export const dynamic = "force-static";
4+
35
export default function robots(): MetadataRoute.Robots {
46
return {
57
rules: {

app/sitemap.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { MetadataRoute } from "next";
22

3+
export const dynamic = "force-static";
4+
35
export default function sitemap(): MetadataRoute.Sitemap {
46
const baseUrl = "https://postgresus.com";
57
const currentDate = new Date().toISOString();
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use client";
2+
3+
import { useEffect } from "react";
4+
5+
export default function OAuthProcessor() {
6+
useEffect(() => {
7+
// Get current URL parameters
8+
const urlParams = new URLSearchParams(window.location.search);
9+
10+
// Extract state and code from current URL
11+
const state = urlParams.get("state");
12+
const code = urlParams.get("code");
13+
14+
if (state && code) {
15+
try {
16+
// Parse the StorageOauthDto from the state parameter
17+
const oauthDto = JSON.parse(decodeURIComponent(state));
18+
19+
// Update the authCode field with the received code
20+
oauthDto.authCode = code;
21+
22+
// Construct the redirect URL with the updated DTO
23+
const redirectUrl = `${
24+
oauthDto.redirectUrl
25+
}?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`;
26+
27+
// Redirect to the constructed URL
28+
window.location.href = redirectUrl;
29+
} catch (error) {
30+
console.error("Error parsing state parameter:", error);
31+
}
32+
} else {
33+
console.error("Missing state or code parameter");
34+
}
35+
}, []);
36+
37+
return (
38+
<div
39+
style={{
40+
textAlign: "center",
41+
padding: "50px",
42+
fontFamily: "Arial, sans-serif",
43+
}}
44+
>
45+
<h2>Processing OAuth...</h2>
46+
<p>Please wait while we redirect you back to the application.</p>
47+
</div>
48+
);
49+
}

app/storages/google-oauth/page.tsx

Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,10 @@
1-
"use client";
1+
import type { Metadata } from "next";
2+
import OAuthProcessor from "./OAuthProcessor";
23

3-
import { useEffect } from "react";
4+
export const metadata: Metadata = {
5+
robots: "noindex, nofollow",
6+
};
47

58
export default function GoogleOAuthPage() {
6-
useEffect(() => {
7-
// Get current URL parameters
8-
const urlParams = new URLSearchParams(window.location.search);
9-
10-
// Extract state and code from current URL
11-
const state = urlParams.get("state");
12-
const code = urlParams.get("code");
13-
14-
if (state && code) {
15-
try {
16-
// Parse the StorageOauthDto from the state parameter
17-
const oauthDto = JSON.parse(decodeURIComponent(state));
18-
19-
// Update the authCode field with the received code
20-
oauthDto.authCode = code;
21-
22-
// Construct the redirect URL with the updated DTO
23-
const redirectUrl = `${
24-
oauthDto.redirectUrl
25-
}?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`;
26-
27-
// Redirect to the constructed URL
28-
window.location.href = redirectUrl;
29-
} catch (error) {
30-
console.error("Error parsing state parameter:", error);
31-
}
32-
} else {
33-
console.error("Missing state or code parameter");
34-
}
35-
}, []);
36-
37-
return (
38-
<div
39-
style={{
40-
textAlign: "center",
41-
padding: "50px",
42-
fontFamily: "Arial, sans-serif",
43-
}}
44-
>
45-
<h2>Processing OAuth...</h2>
46-
<p>Please wait while we redirect you back to the application.</p>
47-
</div>
48-
);
9+
return <OAuthProcessor />;
4910
}

0 commit comments

Comments
 (0)