Allow to search on specific folders

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-01-06 16:06:27 +01:00
parent 881cdfa9cb
commit 717e4136cd
7 changed files with 90 additions and 17 deletions

View File

@@ -12,6 +12,8 @@
initialDatawells = true,
initialGithubRecon = true,
initialGravatarRecon = true,
folders = [],
initialIncludeFolders = [],
}: {
initialQuery?: string;
initialFilter?: string;
@@ -19,6 +21,8 @@
initialDatawells?: boolean;
initialGithubRecon?: boolean;
initialGravatarRecon?: boolean;
folders?: string[];
initialIncludeFolders?: boolean[];
} = $props();
let filters = [
@@ -38,6 +42,16 @@
let datawells = $state<boolean>(initialDatawells);
let githubRecon = $state<boolean>(initialGithubRecon);
let gravatarRecon = $state<boolean>(initialGravatarRecon);
let includeFolders = $state<boolean[]>([]);
$effect(() => {
if (folders.length > 0 && includeFolders.length !== folders.length) {
includeFolders =
initialIncludeFolders.length === folders.length
? [...initialIncludeFolders]
: new Array(folders.length).fill(true);
}
});
function NewSearch() {
axios
@@ -50,6 +64,7 @@
Datawells: datawells,
GithubRecon: githubRecon,
GravatarRecon: gravatarRecon,
IncludeFolders: includeFolders,
},
{
headers: {
@@ -104,6 +119,23 @@
<input type="checkbox" bind:checked={datawells} class="checkbox" />
Datawells lookup
</label>
{#each folders as folder, i}
<label class="label">
{#if includeFolders[i] !== undefined}
<input
type="checkbox"
bind:checked={includeFolders[i]}
class="checkbox checkbox-xs ml-5"
disabled={!datawells}
/>
{/if}
{
folder.split("/")
.filter((part) => part.length > 0)
.pop()
}
</label>
{/each}
</li>
<li>
<label class="label">
@@ -142,14 +174,10 @@
class="grow input-xl"
type="text"
bind:value={query}
placeholder={
(
activeFilter === "all"
placeholder={(activeFilter === "all"
? "Search..."
: `Search in ${activeFilter.replace("_", " ")}...`
)+
(activeFilter === "phone" && " (e.g. 612233445)" || "")
}
: `Search in ${activeFilter.replace("_", " ")}...`) +
((activeFilter === "phone" && " (e.g. 612233445)") || "")}
required
/>