Commit Graph
16 Commits
Author SHA1 Message Date
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