Mercurial Hosting > lang
view src/chat.json.luan @ 60:285029931499
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 18 Aug 2025 10:18:10 +0900 |
parents | 97b0d206cacd |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Http = require "luan:http/Http.luan" local User = require "site:/lib/User.luan" local current_user = User.current or error() local Chat = require "site:/lib/Chat.luan" local get_chat_by_id = Chat.get_by_id or error() return function() local chat_id = Http.request.parameters.chat or error() local chat = get_chat_by_id(chat_id) or error() local user = current_user() local is_owner = user ~= nil and user.id == chat.user_id is_owner or not chat.is_private or error "private" Http.response.text_writer().write(chat.ai_thread) end