Files
nextcloud-mcp-server/third_party/astrolabe/appinfo/routes.php
T
Chris Coutinho d5544a7731 refactor(astrolabe): replace client-side PDF.js with server-side PyMuPDF rendering
Replace the client-side PDF.js viewer with server-side rendering using PyMuPDF.
This avoids CSP worker restrictions and ES private field access issues that
affected Chromium browsers.

Changes:
- Add /api/v1/pdf-preview endpoint to MCP server (management.py)
- Add pdf-preview route and controller action in Astrolabe PHP backend
- Refactor PDFViewer.vue to display server-rendered PNG images
- Remove pdfjs-dist dependency and client-side PDF loading code
- Use @nextcloud/axios for CSRF token handling in PDFViewer

The server downloads the PDF via WebDAV, renders the requested page with
PyMuPDF at the specified scale, and returns a base64-encoded PNG image.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 20:04:57 +01:00

116 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
/**
* Routes configuration for MCP Server UI app.
*
* Defines URL routes for OAuth flow and form handlers.
*/
return [
'routes' => [
// OAuth routes
[
'name' => 'oauth#initiateOAuth',
'url' => '/oauth/authorize',
'verb' => 'GET',
],
[
'name' => 'oauth#oauthCallback',
'url' => '/oauth/callback',
'verb' => 'GET',
],
[
'name' => 'oauth#disconnect',
'url' => '/oauth/disconnect',
'verb' => 'POST',
],
// API routes (form handlers)
[
'name' => 'api#revokeAccess',
'url' => '/api/revoke',
'verb' => 'POST',
],
// Background sync credentials routes
[
'name' => 'credentials#storeAppPassword',
'url' => '/api/v1/background-sync/credentials',
'verb' => 'POST',
],
[
'name' => 'credentials#getCredentials',
'url' => '/api/v1/background-sync/credentials/{userId}',
'verb' => 'GET',
],
[
'name' => 'credentials#deleteCredentials',
'url' => '/api/v1/background-sync/credentials/revoke',
'verb' => 'POST',
],
[
'name' => 'credentials#getStatus',
'url' => '/api/v1/background-sync/status',
'verb' => 'GET',
],
// Vector search API routes
[
'name' => 'api#search',
'url' => '/api/search',
'verb' => 'GET',
],
[
'name' => 'api#vectorStatus',
'url' => '/api/vector-status',
'verb' => 'GET',
],
[
'name' => 'api#chunkContext',
'url' => '/api/chunk-context',
'verb' => 'GET',
],
[
'name' => 'api#pdfPreview',
'url' => '/api/pdf-preview',
'verb' => 'GET',
],
// Admin settings routes
[
'name' => 'api#serverStatus',
'url' => '/api/admin/server-status',
'verb' => 'GET',
],
[
'name' => 'api#adminVectorStatus',
'url' => '/api/admin/vector-status',
'verb' => 'GET',
],
[
'name' => 'api#saveSearchSettings',
'url' => '/api/admin/search-settings',
'verb' => 'POST',
],
// Webhook management routes (admin only)
[
'name' => 'api#getWebhookPresets',
'url' => '/api/admin/webhooks/presets',
'verb' => 'GET',
],
[
'name' => 'api#enableWebhookPreset',
'url' => '/api/admin/webhooks/presets/{presetId}/enable',
'verb' => 'POST',
],
[
'name' => 'api#disableWebhookPreset',
'url' => '/api/admin/webhooks/presets/{presetId}/disable',
'verb' => 'POST',
],
],
];