Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Illuna-Minetest
illuna-minetest
Commits
382357d6
Commit
382357d6
authored
11 years ago
by
proller
Browse files
Options
Downloads
Patches
Plain Diff
Masterserver totals fix
parent
a924409b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
util/master/list.js
+2
-4
2 additions, 4 deletions
util/master/list.js
util/master/master.cgi
+10
-5
10 additions, 5 deletions
util/master/master.cgi
with
12 additions
and
9 deletions
util/master/list.js
+
2
−
4
View file @
382357d6
...
...
@@ -48,10 +48,8 @@ function human_time(t, abs) {
function
success
(
r
)
{
if
(
!
r
||
!
r
.
list
)
return
;
var
h
=
''
;
if
(
!
master
.
no_total
&&
r
.
total
)
h
+=
'
<div class="mts_total">Now players:
'
+
r
.
total
.
clients
+
'
servers:
'
+
r
.
total
.
servers
+
'
</div>
'
;
if
(
!
master
.
no_total_max
&&
r
.
total_max
)
h
+=
'
<div class="mts_total_max">Max players:
'
+
r
.
total_max
.
clients
+
'
servers:
'
+
r
.
total_max
.
servers
+
'
</div>
'
;
if
(
!
master
.
no_total
&&
r
.
total
&&
r
.
total_max
)
h
+=
'
<div class="mts_total">Players:
'
+
r
.
total
.
clients
+
(
'
/
'
+
r
.
total_max
.
clients
)
+
'
servers:
'
+
r
.
total
.
servers
+
(
'
/
'
+
r
.
total_max
.
servers
)
+
'
</div>
'
;
h
+=
'
<table class="mts_table">
'
;
if
(
r
.
list
.
length
)
{
h
+=
'
<tr class="mts_head">
'
;
...
...
This diff is collapsed.
Click to expand it.
util/master/master.cgi
+
10
−
5
View file @
382357d6
...
...
@@ -229,7 +229,7 @@ sub request (;$) {
return
if
!
$param
->
{
ping
};
}
my
$list
=
read_json
(
$config
{
list_full
})
||
{};
printlog
"
readed[
$config
{list_full}] list size=
",
scalar
@
{
$list
->
{
list
}};
printlog
"
readed[
$config
{list_full}] list size=
",
scalar
@
{
$list
->
{
list
}}
if
$config
{
debug
}
;
my
$listk
=
{
map
{
$_
->
{
key
}
=>
$_
}
@
{
$list
->
{
list
}}};
my
$old
=
$listk
->
{
$param
->
{
key
}};
$param
->
{
time
}
=
$old
->
{
time
}
if
$param
->
{
off
};
...
...
@@ -250,13 +250,12 @@ sub request (;$) {
delete
$param
->
{
action
};
$listk
->
{
$param
->
{
key
}}
=
$param
;
#printlog 'write', Dumper $param if $config{debug};
$list
->
{
list
}
=
[
grep
{
$_
->
{
time
}
>
time
-
$config
{
time_purge
}
}
values
%$listk
];
file_rewrite
(
$config
{
list_full
},
JSON
->
new
->
encode
(
$list
));
printlog
"
writed[
$config
{list_full}] list size=
",
scalar
@
{
$list
->
{
list
}}
if
$config
{
debug
};
my
$list_full
=
[
grep
{
$_
->
{
time
}
>
time
-
$config
{
time_purge
}
}
values
%$listk
];
$list
->
{
list
}
=
[
sort
{
$b
->
{
clients
}
<=>
$a
->
{
clients
}
||
$a
->
{
start
}
<=>
$b
->
{
start
}
}
grep
{
$_
->
{
time
}
>
time
-
$config
{
time_alive
}
and
!
$_
->
{
off
}
and
(
!
$config
{
ping
}
or
!
$config
{
pingable
}
or
$_
->
{
ping
})
}
@
{
$list
->
{
list
}
}
@
{
$list
_full
}
];
$list
->
{
total
}
=
{
clients
=>
0
,
servers
=>
0
};
for
(
@
{
$list
->
{
list
}})
{
...
...
@@ -265,8 +264,14 @@ sub request (;$) {
}
$list
->
{
total_max
}{
clients
}
=
$list
->
{
total
}{
clients
}
if
$list
->
{
total_max
}{
clients
}
<
$list
->
{
total
}{
clients
};
$list
->
{
total_max
}{
servers
}
=
$list
->
{
total
}{
servers
}
if
$list
->
{
total_max
}{
servers
}
<
$list
->
{
total
}{
servers
};
file_rewrite
(
$config
{
list_pub
},
JSON
->
new
->
encode
(
$list
));
printlog
"
writed[
$config
{list_pub}] list size=
",
scalar
@
{
$list
->
{
list
}}
if
$config
{
debug
};
$list
->
{
list
}
=
$list_full
;
file_rewrite
(
$config
{
list_full
},
JSON
->
new
->
encode
(
$list
));
printlog
"
writed[
$config
{list_full}] list size=
",
scalar
@
{
$list
->
{
list
}}
if
$config
{
debug
};
}
};
return
[
200
,
["
Content-type
",
"
application/json
"],
[
JSON
->
new
->
encode
({})]],
$after
;
...
...
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