Mercurial Hosting > disearch
view src/bump.js.luan @ 20:914a37651a38
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 11:31:16 -0700 |
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