mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
@@ -1,5 +1,5 @@
|
|||||||
KeePassDX(4.1.2)
|
KeePassDX(4.1.2)
|
||||||
* Fix URL matching in presence of a path #1940
|
* Fix URL matching in presence of a path #1940 #1946 #2003
|
||||||
|
|
||||||
KeePassDX(4.1.1)
|
KeePassDX(4.1.1)
|
||||||
* Fix date parser #1933
|
* Fix date parser #1933
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ object SearchHelper {
|
|||||||
// If search provide results
|
// If search provide results
|
||||||
database.createVirtualGroupFromSearchInfo(
|
database.createVirtualGroupFromSearchInfo(
|
||||||
searchInfo.toString(),
|
searchInfo.toString(),
|
||||||
|
searchInfo.isASearchByDomain(),
|
||||||
MAX_SEARCH_ENTRY
|
MAX_SEARCH_ENTRY
|
||||||
)?.let { searchGroup ->
|
)?.let { searchGroup ->
|
||||||
if (searchGroup.numberOfChildEntries > 0) {
|
if (searchGroup.numberOfChildEntries > 0) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class SearchFiltersView @JvmOverloads constructor(context: Context,
|
|||||||
private var searchUsername: CompoundButton
|
private var searchUsername: CompoundButton
|
||||||
private var searchPassword: CompoundButton
|
private var searchPassword: CompoundButton
|
||||||
private var searchURL: CompoundButton
|
private var searchURL: CompoundButton
|
||||||
|
private var searchByURLDomain: Boolean = false
|
||||||
private var searchExpired: CompoundButton
|
private var searchExpired: CompoundButton
|
||||||
private var searchNotes: CompoundButton
|
private var searchNotes: CompoundButton
|
||||||
private var searchOther: CompoundButton
|
private var searchOther: CompoundButton
|
||||||
@@ -50,6 +51,7 @@ class SearchFiltersView @JvmOverloads constructor(context: Context,
|
|||||||
this.searchInUsernames = searchUsername.isChecked
|
this.searchInUsernames = searchUsername.isChecked
|
||||||
this.searchInPasswords = searchPassword.isChecked
|
this.searchInPasswords = searchPassword.isChecked
|
||||||
this.searchInUrls = searchURL.isChecked
|
this.searchInUrls = searchURL.isChecked
|
||||||
|
this.searchByDomain = searchByURLDomain
|
||||||
this.searchInExpired = searchExpired.isChecked
|
this.searchInExpired = searchExpired.isChecked
|
||||||
this.searchInNotes = searchNotes.isChecked
|
this.searchInNotes = searchNotes.isChecked
|
||||||
this.searchInOther = searchOther.isChecked
|
this.searchInOther = searchOther.isChecked
|
||||||
@@ -70,6 +72,7 @@ class SearchFiltersView @JvmOverloads constructor(context: Context,
|
|||||||
searchUsername.isChecked = value.searchInUsernames
|
searchUsername.isChecked = value.searchInUsernames
|
||||||
searchPassword.isChecked = value.searchInPasswords
|
searchPassword.isChecked = value.searchInPasswords
|
||||||
searchURL.isChecked = value.searchInUrls
|
searchURL.isChecked = value.searchInUrls
|
||||||
|
searchByURLDomain = value.searchByDomain
|
||||||
searchExpired.isChecked = value.searchInExpired
|
searchExpired.isChecked = value.searchInExpired
|
||||||
searchNotes.isChecked = value.searchInNotes
|
searchNotes.isChecked = value.searchInNotes
|
||||||
searchOther.isChecked = value.searchInOther
|
searchOther.isChecked = value.searchInOther
|
||||||
|
|||||||
@@ -38,7 +38,12 @@ import com.kunzisoft.keepass.database.element.node.NodeIdInt
|
|||||||
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
|
import com.kunzisoft.keepass.database.element.node.NodeIdUUID
|
||||||
import com.kunzisoft.keepass.database.element.template.Template
|
import com.kunzisoft.keepass.database.element.template.Template
|
||||||
import com.kunzisoft.keepass.database.element.template.TemplateEngine
|
import com.kunzisoft.keepass.database.element.template.TemplateEngine
|
||||||
import com.kunzisoft.keepass.database.exception.*
|
import com.kunzisoft.keepass.database.exception.DatabaseException
|
||||||
|
import com.kunzisoft.keepass.database.exception.DatabaseInputException
|
||||||
|
import com.kunzisoft.keepass.database.exception.DatabaseOutputException
|
||||||
|
import com.kunzisoft.keepass.database.exception.FileNotFoundDatabaseException
|
||||||
|
import com.kunzisoft.keepass.database.exception.MergeDatabaseKDBException
|
||||||
|
import com.kunzisoft.keepass.database.exception.SignatureDatabaseException
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDB
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX
|
||||||
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
import com.kunzisoft.keepass.database.file.DatabaseHeaderKDBX.Companion.FILE_VERSION_40
|
||||||
@@ -51,11 +56,17 @@ import com.kunzisoft.keepass.database.search.SearchHelper
|
|||||||
import com.kunzisoft.keepass.database.search.SearchParameters
|
import com.kunzisoft.keepass.database.search.SearchParameters
|
||||||
import com.kunzisoft.keepass.hardware.HardwareKey
|
import com.kunzisoft.keepass.hardware.HardwareKey
|
||||||
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
|
import com.kunzisoft.keepass.tasks.ProgressTaskUpdater
|
||||||
import com.kunzisoft.keepass.utils.*
|
import com.kunzisoft.keepass.utils.SingletonHolder
|
||||||
import com.kunzisoft.keepass.utils.StringUtil.toFormattedColorInt
|
import com.kunzisoft.keepass.utils.StringUtil.toFormattedColorInt
|
||||||
import com.kunzisoft.keepass.utils.StringUtil.toFormattedColorString
|
import com.kunzisoft.keepass.utils.StringUtil.toFormattedColorString
|
||||||
import java.io.*
|
import com.kunzisoft.keepass.utils.readAllBytes
|
||||||
import java.util.*
|
import com.kunzisoft.keepass.utils.readBytes4ToUInt
|
||||||
|
import java.io.BufferedInputStream
|
||||||
|
import java.io.File
|
||||||
|
import java.io.FileNotFoundException
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.io.OutputStream
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
|
||||||
open class Database {
|
open class Database {
|
||||||
@@ -875,6 +886,7 @@ open class Database {
|
|||||||
|
|
||||||
fun createVirtualGroupFromSearchInfo(
|
fun createVirtualGroupFromSearchInfo(
|
||||||
searchInfoString: String,
|
searchInfoString: String,
|
||||||
|
searchInfoByDomain: Boolean,
|
||||||
max: Int = Integer.MAX_VALUE
|
max: Int = Integer.MAX_VALUE
|
||||||
): Group? {
|
): Group? {
|
||||||
return mSearchHelper.createVirtualGroupWithSearchResult(this,
|
return mSearchHelper.createVirtualGroupWithSearchResult(this,
|
||||||
@@ -884,6 +896,7 @@ open class Database {
|
|||||||
searchInUsernames = false
|
searchInUsernames = false
|
||||||
searchInPasswords = false
|
searchInPasswords = false
|
||||||
searchInUrls = true
|
searchInUrls = true
|
||||||
|
searchByDomain = searchInfoByDomain
|
||||||
searchInNotes = true
|
searchInNotes = true
|
||||||
searchInOTP = false
|
searchInOTP = false
|
||||||
searchInOther = true
|
searchInOther = true
|
||||||
|
|||||||
@@ -150,11 +150,13 @@ class SearchHelper {
|
|||||||
}
|
}
|
||||||
if (searchParameters.searchInUrls) {
|
if (searchParameters.searchInUrls) {
|
||||||
if (checkSearchQuery(entry.url, searchParameters) { stringToCheck, word ->
|
if (checkSearchQuery(entry.url, searchParameters) { stringToCheck, word ->
|
||||||
try {
|
if (searchParameters.searchByDomain) {
|
||||||
stringToCheck.inTheSameDomainAs(word, sameSubDomain = true)
|
try {
|
||||||
} catch (e: Exception) {
|
stringToCheck.inTheSameDomainAs(word, sameSubDomain = true)
|
||||||
false
|
} catch (e: Exception) {
|
||||||
}
|
false
|
||||||
|
}
|
||||||
|
} else null
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -186,7 +188,7 @@ class SearchHelper {
|
|||||||
private fun checkSearchQuery(
|
private fun checkSearchQuery(
|
||||||
stringToCheck: String,
|
stringToCheck: String,
|
||||||
searchParameters: SearchParameters,
|
searchParameters: SearchParameters,
|
||||||
specialComparison: ((check: String, word: String) -> Boolean)? = null): Boolean {
|
specialComparison: ((check: String, word: String) -> Boolean?)? = null): Boolean {
|
||||||
/*
|
/*
|
||||||
// TODO Search settings
|
// TODO Search settings
|
||||||
var removeAccents = true <- Too much time, to study
|
var removeAccents = true <- Too much time, to study
|
||||||
@@ -203,13 +205,10 @@ class SearchHelper {
|
|||||||
}
|
}
|
||||||
regex.matches(stringToCheck)
|
regex.matches(stringToCheck)
|
||||||
} else {
|
} else {
|
||||||
var searchFound = true
|
searchParameters.searchQuery.split(" ").any { word ->
|
||||||
searchParameters.searchQuery.split(" ").forEach { word ->
|
specialComparison?.invoke(stringToCheck, word)
|
||||||
searchFound = searchFound
|
?: stringToCheck.contains(word, !searchParameters.caseSensitive)
|
||||||
&& (specialComparison?.invoke(stringToCheck, word)
|
|
||||||
?: stringToCheck.contains(word, !searchParameters.caseSensitive))
|
|
||||||
}
|
}
|
||||||
searchFound
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class SearchParameters() : Parcelable{
|
|||||||
var searchInSearchableGroup = true
|
var searchInSearchableGroup = true
|
||||||
var searchInRecycleBin = false
|
var searchInRecycleBin = false
|
||||||
var searchInTemplates = false
|
var searchInTemplates = false
|
||||||
|
var searchByDomain = false
|
||||||
|
|
||||||
constructor(parcel: Parcel) : this() {
|
constructor(parcel: Parcel) : this() {
|
||||||
searchQuery = parcel.readString() ?: searchQuery
|
searchQuery = parcel.readString() ?: searchQuery
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ class SearchInfo : ObjectNameResource, Parcelable {
|
|||||||
&& otpString == null
|
&& otpString == null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isASearchByDomain(): Boolean {
|
||||||
|
return toString() == webDomain && webDomain != null
|
||||||
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
if (other !is SearchInfo) return false
|
if (other !is SearchInfo) return false
|
||||||
|
|||||||
Reference in New Issue
Block a user