40
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Http = require "luan:http/Http.luan"
|
|
4 local Db = require "site:/lib/Db.luan"
|
|
5 local run_in_transaction = Db.run_in_transaction or error()
|
|
6 local User = require "site:/lib/User.luan"
|
|
7 local current_user = User.current or error()
|
|
8
|
|
9
|
|
10 return function()
|
41
|
11 local url = Http.request.parameters.url or error()
|
|
12 if url == "" then
|
|
13 url = nil
|
|
14 end
|
40
|
15 run_in_transaction( function()
|
|
16 local user = current_user() or error()
|
41
|
17 user.voice_url = url
|
40
|
18 user.save()
|
|
19 end )
|
|
20 end
|