Mercurial Hosting > disearch
view src/bump.js.luan @ 23:e5c77f8d506d default tip
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 15 Sep 2024 10:45:43 -0600 |
parents | 552d6f944acb |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Time = require "luan:Time.luan" local time_now = Time.now or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Server = require "site:/lib/Server.luan" local Utils = require "site:/lib/Utils.luan" local get_user = Utils.get_user or error() local Db = require "site:/lib/Db.luan" local run_in_transaction = Db.run_in_transaction or error() return function() local server_id = Http.request.parameters.server or error() run_in_transaction( function() local server = Server.get_by_id(server_id) or error() server.owner_discord_id == get_user() or error() server.bumped = time_now() server.save() end ) Io.stdout = Http.response.text_writer() %> location.reload(); <% end