Update
This commit is contained in:
		@@ -14,7 +14,6 @@ import {
 | 
			
		||||
  fetchEpisodesWithArticles,
 | 
			
		||||
  getAllCategories,
 | 
			
		||||
  getAllFeedsIncludingInactive,
 | 
			
		||||
  getAllSettings,
 | 
			
		||||
  getFeedByUrl,
 | 
			
		||||
  getFeedRequests,
 | 
			
		||||
  getFeedsByCategory,
 | 
			
		||||
@@ -35,6 +34,15 @@ try {
 | 
			
		||||
  process.exit(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Regenerate static files on startup
 | 
			
		||||
try {
 | 
			
		||||
  const { regenerateStartupFiles } = await import("./services/podcast.js");
 | 
			
		||||
  await regenerateStartupFiles();
 | 
			
		||||
} catch (error) {
 | 
			
		||||
  console.error("Failed to regenerate startup files on admin server:", error);
 | 
			
		||||
  // Don't exit - the admin server can still work without the regenerated files
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const app = new Hono();
 | 
			
		||||
 | 
			
		||||
// Basic Authentication middleware (if credentials are provided)
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,15 @@ try {
 | 
			
		||||
  process.exit(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Regenerate static files on startup
 | 
			
		||||
try {
 | 
			
		||||
  const { regenerateStartupFiles } = await import("./services/podcast.js");
 | 
			
		||||
  await regenerateStartupFiles();
 | 
			
		||||
} catch (error) {
 | 
			
		||||
  console.error("Failed to regenerate startup files:", error);
 | 
			
		||||
  // Don't exit - the server can still work without the regenerated files
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const app = new Hono();
 | 
			
		||||
 | 
			
		||||
// 静的ファイルの処理
 | 
			
		||||
 
 | 
			
		||||
@@ -139,6 +139,28 @@ export async function updatePodcastRSS(): Promise<void> {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Regenerate all static files on startup
 | 
			
		||||
 * This ensures that podcast.xml and other generated files are up-to-date
 | 
			
		||||
 */
 | 
			
		||||
export async function regenerateStartupFiles(): Promise<void> {
 | 
			
		||||
  try {
 | 
			
		||||
    console.log("🔄 Regenerating static files on startup...");
 | 
			
		||||
    
 | 
			
		||||
    // Regenerate main podcast.xml
 | 
			
		||||
    await updatePodcastRSS();
 | 
			
		||||
    console.log("✅ podcast.xml regenerated successfully");
 | 
			
		||||
    
 | 
			
		||||
    // Note: Category and feed-specific RSS files are generated dynamically on request
 | 
			
		||||
    // This is more efficient and ensures they're always up-to-date with current data
 | 
			
		||||
    
 | 
			
		||||
    console.log("✅ All startup files regenerated successfully");
 | 
			
		||||
  } catch (error) {
 | 
			
		||||
    console.error("❌ Error regenerating startup files:", error);
 | 
			
		||||
    throw error;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function generateCategoryRSS(category: string): Promise<string> {
 | 
			
		||||
  try {
 | 
			
		||||
    // Get episodes for the specific category
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user