Compare commits

..

No commits in common. "main" and "3.5.6" have entirely different histories.
main ... 3.5.6

9 changed files with 26 additions and 125 deletions

View File

@ -23,8 +23,7 @@
"nextcloud/coding-standard": "^1.3.2", "nextcloud/coding-standard": "^1.3.2",
"nextcloud/ocp": "^31.0.0", "nextcloud/ocp": "^31.0.0",
"nextcloud/rector": "^0.3.1", "nextcloud/rector": "^0.3.1",
"phpstan/phpstan": "~1.12.20", "phpstan/phpstan": "~1.12.19",
"phpstan/phpstan-deprecation-rules": "~1.2.1",
"rector/rector": "~1.2.10", "rector/rector": "~1.2.10",
"roave/security-advisories": "dev-latest" "roave/security-advisories": "dev-latest"
}, },

72
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "600a8f571b8f0aba7eacf029c105560d", "content-hash": "b5e130ac8e2091ae47ec59dd6e996e6a",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@ -259,16 +259,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.12.20", "version": "1.12.19",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "3240b1972042c7f73cf1045e879ea5bd5f761bb7" "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/3240b1972042c7f73cf1045e879ea5bd5f761bb7", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c42ba9bab7a940ed00092ecb1c77bad98896d789",
"reference": "3240b1972042c7f73cf1045e879ea5bd5f761bb7", "reference": "c42ba9bab7a940ed00092ecb1c77bad98896d789",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -313,54 +313,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-03-05T13:37:43+00:00" "time": "2025-02-19T15:42:21+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82",
"reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.12"
},
"require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
},
"type": "phpstan-extension",
"extra": {
"phpstan": {
"includes": [
"rules.neon"
]
}
},
"autoload": {
"psr-4": {
"PHPStan\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1"
},
"time": "2024-09-11T15:52:35+00:00"
}, },
{ {
"name": "psr/clock", "name": "psr/clock",
@ -628,12 +581,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git", "url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "93d6f477df354be282736a37f732e39382ff9f95" "reference": "e7cacb4409da236548159072e5eff2c30cd3bf9c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/93d6f477df354be282736a37f732e39382ff9f95", "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e7cacb4409da236548159072e5eff2c30cd3bf9c",
"reference": "93d6f477df354be282736a37f732e39382ff9f95", "reference": "e7cacb4409da236548159072e5eff2c30cd3bf9c",
"shasum": "" "shasum": ""
}, },
"conflict": { "conflict": {
@ -961,7 +914,7 @@
"lara-zeus/artemis": ">=1,<=1.0.6", "lara-zeus/artemis": ">=1,<=1.0.6",
"lara-zeus/dynamic-dashboard": ">=3,<=3.0.1", "lara-zeus/dynamic-dashboard": ">=3,<=3.0.1",
"laravel/fortify": "<1.11.1", "laravel/fortify": "<1.11.1",
"laravel/framework": "<11.44.1|>=12,<12.1.1", "laravel/framework": "<6.20.45|>=7,<7.30.7|>=8,<8.83.28|>=9,<9.52.17|>=10,<10.48.23|>=11,<11.31",
"laravel/laravel": ">=5.4,<5.4.22", "laravel/laravel": ">=5.4,<5.4.22",
"laravel/pulse": "<1.3.1", "laravel/pulse": "<1.3.1",
"laravel/reverb": "<1.4", "laravel/reverb": "<1.4",
@ -981,7 +934,6 @@
"limesurvey/limesurvey": "<6.5.12", "limesurvey/limesurvey": "<6.5.12",
"livehelperchat/livehelperchat": "<=3.91", "livehelperchat/livehelperchat": "<=3.91",
"livewire/livewire": "<2.12.7|>=3.0.0.0-beta1,<3.5.2", "livewire/livewire": "<2.12.7|>=3.0.0.0-beta1,<3.5.2",
"livewire/volt": "<1.7",
"lms/routes": "<2.1.1", "lms/routes": "<2.1.1",
"localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2", "localizationteam/l10nmgr": "<7.4|>=8,<8.7|>=9,<9.2",
"luyadev/yii-helpers": "<1.2.1", "luyadev/yii-helpers": "<1.2.1",
@ -1171,7 +1123,7 @@
"rap2hpoutre/laravel-log-viewer": "<0.13", "rap2hpoutre/laravel-log-viewer": "<0.13",
"react/http": ">=0.7,<1.9", "react/http": ">=0.7,<1.9",
"really-simple-plugins/complianz-gdpr": "<6.4.2", "really-simple-plugins/complianz-gdpr": "<6.4.2",
"redaxo/source": "<5.18.3", "redaxo/source": "<=5.18.1",
"remdex/livehelperchat": "<4.29", "remdex/livehelperchat": "<4.29",
"reportico-web/reportico": "<=8.1", "reportico-web/reportico": "<=8.1",
"rhukster/dom-sanitizer": "<1.0.7", "rhukster/dom-sanitizer": "<1.0.7",
@ -1497,7 +1449,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-03-05T20:05:33+00:00" "time": "2025-03-03T20:05:19+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace OCA\RePod\Controller; namespace OCA\RePod\Controller;
use OCA\GPodderSync\Core\EpisodeAction\EpisodeAction;
use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionRepository; use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionRepository;
use OCA\RePod\AppInfo\Application; use OCA\RePod\AppInfo\Application;
use OCA\RePod\Core\EpisodeAction\EpisodeActionExtraData; use OCA\RePod\Core\EpisodeAction\EpisodeActionExtraData;
@ -16,13 +15,9 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use OCP\Http\Client\IClientService; use OCP\Http\Client\IClientService;
use OCP\IRequest; use OCP\IRequest;
/**
* @phpstan-import-type EpisodeActionType from EpisodeAction
*/
class EpisodesController extends Controller class EpisodesController extends Controller
{ {
public function __construct( public function __construct(
@ -35,13 +30,10 @@ class EpisodesController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return JSONResponse<Http::STATUS_*, array<int, EpisodeActionExtraData>, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/episodes/list')] #[FrontpageRoute(verb: 'GET', url: '/episodes/list')]
public function list(string $url): Response { public function list(string $url): JSONResponse {
$client = $this->clientService->newClient(); $client = $this->clientService->newClient();
$feed = $client->get($url); $feed = $client->get($url);
$episodes = $this->episodeActionReader->parseRssXml((string) $feed->getBody()); $episodes = $this->episodeActionReader->parseRssXml((string) $feed->getBody());
@ -54,20 +46,16 @@ class EpisodesController extends Controller
return new JSONResponse($episodes, $returnStatusCode); return new JSONResponse($episodes, $returnStatusCode);
} }
/**
* @return JSONResponse<Http::STATUS_OK, EpisodeActionType, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/episodes/action')] #[FrontpageRoute(verb: 'GET', url: '/episodes/action')]
public function action(string $url): Response { public function action(string $url): JSONResponse {
$action = $this->episodeActionRepository->findByEpisodeUrl($url, $this->userService->getUserUID()); $action = $this->episodeActionRepository->findByEpisodeUrl($url, $this->userService->getUserUID());
if ($action) { if ($action) {
return new JSONResponse($action->toArray()); return new JSONResponse($action->toArray());
} }
/** @phpstan-ignore-next-line */
return new JSONResponse([], Http::STATUS_NOT_FOUND); return new JSONResponse([], Http::STATUS_NOT_FOUND);
} }
} }

View File

@ -10,7 +10,6 @@ use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeSaver;
use OCA\RePod\AppInfo\Application; use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\UserService; use OCA\RePod\Service\UserService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
@ -32,13 +31,10 @@ class OpmlController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return DataDownloadResponse<Http::STATUS_OK, 'application/xml', array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/opml/export')] #[FrontpageRoute(verb: 'GET', url: '/opml/export')]
public function export(): Response { public function export(): DataDownloadResponse {
// https://github.com/AntennaPod/AntennaPod/blob/master/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java // https://github.com/AntennaPod/AntennaPod/blob/master/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java
$xml = new \SimpleXMLElement('<opml/>', namespaceOrPrefix: 'http://xmlpull.org/v1/doc/features.html#indent-output'); $xml = new \SimpleXMLElement('<opml/>', namespaceOrPrefix: 'http://xmlpull.org/v1/doc/features.html#indent-output');
$xml->addAttribute('version', '2.0'); $xml->addAttribute('version', '2.0');
@ -88,9 +84,6 @@ class OpmlController extends Controller
return new DataDownloadResponse((string) $xml->asXML(), 'repod-'.$dateCreated->getTimestamp().'.opml', ' application/xml'); return new DataDownloadResponse((string) $xml->asXML(), 'repod-'.$dateCreated->getTimestamp().'.opml', ' application/xml');
} }
/**
* @return Response<Http::STATUS_OK, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'POST', url: '/opml/import')] #[FrontpageRoute(verb: 'POST', url: '/opml/import')]

View File

@ -6,12 +6,10 @@ namespace OCA\RePod\Controller;
use OCA\RePod\AppInfo\Application; use OCA\RePod\AppInfo\Application;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest; use OCP\IRequest;
@ -23,13 +21,10 @@ class PageController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return TemplateResponse<Http::STATUS_OK, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/')] #[FrontpageRoute(verb: 'GET', url: '/')]
public function index(): Response { public function index(): TemplateResponse {
$csp = new ContentSecurityPolicy(); $csp = new ContentSecurityPolicy();
$csp->addAllowedImageDomain('*'); $csp->addAllowedImageDomain('*');
$csp->addAllowedMediaDomain('*'); $csp->addAllowedMediaDomain('*');
@ -40,23 +35,17 @@ class PageController extends Controller
return $response; return $response;
} }
/**
* @return TemplateResponse<Http::STATUS_OK, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/discover')] #[FrontpageRoute(verb: 'GET', url: '/discover')]
public function discover(): Response { public function discover(): TemplateResponse {
return $this->index(); return $this->index();
} }
/**
* @return TemplateResponse<Http::STATUS_OK, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/feed/{path}', requirements: ['path' => '.+'])] #[FrontpageRoute(verb: 'GET', url: '/feed/{path}', requirements: ['path' => '.+'])]
public function feed(): Response { public function feed(): TemplateResponse {
return $this->index(); return $this->index();
} }
} }

View File

@ -13,7 +13,6 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use OCP\Http\Client\IClientService; use OCP\Http\Client\IClientService;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IRequest; use OCP\IRequest;
@ -29,13 +28,10 @@ class PodcastController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData, array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/podcast')] #[FrontpageRoute(verb: 'GET', url: '/podcast')]
public function index(string $url): Response { public function index(string $url): JSONResponse {
$podcast = null; $podcast = null;
if ($this->cacheFactory->isLocalCacheAvailable()) { if ($this->cacheFactory->isLocalCacheAvailable()) {
@ -63,7 +59,6 @@ class PodcastController extends Controller
/** @var Http::STATUS_* $returnStatusCode */ /** @var Http::STATUS_* $returnStatusCode */
$returnStatusCode = $feed->getStatusCode(); $returnStatusCode = $feed->getStatusCode();
/** @phpstan-ignore-next-line */
return new JSONResponse($podcast, $returnStatusCode); return new JSONResponse($podcast, $returnStatusCode);
} }
} }

View File

@ -4,16 +4,13 @@ declare(strict_types=1);
namespace OCA\RePod\Controller; namespace OCA\RePod\Controller;
use OCA\GPodderSync\Core\PodcastData\PodcastData;
use OCA\RePod\AppInfo\Application; use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\MultiPodService; use OCA\RePod\Service\MultiPodService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use OCP\IRequest; use OCP\IRequest;
class SearchController extends Controller class SearchController extends Controller
@ -25,13 +22,10 @@ class SearchController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/search')] #[FrontpageRoute(verb: 'GET', url: '/search')]
public function index(string $q): Response { public function index(string $q): JSONResponse {
return new JSONResponse($this->multiPodService->search($q)); return new JSONResponse($this->multiPodService->search($q));
} }
} }

View File

@ -4,16 +4,13 @@ declare(strict_types=1);
namespace OCA\RePod\Controller; namespace OCA\RePod\Controller;
use OCA\GPodderSync\Core\PodcastData\PodcastData;
use OCA\RePod\AppInfo\Application; use OCA\RePod\AppInfo\Application;
use OCA\RePod\Service\FyydService; use OCA\RePod\Service\FyydService;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\FrontpageRoute; use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\Response;
use OCP\IRequest; use OCP\IRequest;
class ToplistController extends Controller class ToplistController extends Controller
@ -25,23 +22,17 @@ class ToplistController extends Controller
parent::__construct(Application::APP_ID, $request); parent::__construct(Application::APP_ID, $request);
} }
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/hot')] #[FrontpageRoute(verb: 'GET', url: '/toplist/hot')]
public function hot(): Response { public function hot(): JSONResponse {
return new JSONResponse($this->fyydService->hot()); return new JSONResponse($this->fyydService->hot());
} }
/**
* @return JSONResponse<Http::STATUS_OK, PodcastData[], array{}>
*/
#[NoAdminRequired] #[NoAdminRequired]
#[NoCSRFRequired] #[NoCSRFRequired]
#[FrontpageRoute(verb: 'GET', url: '/toplist/new')] #[FrontpageRoute(verb: 'GET', url: '/toplist/new')]
public function new(): Response { public function new(): JSONResponse {
return new JSONResponse($this->fyydService->latest()); return new JSONResponse($this->fyydService->latest());
} }
} }

View File

@ -2,5 +2,5 @@ parameters:
level: 9 level: 9
paths: paths:
- lib - lib
includes: ignoreErrors:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon - '#Method [a-zA-Z0-9:\(\)\\_]+ return type with generic class OCP\\AppFramework\\Http\\[a-zA-Z]+ does not specify its types#'