From a1f25c18accdeb8e0f997820ba4018d6acfffe29 Mon Sep 17 00:00:00 2001 From: dextmorgn Date: Sun, 30 Mar 2025 22:01:52 +0200 Subject: [PATCH] Refresh ignored files --- .../app/__pycache__/__init__.cpython-311.pyc | Bin 192 -> 0 bytes .../core/__pycache__/celery.cpython-311.pyc | Bin 730 -> 0 bytes .../app/core/__pycache__/db.cpython-311.pyc | Bin 850 -> 0 bytes .../__pycache__/__init__.cpython-311.pyc | Bin 198 -> 0 bytes .../__pycache__/email_scanner.cpython-311.pyc | Bin 2349 -> 0 bytes .../__pycache__/__init__.cpython-311.pyc | Bin 200 -> 0 bytes .../__pycache__/email_scanner.cpython-311.pyc | Bin 2355 -> 0 bytes flowsint-web/lib/utils.ts | 6 - .../src/components/dashboard/new-project.tsx | 2 +- flowsint-web/src/lib/actions/auth.ts | 70 ----- .../src/lib/actions/investigations.ts | 25 -- flowsint-web/src/lib/actions/search.ts | 77 ------ .../hooks/individuals/use-emails-breaches.ts | 39 --- .../lib/hooks/individuals/use-individual.ts | 29 -- .../lib/hooks/individuals/use-relations.ts | 36 --- .../lib/hooks/investigation/investigation.ts | 34 --- .../lib/hooks/investigation/use-emails.tsx | 25 -- .../hooks/investigation/use-individuals.tsx | 25 -- .../lib/hooks/investigation/use-phones.tsx | 25 -- .../investigation/use-search-results.tsx | 19 -- .../lib/hooks/investigation/use-socials.ts | 25 -- .../src/lib/hooks/investigation/usernames.tsx | 21 -- .../src/lib/hooks/use-local-storage.ts | 42 --- .../src/lib/hooks/use-platform-icons.tsx | 27 -- flowsint-web/src/lib/supabase/client.ts | 7 - flowsint-web/src/lib/supabase/middleware.ts | 65 ----- flowsint-web/src/lib/supabase/server.ts | 43 --- flowsint-web/src/lib/utils.ts | 260 ------------------ 28 files changed, 1 insertion(+), 901 deletions(-) delete mode 100644 flowsint-api/app/__pycache__/__init__.cpython-311.pyc delete mode 100644 flowsint-api/app/core/__pycache__/celery.cpython-311.pyc delete mode 100644 flowsint-api/app/core/__pycache__/db.cpython-311.pyc delete mode 100644 flowsint-api/app/tasks/__pycache__/__init__.cpython-311.pyc delete mode 100644 flowsint-api/app/tasks/__pycache__/email_scanner.cpython-311.pyc delete mode 100644 flowsint-api/app/workers/__pycache__/__init__.cpython-311.pyc delete mode 100644 flowsint-api/app/workers/__pycache__/email_scanner.cpython-311.pyc delete mode 100644 flowsint-web/lib/utils.ts delete mode 100644 flowsint-web/src/lib/actions/auth.ts delete mode 100644 flowsint-web/src/lib/actions/investigations.ts delete mode 100644 flowsint-web/src/lib/actions/search.ts delete mode 100644 flowsint-web/src/lib/hooks/individuals/use-emails-breaches.ts delete mode 100644 flowsint-web/src/lib/hooks/individuals/use-individual.ts delete mode 100644 flowsint-web/src/lib/hooks/individuals/use-relations.ts delete mode 100644 flowsint-web/src/lib/hooks/investigation/investigation.ts delete mode 100644 flowsint-web/src/lib/hooks/investigation/use-emails.tsx delete mode 100644 flowsint-web/src/lib/hooks/investigation/use-individuals.tsx delete mode 100644 flowsint-web/src/lib/hooks/investigation/use-phones.tsx delete mode 100644 flowsint-web/src/lib/hooks/investigation/use-search-results.tsx delete mode 100644 flowsint-web/src/lib/hooks/investigation/use-socials.ts delete mode 100644 flowsint-web/src/lib/hooks/investigation/usernames.tsx delete mode 100644 flowsint-web/src/lib/hooks/use-local-storage.ts delete mode 100644 flowsint-web/src/lib/hooks/use-platform-icons.tsx delete mode 100644 flowsint-web/src/lib/supabase/client.ts delete mode 100644 flowsint-web/src/lib/supabase/middleware.ts delete mode 100644 flowsint-web/src/lib/supabase/server.ts delete mode 100644 flowsint-web/src/lib/utils.ts diff --git a/flowsint-api/app/__pycache__/__init__.cpython-311.pyc b/flowsint-api/app/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 2d127c6f79c97a4c1018b47c504d9a84b2d3aae3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192 zcmZ3^%ge<81TQ7_r-SInAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnuVDSq;?$yI z{nVVy{F0K~{G#N{oSb}pm;B_?+|<01V*P-keEp)-^4fI72tF zAX7iFpg=!9J~J<~BtBlRpz;@oO>TZlX-=wL5i8IRkSmJ$fy4)9Mn=XD3^1aI87Kw- D+-@>+ diff --git a/flowsint-api/app/core/__pycache__/celery.cpython-311.pyc b/flowsint-api/app/core/__pycache__/celery.cpython-311.pyc deleted file mode 100644 index 1a22136312fb31e48e0f39a6db7c9937c720f45b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 730 zcmY*Xy^GX96n~Rsv)Ru>Tyw5gS|};p2!f)Bjn*QFR~$&lW!^2hO)~3D!f{(!SX?PK zHX>WC=-vO|zpyUCEmIv>*+tIkDkoX9;>*0>`^dcado#?ZPNxYkw%^#t8X=w00x5FTy09 z^f=N`JaFBWy?f{0efRcc(;trqsV_!ifUzG&o(TLTLGI|%+~I75T-JB|V1x;k^)Lyd zjG}D*+bV0XGR#n#WlBh6Pq4(%WUJ`uah9bhl|@8?~+pe>d!TwQ?Pd LE9yVD)rfxpKs?B@ diff --git a/flowsint-api/app/core/__pycache__/db.cpython-311.pyc b/flowsint-api/app/core/__pycache__/db.cpython-311.pyc deleted file mode 100644 index b3db0d026f90ecbb19fc685fd647c93ff1840243..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 850 zcmZ`%&1(}u6rb5_Hpy<5fK}+BlpdRc?!nYk5vt~-meLTxy@buqG_1^K!pyEx@erj* z4<34JFCL8_@qh4NNFax>AQU`#3*^?5Z#GG5i@u%tz0Y|wzsG*IZ4-gKKmO7Bh7tOu zoP}iO#`FsqCx{?|8FH1@7!Ea8!^+OEOsKnhn02!lX^3h)sO~R%pfrYF7>fYWdvH%5 z_DtLyocTMSy_V0@oX}`qT2NOY#?|aQOmZ~4uaW$r?wSPGP`U71HQp)X#A4hd4Z#cogckQ#%@{#y(aJo7yt&d9U-QxIq;4HT^ jK^SkIZl!8$-aOhE+`2n7D^4fI72tF zAX7iFpg_MQu{gU}KR!M)FS8^*Uaz3?7l%!5eoARhs$CH)&?b;uiur-W2WCb_#t#fI JqKFwN1^`dyG}Hh9 diff --git a/flowsint-api/app/tasks/__pycache__/email_scanner.cpython-311.pyc b/flowsint-api/app/tasks/__pycache__/email_scanner.cpython-311.pyc deleted file mode 100644 index 1160ab7e556a198f3a90c92bee9a1234bbe03d5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2349 zcmc&#O=ufO6rSDHu2w6{KZ;dHPHHQONfE9kQV3~FQfM5P6hd0srolQ?taeB8D!W=` zc2(O&E+OP#a;Xc3q%;M!l*A!9g7)?GUrO^LLccSn*Q6KV$xi^TAsy+QiE`bM%W=T-CT|Hjfnzek z3|V4M^l`|PtZ**uW6_kYNG{@I$yBUpF6!g3Ib_9hF%IzvN6W*#OLbX~+*NM!2;G6N z+hB!&BR4sa!Pjj?PLJXdeF(>jAw70Qyb0nvy-AcC)wz#RdiW0}Ih*Ea_!O?jglHhD}UX^J=xq(aOAyO(U`(0_YD9lTJN4DSDU#X4&Ab7){ELhjUnE06ZDd#HyHs*AywD)+rm zm-NUD{^e|hR}wEn_OFRwip$(GS`ik}GMA2?g~%twCR8pO6~kG=kP0k69LNtp=V}fO zLyFZ**P*n{PPWfVFf$dBgm6WSG7v4_678$Q-d3UvnX_O%gJC0hyFd_Q+OG6fR z)$|@3R-M&~X4q69wF+U;N<~*Kn3zhnst%b>d3=#we6fZdmyELoVZ4I18canNRy167 z4ZA`kE>SgHP_+wGVMRf8^KdWRRy7TmidAAj+7ES)%=;=3mPR!E-n;LgIrq^54f)E- z`8=xy`FuJ|Lk>2JgoP)GF|vmd_PU_b3X~9LbKbN|j>8ft)osr|%bs&EakAJnY}d7H zq8X-XXHVH$&4SY7WIrT!mSD}U)JO?ui>AHofNp&-r&f(DRI4m|N;sxps4AFbs;eZz zv|xnglS82LTtc1Dq&W5{p4^=MZR+Sf+?qPxo;u!&pJ>NVtcM>?AKof8r;kG4nB18B z`PjPT$;wyqRe58gB`4c*@`0S%mQ&s<`@M;&jwl>dIta*PBt)W58TnH}L&I0!Sl2gB zZJycupcS2IM`v!G|Ka@ii$5+l7QNBE*I#Rn9Bj%5pY24)J7`oK8<3sER6CJwC1%@+ z*$0Uu+leFhW?G43?ZmNlWk-%RhhJ|fK%lqexwbsll;{3Iy;r@x)3A18_TT6z4?U2R z+j4RzzIQY8Xn(2^|K{|K)9w9p-gFwyiw}d%KtvRoe2k=s@|2N|PvU4~Y+Zf^t#bfO zgV9OC+h0BzKB=Jlin4H6xIaE0TR0&6dO!pwJw{l55>~KixTr$3RSm*QJC(ZsM%~a$ zf|oPPHn{-dk_q^^n+H)guh|4=^a5eknvV1(FV10sM`fp0RSPOa9V^%n$PhSGfMoH* z|e`y2&5x$9Ot3YX0Ll__>%wg(7tA{dnnlqb`PCs z2D^u*n!)a&!_8p-`^g;%@ne@JuS{>4TjNbG)8aC1F5_j6Zk6s8Z`*h64%){-WC6K8 b?+=Yn2O=Lm77(9>O&z|s(if9A!N|V=jTb0H diff --git a/flowsint-api/app/workers/__pycache__/__init__.cpython-311.pyc b/flowsint-api/app/workers/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index 4e9e13de0be8aec357eb33c16cbc6cbaca20314a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 200 zcmZ3^%ge<81RWFir-SInAOZ#$p^VRLK*n^26oz01O-8?!3`I;p{%4TnuW0?y;?$yI z{nVVy{F0K~{G#N{oSb}pm;B_?+|<01V*P-keEp)-^4fI72tF zAX7iFpg_MozbG4IP<(u5US>&ryk0@&FAkgB{FKt1RJ$Tppj{x>6!Qa#56p~=j2{?a JL=iJk3;^P?HO~M5 diff --git a/flowsint-api/app/workers/__pycache__/email_scanner.cpython-311.pyc b/flowsint-api/app/workers/__pycache__/email_scanner.cpython-311.pyc deleted file mode 100644 index adbcbda1c5c612dc6942547e7e1d510478f81254..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2355 zcma)7U1-}@6uy!yS^kUd*iA@(MbfPEpf#mGTSHe!^TS5l^e42?K=D-R#*wEVb0w3X zNn@jBP*(4ab9UJP605;V>$vhYa2e8G^?fVNWnbFKk3S zvGFXVM~#>lG2&jdA@h2|i@C9-jxE00@FAc_ZOMxlk(Y4!5+tcPT%puT5OTvMvAr&q zB5ll++UIcD5=7q|E?45(I8@@>I8vf#Z45VBinnkv>UFps!|2xMUJ~L+MG%YJq>J3R zn|cVA9<{CAK`Q?NcLObQpM)6XrpReGr81i@V=39Pxph{BhY;tZcB~)oa}!Ictr{)7 z-P-nD3|hF_hn(J)E<%S9Ipd{wv!#Yr(M^^*Tlx=>8gY)aB!t}bcKZ*|7a@(=zQ&-N zaAGh0VS3@y<~+?zqZ#fdnr76fo6wkX^ioU*y)^ia{f94BV-&V!eSE{qruAHW&W=hj zuG`p_-m!E%g(b(5Y%CLHN}9BY)Tn4lRurpZIyL}e*|uaob2h0#`gOV*-lMS(HvZ+RB5kdb%G}CtEB9V`ZHpgGnITrd(F0WGBZ5f^5ih zmKmgEVpIqw8kQ?Fm=GL9Oc^>%zFnCOgd#lE%pjs#Fj@8_$+56#Sw$TO{H#1>S!02K zXP`-KXi!2dG8Y-4lcbr_96KNd;f+}54va$kVwI*qGc`w(b!`rBlch+5kcKPTeW1T-MAYp)ElYl+mUow3-Pm)F8WK2mP4X zBu$^w0t@&l$0^SQu|a#*REBg7oABK!Vh0jcE@M*-A|o>jE;}0JOe_>k*}#QDz}XJT zbrRb2J3`zwl1-n4wp}174QFHz6~Y^b4}>NN63w~L%woV`n?_5^YWsNcULNX<*m5 zBAX^A$I7!ocNr6?TBFd+Bn_!i%H%bOC-yE!bSh zEL`^E*;@R-#|*|Cy)#XI5Tc>mRE14^{gw``LYqWB10E z-d;}E`cAB6Pu8+0tJ#z5>%V9A!$$D4mHVmg#g2O&OW|tn%JPlJ1(<+-<9;6eMfg={ zO4UPG*HYJNscY4jXdOnKqedwZP=6Ms@S*wXDkbj;GJ#d;I7&;_bG6r zbpfQ5JYN-e(uQH!4#<8NYT@qSx#1r46E_$eO0rKn7!aN$qr;v2lb-x=f?pMRSXoW* zu(H}IP}~z8VYt=4%0FnN(Y!w)sn_+y^Tiu=N!VzYO`6^RKbY9Lbt1Bmdnu2SKxC email) || [] - - const { data: breaches, error: breachesError, mutate } = useQuery( - emailAddresses.length > 0 - ? supabase.from("accounts_breaches").select(`account, breach:breach_id(raw_content)`).in("account", emailAddresses) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - }, - ) - - const formattedData = emailAddresses.map((email: string) => ({ - email, - breaches: breaches?.filter((breach: any) => breach.account === email).map((breach: any) => breach.breach.raw_content) || [], - })) - - const isLoading = !emails && !error - - return { - emails: formattedData, - isLoading, - refetch: mutate, - error: error || breachesError, - } -} - diff --git a/flowsint-web/src/lib/hooks/individuals/use-individual.ts b/flowsint-web/src/lib/hooks/individuals/use-individual.ts deleted file mode 100644 index 03d9dcb..0000000 --- a/flowsint-web/src/lib/hooks/individuals/use-individual.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useIndividual(individualId: string | null | undefined) { - const { data: individual, mutate, isLoading, error } = useQuery(Boolean(individualId) ? - supabase - .from('individuals') - .select(` - *, - ip_addresses(*), - phone_numbers(*), - social_accounts(*), - emails(*) - `) - .eq("id", individualId) - .single() : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { - individual: individual || null, - isLoading, - refetch: mutate, - error: error - }; -} - diff --git a/flowsint-web/src/lib/hooks/individuals/use-relations.ts b/flowsint-web/src/lib/hooks/individuals/use-relations.ts deleted file mode 100644 index e05c590..0000000 --- a/flowsint-web/src/lib/hooks/individuals/use-relations.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useRelations(individualId: string | null | undefined) { - const { data: individuals, mutate, isLoading, error } = useQuery( - Boolean(individualId) - ? supabase - .from("relationships") - .select(` - id, - individual_a(id, full_name, image_url), - individual_b(id, full_name, image_url), - relation_type, - confidence_level - `) - .or(`individual_a.eq.${individualId},individual_b.eq.${individualId}`) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - const relations = individuals - ? individuals.map((rel: { individual_a: any, individual_b: any, relation_type: string }) => { - return rel.individual_a?.id === individualId - ? { ...rel.individual_b, relation_type: rel.relation_type } - : { ...rel.individual_a, relation_type: rel.relation_type } - }).filter(Boolean) - : []; - return { - relations, - isLoading, - refetch: mutate, - error - }; -} diff --git a/flowsint-web/src/lib/hooks/investigation/investigation.ts b/flowsint-web/src/lib/hooks/investigation/investigation.ts deleted file mode 100644 index 78df521..0000000 --- a/flowsint-web/src/lib/hooks/investigation/investigation.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useInvestigations(project_id: string) { - const { data: investigations, count, mutate, isLoading, error } = useQuery( - supabase - .from('investigations') - .select('id, title, description') - .eq("project_id", project_id) - .order("last_updated_at", { ascending: false }), - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - - return { investigations, count, isLoading, refetch: mutate, error }; -} - -export function useInvestigation(investigationId: string | string[] | undefined) { - if (!investigationId) return { investigation: null } - const { data: investigation, mutate, isLoading, error } = useQuery( - supabase - .from('investigations') - .select('id, title, description') - .eq("id", investigationId) - .single(), - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { investigation: investigation ?? null, isLoading, refetch: mutate, error }; -} \ No newline at end of file diff --git a/flowsint-web/src/lib/hooks/investigation/use-emails.tsx b/flowsint-web/src/lib/hooks/investigation/use-emails.tsx deleted file mode 100644 index 872b70b..0000000 --- a/flowsint-web/src/lib/hooks/investigation/use-emails.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useEmails(investigationId: string | null | undefined) { - const { data: emails, mutate, isLoading, error } = useQuery(Boolean(investigationId) ? - supabase - .from('emails') - .select(` - * - `) - .eq("investigation_id", investigationId) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { - emails: emails || null, - isLoading, - refetch: mutate, - error: error - }; -} - diff --git a/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx b/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx deleted file mode 100644 index e74a1cb..0000000 --- a/flowsint-web/src/lib/hooks/investigation/use-individuals.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useIndividuals(investigationId: string | null | undefined) { - const { data: individuals, mutate, isLoading, error } = useQuery(Boolean(investigationId) ? - supabase - .from('individuals') - .select(` - * - `) - .eq("investigation_id", investigationId) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { - individuals: individuals || null, - isLoading, - refetch: mutate, - error: error - }; -} - diff --git a/flowsint-web/src/lib/hooks/investigation/use-phones.tsx b/flowsint-web/src/lib/hooks/investigation/use-phones.tsx deleted file mode 100644 index 36cc49d..0000000 --- a/flowsint-web/src/lib/hooks/investigation/use-phones.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function usePhones(investigationId: string | null | undefined) { - const { data: phones, mutate, isLoading, error } = useQuery(Boolean(investigationId) ? - supabase - .from('phone_numbers') - .select(` - * - `) - .eq("investigation_id", investigationId) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { - phones: phones || null, - isLoading, - refetch: mutate, - error: error - }; -} - diff --git a/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx b/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx deleted file mode 100644 index 56bc29b..0000000 --- a/flowsint-web/src/lib/hooks/investigation/use-search-results.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useSearchResults(search: string | undefined, investigationId: string | string[] | undefined) { - const { data: results, count, mutate, isLoading, error } = useQuery(search ? - supabase - .from('individuals') - .select('*') - .eq("investigation_id", investigationId) - .ilike('full_name', `%${search}%`) : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - if (error) throw error - - return { results, count, isLoading, refetch: mutate, error }; -} \ No newline at end of file diff --git a/flowsint-web/src/lib/hooks/investigation/use-socials.ts b/flowsint-web/src/lib/hooks/investigation/use-socials.ts deleted file mode 100644 index f3afe6a..0000000 --- a/flowsint-web/src/lib/hooks/investigation/use-socials.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useSocials(investigationId: string | null | undefined) { - const { data: socials, mutate, isLoading, error } = useQuery(Boolean(investigationId) ? - supabase - .from('social_accounts') - .select(` - * - `) - .eq("investigation_id", investigationId) - : null, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - return { - socials: socials || null, - isLoading, - refetch: mutate, - error: error - }; -} - diff --git a/flowsint-web/src/lib/hooks/investigation/usernames.tsx b/flowsint-web/src/lib/hooks/investigation/usernames.tsx deleted file mode 100644 index 6d383c9..0000000 --- a/flowsint-web/src/lib/hooks/investigation/usernames.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { supabase } from "@/lib/supabase/client"; -import { useQuery } from "@supabase-cache-helpers/postgrest-swr"; - -export function useUsernames(investigationId: string | string[] | undefined) { - if (!investigationId) return { usernames: [] } - const { data: usernames, count, mutate, isLoading, error } = useQuery( - supabase - .from('social_accounts') - .select('id, username') - .eq("investigation_id", investigationId) - .not('username', 'is', null) - .neq('username', ''), - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } - ); - if (error) throw error - - return { usernames, count, isLoading, refetch: mutate, error }; -} \ No newline at end of file diff --git a/flowsint-web/src/lib/hooks/use-local-storage.ts b/flowsint-web/src/lib/hooks/use-local-storage.ts deleted file mode 100644 index ee49f09..0000000 --- a/flowsint-web/src/lib/hooks/use-local-storage.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Dispatch, SetStateAction, useEffect, useState } from 'react'; - -export default function useLocalStorage(key: string, initialValue: T): [T, Dispatch>] { - const [storedValue, setStoredValue] = useState(initialValue); - const [firstLoadDone, setFirstLoadDone] = useState(false); - - useEffect(() => { - const fromLocal = () => { - if (typeof window === 'undefined') { - return initialValue; - } - try { - const item = window.localStorage.getItem(key); - return item ? JSON.parse(item) as T : initialValue; - } catch (error) { - console.error(error); - return initialValue; - } - }; - - // Only set stored value if it hasn't been set yet (on initial load) - if (!firstLoadDone) { - setStoredValue(fromLocal()); - setFirstLoadDone(true); - } - }, [firstLoadDone, initialValue, key]); // Only run when first load is done, initialValue, or key change - - useEffect(() => { - - if (!firstLoadDone) return; - - try { - if (typeof window !== 'undefined') { - window.localStorage.setItem(key, JSON.stringify(storedValue)); - } - } catch (error) { - console.log(error); - } - }, [storedValue, firstLoadDone, key]); // Update localStorage when storedValue changes - - return [storedValue, setStoredValue]; -} \ No newline at end of file diff --git a/flowsint-web/src/lib/hooks/use-platform-icons.tsx b/flowsint-web/src/lib/hooks/use-platform-icons.tsx deleted file mode 100644 index e0485c0..0000000 --- a/flowsint-web/src/lib/hooks/use-platform-icons.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useMemo } from "react" -import { CameraIcon, FacebookIcon, GithubIcon, InstagramIcon, MessageCircleDashedIcon, SendIcon } from 'lucide-react'; - -export const usePlatformIcons = (size = "small") => { - const className = size === "small" ? 'h-3 w-3' : 'h-5 w-5' - const platformsIcons = useMemo(() => ({ - "facebook": { - icon: , color: "indigo" - }, - "instagram": { - icon: , color: "plum" - }, - "telegram": { - icon: , color: "cyan" - }, - "signal": { - icon: , color: "blue" - }, - "snapchat": { - icon: , color: "yellow" - }, - "github": { - icon: , color: "gray" - }, - }), []) - return platformsIcons -} \ No newline at end of file diff --git a/flowsint-web/src/lib/supabase/client.ts b/flowsint-web/src/lib/supabase/client.ts deleted file mode 100644 index e823222..0000000 --- a/flowsint-web/src/lib/supabase/client.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { createBrowserClient } from '@supabase/ssr' - -if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) { - throw new Error('Missing Supabase environment variables'); -} - -export const supabase = createBrowserClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY) \ No newline at end of file diff --git a/flowsint-web/src/lib/supabase/middleware.ts b/flowsint-web/src/lib/supabase/middleware.ts deleted file mode 100644 index 21a5df1..0000000 --- a/flowsint-web/src/lib/supabase/middleware.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { createServerClient } from '@supabase/ssr' -import { NextResponse, type NextRequest } from 'next/server' - -export async function updateSession(request: NextRequest) { - let supabaseResponse = NextResponse.next({ - request, - }) - const supabase = createServerClient( - process.env.NEXT_PUBLIC_DOCKER_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - getAll() { - return request.cookies.getAll() - }, - setAll(cookiesToSet) { - cookiesToSet.forEach(({ name, value, options }) => request.cookies.set(name, value)) - supabaseResponse = NextResponse.next({ - request, - }) - cookiesToSet.forEach(({ name, value, options }) => - supabaseResponse.cookies.set(name, value, options) - ) - }, - }, - } - ) - - // Do not run code between createServerClient and - // supabase.auth.getUser(). A simple mistake could make it very hard to debug - // issues with users being randomly logged out. - - // IMPORTANT: DO NOT REMOVE auth.getUser() - - const { - data: { user }, - } = await supabase.auth.getUser() - - if ( - !user && - !request.nextUrl.pathname.startsWith('/login') && - !request.nextUrl.pathname.startsWith('/auth') && - !request.nextUrl.pathname.startsWith('/api') - ) { - // no user, potentially respond by redirecting the user to the login page - const url = request.nextUrl.clone() - url.pathname = '/login' - return NextResponse.redirect(url) - } - - // IMPORTANT: You *must* return the supabaseResponse object as it is. - // If you're creating a new response object with NextResponse.next() make sure to: - // 1. Pass the request in it, like so: - // const myNewResponse = NextResponse.next({ request }) - // 2. Copy over the cookies, like so: - // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll()) - // 3. Change the myNewResponse object to fit your needs, but avoid changing - // the cookies! - // 4. Finally: - // return myNewResponse - // If this is not done, you may be causing the browser and server to go out - // of sync and terminate the user's session prematurely! - - return supabaseResponse -} \ No newline at end of file diff --git a/flowsint-web/src/lib/supabase/server.ts b/flowsint-web/src/lib/supabase/server.ts deleted file mode 100644 index cbbb6d7..0000000 --- a/flowsint-web/src/lib/supabase/server.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { createServerClient } from '@supabase/ssr' -import { cookies } from 'next/headers' - -export async function createClient() { - const cookieStore = await cookies() - const supabaseToken = cookieStore.get('sb-token')?.value - - return createServerClient( - process.env.NEXT_PUBLIC_DOCKER_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - auth: { - persistSession: false, - // Add the token if it exists - ...(supabaseToken && { - autoRefreshToken: false, - detectSessionInUrl: false, - storage: { - getItem: () => supabaseToken, - setItem: () => { }, - removeItem: () => { }, - }, - }), - }, - cookies: { - getAll() { - return cookieStore.getAll() - }, - setAll(cookiesToSet) { - try { - cookiesToSet.forEach(({ name, value, options }) => - cookieStore.set(name, value, options) - ) - } catch { - // The `setAll` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - }, - } - ) -} \ No newline at end of file diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.ts deleted file mode 100644 index c2d4678..0000000 --- a/flowsint-web/src/lib/utils.ts +++ /dev/null @@ -1,260 +0,0 @@ -import { clsx, type ClassValue } from "clsx" -import { twMerge } from "tailwind-merge" -//@ts-ignore -import * as d3 from "d3-force" - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) -} - -export const zoomSelector = (s: { transform: number[]; }) => s.transform[2] >= 0.6; - -import { Position, MarkerType } from '@xyflow/react'; -import { AppNode } from "@/store/flow-store"; - -// this helper function returns the intersection point -// of the line between the center of the intersectionNode and the target node -function getNodeIntersection(intersectionNode: { measured: { width: any; height: any; }; internals: { positionAbsolute: any; }; }, targetNode: { internals: { positionAbsolute: any; }; measured: { width: number; height: number; }; }) { - // https://math.stackexchange.com/questions/1724792/an-algorithm-for-finding-the-intersection-point-between-a-center-of-vision-and-a - const { width: intersectionNodeWidth, height: intersectionNodeHeight } = - intersectionNode.measured; - const intersectionNodePosition = intersectionNode.internals.positionAbsolute; - const targetPosition = targetNode.internals.positionAbsolute; - - const w = intersectionNodeWidth / 2; - const h = intersectionNodeHeight / 2; - - const x2 = intersectionNodePosition.x + w; - const y2 = intersectionNodePosition.y + h; - const x1 = targetPosition.x + targetNode.measured.width / 2; - const y1 = targetPosition.y + targetNode.measured.height / 2; - - const xx1 = (x1 - x2) / (2 * w) - (y1 - y2) / (2 * h); - const yy1 = (x1 - x2) / (2 * w) + (y1 - y2) / (2 * h); - const a = 1 / (Math.abs(xx1) + Math.abs(yy1)); - const xx3 = a * xx1; - const yy3 = a * yy1; - const x = w * (xx3 + yy3) + x2; - const y = h * (-xx3 + yy3) + y2; - - return { x, y }; -} - -// returns the position (top,right,bottom or right) passed node compared to the intersection point -function getEdgePosition(node: { internals: { positionAbsolute: any; }; }, intersectionPoint: { x: any; y: any; }) { - const n = { ...node.internals.positionAbsolute, ...node }; - const nx = Math.round(n.x); - const ny = Math.round(n.y); - const px = Math.round(intersectionPoint.x); - const py = Math.round(intersectionPoint.y); - - if (px <= nx + 1) { - return Position.Left; - } - if (px >= nx + n.measured.width - 1) { - return Position.Right; - } - if (py <= ny + 1) { - return Position.Top; - } - if (py >= n.y + n.measured.height - 1) { - return Position.Bottom; - } - - return Position.Top; -} - -// returns the parameters (sx, sy, tx, ty, sourcePos, targetPos) you need to create an edge -export function getEdgeParams(source: any, target: any) { - const sourceIntersectionPoint = getNodeIntersection(source, target); - const targetIntersectionPoint = getNodeIntersection(target, source); - - const sourcePos = getEdgePosition(source, sourceIntersectionPoint); - const targetPos = getEdgePosition(target, targetIntersectionPoint); - - return { - sx: sourceIntersectionPoint.x, - sy: sourceIntersectionPoint.y, - tx: targetIntersectionPoint.x, - ty: targetIntersectionPoint.y, - sourcePos, - targetPos, - }; -} - -export function initialElements() { - const nodes = []; - const edges = []; - const center = { x: window.innerWidth / 2, y: window.innerHeight / 2 }; - - nodes.push({ id: 'target', data: { label: 'Target' }, position: center }); - - for (let i = 0; i < 8; i++) { - const degrees = i * (360 / 8); - const radians = degrees * (Math.PI / 180); - const x = 250 * Math.cos(radians) + center.x; - const y = 250 * Math.sin(radians) + center.y; - - nodes.push({ id: `${i}`, data: { label: 'Source' }, position: { x, y } }); - - edges.push({ - id: `edge-${i}`, - target: 'target', - source: `${i}`, - type: 'floating', - markerEnd: { - type: MarkerType.Arrow, - }, - }); - } - - return { nodes, edges }; -} - -interface Node { - id: string - position?: { x: number; y: number } - measured?: { width: number; height: number } - [key: string]: any -} - -interface Edge { - source: string - target: string - [key: string]: any -} - -interface LayoutOptions { - direction?: string - strength?: number - distance?: number - iterations?: number -} - -export const getLayoutedElements = ( - nodes: AppNode[], - edges: Edge[], - options: LayoutOptions = { - direction: "LR", - strength: -300, - distance: 100, - iterations: 300, - }, -) => { - // Create a map of node IDs to indices for the simulation - const nodeMap = new Map(nodes.map((node, i) => [node.id, i])) - - // Create a copy of nodes with positions for the simulation - const nodesCopy = nodes.map((node) => ({ - ...node, - x: node.position?.x || Math.random() * 500, - y: node.position?.y || Math.random() * 500, - width: node.measured?.width || 0, - height: node.measured?.height || 0, - })) - - // Create links for the simulation using indices - const links = edges.map((edge) => ({ - source: nodeMap.get(edge.source), - target: nodeMap.get(edge.target), - original: edge, - })) - - // Create the simulation - const simulation = d3 - .forceSimulation(nodesCopy) - .force( - "link", - d3.forceLink(links).id((d: any) => nodeMap.get(d.id)), - ) - .force("charge", d3.forceManyBody().strength(options.strength || -300)) - .force("center", d3.forceCenter(250, 250)) - .force( - "collision", - d3.forceCollide().radius((d: any) => Math.max(d.width, d.height) / 2 + 10), - ) - - // If direction is horizontal, adjust forces - if (options.direction === "LR") { - simulation.force("x", d3.forceX(250).strength(0.1)) - simulation.force("y", d3.forceY(250).strength(0.05)) - } else { - simulation.force("x", d3.forceX(250).strength(0.05)) - simulation.force("y", d3.forceY(250).strength(0.1)) - } - - // Run the simulation synchronously - simulation.stop() - for (let i = 0; i < (options.iterations || 300); i++) { - simulation.tick() - } - - // Update node positions based on simulation results - const updatedNodes = nodesCopy.map((node) => ({ - ...node, - position: { - x: node.x - node.width / 2, - y: node.y - node.height / 2, - }, - })) - - return { - nodes: updatedNodes, - edges, - } -} - - -export const sanitize = (name: string) => { - return name - .normalize("NFKD") // Decompose special characters (e.g., accents) - .replace(/[\u0300-\u036f]/g, "") // Remove accent marks - .replace(/[^a-zA-Z0-9.\-_]/g, "_") // Replace invalid characters with underscores - .replace(/_{2,}/g, "_") // Replace multiple underscores with a single one - .replace(/^_|_$/g, "") // Trim leading or trailing underscores - .toLowerCase(); // Convert to lowercase for consistency -}; - -export const formatFileSize = (bytes: number) => { - if (bytes < 1024) return bytes + " B" - else if (bytes < 1048576) return (bytes / 1024).toFixed(1) + " KB" - else return (bytes / 1048576).toFixed(1) + " MB" -} - -export const nodesTypes = { - emails: { table: "emails", type: "email", fields: ["email"] }, - individuals: { table: "individuals", type: "individual", fields: ["full_name"] }, - phone_numbers: { table: "phone_numbers", type: "phone", fields: ["phone_number"] }, - ip_addresses: { table: "ip_addresses", type: "ip", fields: ["ip_address"] }, - social_accounts_facebook: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:facebook"], - }, - social_accounts_instagram: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:instagram"], - }, - social_accounts_telegram: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:telegram"], - }, - social_accounts_snapchat: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:snapchat"], - }, - social_accounts_signal: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:signal"], - }, - social_accounts_github: { - table: "social_accounts", - type: "social", - fields: ["profile_url", "username", "platform:github"], - }, - physical_addresses: { table: "physical_addresses", type: "address", fields: ["address", "city", "country", "zip"] }, -} \ No newline at end of file