mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-10 07:01:21 +00:00
Fix history truncation.
This commit is contained in:
@@ -24,21 +24,21 @@ GuacamoleHistory = new (function() {
|
|||||||
|
|
||||||
function truncate() {
|
function truncate() {
|
||||||
|
|
||||||
// Avoid history growth beyond defined number of entries
|
// Build list of entries
|
||||||
if (history.length > IDEAL_LENGTH) {
|
var entries = [];
|
||||||
|
for (var old_id in history)
|
||||||
|
entries.push(history[old_id]);
|
||||||
|
|
||||||
// Build list of entries
|
// Avoid history growth beyond defined number of entries
|
||||||
var entries = [];
|
if (entries.length > IDEAL_LENGTH) {
|
||||||
for (var old_entry in history)
|
|
||||||
entries.push(old_entry);
|
|
||||||
|
|
||||||
// Sort list
|
// Sort list
|
||||||
entries.sort(GuacamoleHistory.Entries.compare);
|
entries.sort(GuacamoleHistory.Entry.compare);
|
||||||
|
|
||||||
// Remove entries until length is ideal or all are recent
|
// Remove entries until length is ideal or all are recent
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
while (entries.length > IDEAL_LENGTH
|
while (entries.length > IDEAL_LENGTH
|
||||||
&& entries[0].accessed - now > CUTOFF_AGE) {
|
&& now - entries[0].accessed > CUTOFF_AGE) {
|
||||||
|
|
||||||
// Remove entry
|
// Remove entry
|
||||||
var removed = entries.shift();
|
var removed = entries.shift();
|
||||||
|
@@ -366,6 +366,14 @@ GuacamoleHistory.onchange = function(id, old_entry, new_entry) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This window has no name. We need it to have no name. If someone navigates
|
||||||
|
* to the root UI within the same window as a previous connection, we need to
|
||||||
|
* remove the name from that window such that new attempts to use that previous
|
||||||
|
* connection do not replace the contents of this very window.
|
||||||
|
*/
|
||||||
|
window.name = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update session state when auto-fit checkbox is changed
|
* Update session state when auto-fit checkbox is changed
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user