feat: 인스타 릴스 — 릴스 mp4 저장·공개 주소(/v1/reel)·REELS 게시 API, 관리자 relay, 소개 릴스 HyperFrames 프로젝트·배경 5장, 인스타 올리기 nginx 타임아웃 600s
This commit is contained in:
1 parent
70fe14ae39
commit
7469e58a89
64 files changed
+928
-11
No files matched your search
@@ -136,6 +136,23 @@ function postApi(): Plugin {
|
||||
res.end(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }))
|
||||
}
|
||||
})
|
||||
// 릴스: GET /api/reel → 목록 · POST /api/reel {title, caption, hashtags, video, cover?} → 저장 · POST /api/reel/<id>/instagram → 인스타에 올리기
|
||||
server.middlewares.use('/api/reel', async (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
try {
|
||||
const t = targetOf(req)
|
||||
const path = (req.url ?? '').split('?')[0]
|
||||
const m = path.match(/^\/(\d+)\/instagram$/)
|
||||
if (req.method === 'GET') return await relay(res, await fetch(`${t.api}/v1/reel?limit=100`, { headers: headers(t) }))
|
||||
if (req.method === 'POST' && m) return await relay(res, await fetch(`${t.api}/v1/reel/${m[1]}/instagram`, { method: 'POST', headers: headers(t) }))
|
||||
if (req.method === 'POST' && path === '/') return await relay(res, await fetch(`${t.api}/v1/reel`, { method: 'POST', headers: headers(t), body: JSON.stringify(await readJson(req)) }))
|
||||
throw new Error('GET /api/reel · POST /api/reel · POST /api/reel/<id>/instagram')
|
||||
} catch (e) {
|
||||
server.config.logger.error(`[reel-api] ${e instanceof Error ? e.message : String(e)}`)
|
||||
res.statusCode = 500
|
||||
res.end(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }))
|
||||
}
|
||||
})
|
||||
server.middlewares.use('/api/post', async (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/json; charset=utf-8')
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user