view examples/blog/src/private/tools/backup.html.luan @ 1416:db57d562c4bd

add Http.is_hosted
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 18 Oct 2019 15:06:32 -0600
parents 4721c482c86b
children 82415c9c0015
line wrap: on
line source

local Luan = require "luan:Luan.luan"
local error = Luan.error
local Io = require "luan:Io.luan"
local Http = require "luan:http/Http.luan"
local db = require("site:/lib/Db.luan").db or error()


return function()
	local backup = Io.uri "site:/private/local/backup.zip"
	backup.delete()
	db.zip(backup)

	Io.stdout = Http.response.text_writer()
%>
<!doctype html>
<html>
	<body>
		backed up to <a href="/private/local/backup.zip">/private/local/backup.zip</a>
	</body>
</html>
<%
end