feat: Apply fixes for type errors and unused variables
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import './app/globals.css';
|
||||
import RootLayout from './app/layout';
|
||||
import Home from './app/page';
|
||||
|
@ -1,4 +1,3 @@
|
||||
import React from "react";
|
||||
import FeedList from "../components/FeedList";
|
||||
import EpisodePlayer from "../components/EpisodePlayer";
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
interface Episode {
|
||||
id: string;
|
||||
@ -13,7 +11,6 @@ interface Episode {
|
||||
export default function EpisodePlayer() {
|
||||
const [episodes, setEpisodes] = useState<Episode[]>([]);
|
||||
const [selectedEpisode, setSelectedEpisode] = useState<Episode | null>(null);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
@ -1,8 +1,4 @@
|
||||
"use client";
|
||||
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
interface FeedItem {
|
||||
id: string;
|
||||
|
@ -29,18 +29,22 @@ async function main() {
|
||||
pub.getMonth() === yesterday.getMonth() &&
|
||||
pub.getDate() === yesterday.getDate()
|
||||
) {
|
||||
const already = await markAsProcessed(url, item.id);
|
||||
const already = await markAsProcessed(url, item['id'] as string);
|
||||
if (already) continue;
|
||||
|
||||
const scriptText = await openAI_GenerateScript(item);
|
||||
const audioFilePath = await generateTTS(item.id, scriptText);
|
||||
const scriptText = await openAI_GenerateScript({
|
||||
title: item.title ?? "",
|
||||
link: item.link ?? "",
|
||||
contentSnippet: item.contentSnippet ?? "",
|
||||
});
|
||||
const audioFilePath = await generateTTS(item['id'] as string, scriptText);
|
||||
|
||||
await saveEpisode({
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
id: item['id'] as string,
|
||||
title: item.title ?? "",
|
||||
pubDate: pub.toISOString(),
|
||||
audioPath: audioFilePath,
|
||||
sourceLink: item.link,
|
||||
sourceLink: item.link ?? "",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
19
server.ts
19
server.ts
@ -19,7 +19,6 @@ if (!fs.existsSync(dbPath)) {
|
||||
db.exec(fs.readFileSync(path.join(projectRoot, "schema.sql"), "utf-8"));
|
||||
|
||||
// 静的ファイルパスの設定
|
||||
const frontendPublicDir = path.join(projectRoot, "frontend", "public");
|
||||
const frontendBuildDir = path.join(projectRoot, "frontend", "dist");
|
||||
const podcastAudioDir = path.join(projectRoot, "static", "podcast_audio");
|
||||
const generalPublicDir = path.join(projectRoot, "public");
|
||||
@ -71,7 +70,8 @@ app.get("/assets/*", async (c) => {
|
||||
: filePath.endsWith(".css")
|
||||
? "text/css"
|
||||
: "application/octet-stream";
|
||||
return c.body(file, 200, { "Content-Type": contentType });
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, { "Content-Type": contentType });
|
||||
}
|
||||
return c.notFound();
|
||||
});
|
||||
@ -82,7 +82,8 @@ app.get("/podcast_audio/*", async (c) => {
|
||||
const audioFilePath = path.join(podcastAudioDir, audioFileName);
|
||||
const file = Bun.file(audioFilePath);
|
||||
if (await file.exists()) {
|
||||
return c.body(file, 200, { "Content-Type": "audio/mpeg" });
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, { "Content-Type": "audio/mpeg" });
|
||||
}
|
||||
return c.notFound();
|
||||
});
|
||||
@ -93,7 +94,8 @@ app.get("/podcast.xml", async (c) => {
|
||||
try {
|
||||
const file = Bun.file(filePath);
|
||||
if (await file.exists()) {
|
||||
return c.body(file, 200, {
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, {
|
||||
"Content-Type": "application/xml; charset=utf-8",
|
||||
});
|
||||
}
|
||||
@ -109,7 +111,8 @@ app.get("/", async (c) => {
|
||||
const file = Bun.file(indexPath);
|
||||
if (await file.exists()) {
|
||||
console.log(`Serving index.html from ${indexPath}`);
|
||||
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
}
|
||||
console.error(`index.html not found at ${indexPath}`);
|
||||
return c.notFound();
|
||||
@ -121,7 +124,8 @@ app.get("/index.html", async (c) => {
|
||||
const file = Bun.file(indexPath);
|
||||
if (await file.exists()) {
|
||||
console.log(`Serving index.html from ${indexPath}`);
|
||||
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
}
|
||||
console.error(`index.html not found at ${indexPath}`);
|
||||
return c.notFound();
|
||||
@ -133,7 +137,8 @@ app.get("*", async (c) => {
|
||||
const file = Bun.file(indexPath);
|
||||
if (await file.exists()) {
|
||||
console.log(`Serving index.html from ${indexPath}`);
|
||||
return c.body(file, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
const blob = await file.blob();
|
||||
return c.body(blob, 200, { "Content-Type": "text/html; charset=utf-8" });
|
||||
}
|
||||
console.error(`index.html not found at ${indexPath}`);
|
||||
return c.notFound();
|
||||
|
@ -53,5 +53,5 @@ export async function saveEpisode(ep: Episode): Promise<void> {
|
||||
|
||||
export async function fetchAllEpisodes(): Promise<Episode[]> {
|
||||
const stmt = db.prepare("SELECT * FROM episodes ORDER BY pubDate DESC");
|
||||
return stmt.all();
|
||||
return stmt.all() as Episode[];
|
||||
}
|
||||
|
Reference in New Issue
Block a user