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 './app/globals.css';
|
||||||
import RootLayout from './app/layout';
|
import RootLayout from './app/layout';
|
||||||
import Home from './app/page';
|
import Home from './app/page';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import React from "react";
|
|
||||||
import FeedList from "../components/FeedList";
|
import FeedList from "../components/FeedList";
|
||||||
import EpisodePlayer from "../components/EpisodePlayer";
|
import EpisodePlayer from "../components/EpisodePlayer";
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
"use client";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
interface Episode {
|
interface Episode {
|
||||||
id: string;
|
id: string;
|
||||||
@ -13,7 +11,6 @@ interface Episode {
|
|||||||
export default function EpisodePlayer() {
|
export default function EpisodePlayer() {
|
||||||
const [episodes, setEpisodes] = useState<Episode[]>([]);
|
const [episodes, setEpisodes] = useState<Episode[]>([]);
|
||||||
const [selectedEpisode, setSelectedEpisode] = useState<Episode | null>(null);
|
const [selectedEpisode, setSelectedEpisode] = useState<Episode | null>(null);
|
||||||
const [isPlaying, setIsPlaying] = useState(false);
|
|
||||||
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
const [audioUrl, setAudioUrl] = useState<string | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
"use client";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
"use client";
|
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
interface FeedItem {
|
interface FeedItem {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -29,18 +29,22 @@ async function main() {
|
|||||||
pub.getMonth() === yesterday.getMonth() &&
|
pub.getMonth() === yesterday.getMonth() &&
|
||||||
pub.getDate() === yesterday.getDate()
|
pub.getDate() === yesterday.getDate()
|
||||||
) {
|
) {
|
||||||
const already = await markAsProcessed(url, item.id);
|
const already = await markAsProcessed(url, item['id'] as string);
|
||||||
if (already) continue;
|
if (already) continue;
|
||||||
|
|
||||||
const scriptText = await openAI_GenerateScript(item);
|
const scriptText = await openAI_GenerateScript({
|
||||||
const audioFilePath = await generateTTS(item.id, scriptText);
|
title: item.title ?? "",
|
||||||
|
link: item.link ?? "",
|
||||||
|
contentSnippet: item.contentSnippet ?? "",
|
||||||
|
});
|
||||||
|
const audioFilePath = await generateTTS(item['id'] as string, scriptText);
|
||||||
|
|
||||||
await saveEpisode({
|
await saveEpisode({
|
||||||
id: item.id,
|
id: item['id'] as string,
|
||||||
title: item.title,
|
title: item.title ?? "",
|
||||||
pubDate: pub.toISOString(),
|
pubDate: pub.toISOString(),
|
||||||
audioPath: audioFilePath,
|
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"));
|
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 frontendBuildDir = path.join(projectRoot, "frontend", "dist");
|
||||||
const podcastAudioDir = path.join(projectRoot, "static", "podcast_audio");
|
const podcastAudioDir = path.join(projectRoot, "static", "podcast_audio");
|
||||||
const generalPublicDir = path.join(projectRoot, "public");
|
const generalPublicDir = path.join(projectRoot, "public");
|
||||||
@ -71,7 +70,8 @@ app.get("/assets/*", async (c) => {
|
|||||||
: filePath.endsWith(".css")
|
: filePath.endsWith(".css")
|
||||||
? "text/css"
|
? "text/css"
|
||||||
: "application/octet-stream";
|
: "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();
|
return c.notFound();
|
||||||
});
|
});
|
||||||
@ -82,7 +82,8 @@ app.get("/podcast_audio/*", async (c) => {
|
|||||||
const audioFilePath = path.join(podcastAudioDir, audioFileName);
|
const audioFilePath = path.join(podcastAudioDir, audioFileName);
|
||||||
const file = Bun.file(audioFilePath);
|
const file = Bun.file(audioFilePath);
|
||||||
if (await file.exists()) {
|
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();
|
return c.notFound();
|
||||||
});
|
});
|
||||||
@ -93,7 +94,8 @@ app.get("/podcast.xml", async (c) => {
|
|||||||
try {
|
try {
|
||||||
const file = Bun.file(filePath);
|
const file = Bun.file(filePath);
|
||||||
if (await file.exists()) {
|
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",
|
"Content-Type": "application/xml; charset=utf-8",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -109,7 +111,8 @@ app.get("/", async (c) => {
|
|||||||
const file = Bun.file(indexPath);
|
const file = Bun.file(indexPath);
|
||||||
if (await file.exists()) {
|
if (await file.exists()) {
|
||||||
console.log(`Serving index.html from ${indexPath}`);
|
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}`);
|
console.error(`index.html not found at ${indexPath}`);
|
||||||
return c.notFound();
|
return c.notFound();
|
||||||
@ -121,7 +124,8 @@ app.get("/index.html", async (c) => {
|
|||||||
const file = Bun.file(indexPath);
|
const file = Bun.file(indexPath);
|
||||||
if (await file.exists()) {
|
if (await file.exists()) {
|
||||||
console.log(`Serving index.html from ${indexPath}`);
|
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}`);
|
console.error(`index.html not found at ${indexPath}`);
|
||||||
return c.notFound();
|
return c.notFound();
|
||||||
@ -133,7 +137,8 @@ app.get("*", async (c) => {
|
|||||||
const file = Bun.file(indexPath);
|
const file = Bun.file(indexPath);
|
||||||
if (await file.exists()) {
|
if (await file.exists()) {
|
||||||
console.log(`Serving index.html from ${indexPath}`);
|
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}`);
|
console.error(`index.html not found at ${indexPath}`);
|
||||||
return c.notFound();
|
return c.notFound();
|
||||||
|
@ -53,5 +53,5 @@ export async function saveEpisode(ep: Episode): Promise<void> {
|
|||||||
|
|
||||||
export async function fetchAllEpisodes(): Promise<Episode[]> {
|
export async function fetchAllEpisodes(): Promise<Episode[]> {
|
||||||
const stmt = db.prepare("SELECT * FROM episodes ORDER BY pubDate DESC");
|
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