Allow to search on specific folders
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
/>
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ export type Query = {
|
||||
Text: string;
|
||||
Column: string;
|
||||
ExactMatch: boolean;
|
||||
Folders: string[];
|
||||
IncludeFolders: boolean[];
|
||||
|
||||
// Services
|
||||
Datawells: boolean;
|
||||
|
||||
@@ -116,6 +116,8 @@
|
||||
initialDatawells={result.Query.Datawells}
|
||||
initialGithubRecon={result.Query.GithubRecon}
|
||||
initialGravatarRecon={result.Query.GravatarRecon}
|
||||
folders={result.Query.Folders}
|
||||
initialIncludeFolders={result.Query.IncludeFolders}
|
||||
/>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<main>
|
||||
<header class="flex gap-5 flex-col">
|
||||
<h1 class="h1"><span class="text-2xl align-middle">🔍</span> Search</h1>
|
||||
<Searchbar />
|
||||
<Searchbar folders={serverInfo?.Settings.Folders} />
|
||||
</header>
|
||||
|
||||
<div class="my-10"></div>
|
||||
|
||||
Reference in New Issue
Block a user