You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.7 KiB
Lua

1 year ago
--[[
LuCI - Lua Configuration Interface
]]--
local taskd = require "luci.model.tasks"
local libreddit_model = require "luci.model.libreddit"
local m, s, o
m = taskd.docker_map("libreddit", "libreddit", "/usr/libexec/apps/libreddit/libreddit.sh",
translate("libreddit"),
translate(" Libreddit is a portmanteau of libre (meaning freedom) and Reddit. It is a private frontend like Invidious but for Reddit. Browse the coldest takes of unpopularopinion without being tracked.")
.. translate("Official website:") .. ' <a href=\"https://github.com/libreddit/libreddit/\" target=\"_blank\">https://github.com/libreddit/libreddit/</a>')
s = m:section(SimpleSection, translate("Service Status"), translate("libreddit status:"))
s:append(Template("libreddit/status"))
s = m:section(TypedSection, "libreddit", translate("Setup"), translate("Refresh to update settings."))
s.addremove=false
s.anonymous=true
o = s:option(Value, "port", translate("Port").."<b>*</b>")
o.rmempty = false
o.default = "5741"
o.datatype = "port"
o = s:option(Value, "image_name", translate("Image").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
o:value("spikecodes/libreddit", "spikecodes/libreddit")
o.default = "spikecodes/libreddit"
local blocks = libreddit_model.blocks()
local home = libreddit_model.home()
o = s:option(Value, "config_path", translate("Config path").."<b>*</b>")
o.rmempty = false
o.datatype = "string"
o:value("/opt/docker2/compose/Config/libreddit", "/opt/docker2/compose/Config/libreddit")
o.default = "/opt/docker2/compose/Config/libreddit"
local paths, default_path = libreddit_model.find_paths(blocks, home, "Configs")
for _, val in pairs(paths) do
o:value(val, val)
end
o.default = default_path
return m