From 5c419acf926b7332976c6a5c1586d2badf9664ae Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 17 Jul 2008 21:59:04 +0000 Subject: [PATCH] Added new applications luci-ddns to luci-full and luci-mini --- applications/luci-ddns/Makefile | 2 + .../luci-ddns/luasrc/controller/ddns.lua | 32 ++++++++ .../luci-ddns/luasrc/i18n/ddns.de.lua | 8 ++ .../luci-ddns/luasrc/i18n/ddns.en.lua | 8 ++ .../luci-ddns/luasrc/model/cbi/ddns/ddns.lua | 76 +++++++++++++++++++ .../luasrc/model/cbi/ddns/ddnsmini.lua | 50 ++++++++++++ contrib/package/luci/Makefile | 17 ++++- 7 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 applications/luci-ddns/Makefile create mode 100644 applications/luci-ddns/luasrc/controller/ddns.lua create mode 100644 applications/luci-ddns/luasrc/i18n/ddns.de.lua create mode 100644 applications/luci-ddns/luasrc/i18n/ddns.en.lua create mode 100644 applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua create mode 100644 applications/luci-ddns/luasrc/model/cbi/ddns/ddnsmini.lua diff --git a/applications/luci-ddns/Makefile b/applications/luci-ddns/Makefile new file mode 100644 index 000000000..81a96f6a8 --- /dev/null +++ b/applications/luci-ddns/Makefile @@ -0,0 +1,2 @@ +include ../../build/config.mk +include ../../build/module.mk \ No newline at end of file diff --git a/applications/luci-ddns/luasrc/controller/ddns.lua b/applications/luci-ddns/luasrc/controller/ddns.lua new file mode 100644 index 000000000..f98913655 --- /dev/null +++ b/applications/luci-ddns/luasrc/controller/ddns.lua @@ -0,0 +1,32 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- +module("luci.controller.ddns", package.seeall) + +function index() + require("luci.i18n") + luci.i18n.loadc("ddns") + if not luci.fs.isfile("/etc/config/ddns") then + return + end + + local page = entry({"admin", "services", "ddns"}, cbi("ddns/ddns"), luci.i18n.translate("ddns"), 60) + page.i18n = "ddns" + page.dependent = true + + + local page = entry({"mini", "network", "ddns"}, cbi("ddns/ddnsmini"), luci.i18n.translate("ddns"), 60) + page.i18n = "ddns" + page.dependent = true +end \ No newline at end of file diff --git a/applications/luci-ddns/luasrc/i18n/ddns.de.lua b/applications/luci-ddns/luasrc/i18n/ddns.de.lua new file mode 100644 index 000000000..7827e0acf --- /dev/null +++ b/applications/luci-ddns/luasrc/i18n/ddns.de.lua @@ -0,0 +1,8 @@ +ddns = "Dynamisches DNS" +ddns_desc = "Dynamisches DNS erlaubt es, den Router bei dynamischer IP-Adresse über einen festen DNS-Namen zu erreichen." +ddns_service_ipsource = "Quelle der IP-Adresse" +ddns_service_checkinterval = "Teste auf neue IP alle" +ddns_service_checkunit = "Test-Zeiteinheit" +ddns_service_forceinterval = "Erzwinge Aktualisierung alle" +ddns_service_forceunit = "Erzwinge-Zeiteinheit" +ddns_service_updateurl = "Eigene Update-URL" \ No newline at end of file diff --git a/applications/luci-ddns/luasrc/i18n/ddns.en.lua b/applications/luci-ddns/luasrc/i18n/ddns.en.lua new file mode 100644 index 000000000..32f85b24a --- /dev/null +++ b/applications/luci-ddns/luasrc/i18n/ddns.en.lua @@ -0,0 +1,8 @@ +ddns = "Dynamic DNS" +ddns_desc = "Dynamic DNS allows that your router can be reached with a fixed hostname while having a dynamically changing IP-Address." +ddns_service_ipsource = "Source of IP-Address" +ddns_service_checkinterval = "Check for changed IP every" +ddns_service_checkunit = "Check-Time unit" +ddns_service_forceinterval = "Force update every" +ddns_service_forceunit = "Force-Time unit" +ddns_service_updateurl = "Custom Update-URL" \ No newline at end of file diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua new file mode 100644 index 000000000..1c88579b3 --- /dev/null +++ b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua @@ -0,0 +1,76 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- +m = Map("ddns", translate("ddns"), translate("ddns_desc")) + +s = m:section(TypedSection, "service", "") +s.addremove = true + +s:option(Flag, "enabled", translate("enable")) + +svc = s:option(ListValue, "service_name", translate("service")) +svc.rmempty = true +svc:value("") +svc:value("dyndns.org") +svc:value("changeip.com") +svc:value("zoneedit.com") +svc:value("no-ip.com") +svc:value("freedns.afraid.org") + +s:option(Value, "domain", translate("hostname")).rmempty = true +s:option(Value, "username", translate("username")).rmempty = true +s:option(Value, "password", translate("password")).rmempty = true + +src = s:option(ListValue, "ip_source") +src:value("network", translate("network")) +src:value("interface", translate("interface")) +src:value("web", "URL") + +iface = s:option(ListValue, "ip_network", translate("network")) +iface:depends("ip_source", "network") +iface.rmempty = true +luci.model.uci.foreach("network", "interface", + function (section) + if section[".name"] ~= "loopback" then + iface:value(section[".name"]) + end + end) + +iface = s:option(ListValue, "ip_interface", translate("interface")) +iface:depends("ip_source", "interface") +iface.rmempty = true +for k, v in pairs(luci.sys.net.devices()) do + iface:value(v) +end + +web = s:option(Value, "ip_url", "URL") +web:depends("ip_source", "web") +web.rmempty = true + +s:option(Value, "update_url").optional = true + +s:option(Value, "check_interval").default = 10 +unit = s:option(ListValue, "check_unit") +unit.default = "minutes" +unit:value("minutes", "min") +unit:value("hours", "h") + +s:option(Value, "force_interval").default = 72 +unit = s:option(ListValue, "force_unit") +unit.default = "hours" +unit:value("minutes", "min") +unit:value("hours", "h") + + +return m \ No newline at end of file diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/ddnsmini.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/ddnsmini.lua new file mode 100644 index 000000000..51bebb6e6 --- /dev/null +++ b/applications/luci-ddns/luasrc/model/cbi/ddns/ddnsmini.lua @@ -0,0 +1,50 @@ +--[[ +LuCI - Lua Configuration Interface + +Copyright 2008 Steven Barth +Copyright 2008 Jo-Philipp Wich + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- +m = Map("ddns", translate("ddns"), translate("ddns_desc")) + +s = m:section(TypedSection, "service", "") +s.addremove = true + +s:option(Flag, "enabled", translate("enable")) + +svc = s:option(ListValue, "service_name", translate("service")) +svc.rmempty = true +svc:value("dyndns.org") +svc:value("changeip.com") +svc:value("zoneedit.com") +svc:value("no-ip.com") +svc:value("freedns.afraid.org") + +s:option(Value, "domain", translate("hostname")).rmempty = true +s:option(Value, "username", translate("username")).rmempty = true +s:option(Value, "password", translate("password")).rmempty = true + +s.defaults.ip_source = "network" +s.defaults.ip_network = "wan" + +s:option(Value, "check_interval").default = 10 +unit = s:option(ListValue, "check_unit") +unit.default = "minutes" +unit:value("minutes", "min") +unit:value("hours", "h") + +s:option(Value, "force_interval").default = 72 +unit = s:option(ListValue, "force_unit") +unit.default = "hours" +unit:value("minutes", "min") +unit:value("hours", "h") + + +return m \ No newline at end of file diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index 444c473f5..268048f45 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -426,7 +426,7 @@ endef define Package/luci-app-ntpc $(call Package/luci/webtemplate) DEPENDS+=+luci-mod-admin-core +ntpclient - TITLE:=NTP time synchronisation client configuration + TITLE:=NTP time synchronisation client configuration module endef define Package/luci-app-ntpc/install @@ -434,6 +434,17 @@ define Package/luci-app-ntpc/install endef +define Package/luci-app-ddns + $(call Package/luci/webtemplate) + DEPENDS+=+luci-mod-admin-core +ddns-scripts + TITLE:=Dynamic DNS configuration module +endef + +define Package/luci-app-ddns/install + $(call Package/luci/install/template,$(1),applications/luci-ddns) +endef + + ### Server Gateway Interfaces ### define Package/luci-sgi-cgi @@ -594,6 +605,9 @@ endif ifneq ($(CONFIG_PACKAGE_luci-app-ntpc),) PKG_SELECTED_MODULES+=applications/luci-ntpc endif +ifneq ($(CONFIG_PACKAGE_luci-app-ddns),) + PKG_SELECTED_MODULES+=applications/luci-ddns +endif ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),) PKG_SELECTED_MODULES+=libs/sgi-cgi @@ -660,6 +674,7 @@ $(eval $(call BuildPackage,luci-app-splash)) $(eval $(call BuildPackage,luci-app-statistics)) $(eval $(call BuildPackage,luci-app-upnp)) $(eval $(call BuildPackage,luci-app-ntpc)) +$(eval $(call BuildPackage,luci-app-ddns)) $(eval $(call BuildPackage,luci-sgi-cgi)) $(eval $(call BuildPackage,luci-sgi-luci)) -- 2.25.1