Fix: Add proper Application.php and fix DI
- Created appinfo/Application.php (Nextcloud app bootstrap) - Extends OCP\AppFramework\App - Registers proper app ID: analyticshub - Loads CSS and JS files - Removed obsolete lib/App.php file - Updated all AppInfo::APP_NAME references to Application::APP_NAME - AdminController, ApiV1Controller - GoogleAnalyticsService, LLMService - Fixed dependency injection in AdminController - Injected IConfig service properly - Added missing use statements This is the core fix for the app not appearing in Nextcloud. Nextcloud requires appinfo/Application.php to initialize the app.
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace OCA\AnalyticsHub\Service;
|
||||
|
||||
use OCA\AnalyticsHub\Model\ClientConfig;
|
||||
use OCA\AnalyticsHub\AppInfo\Application;
|
||||
use OCP\IConfig;
|
||||
use OCP\Util\Logger;
|
||||
use OCP\Util\SimplePDOMapper;
|
||||
@@ -33,9 +34,9 @@ class GoogleAnalyticsService {
|
||||
* Check if Google Analytics is configured
|
||||
*/
|
||||
public function isConfigured(): bool {
|
||||
$clientId = $this->config->getAppValue('google_client_id', AppInfo::APP_NAME);
|
||||
$clientSecret = $this->config->getAppValue('google_client_secret', AppInfo::APP_NAME);
|
||||
$refreshToken = $this->config->getAppValue('google_refresh_token', AppInfo::APP_NAME);
|
||||
$clientId = $this->config->getAppValue('google_client_id', Application::APP_NAME);
|
||||
$clientSecret = $this->config->getAppValue('google_client_secret', Application::APP_NAME);
|
||||
$refreshToken = $this->config->getAppValue('google_refresh_token', Application::APP_NAME);
|
||||
|
||||
return !empty($clientId) && !empty($clientSecret) && !empty($refreshToken);
|
||||
}
|
||||
@@ -44,7 +45,7 @@ class GoogleAnalyticsService {
|
||||
* Check if LLM service is configured
|
||||
*/
|
||||
public function isLLMConfigured(): bool {
|
||||
$apiKey = $this->config->getAppValue('anthropic_api_key', AppInfo::APP_NAME);
|
||||
$apiKey = $this->config->getAppValue('anthropic_api_key', Application::APP_NAME);
|
||||
return !empty($apiKey);
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ class GoogleAnalyticsService {
|
||||
* Get all clients
|
||||
*/
|
||||
private function getClients(): array {
|
||||
$json = $this->config->getAppValue('clients_json', AppInfo::APP_NAME);
|
||||
$json = $this->config->getAppValue('clients_json', Application::APP_NAME);
|
||||
if (empty($json)) {
|
||||
return [];
|
||||
}
|
||||
@@ -155,7 +156,7 @@ class GoogleAnalyticsService {
|
||||
* Get fresh access token
|
||||
*/
|
||||
private function getFreshAccessToken(): string {
|
||||
$refreshToken = $this->config->getAppValue('google_refresh_token', AppInfo::APP_NAME);
|
||||
$refreshToken = $this->config->getAppValue('google_refresh_token', Application::APP_NAME);
|
||||
|
||||
if (empty($refreshToken)) {
|
||||
throw new \Exception('Refresh token not configured');
|
||||
@@ -188,8 +189,8 @@ class GoogleAnalyticsService {
|
||||
* Refresh access token using refresh token
|
||||
*/
|
||||
private function refreshAccessToken(string $refreshToken): ?array {
|
||||
$clientId = $this->config->getAppValue('google_client_id', AppInfo::APP_NAME);
|
||||
$clientSecret = $this->config->getAppValue('google_client_secret', AppInfo::APP_NAME);
|
||||
$clientId = $this->config->getAppValue('google_client_id', Application::APP_NAME);
|
||||
$clientSecret = $this->config->getAppValue('google_client_secret', Application::APP_NAME);
|
||||
|
||||
$url = self::TOKEN_REFRESH_URL;
|
||||
$data = [
|
||||
|
||||
Reference in New Issue
Block a user