Skip to content

Commit 84a9f60

Browse files
committed
feat: enhance legacy redirects and query API
- Introduced QueryApiClient to handle printer queries with support for text and XML formats. - Updated legacy redirect logic to resolve paths based on parameters. - Enhanced the generate-query-api script to create static endpoints for printers and drivers. - Improved CSS styles for better text wrapping and hyphenation in prose elements. - Added support for manufacturer filtering in the printer list page. - Updated package.json to include new query API generation script. - Added new legacy redirects for home and database paths.
1 parent befc12e commit 84a9f60

30 files changed

Lines changed: 818 additions & 25 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
/public/ppds
2929
/public/feed.xml
3030
/public/search
31+
/public/query
3132

3233
# debug
3334
npm-debug.log*

app/download.cgi/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyCgiRedirect from "@/components/foomatic/LegacyCgiRedirect"
6+
7+
export default function LegacydownloadCgiPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyCgiRedirect endpoint="download" />
11+
</Suspense>
12+
)
13+
}

app/driver_list.cgi/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyCgiRedirect from "@/components/foomatic/LegacyCgiRedirect"
6+
7+
export default function Legacydriver_listCgiPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyCgiRedirect endpoint="driver_list" />
11+
</Suspense>
12+
)
13+
}

app/drivers/page.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
"use client"
22

33
import { useEffect } from "react"
4-
import { siteConfig } from "@/config/site.config";
4+
import { useRouter } from "next/navigation"
5+
6+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
57

68
export default function DriversPage() {
9+
const router = useRouter()
10+
711
useEffect(() => {
8-
window.location.href = siteConfig.destinations.drivers
9-
}, [])
10-
11-
return (
12-
<main className="min-h-screen bg-background text-foreground container mx-auto px-4 py-24">
13-
<h1 className="text-3xl font-bold mb-4">Redirecting...</h1>
14-
<p className="text-muted-foreground">
15-
Redirecting to OpenPrinting Drivers database...
16-
</p>
17-
</main>
18-
);
12+
router.replace("/foomatic/drivers")
13+
}, [router])
14+
15+
return <LoadingScreen />
1916
}

app/execution.cgi/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyCgiRedirect from "@/components/foomatic/LegacyCgiRedirect"
6+
7+
export default function LegacyexecutionCgiPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyCgiRedirect endpoint="execution" />
11+
</Suspense>
12+
)
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyPpdMaticRedirect from "@/components/foomatic/LegacyPpdMaticRedirect"
6+
7+
export default function LegacyPpdMaticPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyPpdMaticRedirect />
11+
</Suspense>
12+
)
13+
}

app/foomatic/printers/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ export default function HomePage() {
141141
const savedValue = parseInt(savedItemsPerPage, 10)
142142
setItemsPerPage(Number.isFinite(savedValue) ? savedValue : 20)
143143
}
144+
145+
const urlManufacturer = new URLSearchParams(window.location.search).get(
146+
"manufacturer"
147+
)
148+
if (urlManufacturer) {
149+
setSelectedManufacturer(urlManufacturer)
150+
setCurrentPage(1)
151+
}
144152
}, [])
145153

146154
useEffect(() => {

app/globals.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,20 @@
197197

198198
.prose {
199199
overflow-wrap: break-word;
200-
word-wrap: break-word;
200+
hyphens: auto;
201201
}
202202

203203
.prose a {
204-
word-break: break-all;
204+
word-break: normal;
205+
overflow-wrap: anywhere;
206+
hyphens: none;
207+
}
208+
209+
.prose code,
210+
.prose pre,
211+
.prose kbd,
212+
.prose samp {
213+
hyphens: none;
205214
}
206215

207216
.prose iframe {

app/ppd-o-matic.cgi/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyPpdMaticRedirect from "@/components/foomatic/LegacyPpdMaticRedirect"
6+
7+
export default function LegacyPpdMaticEntryPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyPpdMaticRedirect />
11+
</Suspense>
12+
)
13+
}

app/ppd-o-matic.php/page.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Suspense } from "react"
2+
3+
import LoadingScreen from "@/components/foomatic/LoadingScreen"
4+
5+
import LegacyPpdMaticRedirect from "@/components/foomatic/LegacyPpdMaticRedirect"
6+
7+
export default function LegacyPpdMaticEntryPage() {
8+
return (
9+
<Suspense fallback={<LoadingScreen />}>
10+
<LegacyPpdMaticRedirect />
11+
</Suspense>
12+
)
13+
}

0 commit comments

Comments
 (0)