Skip to content

Instantly share code, notes, and snippets.

@fiatjaf
Last active Jan 19, 2022
Embed
What would you like to do?
title = 'Free Tunnel Server'
description = [[
- Manages tunnel clients.
- Starts the LNbits main tunnel service.
This one is the free version, anyone can take a subdomain and keep it for free forever.
]]
models = {
{
name = 'client',
display = 'Client',
fields = {
{ name = 'subdomain', type = 'string', required = true }
}
}
}
actions = {
create = {
fields = {
{ name = 'subdomain', type = 'string', required = true }
},
handler = function (params)
local key = db.client.add({ subdomain = params.subdomain })
tunnel.add_client(params.subdomain, key)
return key
end
}
}
triggers = {
init = function ()
for _, item in ipairs(db.client.list()) do
tunnel.add_client(item.value.subdomain, item.key)
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment