# iamniki01/files_custom architecture

> Architecture diagram of the GitHub repository iamniki01/files_custom, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamniki01/files_custom
- Repository: https://github.com/iamniki01/files_custom

## Overview

files_custom is a small Nextcloud app that adds right-click context menus to the Files interface. Its workflow is: Nextcloud template-render events load the app’s JavaScript, a user right-clicks a file or selection, and the menu exposes actions by invoking the existing Files UI controls. The menu engine handles option rendering and menu behavior; the Files adapter supplies context-specific options. The README contains no further capability details, and the sampled sources do not show styling or other integrations.

Main entry points: [`js/files.js`](https://github.com/iamniki01/files_custom/blob/main/js/files.js) (Files menu adapter), [`lib/Listener/BeforeTemplateRenderedListener.php`](https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeTemplateRenderedListener.php) (Template listener), [`js/script.js`](https://github.com/iamniki01/files_custom/blob/main/js/script.js) (Menu engine), [`lib/Listener/BeforeLoggedInTemplateRenderedListener.php`](https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeLoggedInTemplateRenderedListener.php) (Logged-in listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["App bootstrap"]
  node_app["Application registration<br/>[Application.php]"]
  node_template_listener["Template listener"]
  node_loggedin_listener["Logged-in listener"]
end

subgraph group_menus["Context menus"]
  node_engine["Menu engine<br/>[script.js]"]
end

subgraph group_files["Files integration"]
  node_files_adapter["Files menu adapter<br/>[files.js]"]
  node_files_ui["Files interface"]
end

node_user(("Files user"))
node_nextcloud["Nextcloud runtime"]

node_app -->|"registers"| node_template_listener
node_app -->|"registers"| node_loggedin_listener
node_nextcloud -->|"dispatches event"| node_template_listener
node_nextcloud -->|"dispatches event"| node_loggedin_listener
node_template_listener -->|"loads script"| node_engine
node_template_listener -->|"loads script"| node_files_adapter
node_loggedin_listener -->|"loads script"| node_engine
node_user -->|"right-clicks file"| node_files_adapter
node_files_adapter -->|"creates menu"| node_engine
node_engine -->|"evaluates options"| node_files_adapter
node_files_adapter -->|"triggers file actions"| node_files_ui
node_files_adapter -->|"reads selection"| node_files_ui

click node_app "https://github.com/iamniki01/files_custom/blob/main/lib/AppInfo/Application.php"
click node_template_listener "https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeTemplateRenderedListener.php"
click node_loggedin_listener "https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeLoggedInTemplateRenderedListener.php"
click node_engine "https://github.com/iamniki01/files_custom/blob/main/js/script.js"
click node_files_adapter "https://github.com/iamniki01/files_custom/blob/main/js/files.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_template_listener,node_loggedin_listener,node_user toneBlue
class node_engine toneAmber
class node_files_adapter,node_files_ui toneMint
class node_nextcloud toneIndigo
```

## Components

### App bootstrap

- [Application registration](https://github.com/iamniki01/files_custom/blob/main/lib/AppInfo/Application.php): `lib/AppInfo/Application.php`
- [Template listener](https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeTemplateRenderedListener.php): `lib/Listener/BeforeTemplateRenderedListener.php`
- [Logged-in listener](https://github.com/iamniki01/files_custom/blob/main/lib/Listener/BeforeLoggedInTemplateRenderedListener.php): `lib/Listener/BeforeLoggedInTemplateRenderedListener.php`

### Context menus

- [Menu engine](https://github.com/iamniki01/files_custom/blob/main/js/script.js): `js/script.js`

### Files integration

- [Files menu adapter](https://github.com/iamniki01/files_custom/blob/main/js/files.js): `js/files.js`
- **Files interface**

### Other components

- **Files user**
- **Nextcloud runtime**

## Connections

- Application registration → Template listener: registers (evidence: `lib/AppInfo/Application.php`)
- Application registration → Logged-in listener: registers (evidence: `lib/AppInfo/Application.php`)
- Nextcloud runtime → Template listener: dispatches event (evidence: `lib/Listener/BeforeTemplateRenderedListener.php`)
- Nextcloud runtime → Logged-in listener: dispatches event (evidence: `lib/Listener/BeforeLoggedInTemplateRenderedListener.php`)
- Template listener → Menu engine: loads script (evidence: `lib/Listener/BeforeTemplateRenderedListener.php`)
- Template listener → Files menu adapter: loads script (evidence: `lib/Listener/BeforeTemplateRenderedListener.php`)
- Logged-in listener → Menu engine: loads script (evidence: `lib/Listener/BeforeLoggedInTemplateRenderedListener.php`)
- Files user → Files menu adapter: right-clicks file (evidence: `js/files.js`)
- Files menu adapter → Menu engine: creates menu (evidence: `js/files.js`)
- Menu engine → Files menu adapter: evaluates options (evidence: `js/script.js`)
- Files menu adapter → Files interface: triggers file actions (evidence: `js/files.js`)
- Files menu adapter → Files interface: reads selection (evidence: `js/files.js`)
