Fix: Change route from /admin to / to avoid Nextcloud conflicts

- Changed route URL from /admin to / (root path)
  - /admin was conflicting with Nextcloud built-in admin routes
  - Now uses apps/analyticshub/ instead
- Changed route name from admin#index to page#index
  - Follows Nextcloud naming conventions
- Updated info.xml navigation
  - Points to analyticshub.page.index
  - Removed <settings> section (can cause conflicts)
- Updated AdminController
  - Added request path to diagnostic output
  - Better styling for simple HTML page

The route was conflicting with Nextcloud's admin system.
New URL: https://teamworkapps.com/index.php/apps/analyticshub/
This commit is contained in:
WLTBAgent
2026-02-13 20:21:40 +00:00
parent d4f96cc28b
commit 4b684d101a
3 changed files with 17 additions and 11 deletions

View File

@@ -10,10 +10,10 @@ namespace OCA\AnalyticsHub;
return [
'routes' => [
// Admin route - simple GET only
// Admin route - use root path instead of /admin
[
'name' => 'admin#index',
'url' => '/admin',
'name' => 'page#index',
'url' => '/',
'verb' => 'GET',
'requirements' => [],
],

View File

@@ -10,11 +10,9 @@
<category>integration</category>
<dependencies>
<nextcloud min-version="25" max-version="26"/>
<php min-version="7.4"/>
</dependencies>
<settings>
<admin>OCA\AnalyticsHub\Controller\Admin</admin>
</settings>
<navigation>
<admin>analyticshub.admin.index</admin>
<admin>analyticshub.page.index</admin>
</navigation>
</info>

View File

@@ -15,6 +15,7 @@ use OCP\IRequest;
class AdminController {
private $appName;
private $request;
public function __construct(string $appName, IRequest $request) {
$this->appName = $appName;
@@ -30,13 +31,20 @@ class AdminController {
public function index(): void {
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head><title>Mini-CMO Analytics Hub</title></head>';
echo '<head>';
echo '<title>Mini-CMO Analytics Hub</title>';
echo '<style>';
echo 'body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding: 40px; }';
echo 'h1 { color: #0082c9; }';
echo '</style>';
echo '</head>';
echo '<body>';
echo '<h1>Mini-CMO Analytics Hub</h1>';
echo '<p>Controller is working! App name: ' . htmlspecialchars($this->appName) . '</p>';
echo '<p><strong>Status: Admin accessible!</strong></p>';
echo '<p><strong>App Name:</strong> ' . htmlspecialchars($this->appName) . '</p>';
echo '<p><strong>Status:</strong> Controller is working!</p>';
echo '<p><strong>Route:</strong> ' . htmlspecialchars($this->request->getPathInfo()) . '</p>';
echo '<hr>';
echo '<p>Test successful - routing is working.</p>';
echo '<p>✅ Routing test successful!</p>';
echo '</body>';
echo '</html>';
exit;