update 2026-09-24 16:56:26

This commit is contained in:
action committed 2026-09-24 16:56:26 +08:00
1 parent b31a5c3878
commit e4cee331e9
6885 files changed
+3240523

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
#
#-- Copyright (C) 2018 dz <dingzhong110@gmail.com>
# Copyright (C) 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-cupsd
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for cupsd
LUCI_DEPENDS:= +cups
PKG_VERSION:=1.4
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
@@ -0,0 +1,28 @@
-- Copyright (C) 2018 dz <dingzhong110@gmail.com>
-- mod by 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-cupsd
module("luci.controller.cupsd", package.seeall)
function index()
if not nixio.fs.access("/etc/config/cupsd") then
return
end
local page = entry({"admin", "services", "cupsd"},alias("admin", "services", "cupsd", "basic"), _("CUPS打印服务器"), 60)
page.dependent = true
page.acl_depends = { "luci-app-cupsd" }
entry({"admin", "services", "cupsd", "basic"}, cbi("cupsd/basic"), _("设置"), 10).leaf = true
entry({"admin", "services", "cupsd_status"}, call("act_status"))
end
function act_status()
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local port = tonumber(uci:get_first("cupsd", "cupsd", "port") )
local e = { }
e.running = sys.call("pidof cupsd > /dev/null") == 0
e.port = port or 631
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
@@ -0,0 +1,28 @@
-- Copyright 2008 Yanira <forum-2008@email.de>
-- Licensed to the public under the Apache License 2.0.
-- mod by wulishui 20191205
-- mod by 2021-2022 sirpdboy <herboy2008@gmail.com> https://github.com/sirpdboy/luci-app-cupsd
local m, s, o
m = Map("cupsd", translate("CUPS打印服务器"))
m.description = "<font color=\"green\">CUPS是苹果公司为MacOS和其他类似UNIX的操作系统开发的基于标准的开源打印系统。</font><br><a href=\"/cups.pdf\" target=\"_blank\">点击此处可浏览或下载《添加打印机教程》</a>"
m:section(SimpleSection).template = "cupsd_status"
s = m:section(TypedSection, "cupsd", translate("Global Settings"))
s.addremove=false
s.anonymous = true
o=s:option(Flag, "enabled", translate("Enable"))
o.default=0
o=s:option(Value, "port", translate("WEB管理端口"),translate("可随意设定为无冲突的端口,对程序运行无影响。"))
o.datatype="uinteger"
o.default=631
o:depends("enabled",1)
return m
@@ -0,0 +1,26 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[cupsd_status]])%>', null,
function(x, data) {
var tb = document.getElementById('cupsd_status');
if (data && tb)
{
if (data.running)
{
tb.innerHTML = '<br/><em style=\"color:green\"><%:cupsd服务已启动%></em>'
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:点击打开cupsd%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + data.port + "/')\"/>";
}
else
{
tb.innerHTML = '<br/><em style=\"color:red\"><%:cupsd服务未启动%></em>';
}
}
}
);
//]]></script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:cupsd状态%></legend>
<p id="cupsd_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
@@ -0,0 +1,12 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@cupsd[-1]
add ucitrack cupsd
set ucitrack.@cupsd[-1].init=cupsd
commit ucitrack
EOF
rm -f /tmp/luci*
exit 0
@@ -0,0 +1,11 @@
{
"luci-app-cupsd": {
"description": "Grant UCI access for luci-app-cupsd",
"read": {
"uci": [ "cupsd" ]
},
"write": {
"uci": [ "cupsd" ]
}
}
}
Binary file not shown.