2022-06-27 04:16:16 +08:00
|
|
|
package.path = package.path .. ';<SCRIPT_PATH>/?.lua';
|
2021-12-30 22:22:15 +08:00
|
|
|
local cjson = require "cjson"
|
|
|
|
|
local http = require "resty.http"
|
2022-06-28 22:47:38 +08:00
|
|
|
local create_task = require "lib.create_task"
|
2022-06-28 23:46:51 +08:00
|
|
|
local TaskTypes = require 'lib.task_type'
|
2021-12-30 22:22:15 +08:00
|
|
|
|
2022-09-01 00:02:40 +08:00
|
|
|
--todo: add verify
|
|
|
|
|
|
2021-12-30 22:22:15 +08:00
|
|
|
local httpc = http.new()
|
2022-01-01 02:18:37 +08:00
|
|
|
ngx.req.read_body()
|
|
|
|
|
local req_body = cjson.decode(ngx.req.get_body_data())
|
|
|
|
|
print('req_body...', ngx.req.get_body_data())
|
|
|
|
|
local media_id = req_body['media_id']
|
2021-12-30 22:22:15 +08:00
|
|
|
local authHeader = ngx.req.get_headers().Authorization
|
|
|
|
|
local sudoerToken = ngx.req.get_headers().HtySudoerToken
|
|
|
|
|
|
2022-06-27 04:16:16 +08:00
|
|
|
local task_text = cjson.encode({ task_type = TaskTypes.CONVERT_AUDIO_FILE, payload = { media_id = media_id } })
|
|
|
|
|
create_task(httpc, task_text, authHeader, sudoerToken)
|
2021-12-30 22:22:15 +08:00
|
|
|
|
|
|
|
|
|