Last active
January 19, 2022 23:46
-
-
Save fiatjaf/020a23be8a3c441e40298d36e0701119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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