17 lines
415 B
TypeScript
17 lines
415 B
TypeScript
import Express from 'express';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import makeVideo from './ffmpeg';
|
|
|
|
let p = path.join(__dirname, '..', 'tmp');
|
|
if (!fs.existsSync(p)) fs.mkdirSync(p);
|
|
|
|
const app = Express();
|
|
|
|
app.get('/', async (req, res) => {
|
|
let ip = req.header('X-Forwarded-For')?.split(', ')[0] || req.ip;
|
|
let filePath = await makeVideo(ip);
|
|
res.sendFile(filePath);
|
|
});
|
|
|
|
app.listen(6969); |