Internalization improvements.

This commit is contained in:
Ylian Saint-Hilaire 2020-02-04 16:22:00 -08:00
parent 908b308c30
commit db2577b897
9 changed files with 1621 additions and 1444 deletions

View File

@ -229,7 +229,6 @@
<Content Include="public\images\mapmarker.png" />
<Content Include="public\images\meshicon50.png" />
<Content Include="public\images\trash.png" />
<Content Include="public\player.htm" />
<Content Include="public\scriptblocks.txt" />
<Content Include="public\sounds\chimes.mp3" />
<Content Include="public\styles\font-awesome\css\font-awesome.min.css" />

View File

@ -2654,10 +2654,10 @@ function createMeshCore(agent) {
if (mesh.ExecPowerState == undefined) {
response = 'Power command not supported on this agent.';
} else {
if ((args['_'].length == 0) || (typeof args['_'][0] != 'number')) {
if ((args['_'].length == 0) || isNaN(Number(args['_'][0]))) {
response = 'Proper usage: power (actionNumber), where actionNumber is:\r\n LOGOFF = 1\r\n SHUTDOWN = 2\r\n REBOOT = 3\r\n SLEEP = 4\r\n HIBERNATE = 5\r\n DISPLAYON = 6\r\n KEEPAWAKE = 7\r\n BEEP = 8\r\n CTRLALTDEL = 9\r\n VIBRATE = 13\r\n FLASH = 14'; // Display correct command usage
} else {
var r = mesh.ExecPowerState(args['_'][0], args['_'][1]);
var r = mesh.ExecPowerState(Number(args['_'][0]), Number(args['_'][1]));
response = 'Power action executed with return code: ' + r + '.';
}
}

View File

@ -80,8 +80,9 @@
<option value="es">Spanish (es)</option>
</select>
<input id="searchInput" type="text" placeholder="Search" onchange="onSearchChanged()" onkeyup="onSearchChanged()">
<input id="showLocCheck" type="checkbox" onchange="onLocChanged()"> Show Location
</div>
<label><input id="showLocCheck" type="checkbox" onchange="onLocChanged()"> Show Location</label>
<label><input id="showNoTransOnlyCheck" type="checkbox" onchange="onSearchChanged(true)">Show No Translations Only</label>
</div>
</div>
<div id=deskarea2 style="">
<div class="areaProgress"><div id="progressbar" style="background-color:blue"></div></div>
@ -257,6 +258,7 @@
}
QH('masterListArea', x.join(''));
updateButtons();
onSearchChanged(true);
}
function select(i, scroll, nofocus) {
@ -306,15 +308,17 @@
var currentSearchFilter = '';
function onSearchChanged(force) {
var showNoTranslationOnly = Q('showNoTransOnlyCheck').checked;
if ((force != true) && (currentSearchFilter == Q('searchInput').value)) return;
currentSearchFilter = Q('searchInput').value;
var currentSearchFilterLower = currentSearchFilter.toLowerCase();
if (translations != null) {
for (var i in translations) {
var show = (!showNoTranslationOnly) || (translations[i][selectedLanguage] == null) || (translations[i][selectedLanguage] == '');
if (currentSearchFilter == '') {
QV('nx' + i, true);
QV('nx' + i, show);
} else {
QV('nx' + i, ((translations[i][selectedLanguage] != null) && (translations[i][selectedLanguage].toLowerCase().indexOf(currentSearchFilterLower) >= 0)) || (translations[i]['en'].toLowerCase().indexOf(currentSearchFilterLower) >= 0));
QV('nx' + i, show && (((translations[i][selectedLanguage] != null) && (translations[i][selectedLanguage].toLowerCase().indexOf(currentSearchFilterLower) >= 0)) || (translations[i]['en'].toLowerCase().indexOf(currentSearchFilterLower) >= 0)));
}
}
}

View File

@ -30,7 +30,7 @@ var meshCentralSourceFiles = [
"../views/xterm.handlebars",
"../views/message.handlebars",
"../views/messenger.handlebars",
"../public/player.htm"
"../views/player.handlebars"
];
// True is this module is run directly using NodeJS

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
<meta name="format-detection" content="telephone=no" />
<link type="text/css" href="styles/style.css" media="screen" rel="stylesheet" title="CSS" />
<script type="text/javascript" src="scripts/common-0.0.1.js"></script>
<title>{{{title}}} - Agent Installation</title>
<title>Agent Installation</title>
<style>
.tab {
overflow: hidden;
@ -71,7 +71,7 @@
</div>
</div>
<div id="column_l" style="max-height:calc(100vh - 135px);overflow-y:auto">
<h1>Remote Agent Installation<span id="groupname"></span></h1>
<h1><span id="groupname">Remote Agent Installation</span></h1>
<p>
You have been invited to install a software that will allow a remote operator to fully access your computer remotely including the desktop and files.
Only follow the instructions below if this invitation was expected and you know who will be accessing your computer.
@ -139,12 +139,18 @@
var domain = '{{{domain}}}';
var domainUrl = '{{{domainurl}}}';
var meshid = '{{{meshid}}}';
var title = '{{{title}}}';
var serverPort = '{{{serverport}}}';
var serverHttps = '{{{serverhttps}}}';
var serverNoProxy = '{{{servernoproxy}}}';
var installFlags = '{{{installflags}}}';
var groupName = decodeURIComponent('{{{meshname}}}');
if (groupName != '') { QH('groupname', ' for ' + groupName); }
if (groupName != '') {
QH('groupname', format("Remote Agent Installation for {0}", groupName));
document.title = format("{0} - Agent Installation");
} else {
document.title = "Agent Installation";
}
userInterfaceSelectMenu();
setup();

View File

@ -3863,13 +3863,13 @@
function onSearchInputChanged() {
var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', Q('SearchInput').value);
var userSearch = null, ipSearch = null, groupSearch = null, tagSearch = null;
if (x.startsWith("user:")) { userSearch = x.substring(5); }
else if (x.startsWith("u:")) { userSearch = x.substring(2); }
else if (x.startsWith("ip:")) { ipSearch = x.substring(3); }
else if (x.startsWith("group:")) { groupSearch = x.substring(6); }
else if (x.startsWith("g:")) { groupSearch = x.substring(2); }
else if (x.startsWith("tag:")) { tagSearch = Q('SearchInput').value.trim().substring(4); }
else if (x.startsWith("t:")) { tagSearch = Q('SearchInput').value.trim().substring(2); }
if (x.startsWith("user:".toLowerCase())) { userSearch = x.substring("user:".length); }
else if (x.startsWith("u:".toLowerCase())) { userSearch = x.substring("u:".length); }
else if (x.startsWith("ip:".toLowerCase())) { ipSearch = x.substring("ip:".length); }
else if (x.startsWith("group:".toLowerCase())) { groupSearch = x.substring("group:".length); }
else if (x.startsWith("g:".toLowerCase())) { groupSearch = x.substring("g:".length); }
else if (x.startsWith("tag:".toLowerCase())) { tagSearch = Q('SearchInput').value.trim().substring("tag:".length); }
else if (x.startsWith("t:".toLowerCase())) { tagSearch = Q('SearchInput').value.trim().substring("t:".length); }
if (x == '') {
// No search

View File

@ -2087,6 +2087,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
}
}
// Server the player page
function handlePlayerRequest(req, res) {
const domain = checkUserIpAddress(req, res);
if ((domain == null) || (domain.redirects == null)) { res.sendStatus(404); return; }
parent.debug('web', 'handlePlayerRequest: sending player');
res.set({ 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0' });
render(req, res, getRenderPage('player', req), getRenderArgs({}, domain));
}
// Handle domain redirection
obj.handleDomainRedirect = function (req, res) {
const domain = checkUserIpAddress(req, res);
@ -3525,6 +3535,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
obj.app.get(url + 'logo.png', handleLogoRequest);
obj.app.post(url + 'translations', handleTranslationsRequest);
obj.app.get(url + 'welcome.jpg', handleWelcomeImageRequest);
obj.app.get(url + 'player.htm', handlePlayerRequest);
obj.app.get(url + 'player', handlePlayerRequest);
obj.app.ws(url + 'amtactivate', handleAmtActivateWebSocket);
if (parent.pluginHandler != null) {
obj.app.get(url + 'pluginadmin.ashx', obj.handlePluginAdminReq);