Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
a3a9115c
Commit
a3a9115c
authored
4 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Unbreak active_node_list setting.
Removed some unused stuff.
parent
64c382e3
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
webv4/lib/events/nodelist.js
+1
-1
1 addition, 1 deletion
webv4/lib/events/nodelist.js
webv4/lib/locale/en_us.ini
+1
-0
1 addition, 0 deletions
webv4/lib/locale/en_us.ini
webv4/sidebar/001-nodelist.xjs
+21
-113
21 additions, 113 deletions
webv4/sidebar/001-nodelist.xjs
with
23 additions
and
114 deletions
webv4/lib/events/nodelist.js
+
1
−
1
View file @
a3a9115c
...
...
@@ -73,7 +73,7 @@ function scan() {
if
(
e
.
status
!=
NODE_INUSE
)
{
return
{
node
:
i
+
1
,
status
:
nu
ll
,
status
:
locale
.
strings
.
sidebar_node_list
.
label_waiting_for_ca
ll
,
action
:
null
,
user
:
null
,
connection
:
''
...
...
This diff is collapsed.
Click to expand it.
webv4/lib/locale/en_us.ini
+
1
−
0
View file @
a3a9115c
...
...
@@ -100,6 +100,7 @@ label_node_column = Node
label_send_telegram
=
Send a telegram
label_status_column
=
Status
label_status_web
=
browsing
label_waiting_for_call
=
Waiting for call
[sidebar_recent_visitors]
label_title
=
Recent Visitors
...
...
This diff is collapsed.
Click to expand it.
webv4/sidebar/001-nodelist.xjs
+
21
−
113
View file @
a3a9115c
<h4><?xjs write(locale.strings.sidebar_node_list.label_title); ?></h4>
<div id="sbbs-nodelist"></div>
<?
xjs
if
(
settings
.
nodelist_ibbs
)
{
?>
<div
id=
"sbbsimsg-nodelist"
></div>
<?
xjs
}
?>
<script type="text/javascript">
...
...
@@ -10,30 +7,6 @@
const nch = '<?xjs write(settings.active_node_list ? locale.strings.sidebar_node_list.label_connection_column : locale.strings.sidebar_node_list.label_node_column) ?>';
const nll = <?xjs write(system.node_list.length); ?>;
var niu = 0;
var
ns
=
0
;
function
_sb_list_node
(
e
)
{
if
(
e
.
action
===
null
||
e
.
user
===
null
)
return
;
$
(
'
#sbbs-nodelist-table
'
).
append
(
'
<tr>
'
+
'
<th scope="row">
'
+
(
anl
?
e
.
connection
:
(
typeof
e
.
node
==
'
number
'
?
e
.
node
+
1
:
e
.
connection
))
+
'
</th>
'
+
'
<td id="nodelist-
'
+
e
.
node
+
'
">
'
+
(
e
.
user
==
''
?
e
.
status
:
(
'
<strong>
'
+
e
.
user
+
'
</strong>
'
+
e
.
action
))
+
'
</td>
'
+
'
</tr>
'
);
if
(
e
.
user
!=
''
&&
<?
xjs
write
(
user
.
alias
!=
settings
.
guest
);
?>
)
{
$
(
'
#nodelist-
'
+
e
.
node
).
attr
(
'
title
'
,
'
<?
xjs
write
(
locale
.
strings
.
sidebar_node_list
.
label_send_telegram
);
?>
'
);
$
(
'
#nodelist-
'
+
e
.
node
).
css
(
'
cursor
'
,
'
pointer
'
);
$
(
'
#nodelist-
'
+
e
.
node
).
click
(
function
()
{
sendTelegram
(
e
.
user
);
});
}
if
(
typeof
e
.
node
==
'
number
'
&&
e
.
user
!=
''
)
niu
++
;
ns
++
;
}
function _sb_nodelist(evt) {
const data = JSON.parse(evt.data);
...
...
@@ -49,30 +22,29 @@
'</table>'
);
niu = 0;
ns
=
0
;
if
(
!
anl
)
{
const
nodes
=
Array
(
nll
);
data
.
forEach
(
function
(
e
)
{
if
(
typeof
e
.
node
==
'
number
'
)
{
nodes
[
e
.
node
]
=
e
;
}
else
{
nodes
.
push
(
e
);
// Web user
}
});
for
(
var
n
=
0
;
n
<
nodes
.
length
;
n
++
)
{
if
(
!
nodes
[
n
])
{
_sb_list_node
({
node
:
n
,
user
:
''
,
status
:
'
Waiting for call
'
});
}
else
{
_sb_list_node
(
nodes
[
n
],
n
);
}
var
ns =
data.reduce((a, c) => {
if (anl
&& (c.action === null || c.user === null)) return a;
$('#sbbs-nodelist-table').append(
'<tr>' +
'<th scope="row">' +
(anl ? c.connection : (typeof c.node == 'number' ? c.node : c.connection)) +
'</th>' +
`<td id="nodelist-${c.node}">` +
(c.user ? `<strong>${c.user}</strong> ${c.action}` : c.status) +
'</td>' +
'</tr>'
);
if (c.user && <?xjs write(user.alias != settings.guest); ?>) {
$(`#nodelist-${c.node}`).attr('title', '<?xjs write(locale.strings.sidebar_node_list.label_send_telegram); ?>');
$(`#nodelist-${c.node}`).css('cursor', 'pointer'
);
$(`#nodelist-${c.node}`).click(() => sendTelegram(c.user));
}
if (typeof c.node == 'number' && c.user != '') niu++;
return a + 1;
}, 0);
if (ns) {
$('#sbbs-nodelist').parent().removeClass('hidden');
}
else
{
data
.
forEach
(
_sb_list_node
);
if
(
ns
)
{
$
(
'
#sbbs-nodelist
'
).
parent
().
removeClass
(
'
hidden
'
);
$
(
'
#sbbs-nodelist
'
).
removeClass
(
'
hidden
'
);
}
$('#sbbs-nodelist').removeClass('hidden');
}
// Spans with these classes are used in the 'system stats' sidebar module.
// Update the nodes in use / available counters there.
...
...
@@ -82,68 +54,4 @@
registerEventListener('nodelist', _sb_nodelist);
<?
xjs
if
(
settings
.
nodelist_ibbs
)
{
?>
function
_send_ibbs_telegram
(
sys
,
host
,
user
)
{
async
function
send_ibbs_tg
(
evt
)
{
if
(
typeof
evt
!==
'
undefined
'
)
evt
.
preventDefault
();
await
v4_post
(
'
./api/sbbsimsg.ssjs
'
,
{
call
:
'
send_telegram
'
,
username
:
user
,
host
:
host
,
message
:
$
(
'
#telegram
'
).
val
()
});
$
(
'
#popUpModal
'
).
modal
(
'
hide
'
);
};
$
(
'
#popUpModalTitle
'
).
html
(
'
Send a telegram to
'
+
user
+
'
@
'
+
sys
);
$
(
'
#popUpModalBody
'
).
html
(
'
<form id="ibbs-telegram-form">
'
+
'
<input type="text" class="form-control" placeholder="My message" name="telegram" id="telegram">
'
+
'
<input type="submit" value="submit" class="hidden">
'
+
'
</form>
'
);
$
(
'
#popUpModalActionButton
'
).
show
();
$
(
'
#ibbs-telegram-form
'
).
submit
(
send_ibbs_tg
);
$
(
'
#popUpModalActionButton
'
).
click
(
send_ibbs_tg
);
$
(
'
#popUpModal
'
).
modal
(
'
show
'
);
}
registerEventListener
(
'
sbbsimsg
'
,
function
(
e
)
{
const
data
=
JSON
.
parse
(
e
.
data
);
var
users
=
0
;
$
(
'
#sbbsimsg-nodelist
'
).
addClass
(
'
hidden
'
);
$
(
'
#sbbsimsg-nodelist
'
).
html
(
'
<h4>Other Systems</h4>
'
);
Object
.
keys
(
data
).
forEach
(
function
(
e
,
i
)
{
if
(
!
data
[
e
].
users
.
length
)
return
;
const
id
=
'
sbbsimsg-nodelist-
'
+
i
;
$
(
'
#sbbsimsg-nodelist
'
).
append
(
'
<table id="
'
+
id
+
'
" class="table table-condensed table-responsive table-striped">
'
+
'
<tr><td><strong>
'
+
e
+
'
</strong></td></tr>
'
+
'
</table>
'
);
data
[
e
].
users
.
forEach
(
function
(
ee
,
ii
)
{
const
nid
=
id
+
'
-
'
+
ii
;
$
(
'
#
'
+
id
).
append
(
'
<tr>
'
+
'
<td id="
'
+
nid
+
'
">
'
+
'
<strong>
'
+
ee
.
name
+
'
</strong>
'
+
ee
.
action
+
'
</td>
'
+
'
</tr>
'
);
if
(
<?
xjs
write
(
user
.
alias
!=
settings
.
guest
);
?>
)
{
$
(
'
#
'
+
nid
).
click
(
function
()
{
_send_ibbs_telegram
(
e
,
data
[
e
].
host
,
ee
.
name
);
});
$
(
'
#
'
+
nid
).
attr
(
'
title
'
,
'
<?
xjs
write
(
locale
.
strings
.
sidebar_node_list
.
label_send_telegram
);
?>
'
);
$
(
'
#
'
+
nid
).
css
(
'
cursor
'
,
'
pointer
'
);
}
});
users
+=
data
[
e
].
users
.
length
;
});
if
(
users
)
{
$
(
'
#sbbsimsg-nodelist
'
).
removeClass
(
'
hidden
'
);
$
(
'
#sbbs-nodelist
'
).
parent
().
removeClass
(
'
hidden
'
);
}
});
<?
xjs
}
?>
</script>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment