mirror of
https://github.com/kenzok8/openwrt-packages.git
synced 2025-01-05 10:16:44 +08:00
update 2024-08-14 08:30:03
This commit is contained in:
parent
a18e98c5bf
commit
50b632c272
@ -188,7 +188,7 @@ start_service() {
|
||||
|
||||
json_dump > $data_dir/config.json
|
||||
|
||||
procd_open_instance
|
||||
procd_open_instance alist
|
||||
procd_set_param command $PROG
|
||||
procd_append_param command server --data $data_dir
|
||||
procd_set_param stdout 0
|
||||
@ -196,7 +196,13 @@ start_service() {
|
||||
procd_set_param respawn
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="200000 200000"
|
||||
procd_close_instance
|
||||
procd_close_instance alist
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
sleep 3
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
|
@ -17,18 +17,18 @@ function getServiceStatus() {
|
||||
return L.resolveDefault(callServiceList('alist'), {}).then(function (res) {
|
||||
var isRunning = false;
|
||||
try {
|
||||
isRunning = res['alist']['instances']['instance1']['running'];
|
||||
isRunning = res['alist']['instances']['alist']['running'];
|
||||
} catch (e) { }
|
||||
return isRunning;
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatus(isRunning, webport) {
|
||||
function renderStatus(isRunning, protocol, webport) {
|
||||
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
|
||||
var renderHTML;
|
||||
if (isRunning) {
|
||||
var button = String.format('<input class="cbi-button-reload" type="button" style="margin-left: 50px" value="%s" onclick="window.open(\'//%s:%s/\')">',
|
||||
_('Open Web Interface'), window.location.hostname, webport);
|
||||
var button = String.format('<input class="cbi-button-reload" type="button" style="margin-left: 50px" value="%s" onclick="window.open(\'%s//%s:%s/\')">',
|
||||
_('Open Web Interface'), protocol, window.location.hostname, webport);
|
||||
renderHTML = spanTemp.format('green', 'Alist', _('RUNNING')) + button;
|
||||
} else {
|
||||
renderHTML = spanTemp.format('red', 'Alist', _('NOT RUNNING'));
|
||||
@ -64,6 +64,13 @@ return view.extend({
|
||||
render: function (data) {
|
||||
var m, s, o;
|
||||
var webport = uci.get(data[0], '@alist[0]', 'port') || '5244';
|
||||
var ssl = uci.get(data[0], '@alist[0]', 'ssl') || '0';
|
||||
var protocol;
|
||||
if (ssl === '0') {
|
||||
protocol = 'http:';
|
||||
} else if (ssl === '1') {
|
||||
protocol = 'https:';
|
||||
}
|
||||
|
||||
m = new form.Map('alist', _('Alist'),
|
||||
_('A file list program that supports multiple storage.') +
|
||||
@ -79,7 +86,7 @@ return view.extend({
|
||||
poll.add(function () {
|
||||
return L.resolveDefault(getServiceStatus()).then(function (res) {
|
||||
var view = document.getElementById('service_status');
|
||||
view.innerHTML = renderStatus(res, webport);
|
||||
view.innerHTML = renderStatus(res, protocol, webport);
|
||||
});
|
||||
});
|
||||
|
||||
@ -108,10 +115,12 @@ return view.extend({
|
||||
|
||||
o = s.option(form.Value, 'ssl_cert', _('SSL cert'),
|
||||
_('SSL certificate file path'));
|
||||
o.rmempty = false;
|
||||
o.depends('ssl', '1');
|
||||
|
||||
o = s.option(form.Value, 'ssl_key', _('SSL key'),
|
||||
_('SSL key file path'));
|
||||
o.rmempty = false;
|
||||
o.depends('ssl', '1');
|
||||
|
||||
o = s.option(form.Flag, 'mysql', _('Enable Database'));
|
||||
|
@ -678,9 +678,9 @@ function rand_geturl(){
|
||||
echo `curl -k -s -w "%{http_code}" -m 5 ${url_str} -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58" -o /dev/null`
|
||||
}
|
||||
local check=`getcheck`
|
||||
while [ -z "$check" ] || [[ $check -ne 200 && $check -ne 301 && $check -ne 302 ]]; do
|
||||
while [ -z "$check" ] || [[ $check -ne 200 && $check -ne 202 && $check -ne 301 && $check -ne 302 ]]; do
|
||||
local check=`getcheck`
|
||||
if [ ! -z "$check" ] && [[ $check -eq 200 || $check -eq 301 || $check -eq 302 ]]; then
|
||||
if [ ! -z "$check" ] && [[ $check -eq 200 || $check -eq 202 || $check -eq 301 || $check -eq 302 ]]; then
|
||||
[ ! -z "$network_enable" ] && [ "$network_enable" -eq "404" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【网络状态】网络恢复正常.." >> ${logfile}
|
||||
local network_enable="200"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user