Skip to content

Commit 2496392

Browse files
committed
fix url on homepage
1 parent 2b3ff44 commit 2496392

6 files changed

Lines changed: 28 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ jobs:
99
- uses: actions/checkout@v4
1010
- name: Install dependencies
1111
run: npm install
12+
- name: Type check
13+
run: npx tsc --noEmit
1214
- name: Run tests
1315
run: npx vitest run

env.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ declare module "*.txt" {
88
export default content;
99
}
1010

11-
interface Env {
12-
DPRINT_PLUGINS_GH_TOKEN?: string;
13-
PLUGIN_CACHE: R2Bucket;
11+
declare namespace Cloudflare {
12+
interface Env {
13+
DPRINT_PLUGINS_GH_TOKEN?: string;
14+
PLUGIN_CACHE: R2Bucket;
15+
}
1416
}

handleRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function createRequestHandler() {
9090
}
9191

9292
if (url.pathname === "/") {
93-
return renderHome().then((home) =>
93+
return renderHome(url.origin).then((home) =>
9494
new Response(home, {
9595
headers: {
9696
"content-type": contentTypes.html,

home.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { renderToString } from "preact-render-to-string";
22
import { PluginData, PluginsData, readInfoFile } from "./readInfoFile.js";
33

4-
export async function renderHome() {
5-
const content = await renderContent();
4+
export async function renderHome(origin: string) {
5+
const content = await renderContent(origin);
66
return `<!DOCTYPE html>
77
<html lang="en">
88
<head>
@@ -34,8 +34,8 @@ export async function renderHome() {
3434
`;
3535
}
3636

37-
async function renderContent() {
38-
const pluginsData = await readInfoFile();
37+
async function renderContent(origin: string) {
38+
const pluginsData = await readInfoFile(origin);
3939
const section = (
4040
<section id="content">
4141
<h1>Plugins</h1>

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"devDependencies": {
1515
"@cloudflare/vitest-pool-workers": "^0.13.4",
1616
"@cloudflare/workers-types": "^4.20260317.1",
17+
"typescript": "^6.0.2",
1718
"vitest": "~4.1.1",
1819
"wrangler": "^4.77.0"
1920
}

0 commit comments

Comments
 (0)