summaryrefslogtreecommitdiffstats
path: root/tinydns-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tinydns-controller.lua')
-rw-r--r--tinydns-controller.lua29
1 files changed, 29 insertions, 0 deletions
diff --git a/tinydns-controller.lua b/tinydns-controller.lua
new file mode 100644
index 0000000..b6840d1
--- /dev/null
+++ b/tinydns-controller.lua
@@ -0,0 +1,29 @@
+module(..., package.seeall)
+
+local list_redir = function (self)
+ self.conf.action = "status"
+ self.conf.type = "redir"
+ error (self.conf)
+end
+
+mvc = {}
+mvc.on_load = function(self, parent)
+ if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
+ self.worker[self.conf.action] = list_redir(self)
+ end
+end
+
+local function getstatus(self)
+ local status = self.model.getstatus()
+ if (#status.status.value > 0) then
+ status.status.value = "Enabled"
+ else
+ status.status.value = "Disabled"
+ end
+ return status
+end
+
+function status(self)
+ return { status=getstatus(self) }
+end
+