poprawki do deployu

This commit is contained in:
Patryk Koreń
2026-07-09 22:34:24 +02:00
parent fa9e3b5ce7
commit 6aa9db54f4
7 changed files with 63 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ import path from "path";
export const REMOTE_DIR = "/";
export const LOCAL_DIR = path.resolve("./downloads");
export const OUT_DIR = path.resolve("./out");
export async function downloadMissing(remoteDir: string = REMOTE_DIR) {
await fs.mkdir(LOCAL_DIR, { recursive: true })

View File

@@ -1,14 +1,16 @@
// src/routes/auth.ts
import { Router } from "express";
import { downloadMissing, LOCAL_DIR } from "../lib/nextcloud";
import { downloadMissing, LOCAL_DIR, OUT_DIR } from "../lib/nextcloud";
import path from "node:path";
import { encodeFrames } from "../lib/crateClip";
import fs from "node:fs"
const router = Router();
export const out_vid_path = `${OUT_DIR}/out.mp4`
router.get("/video", async (req, res) => {
const videoPath = path.resolve("./out.mp4");
const videoPath = path.resolve(out_vid_path);
const stat = fs.statSync(videoPath);
// Simple ETag based on file size + modification time
@@ -25,13 +27,15 @@ router.get("/video", async (req, res) => {
router.post("/createclip", async (req, res) => {
try {
await fs.mkdirSync(OUT_DIR, { recursive: true })
await encodeFrames({
inputPattern: `${LOCAL_DIR}/*.jpg`,
output: path.resolve("./out.mp4"),
output: out_vid_path,
fps: 8,
});
res.status(200).end();
} catch {
} catch (e) {
console.log(e)
res.status(501).end();
}
})

View File

@@ -12,7 +12,7 @@ dotenv.config();
const app = express();
app.use(cors({
origin: "http://localhost:5173",
origin: "https://papryk.com",
methods: ["GET", "POST"],
credentials: true
}));