mirror of
https://github.com/kenzok8/openwrt-packages
synced 2025-01-07 07:06:45 +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
|
json_dump > $data_dir/config.json
|
||||||
|
|
||||||
procd_open_instance
|
procd_open_instance alist
|
||||||
procd_set_param command $PROG
|
procd_set_param command $PROG
|
||||||
procd_append_param command server --data $data_dir
|
procd_append_param command server --data $data_dir
|
||||||
procd_set_param stdout 0
|
procd_set_param stdout 0
|
||||||
@ -196,7 +196,13 @@ start_service() {
|
|||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
procd_set_param limits core="unlimited"
|
procd_set_param limits core="unlimited"
|
||||||
procd_set_param limits nofile="200000 200000"
|
procd_set_param limits nofile="200000 200000"
|
||||||
procd_close_instance
|
procd_close_instance alist
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
sleep 3
|
||||||
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
|
@ -17,18 +17,18 @@ function getServiceStatus() {
|
|||||||
return L.resolveDefault(callServiceList('alist'), {}).then(function (res) {
|
return L.resolveDefault(callServiceList('alist'), {}).then(function (res) {
|
||||||
var isRunning = false;
|
var isRunning = false;
|
||||||
try {
|
try {
|
||||||
isRunning = res['alist']['instances']['instance1']['running'];
|
isRunning = res['alist']['instances']['alist']['running'];
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
return isRunning;
|
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 spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
|
||||||
var renderHTML;
|
var renderHTML;
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
var button = String.format('<input class="cbi-button-reload" type="button" style="margin-left: 50px" value="%s" onclick="window.open(\'//%s:%s/\')">',
|
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'), window.location.hostname, webport);
|
_('Open Web Interface'), protocol, window.location.hostname, webport);
|
||||||
renderHTML = spanTemp.format('green', 'Alist', _('RUNNING')) + button;
|
renderHTML = spanTemp.format('green', 'Alist', _('RUNNING')) + button;
|
||||||
} else {
|
} else {
|
||||||
renderHTML = spanTemp.format('red', 'Alist', _('NOT RUNNING'));
|
renderHTML = spanTemp.format('red', 'Alist', _('NOT RUNNING'));
|
||||||
@ -64,6 +64,13 @@ return view.extend({
|
|||||||
render: function (data) {
|
render: function (data) {
|
||||||
var m, s, o;
|
var m, s, o;
|
||||||
var webport = uci.get(data[0], '@alist[0]', 'port') || '5244';
|
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'),
|
m = new form.Map('alist', _('Alist'),
|
||||||
_('A file list program that supports multiple storage.') +
|
_('A file list program that supports multiple storage.') +
|
||||||
@ -79,7 +86,7 @@ return view.extend({
|
|||||||
poll.add(function () {
|
poll.add(function () {
|
||||||
return L.resolveDefault(getServiceStatus()).then(function (res) {
|
return L.resolveDefault(getServiceStatus()).then(function (res) {
|
||||||
var view = document.getElementById('service_status');
|
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'),
|
o = s.option(form.Value, 'ssl_cert', _('SSL cert'),
|
||||||
_('SSL certificate file path'));
|
_('SSL certificate file path'));
|
||||||
|
o.rmempty = false;
|
||||||
o.depends('ssl', '1');
|
o.depends('ssl', '1');
|
||||||
|
|
||||||
o = s.option(form.Value, 'ssl_key', _('SSL key'),
|
o = s.option(form.Value, 'ssl_key', _('SSL key'),
|
||||||
_('SSL key file path'));
|
_('SSL key file path'));
|
||||||
|
o.rmempty = false;
|
||||||
o.depends('ssl', '1');
|
o.depends('ssl', '1');
|
||||||
|
|
||||||
o = s.option(form.Flag, 'mysql', _('Enable Database'));
|
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`
|
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`
|
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`
|
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}
|
[ ! -z "$network_enable" ] && [ "$network_enable" -eq "404" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【网络状态】网络恢复正常.." >> ${logfile}
|
||||||
local network_enable="200"
|
local network_enable="200"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user