Close #5
This commit is contained in:
14
server.ts
14
server.ts
@ -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, {
|
||||
|
Reference in New Issue
Block a user