Commit Graph
34 Commits
Author SHA1 Message Date
kyle 1ab0ed947c docs: update documentation line numbers and file sizes
- Update method line numbers in agent.md to match current codebase
- Correct file sizes and line counts in the documentation table
- Update TODO.md: mark line number and file size updates as completed
- Move remaining tasks to Future Ideas section
2026-06-16 13:39:48 -07:00
kyle 005f76701e docs: update documentation, add future tasks, and fix debug endpoint security
- **Documentation Overhaul**:
  - **README.md**: Restructured installation guide to align with Nextcloud 33+ paths (e.g., "Personal Settings → Security"), added curl examples, updated known limitations, and added a "Future Features" section.
  - **agent.md**: Updated architecture documentation to reflect `TalkService.php` growth (1138 to 1904 lines), updated constructor parameters, and corrected method documentation (e.g., `buildRichObject` now creates TYPE_ROOM shares, `postToRoom` uses query params).
  - **architecture.md**: Added notes regarding the admin gate for the debug endpoint.

- **New Files**:
  - Added `Future to-do.md` to track planned features (inbound messages, filtering, etc.).
  - Added `TODO.md` to track pending tasks and code cleanup.

- **Code Fixes**:
  - **lib/Controller/WebhookController.php**: Re-applied `#[AdminRequired]` attribute to the `debug()` method to enforce admin authentication.
  - **lib/Service/TalkService.php**: Updated docblock for `buildRichObject` to clarify it creates TYPE_ROOM shares.
  - **lib/Settings/Admin.php** & **templates/adminSettings.php**: Corrected bot password generation instructions to point to the correct Nextcloud settings path.

- **Configuration**:
  - **appinfo/info.xml**: Bumped version to 1.2.1 and updated `max-version` to 35.
2026-06-16 13:23:31 -07:00
kyle 99f79a488e docs: update stes 4/5 2026-06-15 22:24:37 -07:00
kyle e7d71c0e0c chore: bump version to 1.2.0
- Updated version in appinfo/info.xml from 1.1.5 to 1.2.0
2026-06-15 19:39:52 -07:00
kyle c814c265ea chore: remove tests, composer, CI, and references to internal infrastructure for privacy reasons 2026-06-15 12:38:38 -07:00
kyle c790a867c6 docs: add AI disclosure section
- Add "AI Disclosure" section to README.md
- Include text regarding the use of a local-only LLM for project development
2026-06-15 10:42:41 -07:00
kyle 5f703e0fa9 docs: update deployment paths and bump version
- add deployment paths table to README
- update installation notes to reference deployment paths
- bump version to 1.1.5
- update nextcloud dependency range (33-35)
- update author homepage and remove email
- remove --prefer-dist flag in ci.yml
- delete img/app (copy).svg
2026-06-14 22:07:34 -07:00
kyle df930de6cd untested... test: add unit test suite and CI workflow
I have never done this style of test before... who knows if it will work

- Add Gitea Actions workflow for PHP 8.2 testing
- Add PHPUnit configuration and bootstrap file
- Add unit tests for TalkService, WebhookController, ImageCleanup, NavigationProvider, and DebugToggle
- Add README documentation for the test suite
- Update composer.json with test and lint scripts
2026-06-14 19:12:25 -07:00
kyle b18b996468 refactor(nc_bot_webhooks): rename app display name and logger tags to nc_bot_webhooks and update docs
- appinfo/info.xml: Update app `<name>` to `nc_bot_web_hooks`.
- lib/NavigationProvider.php: Update navigation entry name to `nc_bot_web_hooks`.
- lib/Controller/WebhookController.php: Update all logger tags from `NCbotwebhooks:` to `nc_bot_web_hooks:`.
- lib/Cron/ImageCleanup.php: Update logger tag to `nc_bot_web_hooks:`.
- lib/Service/TalkService.php: Update all logger tags from `NCbotwebhooks:` to `nc_bot_web_hooks:`.
- agent.md: Update references to app name and logger tags.
- architecture.md: Update references to app name.
- INSTALL.md: Update references to app name and example strings.
- README.md: Restructure "Installation" section (split into Initial installation, Updating using git, Local update), add "Debugging" section with diagnostic grep examples, update app name references.
2026-06-14 15:06:15 -07:00
kyle 1180ab14f7 docs: update README title to nc_bot_webhooks
- Rename repository title from `# NCbotwebhooks` to `# nc_bot_webhooks`
2026-06-14 14:13:57 -07:00
kyle e7db2c8d76 docs: update nextcloud sync path example in README
- Replace hardcoded example path with generic placeholder `<Path on your nextcloud sync>`
- Update instructions to reflect the generic path adjustment
2026-06-14 14:10:47 -07:00
kyle 472a1e4967 docs: update documentation for Home Assistant integration and Apprise icons
- Add Home Assistant integration guide with REST command examples (README.md)
- Document Apprise `type` field mapping to status icons (, ⚠️, ) across agent.md and architecture.md
- Update prerequisites to Nextcloud 33 (INSTALL.md)
- Remove outdated link preview suppression note (agent.md)
- Fix folder name casing in troubleshooting section (INSTALL.md)
2026-06-14 00:38:59 -07:00
kyle 5347ddcdb0 feat(talk): replace text type prefixes with emojis in messages
- Extract `typeIcon` from mapped data in `WebhookController` and pass to `prependDisplayName`
- Update `TalkService.prependDisplayName` to accept optional `$typeIcon` parameter and prepend it to the display name line
- Remove text-based type labels (`[Info]`, `[Success]`, `[Warning]`, `[Error]`) and replace with emoji icons (``, `⚠️`, ``)
- Include `typeIcon` in the message payload array returned by `TalkService`
2026-06-14 00:21:48 -07:00
kyle 7b14ecbcbb feat(webhook): handle Apprise file attachments and add request logging
working for Home Assistant, Changedetector.io, *arrs, Jellyfin...

- Add multipart/form-data file attachment handling in WebhookController
- Support raw data attachments in TalkService
- Log raw request details for debugging
2026-06-14 00:19:47 -07:00
kyle 4aa779c51f refactor(TalkService): update TalkSession usage and improve share creation
Only 1 image share shows up now
-   Replace ParticipantSession with TalkSession and update constructor
-   Inject IUserSession to manage user context
-   Refactor setSessionOverwrite and clearSessionOverwrite to use reflection
-   Update share creation to switch context to talk-bot and support node-based sharing
-   Enhance error logging in share creation
2026-06-13 23:53:03 -07:00
kyle 4f0f2e3f81 fix(TalkService): defer share creation to fix guest actor bug
- Inject ParticipantSession to allow overwriting the current actor.
- Add setSessionOverwrite and clearSessionOverwrite methods.
- Defer room share creation to occur after text POST with session overwrite active.
- This prevents Talk 23.0.6 fixMimeTypeOfVoiceMessage from triggering "guest" actor bug.
- Comment out direct addSystemMessage call, relying on Talk's event listener.
- Update richObject with actual shareId after deferred creation.
2026-06-13 23:25:06 -07:00
kyle b91a54bea5 fix(TalkService): remove public link share logic for TYPE_ROOM shares
Works, image in chat, but duplicate from a "guest" and idk why that happens.

- Remove code block creating public link shares for rich object scraping
- Update comments to note that TYPE_ROOM shares do not produce public URLs
- Set shareToken to null in the return array
- Remove fallback logic appending public share URLs to message text
- Reorder ChatManager::addSystemMessage() block
2026-06-13 23:08:50 -07:00
kyle dec9b5267e refactor(TalkService): update sharing logic and use ChatManager for system messages
Mostly working. Image actually being embedded now.
- Inject `ChatManager` dependency into `TalkService`.
- Refactor `uploadImage` to generate timestamped filenames (`talk-bot YYYY-MM-DD hh.mm.ss.microsec.ext`) and fix directory creation logic for Nextcloud 33 compatibility.
- Update file sharing logic to use `TYPE_ROOM` shares resolved by `fileId` and create a separate `TYPE_LINK` share for public previews.
- Switch message posting to use `ChatManager::addSystemMessage` for `file_shared` events.
- Send text message via HTTP API as a fallback to ensure participant records and moderation checks.
- Update logging to include debug information for rich objects and share IDs.
2026-06-13 22:40:55 -07:00
kyle 77040ae006 fix(talk): improve rich object embedding and fix file cache updates
- Resolve Talk services via \OCP\Server::get for NC33 compatibility
- Compute actual file size from disk and update filecache entry with correct size and etag
- Clear password on public share URLs to allow inline image embedding in Talk
- Append public share URLs to message text so Talk's linkifier can scrape og:image for rich previews
- Update chat API call to pass message and actorDisplayName as query parameters
- Inject ParticipantService dependency
- Improve logging for chat API responses
2026-06-13 20:24:22 -07:00
kyle 9d569453de fix(webhooks): improve Nextcloud 33 compatibility and HA REST notify payload handling
- Replace getFolder() with get() and fallback creation to fix LazyFolder compatibility in NC33
- Add support for unwrapping nested 'data' keys in Home Assistant REST notify payloads
- Implement fallback to $_GET when request body is empty
- Refactor buildRichObject to use direct PDO queries for filecache and share creation, bypassing lazy node resolution
- Generate timestamped filenames for uploaded images to prevent overwrites
- Add comprehensive logging for webhook payloads, image processing, and filecache verification
- Update IShareManager imports and usage to align with Nextcloud API changes
- Improve image attachment handling to support URLs, base64, and file paths
- Wrap image processing in try-catch to prevent webhook crashes on image failures
2026-06-13 14:25:22 -07:00
kyle 18084d0f69 docs: add project documentation and update README
- Add `agent.md`: Complete maintenance reference covering project structure, API interactions, data flow, configuration, security, and operational procedures.
- Add `architecture.md`: High-level architecture overview including component map, data flow, design decisions, and security model.
- Update `README.md`: Add Apprise support documentation, manual deployment instructions, updated installation steps (bot admin requirement), and expanded payload mapping and troubleshooting sections.
- Improve `lib/Controller/WebhookController.php`: Enhance `saveBotPassword` validation to check for missing fields and validate the password content.
- Improve `lib/Service/TalkService.php`: Add `validateBotPassword` method for round-trip encryption testing and integrate it into `saveConfig`.
- Update `css/adminSettings.css`: Add styles for the new `.nc-app-frame` wrapper.
- Update `templates/adminSettings.php`: Refactor UI structure to use `.nc-app-frame` and improve layout of settings sections.
2026-06-12 19:44:42 -07:00
kyle 19241c842d refactor: rename app from ncdiscordhook to nc_bot_webhooks
- Update namespace from OCA\NCdiscordhook to OCA\Ncbotwebhooks
- Update app ID, name, and namespace in appinfo/info.xml
- Update composer.json and autoload files
- Update CLI command names from ncdiscordhook:* to nc_bot_webhooks:*
- Update image directory name to nc_bot_webhooks-images
- Update documentation in README.md and INSTALL.md
- Update JavaScript APP_ID and navigation provider paths
- Update admin settings and controller app references
2026-06-12 18:30:12 -07:00
kyle 98e044ede7 feat: improve Apprise notification subject/title handling and fallbacks
- lib/Controller/WebhookController.php: Extract subject/title from wrapper level and add fallback to default sender name
- lib/Service/TalkService.php: Update display name logic to check subject, and use title/subject as message body when empty
2026-06-12 17:53:30 -07:00
kyle 28d0187760 feat: add command to toggle debug mode
- Add lib/Command/DebugToggle.php to enable/disable debug endpoint via CLI
- Update lib/Controller/WebhookController.php to check debug status
- Add support for base64 attachments in lib/Service/TalkService.php
- Bump version in appinfo/info.xml to 1.1.0
- Update INSTALL.md and README.md documentation
2026-06-12 17:42:36 -07:00
kyle 88ad358eef feat(talk): prepend display name to messages
- Add `prependDisplayName` method to `TalkService` to format the name line
- Update `WebhookController` to prepend display name for Talk messages
- Update `mapApprisePayload` to extract and pass display name from Apprise title or config
- Add `displayName` to return array in `mapApprisePayload`
2026-06-12 16:53:16 -07:00
kyle 42fa70491d feat(webhook): add Apprise webhook support and rename bot-webhook to discord-webhook
- Rename the Discord webhook endpoint from `/bot-webhook/` to `/discord-webhook/` for better clarity.
- Add new routes and controller methods (`receiveApprise`, `receiveAppriseNotify`) to support Apprise integrations.
- Implement `mapApprisePayload` in TalkService to map Apprise JSON format (title, body, type, attachments) to Talk message format.
- Update the settings UI to generate and display URLs for both Discord and Apprise webhooks.
- Update `INSTALL.md` and `README.md` documentation to reflect the new webhook paths and Apprise support.
- Refactor token revocation logic to revoke all tokens for a room at once.
2026-06-12 16:40:53 -07:00
kyle 6453715bf0 fix: update TalkService for Talk 14 compatibility and add CLI copy helper
- **TalkService**:
  - Refactored `ensureBotParticipants` to use `AttendeeMapper` directly, removing the dependency on `ParticipantService`.
  - Added `getBotDisplayNameForRoom` to resolve the bot's display name via direct DB query.
  - Updated `sendMessage` to use Chat API v1 and include `richObjectsEnd`.
  - Improved `getBaseUrl` logic to handle `overwritehost` and `overwritewebroot`.
- **WebhookController**:
  - Fixed `getAllValues` to iterate known keys manually, preventing `RuntimeException` in Nextcloud 33.
  - Added error handling for `saveConfig`.
  - Removed unused `ParticipantService` import.
- **js/settings.js**:
  - Added functionality to copy CLI commands to the clipboard.
- **Deletions**:
  - Removed `lib/Command/AddBotParticipant.php` as its logic is now integrated into `TalkService`.
- **Templates**:
  - Updated admin settings labels and comments.
2026-06-12 14:32:52 -07:00
kyle 53b47efcd6 feat: enhance webhook debugging and ensure bot participant registration
- Add `ncdiscordhook:add-bot-participant` console command to register talk-bot in all configured rooms
- Extend debug endpoint with webhook URL validation and test post capabilities
- Improve `getBaseUrl()` to prefer public trusted domains, fixing container deployment issues
- Add `OCS-APIRequest` header and accept 2xx HTTP status codes for successful message posting
- Auto-register talk-bot as a participant during configuration initialization
2026-06-12 13:05:43 -07:00
kyle 4d0bb40120 feat(config): support disabling rooms and sync auth tokens
- Add support for `disabled_rooms` to remove rooms from active configuration
- Sync auth tokens from server to client to prevent state drift
- Enable `allow_local_address` for Talk API requests
- Update settings page to fetch configured rooms instead of available ones
2026-06-12 11:47:16 -07:00
kyle 5b521afec1 feat: update for Nextcloud 33 and refactor Talk integration
Channel list working, url generation, just need posting working now

- Update dependency to Nextcloud 33 and add `spreed` dependency
- Change webhook route from `/webhook` to `/bot-webhook`
- Add `NavigationProvider` to add app to admin settings menu
- Refactor `TalkService` to query Talk DB directly for room listing (public channels)
- Update `postToRoom` to use Talk Chat API with Basic Auth for `talk-bot` user
- Add debug helper methods to `TalkService` for room debugging
- Enhance `debug` endpoint with detailed system and Talk configuration info
- Update admin settings UI with "Default Sender Name" field and improved room selection
- Add localization strings to admin settings
- Update documentation (`INSTALL.md`, `README.md`) for new route and bot admin requirement
- Improve `getBaseUrl` logic to prioritize `trusted_domains` for Docker compatibility
2026-06-12 11:17:51 -07:00
kyle aa06394aa9 feat: enhance webhook settings UI and security: Mostly working, just final post not functioning
- Add CSS styles for token URL input and hints
- Implement safe data attribute parsing in settings.js
- Refactor room fetching logic to use promise chains and auto-fetch on load
- Display full webhook URLs in the settings UI instead of raw tokens
- Generate URL-safe base64 tokens to prevent encoding issues
- Add #[PublicPage] attribute to WebhookController for unauthenticated delivery
- Filter out internal Nextcloud Talk system rooms from the room picker
- Add OCS-ApiRequest header to bot API requests
- Sanitize data attributes in templates to prevent XSS
2026-06-11 10:55:30 -07:00
kyle 3f51a8ca48 Can now get channels!
- Inject LoggerInterface across WebhookController, TalkService, and ImageCleanup
- Replace TalkService.getAvailableTalkRooms() OCS API calls with direct database queries
- Add getBaseUrl() helper to resolve localhost/SSRF constraints for internal API calls
- Update buildRichObject() to generate public link shares for file attachments
- Add saveBotPassword, debug, and debugTables endpoints to WebhookController
- Separate frontend assets (JS/CSS) from adminSettings template
- Add composer.json and autoload files for PSR-4 autoloading
- Update Admin settings to use TemplateResponse and register app icons
2026-06-11 10:21:23 -07:00
kyle 3bba599133 Fix info.xml schema, purge empty dirs, update URLs 2026-06-10 14:37:04 -07:00
kyle 640a3f4f27 First commit 2026-06-10 14:18:47 -07:00