Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@
"message": "Search all open Kee Vaults and KeePass databases",
"description": ""
},
"pref_excludeExpiredEntries_label": {
"message": "Exclude expired entries",
"description": "When enabled, matching entries that have expired (Expires=true and ExpiryTime is in the past) will be hidden from the result list."
},
"pref_when_kee_chooses_standard_form_desc": {
"message": "When Kee chooses a matching login for a standard form, Kee should",
"description": "Context/label for user when changing setting relating to auto-fill/submit behaviour. A list of potential actions will be displayed immediately after this string and the user can select their preferred behaviour from that list."
Expand Down
50 changes: 0 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/background/jsonrpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export class jsonrpcClient {
username
]);
const results: Entry[] = [];
const now = new Date();
for (const sessionResponse of sessionResponses) {
if (sessionResponse.resultWrapper?.result?.[0]) {
const db = DatabaseSummary.fromKPRPCDatabaseSummaryDTO(
Expand All @@ -256,6 +257,13 @@ export class jsonrpcClient {
);
}
}
if (configManager.current.excludeExpiredEntries) {
return results.filter(entry => {
if (!entry.expires || !entry.expiryTime) return true;
const expiry = new Date(entry.expiryTime);
return isNaN(expiry.getTime()) || expiry >= now;
});
}
return results;
}

Expand Down
1 change: 1 addition & 0 deletions src/common/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ defaultConfig.theme = null;
defaultConfig.hideConfirmationAfterSave = false;
defaultConfig.mustShowReleaseNotesAtStartup = false;
defaultConfig.autoFillFieldsWithExistingValue = false;
defaultConfig.excludeExpiredEntries = false;

export class ConfigManager {
public current: Config;
Expand Down
1 change: 1 addition & 0 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ export class Config {
hideConfirmationAfterSave: boolean;
mustShowReleaseNotesAtStartup: boolean;
autoFillFieldsWithExistingValue: boolean;
excludeExpiredEntries: boolean;
}
9 changes: 8 additions & 1 deletion src/common/model/Entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class Entry {

readonly database: DatabaseSummary;

readonly expires: boolean;
readonly expiryTime: string;

// How relevant this entry is to the current form in
// the browser - transient (not stored in KeePass)
//TODO:5 put all match data into a new object?
Expand All @@ -67,6 +70,8 @@ export class Entry {
this.matchAccuracy = e.matchAccuracy || 0;
this.icon = e.icon || { version: 1, iconImageData: "" };
this.database = e.database || new Database({});
this.expires = e.expires || false;
this.expiryTime = e.expiryTime || "";
this.relevanceScore = e.relevanceScore;
this.lowFieldMatchRatio = e.lowFieldMatchRatio;
this.formIndex = e.formIndex;
Expand Down Expand Up @@ -120,7 +125,9 @@ export class Entry {
httpRealm: entryDto.hTTPRealm,
uuid: entryDto.uniqueID,
title: entryDto.title,
fields: sortedFields
fields: sortedFields,
expires: entryDto.expires,
expiryTime: entryDto.expiryTime
});

return entry;
Expand Down
2 changes: 2 additions & 0 deletions src/common/model/KPRPCDTOs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export class EntryDto {
uniqueID: string;
title: string;
formFieldList: FieldDto[];
expires: boolean;
expiryTime: string;
}

export class EntrySummaryDto {
Expand Down
3 changes: 3 additions & 0 deletions src/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ <h3 class="panel-title" data-i18n="pref_FindingEntries_heading"></h3>
<div class="checkbox">
<label><input type="checkbox" id="pref_searchAllOpenDBs_label" /><span data-i18n="pref_searchAllOpenDBs_label"></span></label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="pref_excludeExpiredEntries_label" /><span data-i18n="pref_excludeExpiredEntries_label"></span></label>
</div>
</div>
</div>

Expand Down
17 changes: 17 additions & 0 deletions src/settings/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function loadInitialConfig() {
(document.getElementById("pref_searchAllOpenDBs_label") as HTMLInputElement).checked =
configManager.current.searchAllOpenDBs ? configManager.current.searchAllOpenDBs : null;

(document.getElementById("pref_excludeExpiredEntries_label") as HTMLInputElement).checked =
configManager.current.excludeExpiredEntries
? configManager.current.excludeExpiredEntries
: null;

(
document.getElementById("pref_autoFillFormsWithMultipleMatches_label") as HTMLInputElement
).checked = configManager.current.autoFillFormsWithMultipleMatches
Expand Down Expand Up @@ -106,6 +111,9 @@ function setupInputListeners() {
document
.getElementById("pref_searchAllOpenDBs_label")
.addEventListener("change", saveSearchAllOpenDBs);
document
.getElementById("pref_excludeExpiredEntries_label")
.addEventListener("change", saveExcludeExpiredEntries);
document
.getElementById("pref_autoFillFormsWithMultipleMatches_label")
.addEventListener("change", saveAutoFillFormsWithMultipleMatches);
Expand Down Expand Up @@ -948,6 +956,15 @@ function saveSearchAllOpenDBs(e) {
});
}

function saveExcludeExpiredEntries(e) {
e.preventDefault();
configManager.setASAP({
excludeExpiredEntries: (
document.getElementById("pref_excludeExpiredEntries_label") as HTMLInputElement
).checked
});
}

function saveAutoFillFormsWithMultipleMatches(e) {
e.preventDefault();
configManager.setASAP({
Expand Down