Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat: some minor fixes

dextmorgn80733d5b0205
diff --git a/flowsint-api/alembic/versions/a566d0f57af1_add_third_party_keys_table.py b/flowsint-api/alembic/versions/a566d0f57af1_add_third_party_keys_table.py
new file mode 100644
index 00000000..503a7108
--- /dev/null
+++ b/flowsint-api/alembic/versions/a566d0f57af1_add_third_party_keys_table.py
@@ -0,0 +1,47 @@
+"""add_third_party_keys_table
+
+Revision ID: a566d0f57af1
+Revises: e403a4152f6b
+Create Date: 2025-06-22 22:43:53.031994
+
+"""
+from typing import Sequence, Union
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+
+# revision identifiers, used by Alembic.
+revision: str = 'a566d0f57af1'
+down_revision: Union[str, None] = 'e403a4152f6b'
+branch_labels: Union[str, Sequence[str], None] = None
+depends_on: Union[str, Sequence[str], None] = None
+
+
+def upgrade() -> None:
+ """Upgrade schema."""
+ # Create third_party_keys table
+ op.create_table('third_party_keys',
+ sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
+ sa.Column('service', sa.String(), nullable=False),
+ sa.Column('owner_id', postgresql.UUID(as_uuid=True), nullable=True),
+ sa.Column('encrypted_key', sa.String(), nullable=False),
+ sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
+ sa.ForeignKeyConstraint(['owner_id'], ['profiles.id'], onupdate='CASCADE', ondelete='CASCADE'),
+ sa.PrimaryKeyConstraint('id')
+ )
+
+ # Create indexes
+ op.create_index('idx_keys_owner_id', 'third_party_keys', ['owner_id'], unique=False)
+ op.create_index('idx_keys_service', 'third_party_keys', ['service'], unique=False)
+
+
+def downgrade() -> None:
+ """Downgrade schema."""
+ # Drop indexes
+ op.drop_index('idx_keys_service', table_name='third_party_keys')
+ op.drop_index('idx_keys_owner_id', table_name='third_party_keys')
+
+ # Drop table
+ op.drop_table('third_party_keys')
diff --git a/flowsint-api/alembic/versions/e403a4152f6b_add_third_party_keys_table.py b/flowsint-api/alembic/versions/e403a4152f6b_add_third_party_keys_table.py
new file mode 100644
index 00000000..6ddeee3c
--- /dev/null
+++ b/flowsint-api/alembic/versions/e403a4152f6b_add_third_party_keys_table.py
@@ -0,0 +1,44 @@
+"""add_third_party_keys_table
+
+Revision ID: e403a4152f6b
+Revises: 6dfa83113ad7
+Create Date: 2025-06-22 22:43:43.440473
+
+"""
+from typing import Sequence, Union
+
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision: str = 'e403a4152f6b'
+down_revision: Union[str, None] = '6dfa83113ad7'
+branch_labels: Union[str, Sequence[str], None] = None
+depends_on: Union[str, Sequence[str], None] = None
+
+
+def upgrade() -> None:
+ """Upgrade schema."""
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('third_party_keys',
+ sa.Column('id', sa.UUID(), nullable=False),
+ sa.Column('service', sa.String(), nullable=False),
+ sa.Column('owner_id', sa.UUID(), nullable=True),
+ sa.Column('encrypted_key', sa.String(), nullable=False),
+ sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
+ sa.ForeignKeyConstraint(['owner_id'], ['profiles.id'], onupdate='CASCADE', ondelete='CASCADE'),
+ sa.PrimaryKeyConstraint('id')
+ )
+ op.create_index('idx_keys_owner_id', 'third_party_keys', ['owner_id'], unique=False)
+ op.create_index('idx_keys_service', 'third_party_keys', ['service'], unique=False)
+ # ### end Alembic commands ###
+
+
+def downgrade() -> None:
+ """Downgrade schema."""
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_index('idx_keys_service', table_name='third_party_keys')
+ op.drop_index('idx_keys_owner_id', table_name='third_party_keys')
+ op.drop_table('third_party_keys')
+ # ### end Alembic commands ###
diff --git a/flowsint-api/app/api/routes/investigations.py b/flowsint-api/app/api/routes/investigations.py
index 3a506d59..e059c35f 100644
--- a/flowsint-api/app/api/routes/investigations.py
+++ b/flowsint-api/app/api/routes/investigations.py
@@ -4,7 +4,7 @@ from typing import List
from datetime import datetime
from sqlalchemy.orm import Session, selectinload
from app.core.postgre_db import get_db
-from app.models.models import Investigation, Profile, Sketch
+from app.models.models import Analysis, Investigation, Profile, Sketch
from app.api.deps import get_current_user
from app.api.schemas.investigation import InvestigationRead, InvestigationCreate, InvestigationUpdate
from app.api.schemas.sketch import SketchRead
@@ -80,6 +80,8 @@ def delete_investigation(investigation_id: UUID, db: Session = Depends(get_db),
# Get all sketches related to this investigation
sketches = db.query(Sketch).filter(Sketch.investigation_id == investigation_id).all()
+ analyses = db.query(Analysis).filter(Sketch.investigation_id == investigation_id).all()
+
# Delete all nodes and relationships for each sketch in Neo4j
for sketch in sketches:
@@ -96,6 +98,8 @@ def delete_investigation(investigation_id: UUID, db: Session = Depends(get_db),
# Delete all sketches from PostgreSQL
for sketch in sketches:
db.delete(sketch)
+ for analysis in analyses:
+ db.delete(analysis)
# Finally delete the investigation
db.delete(investigation)
diff --git a/flowsint-api/app/api/routes/keys.py b/flowsint-api/app/api/routes/keys.py
new file mode 100644
index 00000000..1e91b11f
--- /dev/null
+++ b/flowsint-api/app/api/routes/keys.py
@@ -0,0 +1,69 @@
+from uuid import UUID, uuid4
+from fastapi import APIRouter, HTTPException, Depends, status
+from typing import List
+from sqlalchemy.orm import Session
+from pydantic import BaseModel
+from app.core.postgre_db import get_db
+from app.models.models import Profile, ThirdPartyKey
+from app.api.deps import get_current_user
+from app.api.schemas.key import ThirdPartyKeyRead, ThirdPartyKeyCreate
+from datetime import datetime
+
+router = APIRouter()
+
+class ServiceInfo(BaseModel):
+ service: str
+ variable: str
+ url: str
+ active: bool
+
+# Get the list of all services that require a key
[email protected]("/services", response_model=List[ServiceInfo])
+def get_services(db: Session = Depends(get_db)):
+ services = [
+ ServiceInfo(service="Mistral AI", variable="MISTRAL_API_KEY", url="https://mistral.ai/", active=True),
+ ServiceInfo(service="Etherscan", variable="ETHERSCAN_API_KEY", url="https://etherscan.io/", active=True),
+ ServiceInfo(service="HaveIBeenPwned", variable="HIBP_API_KEY", url="https://haveibeenpwned.com/", active=True),
+ ServiceInfo(service="Onyphe", variable="ONYPHE_API_KEY", url="https://www.onyphe.io/", active=False),
+ ServiceInfo(service="Shodan", variable="SHODAN_API_KEY", url="https://www.shodan.io/", active=False)
+ ]
+ return services
+
+# Get the list of all keys for a user
[email protected]("", response_model=List[ThirdPartyKeyRead])
+def get_keys(db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
+ keys = db.query(ThirdPartyKey).filter(ThirdPartyKey.owner_id == current_user.id).all()
+ return keys
+
+# Get a key by ID
[email protected]("/{id}", response_model=ThirdPartyKeyRead)
+def get_key_by_id(id: UUID, db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
+ key = db.query(ThirdPartyKey).filter(ThirdPartyKey.id == id, ThirdPartyKey.owner_id == current_user.id).first()
+ if not key:
+ raise HTTPException(status_code=404, detail="Key not found")
+ return key
+
+# Create a new key
[email protected]("/create", response_model=ThirdPartyKeyRead, status_code=status.HTTP_201_CREATED)
+def create_key(payload: ThirdPartyKeyCreate, db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
+ new_key = ThirdPartyKey(
+ id=uuid4(),
+ service=payload.service,
+ owner_id=current_user.id,
+ encrypted_key=payload.key,
+ created_at=datetime.utcnow(),
+ )
+ db.add(new_key)
+ db.commit()
+ db.refresh(new_key)
+ return new_key
+
+# Delete a key by ID
[email protected]("/{id}", status_code=status.HTTP_204_NO_CONTENT)
+def delete_key(id: UUID, db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
+ key = db.query(ThirdPartyKey).filter(ThirdPartyKey.id == id, ThirdPartyKey.owner_id == current_user.id).first()
+ if not key:
+ raise HTTPException(status_code=404, detail="Key not found")
+ db.delete(key)
+ db.commit()
+ return None
diff --git a/flowsint-api/app/api/routes/scan.py b/flowsint-api/app/api/routes/scan.py
index 34d507a0..584c5bb2 100644
--- a/flowsint-api/app/api/routes/scan.py
+++ b/flowsint-api/app/api/routes/scan.py
@@ -10,8 +10,8 @@ from app.api.schemas.scan import ScanRead
router = APIRouter()
# Get the list of all scans
[email protected]("", response_model=List[ScanRead])
-def get_scans(db: Session = Depends(get_db)):
[email protected]("", response_model=List[ScanRead],)
+def get_scans(db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
scans = db.query(Scan).all()
return scans
@@ -26,7 +26,6 @@ def get_scan_by_id(id: UUID, db: Session = Depends(get_db), current_user: Profil
# Delete a scan by ID
@router.delete("", status_code=status.HTTP_204_NO_CONTENT)
def delete_scan(db: Session = Depends(get_db)):
- # Get all sketches related to this scan
db.query(Scan).delete()
db.commit()
return None
@@ -37,7 +36,6 @@ def delete_scan(id: UUID, db: Session = Depends(get_db), current_user: Profile =
scan = db.query(Scan).filter(Scan.id == id, Scan.owner_id == current_user.id).first()
if not scan:
raise HTTPException(status_code=404, detail="Scan not found")
- # Get all sketches related to this scan
scan = db.query(Scan).filter(Scan.id == id).all()
# Finally delete the scan
diff --git a/flowsint-api/app/api/routes/sketches.py b/flowsint-api/app/api/routes/sketches.py
index 681c0d18..5295c831 100644
--- a/flowsint-api/app/api/routes/sketches.py
+++ b/flowsint-api/app/api/routes/sketches.py
@@ -123,7 +123,7 @@ async def get_sketch_nodes(id: str, db: Session = Depends(get_db), current_user:
"target": str(record["target"]),
"data": record["data"],
"caption": record["type"],
- "label": record["type"].lower(),
+ # "label": record["type"].lower(),
}
for record in rels_result
]
@@ -136,28 +136,12 @@ class NodeData(BaseModel):
type: str = Field(default="Node", description="Type of the node")
# Add any other specific data fields that might be common across nodes
+ class Config:
+ extra = "allow" # Accept any additional fields
+
class NodeInput(BaseModel):
type: str = Field(..., description="Type of the node")
data: NodeData = Field(default_factory=NodeData, description="Additional data for the node")
-
- @validator('type')
- def validate_type(cls, v):
- # Convert to lowercase and strip any whitespace
- v = v.lower().strip()
- if not v:
- raise ValueError('Type cannot be empty')
- return v
-
- class Config:
- json_schema_extra = {
- "example": {
- "type": "person",
- "data": {
- "label": "John Doe",
- "color": "#FF0000"
- }
- }
- }
def dict_to_cypher_props(props: dict, prefix: str = "") -> str:
return ", ".join(f"{key}: ${prefix}{key}" for key in props)
@@ -165,23 +149,25 @@ def dict_to_cypher_props(props: dict, prefix: str = "") -> str:
@router.post("/{sketch_id}/nodes/add")
def add_node(sketch_id: str, node: NodeInput, current_user: Profile = Depends(get_current_user)):
node_data = node.data.model_dump()
+
print(node_data)
node_type = node_data["type"]
properties = {
- "type": node_type,
+ "type": node_type.lower(),
"sketch_id": sketch_id,
"caption": node_data["label"],
"label": node_data["label"],
- "color": node_data["color"],
- "size": 40,
}
if node_data:
flattened_data = flatten(node_data)
properties.update(flattened_data)
+
cypher_props = dict_to_cypher_props(properties)
+ print(properties)
+ print(cypher_props)
create_query = f"""
MERGE (d:`{node_type}` {{ {cypher_props} }})
diff --git a/flowsint-api/app/api/routes/transforms.py b/flowsint-api/app/api/routes/transforms.py
index dc2d55bf..2d26f654 100644
--- a/flowsint-api/app/api/routes/transforms.py
+++ b/flowsint-api/app/api/routes/transforms.py
@@ -8,7 +8,7 @@ from app.scanners.registry import ScannerRegistry
from app.core.celery import celery
from app.types.domain import Domain
from app.types.ip import Ip
-from app.types.social import Social
+from app.types.social import SocialProfile
from app.types.organization import Organization
from app.types.email import Email
from app.types.transform import Node, Edge, FlowStep, FlowBranch
@@ -48,10 +48,11 @@ def get_transforms(
db: Session = Depends(get_db),
current_user: Profile = Depends(get_current_user)
):
- # if category is not None and category != "undefined":
- # query = query.filter(Transform.category.any(category))
- query = db.query(Transform).order_by(Transform.last_updated_at.desc())
- return query.all()
+ if category is not None and category != "undefined":
+ query = db.query(Transform).filter(Transform.category.any(category))
+ else:
+ query = db.query(Transform)
+ return query.order_by(Transform.last_updated_at.desc()).all()
# Returns the "raw_materials" for the transform editor
@router.get("/raw_materials")
@@ -77,13 +78,13 @@ async def get_scans_list(current_user: Profile = Depends(get_current_user)):
object_inputs = [
extract_input_schema("Organization", Organization),
extract_input_schema("Domain", Domain),
- extract_input_schema("IP address", Ip),
+ extract_input_schema("Ip", Ip),
extract_input_schema("ASN", ASN),
extract_input_schema("CIDR", CIDR),
- extract_input_schema("Social profile", Social),
+ extract_input_schema("SocialProfile", SocialProfile),
extract_input_schema("Email", Email),
- extract_input_schema("Crypto wallet", Wallet),
- extract_input_schema("Crypto transaction", WalletTransaction),
+ extract_input_schema("CryptoWallet", Wallet),
+ extract_input_schema("CryptoTransaction", WalletTransaction),
]
flattened_scanners["types"] = object_inputs
@@ -94,6 +95,7 @@ async def get_scans_list(current_user: Profile = Depends(get_current_user)):
# Create a new transform
@router.post("/create", response_model=TransformRead, status_code=status.HTTP_201_CREATED)
def create_transform(payload: TransformCreate, db: Session = Depends(get_db), current_user: Profile = Depends(get_current_user)):
+
new_transform = Transform(
id=uuid4(),
name=payload.name,
@@ -125,6 +127,9 @@ def update_transform(transform_id: UUID, payload: TransformUpdate, db: Session =
update_data = payload.dict(exclude_unset=True)
for key, value in update_data.items():
print(f'only update {key}')
+ if key == "category":
+ if "SocialProfile" in value:
+ value.append("Username")
setattr(transform, key, value)
transform.last_updated_at = datetime.utcnow()
diff --git a/flowsint-api/app/api/schemas/key.py b/flowsint-api/app/api/schemas/key.py
new file mode 100644
index 00000000..9db41fdd
--- /dev/null
+++ b/flowsint-api/app/api/schemas/key.py
@@ -0,0 +1,14 @@
+from .base import ORMBase
+from pydantic import UUID4, BaseModel
+from datetime import datetime
+
+class ThirdPartyKeyCreate(BaseModel):
+ key: str
+ service: str
+
+class ThirdPartyKeyRead(ORMBase):
+ id: UUID4
+ owner_id: UUID4
+ encrypted_key: str
+ service: str
+ created_at: datetime
diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.py
index f2fe6f08..06f39332 100644
--- a/flowsint-api/app/main.py
+++ b/flowsint-api/app/main.py
@@ -13,6 +13,7 @@ from app.api.routes import events
from app.api.routes import analysis
from app.api.routes import chat
from app.api.routes import scan
+from app.api.routes import keys
load_dotenv()
URI = os.getenv("NEO4J_URI_BOLT")
@@ -55,4 +56,5 @@ app.include_router(transforms.router, prefix="/api/transforms", tags=["transform
app.include_router(events.router, prefix="/api/events", tags=["events"])
app.include_router(analysis.router, prefix="/api/analyses", tags=["analyses"])
app.include_router(chat.router, prefix="/api/chat", tags=["chat"])
-app.include_router(scan.router, prefix="/api/scans", tags=["scans"])
\ No newline at end of file
+app.include_router(scan.router, prefix="/api/scans", tags=["scans"])
+app.include_router(keys.router, prefix="/api/third_party_keys", tags=["third_party_keys"])
\ No newline at end of file
diff --git a/flowsint-api/app/models/models.py b/flowsint-api/app/models/models.py
index bbe9be2b..4dca2420 100644
--- a/flowsint-api/app/models/models.py
+++ b/flowsint-api/app/models/models.py
@@ -160,4 +160,19 @@ class Analysis(Base):
__table_args__ = (
Index("idx_analyses_owner_id", "owner_id"),
Index("idx_analyses_investigation_id", "investigation_id"),
+ )
+
+
+class ThirdPartyKey(Base):
+ __tablename__ = "third_party_keys"
+
+ id: Mapped[uuid.UUID] = mapped_column(PGUUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
+ service = mapped_column(String, nullable=False)
+ owner_id = mapped_column(PGUUID(as_uuid=True), ForeignKey("profiles.id", onupdate="CASCADE", ondelete="CASCADE"), nullable=True)
+ encrypted_key = mapped_column(String, nullable=False)
+ created_at = mapped_column(DateTime(timezone=True), server_default=func.now())
+
+ __table_args__ = (
+ Index("idx_keys_owner_id", "owner_id"),
+ Index("idx_keys_service", "service"),
)
\ No newline at end of file
diff --git a/flowsint-api/app/scanners/domains/domain_to_asn.py b/flowsint-api/app/scanners/domains/domain_to_asn.py
index 8b1258ea..85ced77c 100644
--- a/flowsint-api/app/scanners/domains/domain_to_asn.py
+++ b/flowsint-api/app/scanners/domains/domain_to_asn.py
@@ -22,11 +22,11 @@ class DomainToAsnScanner(Scanner):
@classmethod
def category(cls) -> str:
- return "domains"
+ return "Domain"
@classmethod
def key(cls) -> str:
- return "domain"
+ return "Domain"
@classmethod
def input_schema(cls) -> Dict[str, Any]:
@@ -112,7 +112,6 @@ class DomainToAsnScanner(Scanner):
MERGE (domain:domain {domain: $domain})
SET domain.sketch_id = $sketch_id,
domain.label = $domain,
- domain.caption = $domain,
domain.type = "domain"
MERGE (asn:asn {number: $asn_number})
@@ -120,7 +119,6 @@ class DomainToAsnScanner(Scanner):
asn.name = $asn_name,
asn.country = $asn_country,
asn.label = $asn_label,
- asn.caption = $asn_caption,
asn.type = "asn"
MERGE (domain)-[:BELONGS_TO {sketch_id: $sketch_id}]->(asn)
diff --git a/flowsint-api/app/scanners/domains/resolve.py b/flowsint-api/app/scanners/domains/resolve.py
index 16739b93..48447dc6 100644
--- a/flowsint-api/app/scanners/domains/resolve.py
+++ b/flowsint-api/app/scanners/domains/resolve.py
@@ -21,7 +21,7 @@ class ResolveScanner(Scanner):
@classmethod
def category(cls) -> str:
- return "domains"
+ return "Domain"
@classmethod
def key(cls) -> str:
@@ -81,16 +81,13 @@ class ResolveScanner(Scanner):
for domain_obj, ip_obj in zip(original_input, results):
query = """
MERGE (d:domain {domain: $domain})
- SET d.domain = $domain
- SET d.label = $domain
- SET d.caption = $caption
- SET d.type = "domain"
- SET d.sketch_id = $sketch_id
+ SET d.sketch_id = $sketch_id,
+ d.label = $domain,
+ d.type = "domain"
MERGE (ip:ip {address: $ip})
- SET ip.sketch_id = $sketch_id
- SET ip.label = $label
- SET ip.caption = $caption
- SET ip.type = $type
+ SET ip.sketch_id = $sketch_id,
+ ip.label = $label,
+ ip.type = "ip"
MERGE (d)-[:RESOLVES_TO {sketch_id: $sketch_id}]->(ip)
"""
if self.neo4j_conn:
@@ -99,14 +96,11 @@ class ResolveScanner(Scanner):
"ip": ip_obj.address,
"sketch_id": self.sketch_id,
"label": ip_obj.address,
- "caption": ip_obj.address,
- "type": "ip"
})
nodes = [Node(
id=str(uuid.uuid4()),
data={
"label": ip_obj.address,
- "caption": ip_obj.address,
"type": "ip"
},
position={
@@ -121,7 +115,6 @@ class ResolveScanner(Scanner):
target="",
data={
"label": "RESOLVES_TO",
- "caption": "RESOLVES_TO"
},
)]
nodes=[node.model_dump_json() for node in nodes]
diff --git a/flowsint-api/app/scanners/domains/subdomains.py b/flowsint-api/app/scanners/domains/subdomains.py
index 5aba2c91..69f318b7 100644
--- a/flowsint-api/app/scanners/domains/subdomains.py
+++ b/flowsint-api/app/scanners/domains/subdomains.py
@@ -20,7 +20,7 @@ class SubdomainScanner(Scanner):
@classmethod
def category(cls) -> str:
- return "domains"
+ return "Domain"
@classmethod
def key(cls) -> str:
@@ -55,7 +55,9 @@ class SubdomainScanner(Scanner):
def preprocess(self, data: Union[List[str], List[dict], InputType]) -> InputType:
cleaned: InputType = []
- for item in data:
+ invalid_items = []
+
+ for i, item in enumerate(data):
domain_obj = None
if isinstance(item, str):
domain_obj = Domain(domain=item)
@@ -63,8 +65,20 @@ class SubdomainScanner(Scanner):
domain_obj = Domain(domain=item["domain"])
elif isinstance(item, Domain):
domain_obj = item
+ else:
+ invalid_items.append(f"Item at index {i}: {type(item).__name__} - {item}")
+ continue
+
if domain_obj and is_valid_domain(domain_obj.domain):
cleaned.append(domain_obj)
+ else:
+ invalid_items.append(f"Item at index {i}: Invalid domain '{getattr(domain_obj, 'domain', item) if domain_obj else item}'")
+
+ if invalid_items:
+ error_msg = f"Invalid input format. The following items could not be processed:\n" + "\n".join(invalid_items)
+ Logger.error(self.sketch_id, {"message":error_msg})
+ raise ValueError(error_msg)
+
return cleaned
def scan(self, data: InputType) -> OutputType:
@@ -83,8 +97,7 @@ class SubdomainScanner(Scanner):
Logger.info(self.sketch_id, "subfinder not found, using crt.sh only")
subdomains = self.__get_subdomains_from_crtsh(d.domain)
- d.subdomains = sorted(subdomains)
- domains.append(d)
+ domains.append({"domain": d.domain, "subdomains": sorted(subdomains)})
return domains
@@ -135,25 +148,23 @@ class SubdomainScanner(Scanner):
for domain_obj in results:
if not self.neo4j_conn:
continue
- for subdomain in domain_obj.subdomains:
+ for subdomain in domain_obj["subdomains"]:
output.append(Domain(domain=subdomain))
- Logger.info(self.sketch_id, {"message": f"{domain_obj.domain} -> {subdomain}"})
+ Logger.info(self.sketch_id, {"message": f"{domain_obj['domain']} -> {subdomain}"})
self.neo4j_conn.query("""
MERGE (sub:domain {domain: $subdomain})
SET sub.sketch_id = $sketch_id,
sub.label = $label,
- sub.caption = $caption,
sub.type = $type
MERGE (d:domain {domain: $domain})
MERGE (d)-[:HAS_SUBDOMAIN {sketch_id: $sketch_id}]->(sub)
""", {
- "domain": domain_obj.domain,
+ "domain": domain_obj["domain"],
"subdomain": subdomain,
"sketch_id": self.sketch_id,
"label": subdomain,
- "caption": subdomain,
- "type": "subdomain"
+ "type": "domain"
})
- Logger.graph_append(self.sketch_id, {"message":f"{domain_obj.domain} -> {len(domain_obj.subdomains)} subdomain(s) found."})
+ Logger.graph_append(self.sketch_id, {"message":f"{domain_obj['domain']} -> {len(domain_obj['subdomains'])} subdomain(s) found."})
return output
diff --git a/flowsint-api/app/scanners/domains/whois.py b/flowsint-api/app/scanners/domains/whois.py
index e4c75b2b..7df53740 100644
--- a/flowsint-api/app/scanners/domains/whois.py
+++ b/flowsint-api/app/scanners/domains/whois.py
@@ -6,11 +6,12 @@ from app.scanners.base import Scanner
from app.types.domain import Domain, Domain
from app.types.whois import Whois
from app.types.email import Email
+from app.types.organization import Organization
from pydantic import TypeAdapter
from app.core.logger import Logger
InputType: TypeAlias = List[Domain]
-OutputType: TypeAlias = List[Domain]
+OutputType: TypeAlias = List[Whois]
class WhoisScanner(Scanner):
@@ -18,11 +19,11 @@ class WhoisScanner(Scanner):
@classmethod
def name(cls) -> str:
- return "domain_whois_scanner"
+ return "to_whois"
@classmethod
def category(cls) -> str:
- return "domains"
+ return "Domain"
@classmethod
def key(cls) -> str:
@@ -76,7 +77,6 @@ class WhoisScanner(Scanner):
w = whois.whois(d.domain)
w_data = json.loads(json.dumps(w, default=str))
whois_obj = Whois(
- domain=Domain(domain=d.domain),
registrar=w_data.get("registrar"),
org=w_data.get("org"),
city=w_data.get("city"),
@@ -85,8 +85,7 @@ class WhoisScanner(Scanner):
creation_date=str(w_data.get("creation_date")) if w_data.get("creation_date") else None,
expiration_date=str(w_data.get("expiration_date")) if w_data.get("expiration_date") else None,
)
- d.whois = whois_obj
- results.append(d)
+ results.append({"whois": whois_obj, "domain": d.domain})
except Exception as e:
print(e)
@@ -98,11 +97,11 @@ class WhoisScanner(Scanner):
for domain in results:
if not self.neo4j_conn:
continue
- whois_obj = domain.whois
- Logger.graph_append(self.sketch_id, {"message": f"WHOIS for {domain.domain} -> registrar: {whois_obj.registrar} org: {whois_obj.org} city: {whois_obj.city} country: {whois_obj.country} creation_date: {whois_obj.creation_date} expiration_date: {whois_obj.expiration_date} email: {whois_obj.email.email}"})
+ whois_obj = domain["whois"]
+ Logger.graph_append(self.sketch_id, {"message": f"WHOIS for {domain['domain']} -> registrar: {whois_obj.registrar} org: {whois_obj.org} city: {whois_obj.city} country: {whois_obj.country} creation_date: {whois_obj.creation_date} expiration_date: {whois_obj.expiration_date}"})
props = {
- "domain": domain.domain,
+ "domain": domain["domain"],
"registrar": whois_obj.registrar,
"org": whois_obj.org,
"city": whois_obj.city,
@@ -115,28 +114,71 @@ class WhoisScanner(Scanner):
query = """
MERGE (d:domain {domain: $domain})
- MERGE (d)-[:HAS_WHOIS {sketch_id: $sketch_id}]->(sub)
- SET d.registrar = $registrar,
- d.org = $org,
- d.city = $city,
- d.country = $country,
- d.creation_date = $creation_date,
- d.expiration_date = $expiration_date,
- d.whois_email = $email,
- d.sketch_id = $sketch_id
+ SET d.sketch_id = $sketch_id,
+ d.label = $domain,
+ d.type = "domain"
+ MERGE (w:whois {domain: $domain, sketch_id: $sketch_id})
+ SET w.registrar = $registrar,
+ w.org = $org,
+ w.type = "whois",
+ w.label = "Whois",
+ w.city = $city,
+ w.country = $country,
+ w.creation_date = $creation_date,
+ w.expiration_date = $expiration_date,
+ w.email = $email
+ MERGE (d)-[:HAS_WHOIS {sketch_id: $sketch_id}]->(w)
"""
self.neo4j_conn.query(query, props)
+ # Create organization node if org information is available
+ if whois_obj.org:
+ org_query = """
+ MERGE (o:organization {name: $org_name})
+ SET o.country = $country,
+ o.founding_date = $creation_date,
+ o.description = $description,
+ o.label = $label,
+ o.caption = $caption,
+ o.type = $type,
+ o.sketch_id = $sketch_id
+ """
+ self.neo4j_conn.query(org_query, {
+ "org_name": whois_obj.org,
+ "country": whois_obj.country,
+ "creation_date": whois_obj.creation_date,
+ "description": f"Organization from WHOIS data for {domain['domain']}",
+ "label": whois_obj.org,
+ "caption": whois_obj.org,
+ "type": "organization",
+ "sketch_id": self.sketch_id,
+ })
+
+ # Create relationship between domain and organization
+ self.neo4j_conn.query("""
+ MERGE (d:domain {domain: $domain})
+ MERGE (o:organization {name: $org_name})
+ MERGE (o)-[:HAS_DOMAIN {sketch_id: $sketch_id}]->(d)
+ """, {
+ "domain": domain["domain"],
+ "org_name": whois_obj.org,
+ "sketch_id": self.sketch_id,
+ })
+
+ Logger.graph_append(self.sketch_id, {"message": f"{domain['domain']} -> {whois_obj.org} (organization)"})
+
if whois_obj.email:
email_query = """
MERGE (e:email {email: $email})
- SET e.sketch_id = $sketch_id
- MERGE (d:domain {domain: $domain})
- MERGE (d)-[:HAS_WHOIS_EMAIL {sketch_id: $sketch_id}]->(e)
+ SET e.sketch_id = $sketch_id,
+ e.type = "email",
+ e.label = $email
+ MERGE (w:whois {domain: $domain, sketch_id: $sketch_id})
+ MERGE (w)-[:REGISTERED_BY {sketch_id: $sketch_id}]->(e)
"""
self.neo4j_conn.query(email_query, {
"email": whois_obj.email.email,
- "domain": whois_obj.domain.domain,
+ "domain": domain["domain"],
"sketch_id": self.sketch_id
})
diff --git a/flowsint-api/app/scanners/emails/holehe.py b/flowsint-api/app/scanners/emails/holehe.py
index 2e55b701..b483d426 100644
--- a/flowsint-api/app/scanners/emails/holehe.py
+++ b/flowsint-api/app/scanners/emails/holehe.py
@@ -1,13 +1,13 @@
from typing import Dict, Any, List, TypeAlias, Union
from app.scanners.base import Scanner
from app.types.email import Email
-from app.types.social import Social
+from app.types.social import SocialProfile
from pydantic import TypeAdapter
from app.utils import is_valid_email, resolve_type
import asyncio
from app.core.logger import Logger
InputType: TypeAlias = List[Email]
-OutputType: TypeAlias = List[Social]
+OutputType: TypeAlias = List[SocialProfile]
class HoleheScanner(Scanner):
@classmethod
@@ -106,7 +106,7 @@ class HoleheScanner(Scanner):
for result in result["results"]:
if("error" not in result and "exists" in result):
found.append(
- Social(
+ SocialProfile(
username=email.email,
profile_url=f"https://{result['domain']}",
platform=result["name"]))
diff --git a/flowsint-api/app/scanners/organizations/sirene.py b/flowsint-api/app/scanners/organizations/sirene.py
index 445c2251..3b046b26 100644
--- a/flowsint-api/app/scanners/organizations/sirene.py
+++ b/flowsint-api/app/scanners/organizations/sirene.py
@@ -9,7 +9,7 @@ from app.core.logger import Logger
InputType: TypeAlias = List[Organization]
-OutputType: TypeAlias = List[Organization]
+OutputType: TypeAlias = List[Identifier]
class SireneScanner(Scanner):
"""Enrich Organization with data from SIRENE (France only)."""
diff --git a/flowsint-api/app/scanners/socials/maigret.py b/flowsint-api/app/scanners/socials/maigret.py
index a5407c72..4ca1b4e8 100644
--- a/flowsint-api/app/scanners/socials/maigret.py
+++ b/flowsint-api/app/scanners/socials/maigret.py
@@ -5,12 +5,12 @@ from typing import List, Dict, Any, TypeAlias, Union
from app.utils import is_valid_username, resolve_type
from app.scanners.base import Scanner
-from app.types.social import Social, Social
+from app.types.social import SocialProfile
from pydantic import TypeAdapter
from app.core.logger import Logger
-InputType: TypeAlias = List[Social]
-OutputType: TypeAlias = List[Social]
+InputType: TypeAlias = List[SocialProfile]
+OutputType: TypeAlias = List[SocialProfile]
false_positives = ["LeagueOfLegends"]
@@ -60,10 +60,10 @@ class MaigretScanner(Scanner):
for item in data:
obj = None
if isinstance(item, str):
- obj = Social(username=item)
+ obj = SocialProfile(username=item)
elif isinstance(item, dict) and "username" in item:
- obj = Social(username=item["username"])
- elif isinstance(item, Social):
+ obj = SocialProfile(username=item["username"])
+ elif isinstance(item, SocialProfile):
obj = item
if obj and obj.username and is_valid_username(obj.username):
@@ -83,8 +83,8 @@ class MaigretScanner(Scanner):
print(f"[FAILED] Maigret execution failed for {username}: {e}")
return output_file
- def parse_maigret_output(self, username: str, output_file: Path) -> List[Social]:
- results: List[Social] = []
+ def parse_maigret_output(self, username: str, output_file: Path) -> List[SocialProfile]:
+ results: List[SocialProfile] = []
if not output_file.exists():
return results
@@ -119,7 +119,7 @@ class MaigretScanner(Scanner):
except ValueError:
followers = following = posts = None
- results.append(Social(
+ results.append(SocialProfile(
username=username,
profile_url=profile_url,
platform=platform,
diff --git a/flowsint-api/app/types/address.py b/flowsint-api/app/types/address.py
index 94461da9..bde20016 100644
--- a/flowsint-api/app/types/address.py
+++ b/flowsint-api/app/types/address.py
@@ -1,7 +1,7 @@
from pydantic import BaseModel, Field
from typing import Optional
-class Address(BaseModel):
+class PhysicalAddress(BaseModel):
address: str = Field(..., description="Street address")
city: str = Field(..., description="City name")
country: str = Field(..., description="Country name")
diff --git a/flowsint-api/app/types/domain.py b/flowsint-api/app/types/domain.py
index 03e943e3..df2dd52d 100644
--- a/flowsint-api/app/types/domain.py
+++ b/flowsint-api/app/types/domain.py
@@ -1,13 +1,6 @@
from pydantic import BaseModel, Field
-from typing import List, Optional
-from app.types.whois import Whois
-from .ip import Ip
class Domain(BaseModel):
domain: str = Field(..., description="Domain name")
- subdomains: Optional[List["Domain"]] = Field(default=[], description="List of subdomains associated with this domain")
- ips: Optional[List[Ip]] = Field(default=[], description="List of IP addresses associated with this domain")
- whois: Optional[Whois] = Field(default=None, description="Whois information for this domain")
-
Domain.model_rebuild()
diff --git a/flowsint-api/app/types/organization.py b/flowsint-api/app/types/organization.py
index c244b473..37265cbf 100644
--- a/flowsint-api/app/types/organization.py
+++ b/flowsint-api/app/types/organization.py
@@ -12,5 +12,4 @@ class Organization(BaseModel):
name: str = Field(..., description="Organization name")
founding_date: Optional[str] = Field(None, description="Date when the organization was founded")
country: Optional[str] = Field(None, description="Country where the organization is based")
- description: Optional[str] = Field(None, description="Description of the organization's activities")
- identifiers: Optional[List[Identifier]] = Field(None, description="List of official identifiers for the organization")
\ No newline at end of file
+ description: Optional[str] = Field(None, description="Description of the organization's activities")
\ No newline at end of file
diff --git a/flowsint-api/app/types/social.py b/flowsint-api/app/types/social.py
index b493f64e..5b188d3b 100644
--- a/flowsint-api/app/types/social.py
+++ b/flowsint-api/app/types/social.py
@@ -1,7 +1,7 @@
from pydantic import BaseModel, Field
from typing import Optional
-class Social(BaseModel):
+class SocialProfile(BaseModel):
username: Optional[str] = Field(None, description="Username on the social platform")
profile_url: Optional[str] = Field(None, description="URL to the user's profile page")
platform: Optional[str] = Field(None, description="Name of the social media platform")
diff --git a/flowsint-app/src/renderer/public/icons/wallet.svg b/flowsint-app/src/renderer/public/icons/cryptowallet.svg
similarity index 100%
rename from flowsint-app/src/renderer/public/icons/wallet.svg
rename to flowsint-app/src/renderer/public/icons/cryptowallet.svg
diff --git a/flowsint-app/src/renderer/public/icons/social_profile.svg b/flowsint-app/src/renderer/public/icons/social_profile.svg
new file mode 100644
index 00000000..e45ee0dc
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/social_profile.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="#B8AFE6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-user-check-icon lucide-user-check"><path d="m16 11 2 2 4-4"/><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/public/icons/whois.svg b/flowsint-app/src/renderer/public/icons/whois.svg
new file mode 100644
index 00000000..5bfe253c
--- /dev/null
+++ b/flowsint-app/src/renderer/public/icons/whois.svg
@@ -0,0 +1 @@
+<?xml version="1.0" ?><svg id="fill" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><rect height="54" style="fill:#cfcfd9" width="14" x="44" y="5"/><polygon points="50 61 6 61 6 3 42 3 50 11 50 61" style="fill:#e5e6eb"/><path d="M48,9V23.743A35.257,35.257,0,0,1,12.743,59H6v2H50V11Z" style="fill:#d9dae2"/><circle cx="22" cy="18" r="9" style="fill:#fff"/><circle cx="22" cy="46" r="9" style="fill:#fff"/><path d="M23.972,17H20.028A2.028,2.028,0,0,0,18,19.028v7.025a8.921,8.921,0,0,0,8,0V19.028A2.028,2.028,0,0,0,23.972,17Z" style="fill:#A6D0BF"/><circle cx="22" cy="14" r="3" style="fill:#A6D0BF"/><rect height="2" style="fill:#444" width="4" x="33" y="14"/><rect height="2" style="fill:#444" width="2" x="39" y="14"/><rect height="2" style="fill:#444" width="9" x="33" y="18"/><rect height="2" style="fill:#444" width="11" x="33" y="22"/><path d="M23.972,45H20.028A2.028,2.028,0,0,0,18,47.028v7.025a8.921,8.921,0,0,0,8,0V47.028A2.028,2.028,0,0,0,23.972,45Z" style="fill:#A6D0BF"/><circle cx="22" cy="42" r="3" style="fill:#A6D0BF"/><rect height="2" style="fill:#444" width="4" x="33" y="42"/><rect height="2" style="fill:#444" width="2" x="39" y="42"/><rect height="2" style="fill:#444" width="9" x="33" y="46"/><rect height="2" style="fill:#444" width="11" x="33" y="50"/><polygon points="50 11 42 11 42 3 50 11" style="fill:#cceaff"/><path d="M58,4H44.414L42.707,2.293A1,1,0,0,0,42,2H6A1,1,0,0,0,5,3V61a1,1,0,0,0,1,1H50a1,1,0,0,0,1-1V60h7a1,1,0,0,0,1-1V5A1,1,0,0,0,58,4ZM43,5.414,47.586,10H43ZM7,60V4H41v7a1,1,0,0,0,1,1h7V60Zm50-2H51V11a1,1,0,0,0-.293-.707L46.414,6H57Z"/></svg>
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/api/third-party-keys-service.ts b/flowsint-app/src/renderer/src/api/third-party-keys-service.ts
new file mode 100644
index 00000000..a4a9c1cf
--- /dev/null
+++ b/flowsint-app/src/renderer/src/api/third-party-keys-service.ts
@@ -0,0 +1,12 @@
+import { fetchWithAuth } from './api'
+
+export const ThirdPartyKeysService = {
+ get: () => fetchWithAuth(`/api/third_party_keys`, { method: 'GET' }),
+ getServices: () => fetchWithAuth(`/api/third_party_keys/services`, { method: 'GET' }),
+ getById: (key_id: string) => fetchWithAuth(`/api/third_party_keys/${key_id}`, { method: 'GET' }),
+ create: (data: { service: string; key: string }) => fetchWithAuth(`/api/third_party_keys/create`, {
+ method: 'POST',
+ body: JSON.stringify(data)
+ }),
+ deleteById: (key_id: string) => fetchWithAuth(`/api/third_party_keys/${key_id}`, { method: 'DELETE' }),
+}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
index 8a446cae..273b57b7 100644
--- a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
@@ -5,7 +5,7 @@ import { analysisService } from "@/api/analysis-service"
import type { Analysis } from "@/types"
import { Button } from "@/components/ui/button"
import { Skeleton } from "@/components/ui/skeleton"
-import { PlusIcon, Trash2, Save, Sparkles, XIcon, ChevronDown, ChevronsRight, ExternalLink } from "lucide-react"
+import { PlusIcon, Trash2, Save, Sparkles, XIcon, ChevronDown, ChevronsRight, ExternalLink, Send, Zap, FileText, Code2, X, ImageIcon, ArrowUp, Settings } from "lucide-react"
import { toast } from "sonner"
import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
import { useConfirm } from "../use-confirm-dialog"
@@ -19,6 +19,10 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
+import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"
+import { Badge } from "../ui/badge"
+import { Separator } from "../ui/separator"
+import { useGraphStore } from "@/stores/graph-store"
interface AnalysisEditorProps {
// Core data
@@ -73,8 +77,8 @@ export const AnalysisEditor = ({
const [titleValue, setTitleValue] = useState("")
const [editor, setEditor] = useState<Editor | undefined>(undefined)
const [isEditingTitle, setIsEditingTitle] = useState(false)
- const [includeContext, setIncludeContext] = useState(false)
-
+ const selectedNodes = useGraphStore(s => s.selectedNodes)
+ const clearSelectedNodes = useGraphStore(s => s.clearSelectedNodes)
// Chat hook
const {
isAiLoading,
@@ -239,7 +243,7 @@ export const AnalysisEditor = ({
<div className={`flex flex-col h-full w-full ${className}`}>
{/* Header */}
{showHeader && (
- <div className="border-b bg-background h-11 w-full flex items-center justify-between">
+ <div className="border-b bg-card h-11 w-full flex items-center justify-between">
<div className="flex items-center justify-between p-3 w-full">
{/* Left section with navigation and title */}
<div className="flex items-center gap-3 flex-1 min-w-0">
@@ -383,83 +387,88 @@ export const AnalysisEditor = ({
{/* Editor */}
<div className="flex-1 min-h-0 flex flex-col">
{analysis ? (
- <>
- <div className="flex-1 h-full w-full">
- <MinimalTiptapEditor
- key={analysis.id}
- immediatelyRender={true}
- value={editorValue}
- onChange={setEditorValue}
- className="w-full flex-1"
- editorContentClassName="p-5 min-h-[300px]"
- output="json"
- placeholder="Enter your analysis..."
- autofocus={true}
- editable={true}
- editorClassName="focus:outline-hidden"
- onEditorReady={setEditor}
- />
- </div>
- {/* Prompt Panel */}
- <div className={`border-t bg-background transition-all duration-200 ${promptOpen ? 'h-[300px]' : 'h-0'}`}>
- <div className="flex flex-col h-full">
- <div className="flex items-center justify-between p-2 border-b">
- <div className="flex items-center gap-2">
- <Sparkles className="w-4 h-4" strokeWidth={1.5} />
- <span className="text-sm font-medium">AI Prompt</span>
- </div>
- <Button
- variant="ghost"
- size="icon"
- onClick={() => setPromptOpen(false)}
- className="h-6 w-6 px-2"
- >
- <XIcon />
- </Button>
- </div>
- <div className="flex-1 p-2 flex flex-col gap-2">
- <div className="flex items-center gap-2">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => setIncludeContext(!includeContext)}
- className="h-6 px-2"
- >
- {includeContext ? "Hide Context" : "Show Context"}
- </Button>
- {includeContext && (
- <span className="text-xs text-muted-foreground">
- Current analysis content will be included as context
- </span>
- )}
- </div>
- {includeContext && (
- <Textarea
- autoFocus
- value={JSON.stringify(editorValue, null, 2)}
- readOnly
- className="h-[100px] text-xs font-mono resize-none"
- />
- )}
- <Textarea
- placeholder="Enter your prompt..."
- value={customPrompt}
- onChange={(e) => setCustomPrompt(e.target.value)}
- className="flex-1 resize-none"
- />
- </div>
- <div className="p-2 border-t">
- <Button
- onClick={() => handleCustomPrompt(editorValue)}
- disabled={!customPrompt.trim() || isAiLoading}
- className="w-full"
- >
- {isAiLoading ? "Generating..." : "Generate"}
- </Button>
- </div>
+ <ResizablePanelGroup autoSaveId="conditional" direction="vertical" className="h-full">
+ <ResizablePanel
+ id="editor"
+ defaultSize={promptOpen ? 70 : 100}
+ minSize={30}
+ className="transition-all duration-200"
+ >
+ <div className="h-full w-full">
+ <MinimalTiptapEditor
+ key={analysis.id}
+ immediatelyRender={true}
+ value={editorValue}
+ onChange={setEditorValue}
+ className="w-full h-full"
+ editorContentClassName="p-5 min-h-[300px]"
+ output="json"
+ placeholder="Enter your analysis..."
+ autofocus={true}
+ editable={true}
+ editorClassName="focus:outline-hidden"
+ onEditorReady={setEditor}
+ />
</div>
- </div>
- </>
+ </ResizablePanel>
+
+ {promptOpen && (
+ <>
+ <ResizableHandle withHandle />
+ <ResizablePanel id="chat" defaultSize={30} minSize={20} maxSize={50} className="transition-all duration-200">
+ <div className="h-full bg-card flex flex-col">
+ <div className="flex flex-col h-full">
+ {/* File Tabs Header */}
+ <div className="flex items-center bg-background border-b p-1">
+ {selectedNodes?.length > 0 && <Badge variant={"outline"} className="flex items-center gap-1 pr-1">
+ {selectedNodes?.length} entities(s) in context
+ <Button size={"icon"} variant={"ghost"} className="h-5 w-5 rounded-full" onClick={clearSelectedNodes}>
+ <XIcon className="h-3 w-3" />
+ </Button>
+ </Badge>}
+ <div className="ml-auto pr-2">
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={() => setPromptOpen(false)}
+ className="h-6 w-6 text-[#888] hover:text-white hover:bg-[#333]"
+ >
+ <X className="w-3 h-3" />
+ </Button>
+ </div>
+ </div>
+ {/* Bottom Input Bar */}
+ <div className="border-t bg-card grow">
+ <div className="p-3 h-full">
+ <div className="relative h-full">
+ <Textarea
+ placeholder="Enter your prompt..."
+ value={customPrompt}
+ autoFocus
+ onChange={(e) => setCustomPrompt(e.target.value)}
+ className="h-full resize-none bg-background focus:ring-1 pr-12"
+ />
+ <Button
+ onClick={() => handleCustomPrompt(editorValue)}
+ disabled={!customPrompt.trim() || isAiLoading}
+ size="icon"
+ className="absolute bottom-2 right-2 h-8 w-8 bg-[#444] hover:bg-[#555] text-white disabled:opacity-50"
+ >
+ {isAiLoading ? (
+ <div className="w-4 h-4 border-2 border-[#888] border-t-white rounded-full animate-spin" />
+ ) : (
+ <ArrowUp className="w-4 h-4" />
+ )}
+ </Button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </ResizablePanel>
+ </>
+ )}
+ </ResizablePanelGroup>
) : (
<div className="flex flex-col items-center justify-center h-full text-muted-foreground space-y-3">
<div>No analysis selected.</div>
diff --git a/flowsint-app/src/renderer/src/components/dashboard/useful-resources.tsx b/flowsint-app/src/renderer/src/components/dashboard/useful-resources.tsx
index f25460d4..558360a2 100644
--- a/flowsint-app/src/renderer/src/components/dashboard/useful-resources.tsx
+++ b/flowsint-app/src/renderer/src/components/dashboard/useful-resources.tsx
@@ -6,7 +6,7 @@ export function UsefulResources() {
return (
<div className="w-full mt-10">
<h3 className="text-lg font-semibold mb-2">Useful Resources</h3>
- <div className="flex flex-wrap gap-4">
+ <div className="flex flex-col gap-4">
<Card className='gap-3 grow'>
<CardHeader>
<CardTitle>API Reference</CardTitle>
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
index 4522da2d..250e0218 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
@@ -116,7 +116,7 @@ const GraphPanel = ({ graphData, isLoading, isRefetching }: GraphPanelProps) =>
</div>
</div>
}>
- {nodes?.length > 400 || view === "force" ? <Graph /> : <WallEditor isRefetching={isRefetching} isLoading={loading} />}
+ {nodes?.length > 300 || view === "force" ? <Graph /> : <WallEditor isRefetching={isRefetching} isLoading={loading} />}
{/* <GraphReactForce /> */}
</Suspense>
{/* <Graph /> */}
diff --git a/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx b/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
index 83e76f83..806486fd 100644
--- a/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/launch-transform.tsx
@@ -35,7 +35,7 @@ const LaunchTransform = ({ values, type }: { values: string[], type: string }) =
const [selectedTransform, setSelectedTransform] = useState<Transform | null>(null)
const { data: transforms, isLoading } = useQuery({
- queryKey: ["dashboard", "transforms", type],
+ queryKey: ["transforms", type],
queryFn: () => transformService.get(type),
refetchOnWindowFocus: true,
})
@@ -86,8 +86,8 @@ const LaunchTransform = ({ values, type }: { values: string[], type: string }) =
<Card
key={transform.id}
className={`cursor-pointer border py-1 transition-all ${selectedTransform?.id === transform.id
- ? "border-primary bg-primary/5"
- : "hover:border-primary/50"
+ ? "border-primary bg-primary/5"
+ : "hover:border-primary/50"
}`}
onClick={() => handleSelectTransform(transform)}
>
diff --git a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
index 646d013e..2e5eba1a 100644
--- a/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/new-actions.tsx
@@ -24,7 +24,6 @@ interface ActionDialogProps {
}
export default function ActionDialog({ children, setCurrentNode }: ActionDialogProps) {
- const colors = useNodesDisplaySettings(s => s.colors)
const handleOpenFormModal = useGraphStore(state => state.handleOpenFormModal)
const currentNodeType = useGraphStore(state => state.currentNodeType)
const openMainDialog = useGraphStore(state => state.openMainDialog)
@@ -46,19 +45,16 @@ export default function ActionDialog({ children, setCurrentNode }: ActionDialogP
const label_key = currentNodeType.fields.find((f: FormField) => f.name === currentNodeType.label_key)?.name || currentNodeType.fields[0].name
const label = data[label_key as keyof typeof data]
const type = currentNodeType.type
- const color = colors[type as keyof typeof colors]
const newNode = {
type: "custom",
- caption: label,
label: label,
- color,
data: {
...flattenObj(data),
- color,
label,
type: type.toLowerCase(),
},
}
+ console.log(newNode)
if (addNode) addNode(newNode as any)
setOpenFormDialog(false)
toast.success("New node added.")
diff --git a/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx b/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
index 98a981fb..8aafcb54 100644
--- a/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/toolbar.tsx
@@ -5,14 +5,11 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
import { useConfirm } from "@/components/use-confirm-dialog"
import { useGraphControls } from "@/stores/graph-controls-store"
import { useGraphStore } from "@/stores/graph-store"
-import { useModalStore } from "@/stores/store-settings"
import {
- Filter,
Maximize,
Minus,
Trash,
ZoomIn,
- Settings,
RotateCw,
GitPullRequestCreate,
GitFork,
@@ -23,6 +20,7 @@ import { sketchService } from "@/api/sketch-service"
import { useParams } from "@tanstack/react-router"
import { toast } from "sonner"
import { cn } from "@/lib/utils"
+import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
// Tooltip wrapper component to avoid repetition
const ToolbarButton = memo(function ToolbarButton({
@@ -64,13 +62,13 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
const setOpenAddRelationDialog = useGraphStore((state) => state.setOpenAddRelationDialog)
const setView = useGraphControls((s) => s.setView)
const removeNodes = useGraphStore((state) => state.removeNodes)
- const toggleSettings = useModalStore((s) => s.toggleSettings)
const zoomToFit = useGraphControls((s) => s.zoomToFit);
const zoomIn = useGraphControls((s) => s.zoomIn);
const zoomOut = useGraphControls((s) => s.zoomOut);
const onLayout = useGraphControls((s) => s.onLayout);
const { confirm } = useConfirm()
const refetchGraph = useGraphControls((s) => s.refetchGraph)
+ const nodesLength = useGraphStore((s) => s.getNodesLength())
const handleRefresh = useCallback(() => {
try {
@@ -103,6 +101,7 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
}
const isMoreThanZero = selectedNodes.length > 0
const isTwo = selectedNodes.length == 2
+ const isGraphOnly = nodesLength > 300
const handleForceLayout = useCallback(() => {
setView("force")
@@ -113,8 +112,15 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
onLayout && onLayout("dagre")
}, [onLayout, setView])
+
+ const { isMac } = useKeyboardShortcut({
+ key: "y",
+ ctrlOrCmd: true,
+ callback: handleDagreLayout
+ })
+
return (
- <div className="flex justify-start gap-2 items-center space-y-1 py-1">
+ <div className="flex justify-start gap-2 items-center">
<TooltipProvider>
<ToolbarButton
onClick={handleOpenRelationshipDialog}
@@ -147,13 +153,15 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
/>
<ToolbarButton
icon={<Waypoints className="h-4 w-4 opacity-70" />}
- tooltip="Graph"
+ tooltip={isGraphOnly ? "Graph is rendered in force layout only" : "Graph"}
onClick={handleForceLayout}
+ disabled={isGraphOnly}
/>
<ToolbarButton
icon={<GitFork className="h-4 w-4 opacity-70" />}
- tooltip="Hierarchy"
+ tooltip={isGraphOnly ? "Graph is too large to render in hierarchy layout" : `Hierarchy (${isMac ? '⌘' : 'ctrl'}+Y)`}
onClick={handleDagreLayout}
+ disabled={isGraphOnly}
/>
{/* <ToolbarButton onClick={toggleSettings} icon={<Settings className="h-4 w-4 opacity-70" />} tooltip="Settings" /> */}
<ToolbarButton
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
index 62e78a02..8da60639 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/context-menu.tsx
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { memo, useCallback, useState } from 'react';
import { transformService } from '@/api/transfrom-service';
import { useQuery } from '@tanstack/react-query';
import { Skeleton } from '@/components/ui/skeleton';
@@ -6,9 +6,17 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Pencil, Trash2, FileCode2, Search, Info, Star } from 'lucide-react';
import { Transform } from '@/types';
-import { GraphNode } from '@/stores/graph-store';
+import { GraphNode, useGraphStore } from '@/stores/graph-store';
import { useLaunchTransform } from '@/hooks/use-launch-transform';
import { useParams } from '@tanstack/react-router';
+import { cn } from '@/lib/utils';
+import { useConfirm } from '@/components/use-confirm-dialog';
+import { toast } from 'sonner';
+import { sketchService } from '@/api/sketch-service';
+
+function capitalizeFirstLetter(string: string) {
+ return string.charAt(0).toUpperCase() + string.slice(1)
+}
export default function ContextMenu({
node,
@@ -16,8 +24,11 @@ export default function ContextMenu({
left,
right,
bottom,
+ wrapperWidth,
+ wrapperHeight,
onEdit,
onDelete,
+ setMenu,
...props
}: {
node: GraphNode;
@@ -25,16 +36,22 @@ export default function ContextMenu({
left: number;
right: number;
bottom: number;
+ wrapperWidth: number;
+ wrapperHeight: number;
onEdit?: () => void;
onDelete?: () => void;
+ setMenu: (menu: any | null) => void;
[key: string]: any;
}) {
- const { id } = useParams({ strict: false })
+ const { id: sketchId } = useParams({ strict: false })
const [searchQuery, setSearchQuery] = useState('');
+ const { confirm } = useConfirm();
const { launchTransform } = useLaunchTransform(false);
+ const removeNodes = useGraphStore(s => s.removeNodes);
const { data: transforms, isLoading } = useQuery({
- queryKey: ["transforms"],
- queryFn: () => transformService.get(),
+ queryKey: ["transforms", node.data.type],
+ queryFn: () => transformService.get(capitalizeFirstLetter(node.data.type)),
+ // queryFn: () => transformService.get(),
});
const filteredTransforms = transforms?.filter((transform: Transform) => {
@@ -45,38 +62,89 @@ export default function ContextMenu({
return matchesName || matchesDescription;
}) || [];
- const handleMenuClick = (e: React.MouseEvent) => {
- e.stopPropagation();
+ // Calculate dynamic dimensions based on available space
+ const maxWidth = 320; // Default width (w-80)
+ const maxHeight = 500; // Default height (h-96)
+ const minWidth = 280; // Minimum width
+ const minHeight = 200; // Minimum height
+
+ // Calculate available space based on menu position and wrapper dimensions
+ let availableWidth = maxWidth;
+ let availableHeight = maxHeight;
+
+ if (left > 0) {
+ // Menu is positioned from left, so available width is from left to right edge
+ availableWidth = wrapperWidth - left - 20; // 20px padding from right edge
+ } else if (right > 0) {
+ // Menu is positioned from right, so available width is from left edge to right position
+ availableWidth = wrapperWidth - right - 20; // 20px padding from left edge
+ }
+
+ if (top > 0) {
+ // Menu is positioned from top, so available height is from top to bottom edge
+ availableHeight = wrapperHeight - top - 20; // 20px padding from bottom edge
+ } else if (bottom > 0) {
+ // Menu is positioned from bottom, so available height is from top edge to bottom position
+ availableHeight = wrapperHeight - bottom - 20; // 20px padding from top edge
+ }
+
+ // Determine dynamic dimensions
+ const dynamicWidth = Math.min(maxWidth, Math.max(minWidth, availableWidth));
+ const dynamicHeight = Math.min(maxHeight, Math.max(minHeight, availableHeight));
+
+ // Calculate dynamic styles
+ const dynamicStyles = {
+ width: `${dynamicWidth}px`,
+ maxHeight: `${dynamicHeight}px`,
+ top: top > 0 ? `${top}px` : 'auto',
+ left: left > 0 ? `${left}px` : 'auto',
+ right: right > 0 ? `${right}px` : 'auto',
+ bottom: bottom > 0 ? `${bottom}px` : 'auto',
};
- const handleButtonClick = (e: React.MouseEvent, action?: () => void) => {
+ const handleMenuClick = (e: React.MouseEvent) => {
e.stopPropagation();
- action?.();
};
+ const handleDeleteNode = async () => {
+ if (!node.id || !sketchId) return
+ if (!await confirm({ title: `You are about to delete this node ?`, message: "The action is irreversible." })) return
+ toast.promise(
+ (async () => {
+ removeNodes([node.id])
+ return sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: [node.id] }))
+ })(),
+ {
+ loading: `Deleting ${node.data.label}...`,
+ success: 'Node deleted successfully.',
+ error: 'Failed to delete node.'
+ }
+ )
+ }
+
const handleTransformClick = (e: React.MouseEvent, transformId: string) => {
e.stopPropagation();
- launchTransform([node.data.label], transformId, id)
+ launchTransform([node.data.label], transformId, sketchId)
+ setMenu(null)
};
return (
<div
- style={{ top, left, right, bottom }}
- className="bg-background border border-border flex flex-col rounded-lg shadow-lg absolute z-50 w-80 h-96"
+ style={dynamicStyles}
+ className="bg-background border border-border flex flex-col rounded-lg shadow-lg absolute z-50"
onClick={handleMenuClick}
{...props}
>
{/* Header with title and action buttons */}
- <div className="px-3 py-2 border-b border-border flex items-center justify-between">
- <p className="text-xs text-muted-foreground font-medium truncate flex-1">
- {node.data.label} - {node.data.type}
- </p>
+ <div className="px-3 py-2 border-b border-border flex items-center justify-between flex-shrink-0">
+ <div className='flex text-xs items-center gap-1 truncate'>
+ <span className='block truncate'>{node.data.label}</span> - <span className='block'>{node.data.type}</span>
+ </div>
<div className="flex items-center gap-1 ml-2">
<Button
variant="ghost"
size="sm"
className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100"
- onClick={(e) => handleButtonClick(e, onEdit)}
>
<Pencil className="h-3 w-3" strokeWidth={1.5} />
</Button>
@@ -84,7 +152,7 @@ export default function ContextMenu({
variant="ghost"
size="sm"
className="h-6 w-6 p-0 hover:bg-muted opacity-70 hover:opacity-100 text-destructive hover:text-destructive"
- onClick={(e) => handleButtonClick(e, onDelete)}
+ onClick={handleDeleteNode}
>
<Trash2 className="h-3 w-3" strokeWidth={1.5} />
</Button>
@@ -92,7 +160,7 @@ export default function ContextMenu({
</div>
{/* Search bar */}
- <div className="px-3 py-2 border-b border-border">
+ <div className="px-3 py-2 border-b border-border flex-shrink-0">
<div className="relative">
<Search className="absolute left-2 top-1/2 transform -translate-y-1/2 h-3 w-3 text-muted-foreground" />
<Input
@@ -110,7 +178,7 @@ export default function ContextMenu({
</div>
{/* Transforms list */}
- <div className="flex-1 overflow-auto grow">
+ <div className="flex-1 overflow-auto min-h-0">
{isLoading ? (
<div className="p-2 space-y-2">
{[...Array(8)].map((_, i) => (
@@ -144,9 +212,7 @@ export default function ContextMenu({
</div>
<div className='flex items-center gap-1'>
- <Button className='w-5 h-5' variant='ghost' size={"icon"}>
- <Star className='w-4 h-4 opacity-50' strokeWidth={1.5} />
- </Button>
+ <FavoriteButton isFavorite={false} />
<Button className='w-5 h-5' variant='ghost' size={"icon"}>
<Info className='w-4 h-4 opacity-50' strokeWidth={1.5} />
</Button>
@@ -165,3 +231,19 @@ export default function ContextMenu({
</div>
);
}
+
+
+const FavoriteButton = memo(({ isFavorite }: { isFavorite: boolean }) => {
+ const [favorite, seFavorite] = useState(isFavorite);
+
+ const handleClick = useCallback((e: React.MouseEvent) => {
+ e.stopPropagation();
+ seFavorite(!favorite);
+ }, [favorite]);
+
+ return (
+ <Button onClick={handleClick} className='w-5 h-5' variant='ghost' size={"icon"}>
+ <Star fill={favorite ? 'yellow' : 'none'} className={cn('w-4 h-4 opacity-50', favorite && 'text-yellow-500 opacity-100')} strokeWidth={1.5} />
+ </Button>
+ )
+})
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
index 0e11346b..b0c02cd7 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/custom/custom-node.tsx
@@ -60,7 +60,7 @@ export const CustomNode = memo(({ data, selected, id }: NodeProps) => {
id="bottom"
className="opacity-0"
/>
- <div style={{ width: size, height: size, borderColor: (selected || isCurrent(id)) ? "#f97316" : color }} className="!rounded-full gap-0 bg-card flex items-center justify-center border-2 border-primary/70 p-1 overflow-hidden">
+ <div style={{ width: size, height: size, borderColor: (selected || isCurrent(id)) ? "#f97316" : color }} className="!rounded-full gap-0 flex items-center justify-center border-2 border-primary/70 p-1 overflow-hidden">
<img
src={iconUrl}
alt={data?.label as string ?? "N/A"}
diff --git a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
index b457f69f..992ab638 100644
--- a/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/wall/wall.tsx
@@ -59,6 +59,9 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
left: number;
right: number;
bottom: number;
+ wrapperWidth: number;
+ wrapperHeight: number;
+ setMenu: (menu: any | null) => void;
} | null>(null);
@@ -200,13 +203,42 @@ const Wall = memo(({ theme, edges }: { theme: ColorMode, edges: GraphEdge[] }) =
const relativeX = event.clientX - pane.left;
const relativeY = event.clientY - pane.top;
+ // Calculate available space in each direction
+ const menuWidth = 320; // Default menu width
+ const menuHeight = 250; // Use a more reasonable height for overflow calculation
+ const padding = 20; // Minimum padding from edges
+
+ // Determine if menu would overflow in each direction
+ const wouldOverflowRight = relativeX + menuWidth + padding > pane.width;
+ const wouldOverflowBottom = relativeY + menuHeight + padding > pane.height;
+
+ // Calculate final position
+ let finalTop = 0;
+ let finalLeft = 0;
+ let finalRight = 0;
+ let finalBottom = 0;
+
+ if (wouldOverflowRight) {
+ finalRight = pane.width - relativeX;
+ } else {
+ finalLeft = relativeX;
+ }
+
+ if (wouldOverflowBottom) {
+ finalBottom = pane.height - relativeY;
+ } else {
+ finalTop = relativeY;
+ }
+
setMenu({
node: node as GraphNode,
- top: relativeY < pane.height - 200 ? relativeY : 0,
- left: relativeX < pane.width - 200 ? relativeX : 0,
- right: relativeX >= pane.width - 200 ? pane.width - relativeX : 0,
- bottom:
- relativeY >= pane.height - 200 ? pane.height - relativeY : 0,
+ top: finalTop,
+ left: finalLeft,
+ right: finalRight,
+ bottom: finalBottom,
+ wrapperWidth: pane.width,
+ wrapperHeight: pane.height,
+ setMenu: setMenu,
});
},
[setMenu],
diff --git a/flowsint-app/src/renderer/src/components/layout/log-panel.tsx b/flowsint-app/src/renderer/src/components/layout/log-panel.tsx
index 07d97abb..7a09b589 100644
--- a/flowsint-app/src/renderer/src/components/layout/log-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/log-panel.tsx
@@ -1,7 +1,6 @@
"use client"
import { ScrollArea } from "../ui/scroll-area"
-import { useEvents } from "@/hooks/use-events"
import { Badge } from "../ui/badge"
import { logService } from "@/api/log-service"
import { useConfirm } from "../use-confirm-dialog"
@@ -20,11 +19,12 @@ import {
FileText,
Trash2,
} from "lucide-react"
-import { useEffect, useRef, useState } from "react"
+import { useEffect, useRef } from "react"
import { CopyButton } from "../copy"
import { EventLevel } from "@/types"
import { cn } from "@/lib/utils"
import { Button } from "../ui/button"
+import { type Event } from "@/types"
const logLevelConfig = {
[EventLevel.INFO]: {
@@ -100,19 +100,17 @@ const defaultConfig = {
emoji: "📝",
}
-export function LogPanel() {
+export function LogPanel({ logs, refetch }: { logs: Event[], refetch: () => void }) {
const { id: sketch_id } = useParams({ strict: false })
- const { logs, refetch } = useEvents(sketch_id)
const { confirm } = useConfirm()
- const [isAutoScroll, setIsAutoScroll] = useState(true)
const bottomRef = useRef<HTMLDivElement | null>(null)
const scrollAreaRef = useRef<HTMLDivElement>(null)
useEffect(() => {
- if (isAutoScroll && bottomRef.current) {
+ if (bottomRef.current) {
bottomRef.current.scrollIntoView({ behavior: "smooth" })
}
- }, [logs, isAutoScroll])
+ }, [logs])
const handleDeleteLogs = async () => {
if (!sketch_id) return
diff --git a/flowsint-app/src/renderer/src/components/layout/root.layout.tsx b/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
index edb5e297..2bdba1a7 100644
--- a/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/root.layout.tsx
@@ -7,10 +7,10 @@ import { ConfirmContextProvider } from "@/components/use-confirm-dialog"
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "../ui/resizable"
import { LogPanel } from "./log-panel"
import { useLayoutStore } from "@/stores/layout-store"
-import { PathBreadcrumb } from "./breadcrumb"
import NotesPanel from "../analyses/notes-panel"
import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
import { useParams } from "@tanstack/react-router"
+import { useEvents } from "@/hooks/use-events"
interface LayoutProps {
children: ReactNode
@@ -28,6 +28,8 @@ export default function RootLayout({ children }: LayoutProps) {
const closeChat = useLayoutStore(s => s.closeChat)
const openChat = useLayoutStore(s => s.openChat)
const { investigationId, type, id } = useParams({ strict: false })
+ const { logs, refetch } = useEvents(id as string)
+
// Set up keyboard shortcut for chat panel
useKeyboardShortcut({
@@ -132,7 +134,7 @@ export default function RootLayout({ children }: LayoutProps) {
maxSize={50}
>
<div className="h-full overflow-hidden">
- <LogPanel />
+ <LogPanel logs={logs} refetch={refetch} />
</div>
</ResizablePanel>
</>
diff --git a/flowsint-app/src/renderer/src/components/layout/status-bar.tsx b/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
index f1b68e49..462103a7 100644
--- a/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
@@ -3,6 +3,7 @@ import { HelpCircle, Terminal, Trash, Unlock } from "lucide-react"
import { ModeToggle } from "../mode-toggle"
import { useLayoutStore } from "@/stores/layout-store"
import Legend from "../graphs/legend"
+import { Link } from "@tanstack/react-router"
export function StatusBar() {
const isOpenConsole = useLayoutStore(s => s.isOpenConsole)
@@ -23,10 +24,12 @@ export function StatusBar() {
</div>
<div className="flex-1"></div>
<div className="flex items-center gap-2">
- <Button variant="ghost" size="sm" className="h-6 gap-1 text-xs">
- <Unlock strokeWidth={1.4} className="h-3 w-3 opacity-60" />
- <span>Vault</span>
- </Button>
+ <Link to="/dashboard/vault">
+ <Button variant="ghost" size="sm" className="h-6 gap-1 text-xs">
+ <Unlock strokeWidth={1.4} className="h-3 w-3 opacity-60" />
+ <span>Vault</span>
+ </Button>
+ </Link>
<Button variant="ghost" size="sm" className="h-6 gap-1 text-xs">
<Trash strokeWidth={1.4} className="h-3 w-3 opacity-60" />
<span>Trash</span>
diff --git a/flowsint-app/src/renderer/src/components/transforms/editor.tsx b/flowsint-app/src/renderer/src/components/transforms/editor.tsx
index 1bb09a92..d6add171 100644
--- a/flowsint-app/src/renderer/src/components/transforms/editor.tsx
+++ b/flowsint-app/src/renderer/src/components/transforms/editor.tsx
@@ -44,7 +44,7 @@ const nodeTypes: NodeTypes = {
}
interface TransformEditorProps {
- theme: ColorMode
+ theme?: ColorMode
initialEdges: TransformEdge[]
initialNodes: TransformNode[]
transform?: any
@@ -120,12 +120,7 @@ const TransformEditorFlow = memo(({ initialEdges, initialNodes, theme, transform
const scannerData = JSON.parse(event.dataTransfer.getData("application/json")) as ScannerNodeData & {
category: string
}
- if (scannerData.type === "input") {
- const existsInput = nodes.find((node) => node.data.type === "input")
- if (existsInput) {
- return toast.error("Only one input node is allowed")
- }
- }
+
if (scannerData.type === "type") {
const existsType = nodes.find((node) => node.data.type === "type")
if (existsType) {
@@ -220,7 +215,6 @@ const TransformEditorFlow = memo(({ initialEdges, initialNodes, theme, transform
setLoading(true)
try {
const inputType = nodes.find((node) => node.data.type === "type")?.data?.class_name
- console.log(nodes)
if (!inputType) {
toast.error("Make sure your transform contains an input type.")
return
diff --git a/flowsint-app/src/renderer/src/hooks/use-chat.ts b/flowsint-app/src/renderer/src/hooks/use-chat.ts
index 84b77a80..2cb57885 100644
--- a/flowsint-app/src/renderer/src/hooks/use-chat.ts
+++ b/flowsint-app/src/renderer/src/hooks/use-chat.ts
@@ -99,7 +99,8 @@ export const useChat = ({ onContentUpdate, onSuccess, editor }: UseChatOptions)
return
}
const content = typeof currentContent === 'string' ? currentContent : JSON.stringify(currentContent)
- const context = selectedNodes ? `entities:${JSON.stringify(selectedNodes)}}\n\nContext:\n${content}` : content
+ const nodeLabel = selectedNodes.map(node => node.data.label).join(", ")
+ const context = selectedNodes ? `entities:${nodeLabel}\n\nContext:\n${content}` : content
const fullPrompt = `${customPrompt}\n\nContext:\n${context}`
setPromptOpen(false)
setCustomPrompt("")
diff --git a/flowsint-app/src/renderer/src/lib/action-items.ts b/flowsint-app/src/renderer/src/lib/action-items.ts
index a606e8a2..ec90bfc2 100644
--- a/flowsint-app/src/renderer/src/lib/action-items.ts
+++ b/flowsint-app/src/renderer/src/lib/action-items.ts
@@ -81,7 +81,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 1,
- type: "individual",
+ type: "Individual",
table: "individuals",
key: "individual",
label_key: "first_name",
@@ -107,7 +107,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 512932,
- type: "username",
+ type: "Username",
table: "usernames",
key: "username",
icon: UserCheckIcon,
@@ -130,7 +130,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 24,
- type: "organization",
+ type: "Organization",
table: "organizations",
key: "organization",
icon: Building2,
@@ -170,7 +170,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 2,
- type: "phone",
+ type: "Phone",
table: "phones",
key: "phone",
label_key: "number",
@@ -190,7 +190,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 4,
- type: "email",
+ type: "Email",
table: "emails",
key: "email",
icon: AtSign,
@@ -213,7 +213,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 25,
- type: "website",
+ type: "Website",
table: "websites",
key: "website",
label_key: "url",
@@ -229,7 +229,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 259,
- type: "domain",
+ type: "Domain",
table: "domains",
key: "domain",
icon: Locate,
@@ -240,7 +240,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 2588,
- type: "subdomain",
+ type: "Subdomain",
table: "subdomains",
key: "subdomain",
label_key: "subomain",
@@ -251,7 +251,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 5,
- type: "ip",
+ type: "Ip",
table: "ips",
key: "ip",
icon: Locate,
@@ -274,7 +274,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 215,
- type: "wallet",
+ type: "CryptoWallet",
table: "wallets",
key: "wallet",
label_key: "wallet",
@@ -309,7 +309,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 3,
- type: "address",
+ type: "PhysicalAddress",
table: "addresses",
label_key: "address",
key: "address",
@@ -329,7 +329,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 6,
- type: "social_profile",
+ type: "Socials",
size: "h-5 w-5",
table: "",
key: "social_profile",
@@ -340,7 +340,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 7,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_facebook",
label_key: "username",
@@ -356,7 +356,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 8,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_instagram",
label_key: "username",
@@ -372,7 +372,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 9,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_telegram",
label_key: "username",
@@ -388,7 +388,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 10,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_signal",
label_key: "username",
@@ -404,7 +404,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 11,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_snapchat",
label_key: "username",
@@ -420,7 +420,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 12,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_github",
label_key: "username",
@@ -435,7 +435,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 13,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_coco",
label_key: "username",
@@ -452,7 +452,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 18,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_linkedin",
label_key: "username",
@@ -468,7 +468,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 19,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_twitter",
label_key: "username",
@@ -483,7 +483,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 20,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_tiktok",
label_key: "username",
@@ -498,7 +498,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 21,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_reddit",
label_key: "username",
@@ -514,7 +514,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 22,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_discord",
label_key: "username",
@@ -530,7 +530,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 2343,
- type: "social_profile",
+ type: "SocialProfile",
table: "social_profiles",
key: "social_profiles_twitch",
label_key: "username",
@@ -558,7 +558,7 @@ export const actionItems: ActionItem[] = [
children: [
{
id: 15,
- type: "vehicle",
+ type: "Vehicle",
table: "vehicles",
key: "vehicles_car",
icon: Car,
@@ -575,7 +575,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 16,
- type: "vehicle",
+ type: "Vehicle",
table: "vehicles",
key: "vehicles_motorcycle",
label_key: "plate",
@@ -592,7 +592,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 17,
- type: "vehicle",
+ type: "Vehicle",
table: "vehicles",
key: "vehicles_boat",
label_key: "plate",
@@ -609,7 +609,7 @@ export const actionItems: ActionItem[] = [
},
{
id: 23,
- type: "vehicle",
+ type: "Vehicle",
table: "vehicles",
key: "vehicles_aircraft",
icon: Plane,
diff --git a/flowsint-app/src/renderer/src/routeTree.gen.ts b/flowsint-app/src/renderer/src/routeTree.gen.ts
index cca52a19..cffff5f3 100644
--- a/flowsint-app/src/renderer/src/routeTree.gen.ts
+++ b/flowsint-app/src/renderer/src/routeTree.gen.ts
@@ -10,270 +10,113 @@
import { createFileRoute } from '@tanstack/react-router'
-// Import Routes
-
-import { Route as rootRoute } from './routes/__root'
-import { Route as RegisterImport } from './routes/register'
-import { Route as MiddlewareImport } from './routes/middleware'
-import { Route as LoginImport } from './routes/login'
-import { Route as AuthImport } from './routes/_auth'
-import { Route as IndexImport } from './routes/index'
-import { Route as AuthDashboardImport } from './routes/_auth.dashboard'
-import { Route as AuthDashboardIndexImport } from './routes/_auth.dashboard.index'
-import { Route as AuthDashboardToolsImport } from './routes/_auth.dashboard.tools'
-import { Route as AuthDashboardTransformsIndexImport } from './routes/_auth.dashboard.transforms.index'
-import { Route as AuthDashboardInvestigationsIndexImport } from './routes/_auth.dashboard.investigations.index'
-import { Route as AuthDashboardTransformsTransformIdImport } from './routes/_auth.dashboard.transforms.$transformId'
-import { Route as AuthDashboardInvestigationsInvestigationIdIndexImport } from './routes/_auth.dashboard.investigations.$investigationId.index'
-import { Route as AuthDashboardInvestigationsInvestigationIdTypeIdImport } from './routes/_auth.dashboard.investigations.$investigationId.$type.$id'
-
-// Create Virtual Routes
-
-const ToolbarLazyImport = createFileRoute('/toolbar')()
-
-// Create/Update Routes
-
-const ToolbarLazyRoute = ToolbarLazyImport.update({
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as RegisterRouteImport } from './routes/register'
+import { Route as MiddlewareRouteImport } from './routes/middleware'
+import { Route as LoginRouteImport } from './routes/login'
+import { Route as AuthRouteImport } from './routes/_auth'
+import { Route as IndexRouteImport } from './routes/index'
+import { Route as AuthDashboardRouteImport } from './routes/_auth.dashboard'
+import { Route as AuthDashboardIndexRouteImport } from './routes/_auth.dashboard.index'
+import { Route as AuthDashboardVaultRouteImport } from './routes/_auth.dashboard.vault'
+import { Route as AuthDashboardToolsRouteImport } from './routes/_auth.dashboard.tools'
+import { Route as AuthDashboardTransformsIndexRouteImport } from './routes/_auth.dashboard.transforms.index'
+import { Route as AuthDashboardInvestigationsIndexRouteImport } from './routes/_auth.dashboard.investigations.index'
+import { Route as AuthDashboardTransformsTransformIdRouteImport } from './routes/_auth.dashboard.transforms.$transformId'
+import { Route as AuthDashboardInvestigationsInvestigationIdIndexRouteImport } from './routes/_auth.dashboard.investigations.$investigationId.index'
+import { Route as AuthDashboardInvestigationsInvestigationIdTypeIdRouteImport } from './routes/_auth.dashboard.investigations.$investigationId.$type.$id'
+
+const ToolbarLazyRouteImport = createFileRoute('/toolbar')()
+
+const ToolbarLazyRoute = ToolbarLazyRouteImport.update({
id: '/toolbar',
path: '/toolbar',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any).lazy(() => import('./routes/toolbar.lazy').then((d) => d.Route))
-
-const RegisterRoute = RegisterImport.update({
+const RegisterRoute = RegisterRouteImport.update({
id: '/register',
path: '/register',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
-
-const MiddlewareRoute = MiddlewareImport.update({
+const MiddlewareRoute = MiddlewareRouteImport.update({
id: '/middleware',
path: '/middleware',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
-
-const LoginRoute = LoginImport.update({
+const LoginRoute = LoginRouteImport.update({
id: '/login',
path: '/login',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
-
-const AuthRoute = AuthImport.update({
+const AuthRoute = AuthRouteImport.update({
id: '/_auth',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
-
-const IndexRoute = IndexImport.update({
+const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
- getParentRoute: () => rootRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
-
-const AuthDashboardRoute = AuthDashboardImport.update({
+const AuthDashboardRoute = AuthDashboardRouteImport.update({
id: '/dashboard',
path: '/dashboard',
getParentRoute: () => AuthRoute,
} as any)
-
-const AuthDashboardIndexRoute = AuthDashboardIndexImport.update({
+const AuthDashboardIndexRoute = AuthDashboardIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
-const AuthDashboardToolsRoute = AuthDashboardToolsImport.update({
+const AuthDashboardVaultRoute = AuthDashboardVaultRouteImport.update({
+ id: '/vault',
+ path: '/vault',
+ getParentRoute: () => AuthDashboardRoute,
+} as any)
+const AuthDashboardToolsRoute = AuthDashboardToolsRouteImport.update({
id: '/tools',
path: '/tools',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
const AuthDashboardTransformsIndexRoute =
- AuthDashboardTransformsIndexImport.update({
+ AuthDashboardTransformsIndexRouteImport.update({
id: '/transforms/',
path: '/transforms/',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
const AuthDashboardInvestigationsIndexRoute =
- AuthDashboardInvestigationsIndexImport.update({
+ AuthDashboardInvestigationsIndexRouteImport.update({
id: '/investigations/',
path: '/investigations/',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
const AuthDashboardTransformsTransformIdRoute =
- AuthDashboardTransformsTransformIdImport.update({
+ AuthDashboardTransformsTransformIdRouteImport.update({
id: '/transforms/$transformId',
path: '/transforms/$transformId',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
const AuthDashboardInvestigationsInvestigationIdIndexRoute =
- AuthDashboardInvestigationsInvestigationIdIndexImport.update({
+ AuthDashboardInvestigationsInvestigationIdIndexRouteImport.update({
id: '/investigations/$investigationId/',
path: '/investigations/$investigationId/',
getParentRoute: () => AuthDashboardRoute,
} as any)
-
const AuthDashboardInvestigationsInvestigationIdTypeIdRoute =
- AuthDashboardInvestigationsInvestigationIdTypeIdImport.update({
+ AuthDashboardInvestigationsInvestigationIdTypeIdRouteImport.update({
id: '/investigations/$investigationId/$type/$id',
path: '/investigations/$investigationId/$type/$id',
getParentRoute: () => AuthDashboardRoute,
} as any)
-// Populate the FileRoutesByPath interface
-
-declare module '@tanstack/react-router' {
- interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexImport
- parentRoute: typeof rootRoute
- }
- '/_auth': {
- id: '/_auth'
- path: ''
- fullPath: ''
- preLoaderRoute: typeof AuthImport
- parentRoute: typeof rootRoute
- }
- '/login': {
- id: '/login'
- path: '/login'
- fullPath: '/login'
- preLoaderRoute: typeof LoginImport
- parentRoute: typeof rootRoute
- }
- '/middleware': {
- id: '/middleware'
- path: '/middleware'
- fullPath: '/middleware'
- preLoaderRoute: typeof MiddlewareImport
- parentRoute: typeof rootRoute
- }
- '/register': {
- id: '/register'
- path: '/register'
- fullPath: '/register'
- preLoaderRoute: typeof RegisterImport
- parentRoute: typeof rootRoute
- }
- '/toolbar': {
- id: '/toolbar'
- path: '/toolbar'
- fullPath: '/toolbar'
- preLoaderRoute: typeof ToolbarLazyImport
- parentRoute: typeof rootRoute
- }
- '/_auth/dashboard': {
- id: '/_auth/dashboard'
- path: '/dashboard'
- fullPath: '/dashboard'
- preLoaderRoute: typeof AuthDashboardImport
- parentRoute: typeof AuthImport
- }
- '/_auth/dashboard/tools': {
- id: '/_auth/dashboard/tools'
- path: '/tools'
- fullPath: '/dashboard/tools'
- preLoaderRoute: typeof AuthDashboardToolsImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/': {
- id: '/_auth/dashboard/'
- path: '/'
- fullPath: '/dashboard/'
- preLoaderRoute: typeof AuthDashboardIndexImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/transforms/$transformId': {
- id: '/_auth/dashboard/transforms/$transformId'
- path: '/transforms/$transformId'
- fullPath: '/dashboard/transforms/$transformId'
- preLoaderRoute: typeof AuthDashboardTransformsTransformIdImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/investigations/': {
- id: '/_auth/dashboard/investigations/'
- path: '/investigations'
- fullPath: '/dashboard/investigations'
- preLoaderRoute: typeof AuthDashboardInvestigationsIndexImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/transforms/': {
- id: '/_auth/dashboard/transforms/'
- path: '/transforms'
- fullPath: '/dashboard/transforms'
- preLoaderRoute: typeof AuthDashboardTransformsIndexImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/investigations/$investigationId/': {
- id: '/_auth/dashboard/investigations/$investigationId/'
- path: '/investigations/$investigationId'
- fullPath: '/dashboard/investigations/$investigationId'
- preLoaderRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexImport
- parentRoute: typeof AuthDashboardImport
- }
- '/_auth/dashboard/investigations/$investigationId/$type/$id': {
- id: '/_auth/dashboard/investigations/$investigationId/$type/$id'
- path: '/investigations/$investigationId/$type/$id'
- fullPath: '/dashboard/investigations/$investigationId/$type/$id'
- preLoaderRoute: typeof AuthDashboardInvestigationsInvestigationIdTypeIdImport
- parentRoute: typeof AuthDashboardImport
- }
- }
-}
-
-// Create and export the route tree
-
-interface AuthDashboardRouteChildren {
- AuthDashboardToolsRoute: typeof AuthDashboardToolsRoute
- AuthDashboardIndexRoute: typeof AuthDashboardIndexRoute
- AuthDashboardTransformsTransformIdRoute: typeof AuthDashboardTransformsTransformIdRoute
- AuthDashboardInvestigationsIndexRoute: typeof AuthDashboardInvestigationsIndexRoute
- AuthDashboardTransformsIndexRoute: typeof AuthDashboardTransformsIndexRoute
- AuthDashboardInvestigationsInvestigationIdIndexRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
- AuthDashboardInvestigationsInvestigationIdTypeIdRoute: typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
-}
-
-const AuthDashboardRouteChildren: AuthDashboardRouteChildren = {
- AuthDashboardToolsRoute: AuthDashboardToolsRoute,
- AuthDashboardIndexRoute: AuthDashboardIndexRoute,
- AuthDashboardTransformsTransformIdRoute:
- AuthDashboardTransformsTransformIdRoute,
- AuthDashboardInvestigationsIndexRoute: AuthDashboardInvestigationsIndexRoute,
- AuthDashboardTransformsIndexRoute: AuthDashboardTransformsIndexRoute,
- AuthDashboardInvestigationsInvestigationIdIndexRoute:
- AuthDashboardInvestigationsInvestigationIdIndexRoute,
- AuthDashboardInvestigationsInvestigationIdTypeIdRoute:
- AuthDashboardInvestigationsInvestigationIdTypeIdRoute,
-}
-
-const AuthDashboardRouteWithChildren = AuthDashboardRoute._addFileChildren(
- AuthDashboardRouteChildren,
-)
-
-interface AuthRouteChildren {
- AuthDashboardRoute: typeof AuthDashboardRouteWithChildren
-}
-
-const AuthRouteChildren: AuthRouteChildren = {
- AuthDashboardRoute: AuthDashboardRouteWithChildren,
-}
-
-const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)
-
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
- '': typeof AuthRouteWithChildren
'/login': typeof LoginRoute
'/middleware': typeof MiddlewareRoute
'/register': typeof RegisterRoute
'/toolbar': typeof ToolbarLazyRoute
'/dashboard': typeof AuthDashboardRouteWithChildren
'/dashboard/tools': typeof AuthDashboardToolsRoute
+ '/dashboard/vault': typeof AuthDashboardVaultRoute
'/dashboard/': typeof AuthDashboardIndexRoute
'/dashboard/transforms/$transformId': typeof AuthDashboardTransformsTransformIdRoute
'/dashboard/investigations': typeof AuthDashboardInvestigationsIndexRoute
@@ -281,15 +124,14 @@ export interface FileRoutesByFullPath {
'/dashboard/investigations/$investigationId': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
-
export interface FileRoutesByTo {
'/': typeof IndexRoute
- '': typeof AuthRouteWithChildren
'/login': typeof LoginRoute
'/middleware': typeof MiddlewareRoute
'/register': typeof RegisterRoute
'/toolbar': typeof ToolbarLazyRoute
'/dashboard/tools': typeof AuthDashboardToolsRoute
+ '/dashboard/vault': typeof AuthDashboardVaultRoute
'/dashboard': typeof AuthDashboardIndexRoute
'/dashboard/transforms/$transformId': typeof AuthDashboardTransformsTransformIdRoute
'/dashboard/investigations': typeof AuthDashboardInvestigationsIndexRoute
@@ -297,9 +139,8 @@ export interface FileRoutesByTo {
'/dashboard/investigations/$investigationId': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
-
export interface FileRoutesById {
- __root__: typeof rootRoute
+ __root__: typeof rootRouteImport
'/': typeof IndexRoute
'/_auth': typeof AuthRouteWithChildren
'/login': typeof LoginRoute
@@ -308,6 +149,7 @@ export interface FileRoutesById {
'/toolbar': typeof ToolbarLazyRoute
'/_auth/dashboard': typeof AuthDashboardRouteWithChildren
'/_auth/dashboard/tools': typeof AuthDashboardToolsRoute
+ '/_auth/dashboard/vault': typeof AuthDashboardVaultRoute
'/_auth/dashboard/': typeof AuthDashboardIndexRoute
'/_auth/dashboard/transforms/$transformId': typeof AuthDashboardTransformsTransformIdRoute
'/_auth/dashboard/investigations/': typeof AuthDashboardInvestigationsIndexRoute
@@ -315,18 +157,17 @@ export interface FileRoutesById {
'/_auth/dashboard/investigations/$investigationId/': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
'/_auth/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
}
-
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths:
| '/'
- | ''
| '/login'
| '/middleware'
| '/register'
| '/toolbar'
| '/dashboard'
| '/dashboard/tools'
+ | '/dashboard/vault'
| '/dashboard/'
| '/dashboard/transforms/$transformId'
| '/dashboard/investigations'
@@ -336,12 +177,12 @@ export interface FileRouteTypes {
fileRoutesByTo: FileRoutesByTo
to:
| '/'
- | ''
| '/login'
| '/middleware'
| '/register'
| '/toolbar'
| '/dashboard/tools'
+ | '/dashboard/vault'
| '/dashboard'
| '/dashboard/transforms/$transformId'
| '/dashboard/investigations'
@@ -358,6 +199,7 @@ export interface FileRouteTypes {
| '/toolbar'
| '/_auth/dashboard'
| '/_auth/dashboard/tools'
+ | '/_auth/dashboard/vault'
| '/_auth/dashboard/'
| '/_auth/dashboard/transforms/$transformId'
| '/_auth/dashboard/investigations/'
@@ -366,7 +208,6 @@ export interface FileRouteTypes {
| '/_auth/dashboard/investigations/$investigationId/$type/$id'
fileRoutesById: FileRoutesById
}
-
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
AuthRoute: typeof AuthRouteWithChildren
@@ -376,6 +217,155 @@ export interface RootRouteChildren {
ToolbarLazyRoute: typeof ToolbarLazyRoute
}
+declare module '@tanstack/react-router' {
+ interface FileRoutesByPath {
+ '/toolbar': {
+ id: '/toolbar'
+ path: '/toolbar'
+ fullPath: '/toolbar'
+ preLoaderRoute: typeof ToolbarLazyRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/register': {
+ id: '/register'
+ path: '/register'
+ fullPath: '/register'
+ preLoaderRoute: typeof RegisterRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/middleware': {
+ id: '/middleware'
+ path: '/middleware'
+ fullPath: '/middleware'
+ preLoaderRoute: typeof MiddlewareRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/login': {
+ id: '/login'
+ path: '/login'
+ fullPath: '/login'
+ preLoaderRoute: typeof LoginRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/_auth': {
+ id: '/_auth'
+ path: ''
+ fullPath: ''
+ preLoaderRoute: typeof AuthRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/_auth/dashboard': {
+ id: '/_auth/dashboard'
+ path: '/dashboard'
+ fullPath: '/dashboard'
+ preLoaderRoute: typeof AuthDashboardRouteImport
+ parentRoute: typeof AuthRoute
+ }
+ '/_auth/dashboard/': {
+ id: '/_auth/dashboard/'
+ path: '/'
+ fullPath: '/dashboard/'
+ preLoaderRoute: typeof AuthDashboardIndexRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/vault': {
+ id: '/_auth/dashboard/vault'
+ path: '/vault'
+ fullPath: '/dashboard/vault'
+ preLoaderRoute: typeof AuthDashboardVaultRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/tools': {
+ id: '/_auth/dashboard/tools'
+ path: '/tools'
+ fullPath: '/dashboard/tools'
+ preLoaderRoute: typeof AuthDashboardToolsRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/transforms/': {
+ id: '/_auth/dashboard/transforms/'
+ path: '/transforms'
+ fullPath: '/dashboard/transforms'
+ preLoaderRoute: typeof AuthDashboardTransformsIndexRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/investigations/': {
+ id: '/_auth/dashboard/investigations/'
+ path: '/investigations'
+ fullPath: '/dashboard/investigations'
+ preLoaderRoute: typeof AuthDashboardInvestigationsIndexRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/transforms/$transformId': {
+ id: '/_auth/dashboard/transforms/$transformId'
+ path: '/transforms/$transformId'
+ fullPath: '/dashboard/transforms/$transformId'
+ preLoaderRoute: typeof AuthDashboardTransformsTransformIdRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/investigations/$investigationId/': {
+ id: '/_auth/dashboard/investigations/$investigationId/'
+ path: '/investigations/$investigationId'
+ fullPath: '/dashboard/investigations/$investigationId'
+ preLoaderRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ '/_auth/dashboard/investigations/$investigationId/$type/$id': {
+ id: '/_auth/dashboard/investigations/$investigationId/$type/$id'
+ path: '/investigations/$investigationId/$type/$id'
+ fullPath: '/dashboard/investigations/$investigationId/$type/$id'
+ preLoaderRoute: typeof AuthDashboardInvestigationsInvestigationIdTypeIdRouteImport
+ parentRoute: typeof AuthDashboardRoute
+ }
+ }
+}
+
+interface AuthDashboardRouteChildren {
+ AuthDashboardToolsRoute: typeof AuthDashboardToolsRoute
+ AuthDashboardVaultRoute: typeof AuthDashboardVaultRoute
+ AuthDashboardIndexRoute: typeof AuthDashboardIndexRoute
+ AuthDashboardTransformsTransformIdRoute: typeof AuthDashboardTransformsTransformIdRoute
+ AuthDashboardInvestigationsIndexRoute: typeof AuthDashboardInvestigationsIndexRoute
+ AuthDashboardTransformsIndexRoute: typeof AuthDashboardTransformsIndexRoute
+ AuthDashboardInvestigationsInvestigationIdIndexRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexRoute
+ AuthDashboardInvestigationsInvestigationIdTypeIdRoute: typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute
+}
+
+const AuthDashboardRouteChildren: AuthDashboardRouteChildren = {
+ AuthDashboardToolsRoute: AuthDashboardToolsRoute,
+ AuthDashboardVaultRoute: AuthDashboardVaultRoute,
+ AuthDashboardIndexRoute: AuthDashboardIndexRoute,
+ AuthDashboardTransformsTransformIdRoute:
+ AuthDashboardTransformsTransformIdRoute,
+ AuthDashboardInvestigationsIndexRoute: AuthDashboardInvestigationsIndexRoute,
+ AuthDashboardTransformsIndexRoute: AuthDashboardTransformsIndexRoute,
+ AuthDashboardInvestigationsInvestigationIdIndexRoute:
+ AuthDashboardInvestigationsInvestigationIdIndexRoute,
+ AuthDashboardInvestigationsInvestigationIdTypeIdRoute:
+ AuthDashboardInvestigationsInvestigationIdTypeIdRoute,
+}
+
+const AuthDashboardRouteWithChildren = AuthDashboardRoute._addFileChildren(
+ AuthDashboardRouteChildren,
+)
+
+interface AuthRouteChildren {
+ AuthDashboardRoute: typeof AuthDashboardRouteWithChildren
+}
+
+const AuthRouteChildren: AuthRouteChildren = {
+ AuthDashboardRoute: AuthDashboardRouteWithChildren,
+}
+
+const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren)
+
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
AuthRoute: AuthRouteWithChildren,
@@ -384,87 +374,6 @@ const rootRouteChildren: RootRouteChildren = {
RegisterRoute: RegisterRoute,
ToolbarLazyRoute: ToolbarLazyRoute,
}
-
-export const routeTree = rootRoute
+export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
-
-/* ROUTE_MANIFEST_START
-{
- "routes": {
- "__root__": {
- "filePath": "__root.tsx",
- "children": [
- "/",
- "/_auth",
- "/login",
- "/middleware",
- "/register",
- "/toolbar"
- ]
- },
- "/": {
- "filePath": "index.tsx"
- },
- "/_auth": {
- "filePath": "_auth.tsx",
- "children": [
- "/_auth/dashboard"
- ]
- },
- "/login": {
- "filePath": "login.tsx"
- },
- "/middleware": {
- "filePath": "middleware.tsx"
- },
- "/register": {
- "filePath": "register.tsx"
- },
- "/toolbar": {
- "filePath": "toolbar.lazy.tsx"
- },
- "/_auth/dashboard": {
- "filePath": "_auth.dashboard.tsx",
- "parent": "/_auth",
- "children": [
- "/_auth/dashboard/tools",
- "/_auth/dashboard/",
- "/_auth/dashboard/transforms/$transformId",
- "/_auth/dashboard/investigations/",
- "/_auth/dashboard/transforms/",
- "/_auth/dashboard/investigations/$investigationId/",
- "/_auth/dashboard/investigations/$investigationId/$type/$id"
- ]
- },
- "/_auth/dashboard/tools": {
- "filePath": "_auth.dashboard.tools.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/": {
- "filePath": "_auth.dashboard.index.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/transforms/$transformId": {
- "filePath": "_auth.dashboard.transforms.$transformId.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/investigations/": {
- "filePath": "_auth.dashboard.investigations.index.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/transforms/": {
- "filePath": "_auth.dashboard.transforms.index.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/investigations/$investigationId/": {
- "filePath": "_auth.dashboard.investigations.$investigationId.index.tsx",
- "parent": "/_auth/dashboard"
- },
- "/_auth/dashboard/investigations/$investigationId/$type/$id": {
- "filePath": "_auth.dashboard.investigations.$investigationId.$type.$id.tsx",
- "parent": "/_auth/dashboard"
- }
- }
-}
-ROUTE_MANIFEST_END */
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.$transformId.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.$transformId.tsx
index a482ed56..3b81cf6d 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.$transformId.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.transforms.$transformId.tsx
@@ -32,6 +32,7 @@ export const Route = createFileRoute('/_auth/dashboard/transforms/$transformId')
function TranformPage() {
const { transform } = Route.useLoaderData()
+ console.log(transform)
return (
<Editor
key={transform.id}
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.vault.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.vault.tsx
new file mode 100644
index 00000000..ec3b810d
--- /dev/null
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.vault.tsx
@@ -0,0 +1,304 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
+import { ThirdPartyKeysService } from '../api/third-party-keys-service'
+import { Button } from '../components/ui/button'
+import { Input } from '../components/ui/input'
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../components/ui/card'
+import { Badge } from '../components/ui/badge'
+import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '../components/ui/dialog'
+import { Label } from '../components/ui/label'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../components/ui/select'
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../components/ui/table'
+import { Loader2, Plus, ExternalLink, Trash2, CheckCircle, XCircle, Clock, Shield } from 'lucide-react'
+import { toast } from 'sonner'
+import { useConfirm } from '../components/use-confirm-dialog'
+
+export const Route = createFileRoute('/_auth/dashboard/vault')({
+ component: VaultPage,
+})
+
+interface ServiceInfo {
+ service: string
+ variable: string
+ url: string
+ active: boolean
+}
+function VaultPage() {
+ const [isAddDialogOpen, setIsAddDialogOpen] = useState(false)
+ const [selectedService, setSelectedService] = useState('')
+ const [apiKey, setApiKey] = useState('')
+ const queryClient = useQueryClient()
+ const { confirm } = useConfirm()
+
+ // Fetch services and keys
+ const { data: services = [], isLoading: servicesLoading } = useQuery({
+ queryKey: ['third-party-services'],
+ queryFn: () => ThirdPartyKeysService.getServices(),
+ })
+
+ const { data: keys = [], isLoading: keysLoading } = useQuery({
+ queryKey: ['third-party-keys'],
+ queryFn: () => ThirdPartyKeysService.get(),
+ })
+
+ // Create key mutation
+ const createKeyMutation = useMutation({
+ mutationFn: ThirdPartyKeysService.create,
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['third-party-keys'] })
+ setIsAddDialogOpen(false)
+ setSelectedService('')
+ setApiKey('')
+ toast.success('API key added successfully!')
+ },
+ onError: (error) => {
+ toast.error('Failed to add API key. Please try again.')
+ console.error('Error creating key:', error)
+ }
+ })
+
+ // Delete key mutation
+ const deleteKeyMutation = useMutation({
+ mutationFn: ThirdPartyKeysService.deleteById,
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ['third-party-keys'] })
+ toast.success('API key deleted successfully!')
+ },
+ onError: (error) => {
+ toast.error('Failed to delete API key. Please try again.')
+ console.error('Error deleting key:', error)
+ }
+ })
+
+ const handleAddKey = () => {
+ if (!selectedService || !apiKey.trim()) {
+ toast.error('Please select a service and enter an API key')
+ return
+ }
+ createKeyMutation.mutate({ service: selectedService, key: apiKey })
+ }
+
+ const handleDeleteKey = async (keyId: string, serviceName: string) => {
+ const confirmed = await confirm({
+ title: 'Delete API Key',
+ message: `Are you sure you want to delete the API key for ${serviceName}? This action cannot be undone.`
+ })
+
+ if (confirmed) {
+ deleteKeyMutation.mutate(keyId)
+ }
+ }
+
+ const getKeyForService = (serviceName: string) => {
+ return keys.find(key => key.service === serviceName)
+ }
+
+ const getStatusIcon = (service: ServiceInfo) => {
+ const key = getKeyForService(service.service)
+ if (key) {
+ return <CheckCircle className="w-5 h-5 text-green-500" />
+ }
+ return <XCircle className="w-5 h-5 text-red-500" />
+ }
+
+ const getStatusBadge = (service: ServiceInfo) => {
+ const key = getKeyForService(service.service)
+ if (key) {
+ return <Badge variant="default" className="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">Configured</Badge>
+ }
+ return <Badge variant="secondary" className="bg-muted text-muted-foreground">Not configured</Badge>
+ }
+
+ if (servicesLoading || keysLoading) {
+ return (
+ <div className="h-full w-full px-12 py-12 bg-background overflow-auto">
+ <div className='max-w-7xl mx-auto flex flex-col gap-12 items-center justify-start'>
+ <div className='w-full'>
+ <h1 className="font-semibold text-2xl">Vault</h1>
+ <p className="opacity-60 mt-3">Here are the keys used to query third party services.</p>
+ </div>
+ <div className="w-full flex items-center justify-center">
+ <Loader2 className="h-8 w-8 animate-spin" />
+ </div>
+ </div>
+ </div>
+ )
+ }
+
+ return (
+ <div className="h-full w-full px-12 py-12 bg-background overflow-auto">
+ <div className='max-w-7xl mx-auto flex flex-col gap-12 items-center justify-start'>
+ <div className='w-full flex justify-between items-start'>
+ <div>
+ <h1 className="font-semibold text-2xl">Vault</h1>
+ <p className="opacity-60 mt-3">Here are the keys used to query third party services.</p>
+ </div>
+ <Dialog open={isAddDialogOpen} onOpenChange={setIsAddDialogOpen}>
+ <DialogTrigger asChild>
+ <Button className="flex items-center gap-2">
+ <Plus className="w-4 h-4" />
+ Add API Key
+ </Button>
+ </DialogTrigger>
+ <DialogContent className="sm:max-w-[425px]">
+ <DialogHeader>
+ <DialogTitle>Add API Key</DialogTitle>
+ <DialogDescription>
+ Add a new API key for a third-party service. Your keys are encrypted and stored securely.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="grid gap-4 py-4">
+ <div className="grid gap-2">
+ <Label htmlFor="service">Service</Label>
+ <Select value={selectedService} onValueChange={setSelectedService}>
+ <SelectTrigger>
+ <SelectValue placeholder="Select a service" />
+ </SelectTrigger>
+ <SelectContent>
+ {services.filter(s => s.active).map((service) => (
+ <SelectItem key={service.service} value={service.service}>
+ {service.service}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="grid gap-2">
+ <Label htmlFor="apiKey">API Key</Label>
+ <Input
+ id="apiKey"
+ type="password"
+ placeholder="Enter your API key"
+ value={apiKey}
+ onChange={(e) => setApiKey(e.target.value)}
+ />
+ </div>
+ </div>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => setIsAddDialogOpen(false)}
+ disabled={createKeyMutation.isPending}
+ >
+ Cancel
+ </Button>
+ <Button
+ onClick={handleAddKey}
+ disabled={createKeyMutation.isPending || !selectedService || !apiKey.trim()}
+ >
+ {createKeyMutation.isPending && <Loader2 className="w-4 h-4 mr-2 animate-spin" />}
+ Add Key
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </div>
+
+ <div className="w-full">
+ <Card>
+ <CardHeader>
+ <CardTitle className="flex items-center gap-2">
+ <Shield className="w-5 h-5" />
+ Third-Party Services
+ </CardTitle>
+ <CardDescription>
+ Manage your API keys for external services. Configured services will be available for your investigations.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div className="rounded-md border">
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="w-12"></TableHead>
+ <TableHead>Service</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead>Added</TableHead>
+ <TableHead className="text-right">Actions</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {services.map((service) => {
+ const key = getKeyForService(service.service)
+ return (
+ <TableRow key={service.service} className="hover:bg-muted/50">
+ <TableCell className="w-12">
+ {getStatusIcon(service)}
+ </TableCell>
+ <TableCell>
+ <div className="flex flex-col gap-1">
+ <div className="font-medium">{service.service}</div>
+ {!service.active && (
+ <Badge variant="outline" className="w-fit text-orange-600 border-orange-200 dark:text-orange-400 dark:border-orange-800 text-xs">
+ Coming Soon
+ </Badge>
+ )}
+ </div>
+ </TableCell>
+ <TableCell>
+ {getStatusBadge(service)}
+ </TableCell>
+ <TableCell>
+ {key ? (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <Clock className="w-4 h-4" />
+ {new Date(key.created_at).toLocaleDateString()}
+ </div>
+ ) : (
+ <span className="text-sm text-muted-foreground">—</span>
+ )}
+ </TableCell>
+ <TableCell className="text-right">
+ <div className="flex items-center justify-end gap-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => window.open(service.url, '_blank')}
+ className="flex items-center gap-1 h-8 px-2"
+ >
+ <ExternalLink className="w-4 h-4" />
+ <span className="hidden sm:inline">Visit</span>
+ </Button>
+ {key ? (
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-destructive hover:text-destructive/80 h-8 px-2"
+ onClick={() => handleDeleteKey(key.id, service.service)}
+ disabled={deleteKeyMutation.isPending}
+ >
+ <Trash2 className="w-4 h-4" />
+ </Button>
+ ) : (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ setSelectedService(service.service)
+ setIsAddDialogOpen(true)
+ }}
+ disabled={!service.active}
+ className="flex items-center gap-1 h-8 px-2"
+ >
+ <Plus className="w-4 h-4" />
+ <span className="hidden sm:inline">Add Key</span>
+ </Button>
+ )}
+ </div>
+ </TableCell>
+ </TableRow>
+ )
+ })}
+ </TableBody>
+ </Table>
+ </div>
+ </CardContent>
+ </Card>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+export default VaultPage
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/stores/graph-store.ts b/flowsint-app/src/renderer/src/stores/graph-store.ts
index a435c914..7d2628ea 100644
--- a/flowsint-app/src/renderer/src/stores/graph-store.ts
+++ b/flowsint-app/src/renderer/src/stores/graph-store.ts
@@ -62,6 +62,12 @@ interface GraphState {
// === Collapse/Expand logic ===
toggleCollapse: (nodeId: string) => void
+
+ // === Utils ===
+ nodesLength: number
+ edgesLength: number
+ getNodesLength: () => number
+ getEdgesLength: () => number
}
export const useGraphStore = create<GraphState>()((set, get) => ({
@@ -222,4 +228,11 @@ export const useGraphStore = create<GraphState>()((set, get) => ({
),
});
},
+
+ // === Utils ===
+ nodesLength: 0,
+ edgesLength: 0,
+
+ getNodesLength: () => get().nodes.length,
+ getEdgesLength: () => get().edges.length,
}))
diff --git a/flowsint-app/src/renderer/src/stores/node-display-settings.ts b/flowsint-app/src/renderer/src/stores/node-display-settings.ts
index e6fb1a16..b4e5bd40 100644
--- a/flowsint-app/src/renderer/src/stores/node-display-settings.ts
+++ b/flowsint-app/src/renderer/src/stores/node-display-settings.ts
@@ -28,9 +28,10 @@ export type ItemType =
| "username"
| "siret"
| "siren"
- | "wallet"
+ | "cryptowallet"
| "asn"
| "cidr"
+ | "whois"
export const ITEM_TYPES: ItemType[] = [
"individual",
@@ -58,9 +59,10 @@ export const ITEM_TYPES: ItemType[] = [
"username",
"siret",
"siren",
- "wallet",
+ "cryptowallet",
"asn",
"cidr",
+ "whois"
]
const DEFAULT_COLORS: Record<ItemType, string> = {
@@ -89,9 +91,10 @@ const DEFAULT_COLORS: Record<ItemType, string> = {
biometric: "#AEB3B9", // Notion slate gray
siret: "#ADB9C6", // Notion blue-gray
siren: "#9FAAB8", // Notion dark slate
- wallet: "#F7D154", // Notion gold
+ cryptowallet: "#F7D154", // Notion gold
asn: "#F7D154",
- cidr: "#A2D4BF"
+ cidr: "#A2D4BF",
+ whois: "#A6D0BF"
}
// Définition des icônes par défaut pour chaque type d'élément
@@ -121,9 +124,10 @@ const DEFAULT_ICONS: Record<ItemType, string> = {
username: "🧑‍💻",
siret: "ℹ️",
siren: "ℹ️",
- wallet: "₿",
+ cryptowallet: "₿",
asn: "🌐",
- cidr: "📡"
+ cidr: "📡",
+ whois: "🌐"
};
const DEFAULT_SIZES: Record<ItemType, number> = {
@@ -152,9 +156,10 @@ const DEFAULT_SIZES: Record<ItemType, number> = {
username: 8,
siret: 5,
siren: 5,
- wallet: 7,
- asn: 12,
- cidr: 10
+ cryptowallet: 7,
+ asn: 12,
+ cidr: 10,
+ whois: 6
}
interface NodesDisplaySettingsState {