ipk-source: Add luci-app-tailscale; rename directories

- Added luci-app-tailcale to ipk-source from: https://github.com/asvow/luci-app-tailscale/releases/tag/v1.2.3

- Renamed ipk-source directories to have no version number, only arch where needed.
This commit is contained in:
Cameron Thompson
2025-01-16 14:03:39 -05:00
parent bd97f2e652
commit adcd4a553d
55 changed files with 377 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
local e=require"luci.util"
local e=require"nixio.fs"
local e=require"luci.sys"
local e=require"luci.http"
local e=require"luci.dispatcher"
local e=require"luci.http"
local t=require"luci.sys"
local t=require"luci.model.uci".cursor()
module("luci.controller.modem.atc",package.seeall)
function index()
entry({"admin","modem"},firstchild(),"Modem",30).dependent=false
entry({"admin","modem","atc"},alias("admin","modem","atc","atcommand"),translate("AT Commands"),10).acl_depends={"luci-app-atinout-mod"}
entry({"admin","modem","atc","atcommand"},template("modem/atcommand"),translate("AT Commands"),10)
entry({"admin","modem","atc","atconfig"},cbi("modem/atconfig"),translate("Configuration"),20)
entry({"admin","modem","webcmd"},call("webcmd"))
entry({"admin","modem","atc","user_atc"},call("useratc"),nil).leaf=true
end
function webcmd()
local t=e.formvalue("cmd")
if t then
local t=io.popen("/usr/bin/luci-app-atinout "..t:gsub("[$]","\\\$"):gsub("\"","\\\"").." 2>&1")
local a=t:read("*a")
t:close()
e.write(tostring(a))
else
e.write_json(e.formvalue())
end
end
function uussd(t)
local e=nixio.fs.access("/etc/config/atcommands.user")and
io.popen("cat /etc/config/atcommands.user")
if e then
for a in e:lines()do
local e=a
if e then
t[#t+1]={
usd=e
}
end
end
e:close()
end
end
function useratc()
local e={}
uussd(e)
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@@ -0,0 +1,35 @@
local e=require"luci.util"
local o=require"nixio.fs"
local e=require"luci.sys"
local e=require"luci.http"
local e=require"luci.dispatcher"
local e=require"luci.http"
local e=require"luci.sys"
local e=require"luci.model.uci".cursor()
local n="/etc/config/atcommands.user"
local t
local e
local i
local a=nixio.fs.glob("/dev/tty[A-Z][A-Z]*")
t=Map("atinout",translate("Atinout Configuration"),
translate("Configuration panel for atinout."))
e=t:section(NamedSection,'general',"atinout",""..translate("AT Commands Terminal Settings"))
e.anonymous=true
i=e:option(Value,"atcport",translate("AT Command Sending Port"))
if a then
local e
for e in a do
i:value(e,e)
end
end
local e=e:option(TextValue,"user_atcommands",translate("User AT Commands"),translate("Each line must have the following format: 'AT Command name;AT Command'. Save to file '/etc/config/atcommands.user'."))
e.rows=20
e.rmempty=false
function e.cfgvalue(e,e)
return o.readfile(n)
end
function e.write(t,t,e)
e=e:gsub("\r\n","\n")
o.writefile(n,e)
end
return t

View File

@@ -0,0 +1,133 @@
<%+header%>
<!--
This module gives some convinience to access the shell via web, in
case that you don't have a uart console or telnet/ssh connection.
Hua Shao <nossiac@163.com>
-->
<h2><%:AT Commands%></h2>
<label><%:Web UI for sending AT Commands.%></label>
<p></p>
<h4><%:Sending commands to modem%></h4>
<div class="table" width="100%">
<div class="tr">
<div class="td left" width="23%"><%:User AT Commands%>:</div>
<div class="td left" style="width:55%;">
<select name="ussd" id="pl" onclick="copyFunction()">
</select>
</div>
<div class="td left" style="width:55%;"></div>
</div>
<div class="tr">
<div class="td left" style="width:23%;"><%:Command to send%>:</div>
<div class="td left" ><input type="text" id="code" required size="20" ></div>
</div>
</div>
<div class="table" width="100%">
<div class="td left" style="width:23%;"><%:Reply%>:
<p>
<pre id="result" style="visibility: hidden; width:77%;"></pre></div>
<div class="tr cbi-rowstyle-2">
<div class="td right"><div style="float: left;"><div class="ifacebadge"><a href="https://eko.one.pl">e1</a></div></div><input type="button" style="margin-right: 23%"; id="sendcmd" class="btn cbi-button cbi-button-neutral" value="<%:Send Command%>" /></div>
</div>
</div>
<script type="text/javascript">
window.onload = function readUSER() {
XHR.get('<%=luci.dispatcher.build_url("admin", "modem", "atc", "user_atc")%>', null,
function(x, json)
{
select = document.getElementById('pl');
var count = Object.keys(json).length;
for(var d=0;d<=count;d++)
{
var opt = document.createElement('option');
var s = json[d].usd;
var fields = s.split(/;/);
var name = fields[0];
var code = fields[1];
opt.text = name;
opt.value = code.trim();
opt.innerHTML = name;
select.appendChild(opt);
}
}
);
}
function copyFunction() {
var node = document.getElementById('result');
node.style.visibility = 'hidden';
var x = document.getElementById("pl").value;
document.getElementById("code").value = x;
document.getElementById("result").innerHTML = "";
}
function postcmd(cmd) {
(new XHR()).post("<%=luci.dispatcher.build_url("admin", "modem", "webcmd")%>", {"cmd":cmd}, function(x) {
console.log(x.response)
console.log(x)
var aStr = x.response;
var myre = /(^[ \t]*\n)/gm;
var bStr = aStr.replace(myre,"");
document.getElementById("result").innerHTML = bStr;
});
return false;
}
document.addEventListener('DOMContentLoaded', function (ev) {var button = document.getElementById("sendcmd");
button.addEventListener("click", function () {
var s = document.getElementById("code").value;
if ( s.length == 0 )
{
document.getElementById("result").innerHTML = "";
alert("<%:Please enter a AT Command%>");
return false;
}
var cmd = document.getElementById("code");
postcmd(cmd.value);
cmd.value = "";
var node = document.getElementById('result');
if (node.style.visibility=='visible') {
node.style.visibility = 'hidden';
}
else
node.style.visibility = 'visible'
return true;
});
}, true);
</script>
<%+footer%>