Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
Use locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
echicken committed Jan 14, 2019
1 parent 6708079 commit 4028d5d
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions web/root/api/system.ssjs
Expand Up @@ -7,8 +7,6 @@ load(settings.web_directory + '/lib/init.js');
load(settings.web_lib + 'auth.js');
load(settings.web_lib + 'language.js');

var _language = getLanguage(settings.language_file || 'english.ini', 'api_system');

var reply = {};

if ((http_request.method === 'GET' || http_request.method === 'POST') &&
Expand All @@ -19,18 +17,18 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
switch (http_request.query.call[0]) {

case 'node-list':
var usr = new User(1);
var usr = new User(1);
reply = system.node_list.reduce(function (a, c, i) {
if (c.status !== 3) return a;
usr.number = c.useron;
if (c.status !== 3) return a;
usr.number = c.useron;
a.push({
node : i,
status : format(NodeStatus[c.status], c.aux, c.extaux),
action : format(NodeAction[c.action], c.aux, c.extaux),
user : usr.alias,
connection : usr.connection
node: i,
status: format(NodeStatus[c.status], c.aux, c.extaux),
action: format(NodeAction[c.action], c.aux, c.extaux),
user: usr.alias,
connection: usr.connection
});
return a;
return a;
}, []);
for (var un = 1; un < system.lastuser; un++) {
usr.number = un;
Expand All @@ -41,13 +39,13 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
var webAction = getSessionValue(usr.number, 'action');
if (webAction === null) continue;
reply.push({
status : '',
action : _language.nodelist_action_prefix + ' ' + webAction,
user : usr.alias,
connection : 'W'
status: '',
action: locale.strings.api_system.nodelist_action_prefix + ' ' + webAction,
user: usr.alias,
connection: 'W'
});
}
usr = undefined;
usr = undefined;
break;

case 'send-telegram':
Expand All @@ -67,7 +65,7 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
if (un < 1) break;
system.put_telegram(
un, format(
_language.telegram_header_format,
locale.strings.api_system.telegram_header_format,
user.alias, (new Date()).toLocaleString()
) + '\r\n' + http_request.query.telegram[0] + '\r\n'
);
Expand Down

0 comments on commit 4028d5d

Please sign in to comment.