This commit is contained in:
2025-06-08 16:35:06 +09:00
parent 230b3558b9
commit be026db3d8
20 changed files with 182 additions and 73 deletions

View File

@ -1,8 +1,8 @@
import { Hono } from "hono";
import { serve } from "@hono/node-server";
import path from "path";
import { config, validateConfig } from "./services/config.js";
import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { batchScheduler } from "./services/batch-scheduler.js";
import { config, validateConfig } from "./services/config.js";
// Validate configuration on startup
try {
@ -61,16 +61,16 @@ app.get("/podcast_audio/*", async (c) => {
if (range) {
// Handle range requests for streaming
const parts = range.replace(/bytes=/, "").split("-");
const start = parseInt(parts[0] || "0", 10);
const end = parts[1] ? parseInt(parts[1], 10) : fileSize - 1;
const start = Number.parseInt(parts[0] || "0", 10);
const end = parts[1] ? Number.parseInt(parts[1], 10) : fileSize - 1;
if (start >= fileSize) {
return c.text("Requested range not satisfiable", 416, {
"Content-Range": `bytes */${fileSize}`,
});
}
const chunkSize = (end - start) + 1;
const chunkSize = end - start + 1;
const stream = file.stream();
return c.body(stream, 206, {