# ibnuh/flow.launcher.plugin.ipdetails architecture

> Architecture diagram of the GitHub repository ibnuh/flow.launcher.plugin.ipdetails, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ibnuh/flow.launcher.plugin.ipdetails
- Repository: https://github.com/ibnuh/flow.launcher.plugin.ipdetails

## Overview

##### Project Type and Purpose
- This is a single‐plugin C#/.NET application that extends the Flow Launcher host. Its purpose is to fetch and display public IP details (either current or a specified IPv4), using external IP lookup services with a 24‐hour disk cache and optional API key support.

##### File Structure
- Top‐Level Artifacts
- Flow.Launcher.Plugin.IPDetails.sln – Visual Studio solution
- Flow.Launcher.Plugin.IPDetails/ – main plugin folder
- .github/workflows/release.yml & release.ps1 – CI/CD and release script
- README.md, LICENSE, screenshots/
- Plugin Folder Breakdown
- Main.cs – plugin entry point implementing Flow Launcher’s IPlugin interface
- IpApiResponse.cs – data model for JSON responses
- Converter/IsVpnConverter.cs – value‐converter for UI (e.g., flagging VPN)
- Settings/Settings.cs & SettingsControl.xaml(.cs) – settings model + WPF control (MVVM pattern)
- plugin.json – metadata for Flow Launcher to load the plugin

##### Extract README Insights
- Integrates with two external services: ipv4.icanhazip.com (for current IP) and ipapi.is (for detailed info, optional API key)
- Caches requests for 24h in plugin directory to reduce API calls and improve performance
- Uses PowerShell script (release.ps1) to build, stop the host, deploy, restart

##### Main Components & Interactions (to include
a. Flow Launcher Host
- Loads plugin via plugin.json
- Sends user queries (“ip”, “ip <address>”)
b. IPDetails Plugin Core
- Main.cs: registers query/action handlers
- Settings module: reads/writes API key and cache path
- Converter module: transforms raw data to UI‐friendly display
c. Networking Layer
- HTTP Client calls to ipv4.icanhazip.com and ipapi.is
- Retries or error handling (implicit)
d. Caching Layer
- Disk cache (JSON files) in plugin directory
- Cache invalidation after 24h
e. Settings UI
- WPF/XAML control for API key input
- Bound to Settings.cs via MVVM
f. External Services
- ipv4.icanhazip.com (public IP endpoint)
- api.ipapi.is (detail endpoint, requires key for higher quota)

##### Architectural Patterns & Design Principles
- Plugin Architecture: decouples host and extension by well‐defined interfaces (IPlugin)
- MVVM for settings: separate view (XAML) and view‐model (Settings.cs)
- Caching Strategy: local persistent cache to minimize external calls
- Single‐responsibility: separate classes for conversion, settings, data modeling

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Flow Launcher Host"
        host["Flow Launcher Host"]:::host
        pluginContract["plugin.json"]:::component
    end

    host -->|"query(ip)"| pluginCore
    pluginContract -.-> pluginCore

    pluginCore["IPDetails Plugin Core\n(Main.cs)"]:::component
    pluginCore --> cache["Cache (Filesystem)"]:::storage
    cache -->|"cache hit"| pluginCore
    pluginCore -->|"cache miss"| httpClient["HTTP Client"]:::component
    httpClient --> ext1["ipv4.icanhazip.com"]:::external
    httpClient --> ext2["api.ipapi.is"]:::external
    pluginCore --> converter["Converter\n(IsVpnConverter)"]:::component
    pluginCore --> dataModel["Data Model\n(IpApiResponse.cs)"]:::component
    pluginCore --> settingsModel["Settings Model\n(Settings.cs)"]:::component
    host -->|"open settings"| settingsUI["Settings UI\n(SettingsControl.xaml/.cs)"]:::component
    settingsUI --> settingsModel
    settingsModel --> pluginCore
    pluginCore --> converter --> host

    subgraph "Project Definition & Assets"
        solution["Flow.Launcher.Plugin.IPDetails.sln"]:::docs
        pluginProject["Flow.Launcher.Plugin.IPDetails.csproj"]:::component
        images["Images"]:::storage
        solution --> pluginProject
        pluginProject --> pluginCore
        pluginProject --> dataModel
        pluginProject --> converter
        pluginProject --> settingsModel
        pluginProject --> settingsUI
        pluginProject --> cache
        pluginProject --> httpClient
        pluginProject --> images
    end

    subgraph "CI/CD & Release Pipeline"
        pipeline["Release Pipeline\n(.github/workflows/release.yml,\nrelease.ps1)"]:::pipeline
    end
    pipeline --> pluginProject
    pipeline --> host

    extDocs["README.md"]:::docs
    extDocs -.-> ext1
    extDocs -.-> ext2

    classDef host fill:#cccccc,stroke:#333,stroke-width:1px;
    classDef component fill:#90cdf4,stroke:#333,stroke-width:1px;
    classDef storage fill:#9ae6b4,stroke:#333,stroke-width:1px;
    classDef external fill:#f6ad55,stroke:#333,stroke-width:1px;
    classDef pipeline fill:#ebf4ff,stroke:#3182ce,stroke-width:2px,stroke-dasharray: 5 5;
    classDef docs fill:#faf089,stroke:#333,stroke-width:1px;

    click pluginContract "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/plugin.json"
    click pluginCore "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Main.cs"
    click dataModel "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/IpApiResponse.cs"
    click converter "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Converter/IsVpnConverter.cs"
    click settingsModel "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Settings/Settings.cs"
    click settingsUI "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Settings/SettingsControl.xaml"
    click settingsUI "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Settings/SettingsControl.xaml.cs"
    click pluginProject "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails/Flow.Launcher.Plugin.IPDetails.csproj"
    click extDocs "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/README.md"
    click pipeline "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/ .github/workflows/release.yml"
    click pipeline "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/release.ps1"
    click solution "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/blob/main/Flow.Launcher.Plugin.IPDetails.sln"
    click images "https://github.com/ibnuh/flow.launcher.plugin.ipdetails/tree/main/Flow.Launcher.Plugin.IPDetails/images"
```
