diff --git a/src/app/_components/DownloadedScriptsTab.tsx b/src/app/_components/DownloadedScriptsTab.tsx index 1d2f64c..94552c0 100644 --- a/src/app/_components/DownloadedScriptsTab.tsx +++ b/src/app/_components/DownloadedScriptsTab.tsx @@ -356,7 +356,7 @@ export function DownloadedScriptsTab({ onInstallScript }: DownloadedScriptsTabPr } }, [selectedCategory]); - const handleCardClick = (scriptCard: { slug: string }) => { + const handleCardClick = (scriptCard: ScriptCardType) => { // All scripts are GitHub scripts, open modal setSelectedSlug(scriptCard.slug); setIsModalOpen(true); diff --git a/src/app/_components/ScriptsGrid.tsx b/src/app/_components/ScriptsGrid.tsx index 5d82e70..1dea71e 100644 --- a/src/app/_components/ScriptsGrid.tsx +++ b/src/app/_components/ScriptsGrid.tsx @@ -574,7 +574,7 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) { }, []); - const handleCardClick = (scriptCard: { slug: string }) => { + const handleCardClick = (scriptCard: ScriptCardType) => { // All scripts are GitHub scripts, open modal setSelectedSlug(scriptCard.slug); setIsModalOpen(true); diff --git a/src/server/api/routers/scripts.ts b/src/server/api/routers/scripts.ts index 00dc243..61947d4 100644 --- a/src/server/api/routers/scripts.ts +++ b/src/server/api/routers/scripts.ts @@ -1,9 +1,9 @@ import { z } from "zod"; import { createTRPCRouter, publicProcedure } from "~/server/api/trpc"; import { scriptManager } from "~/server/lib/scripts"; -import { githubJsonService } from "~/server/services/githubJsonService"; -import { localScriptsService } from "~/server/services/localScripts"; -import { scriptDownloaderService } from "~/server/services/scriptDownloader"; +import { githubJsonService } from "~/server/services/githubJsonService.ts"; +import { localScriptsService } from "~/server/services/localScripts.ts"; +import { scriptDownloaderService } from "~/server/services/scriptDownloader.ts"; import { AutoSyncService } from "~/server/services/autoSyncService"; import type { ScriptCard } from "~/types/script"; @@ -115,6 +115,18 @@ export const scriptsRouter = createTRPCRouter({ .input(z.object({ slug: z.string() })) .query(async ({ input }) => { try { + console.log('getScriptBySlug called with slug:', input.slug); + console.log('githubJsonService methods:', Object.getOwnPropertyNames(Object.getPrototypeOf(githubJsonService))); + console.log('githubJsonService.getScriptBySlug type:', typeof githubJsonService.getScriptBySlug); + + if (typeof githubJsonService.getScriptBySlug !== 'function') { + return { + success: false, + error: 'getScriptBySlug method is not available on githubJsonService', + script: null + }; + } + const script = await githubJsonService.getScriptBySlug(input.slug); if (!script) { return { @@ -125,6 +137,7 @@ export const scriptsRouter = createTRPCRouter({ } return { success: true, script }; } catch (error) { + console.error('Error in getScriptBySlug:', error); return { success: false, error: error instanceof Error ? error.message : 'Failed to fetch script', diff --git a/src/server/services/autoSyncService.js b/src/server/services/autoSyncService.js index e980bf3..c3bf74a 100644 --- a/src/server/services/autoSyncService.js +++ b/src/server/services/autoSyncService.js @@ -1,5 +1,5 @@ import cron from 'node-cron'; -import { githubJsonService } from './githubJsonService.js'; +import { githubJsonService } from './githubJsonService.ts'; import { scriptDownloaderService } from './scriptDownloader.js'; import { appriseService } from './appriseService.js'; import { readFile, writeFile, readFileSync, writeFileSync } from 'fs'; diff --git a/src/server/services/githubJsonService.ts b/src/server/services/githubJsonService.ts index 5a6848f..344d51e 100644 --- a/src/server/services/githubJsonService.ts +++ b/src/server/services/githubJsonService.ts @@ -1,7 +1,7 @@ import { writeFile, mkdir } from 'fs/promises'; import { join } from 'path'; -import { env } from '~/env.js'; -import type { Script, ScriptCard, GitHubFile } from '~/types/script'; +import { env } from '../../env.js'; +import type { Script, ScriptCard, GitHubFile } from '../../types/script'; export class GitHubJsonService { private baseUrl: string | null = null;