From 8f9c4143fcc133f28db4c3f618649fb1170e33b4 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 6 Jan 2023 19:53:43 +0100 Subject: Better enclosures (#4944) * Better enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4702 Improvement of https://github.com/FreshRSS/FreshRSS/pull/2898 * A few fixes * Better enclosure titles * Improve thumbnails * Implement thumbnail for HTML+XPath * Avoid duplicate enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/1668 * Fix regex * Add basic support for media:credit And use
for enclosures * Fix link encoding + simplify code * Fix some SimplePie bugs Encoding errors in enclosure links * Remove debugging syslog * Remove debugging syslog * SimplePie fix multiple RSS2 enclosures #fix https://github.com/FreshRSS/FreshRSS/issues/4974 * Improve thumbnails * Performance with yield Avoid generating all enclosures if not used * API keep providing enclosures inside content Clients are typically not showing the enclosures to the users (tested with News+, FeedMe, Readrops, Fluent Reader Lite) * Lint * Fix API output enclosure * Fix API content strcut * API tolerate enclosures without a type --- app/Models/Entry.php | 167 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 140 insertions(+), 27 deletions(-) (limited to 'app/Models/Entry.php') diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 47fcf3b4a..ec7629253 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -67,7 +67,9 @@ class FreshRSS_Entry extends Minz_Model { $dao['content'] = ''; } if (!empty($dao['thumbnail'])) { - $dao['content'] .= '

'; + $dao['attributes']['thumbnail'] = [ + 'url' => $dao['thumbnail'], + ]; } $entry = new FreshRSS_Entry( $dao['id_feed'] ?? 0, @@ -116,15 +118,117 @@ class FreshRSS_Entry extends Minz_Model { return $this->authors; } } - public function content(): string { - return $this->content; + + /** + * Basic test without ambition to catch all cases such as unquoted addresses, variants of entities, HTML comments, etc. + */ + private static function containsLink(string $html, string $link): bool { + return preg_match('/(?P[\'"])' . preg_quote($link, '/') . '(?P=delim)/', $html) == 1; + } + + private static function enclosureIsImage(array $enclosure): bool { + $elink = $enclosure['url'] ?? ''; + $length = $enclosure['length'] ?? 0; + $medium = $enclosure['medium'] ?? ''; + $mime = $enclosure['type'] ?? ''; + + return $elink != '' && $medium === 'image' || strpos($mime, 'image') === 0 || + ($mime == '' && $length == 0 && preg_match('/[.](avif|gif|jpe?g|png|svg|webp)$/i', $elink)); } - /** @return array> */ - public function enclosures(bool $searchBodyImages = false): array { - $results = []; + /** + * @param bool $withEnclosures Set to true to include the enclosures in the returned HTML, false otherwise. + * @param bool $allowDuplicateEnclosures Set to false to remove obvious enclosure duplicates (based on simple string comparison), true otherwise. + * @return string HTML content + */ + public function content(bool $withEnclosures = true, bool $allowDuplicateEnclosures = false): string { + if (!$withEnclosures) { + return $this->content; + } + + $content = $this->content; + + $thumbnail = $this->attributes('thumbnail'); + if (!empty($thumbnail['url'])) { + $elink = $thumbnail['url']; + if ($allowDuplicateEnclosures || !self::containsLink($content, $elink)) { + $content .= << +

+ +

+
+HTML; + } + } + + $attributeEnclosures = $this->attributes('enclosures'); + if (empty($attributeEnclosures)) { + return $content; + } + + foreach ($attributeEnclosures as $enclosure) { + $elink = $enclosure['url'] ?? ''; + if ($elink == '') { + continue; + } + if (!$allowDuplicateEnclosures && self::containsLink($content, $elink)) { + continue; + } + $credit = $enclosure['credit'] ?? ''; + $description = $enclosure['description'] ?? ''; + $length = $enclosure['length'] ?? 0; + $medium = $enclosure['medium'] ?? ''; + $mime = $enclosure['type'] ?? ''; + $thumbnails = $enclosure['thumbnails'] ?? []; + $etitle = $enclosure['title'] ?? ''; + + $content .= '
'; + + foreach ($thumbnails as $thumbnail) { + $content .= '

'; + } + + if (self::enclosureIsImage($enclosure)) { + $content .= '

'; + } elseif ($medium === 'audio' || strpos($mime, 'audio') === 0) { + $content .= '

💾

'; + } elseif ($medium === 'video' || strpos($mime, 'video') === 0) { + $content .= '

💾

'; + } else { //e.g. application, text, unknown + $content .= '

💾

'; + } + + if ($credit != '') { + $content .= '

© ' . $credit . '

'; + } + if ($description != '') { + $content .= '
' . $description . '
'; + } + $content .= "
\n"; + } + + return $content; + } + + /** @return iterable> */ + public function enclosures(bool $searchBodyImages = false) { + $attributeEnclosures = $this->attributes('enclosures'); + if (is_array($attributeEnclosures)) { + // FreshRSS 1.20.1+: The enclosures are saved as attributes + yield from $attributeEnclosures; + } try { - $searchEnclosures = strpos($this->content, '

content, 'query('//div[@class="enclosure"]/p[@class="enclosure-content"]/*[@src]'); foreach ($enclosures as $enclosure) { $result = [ @@ -148,7 +253,7 @@ class FreshRSS_Entry extends Minz_Model { case 'audio': $result['medium'] = 'audio'; break; } } - $results[] = $result; + yield Minz_Helper::htmlspecialchars_utf8($result); } } if ($searchBodyImages) { @@ -159,26 +264,31 @@ class FreshRSS_Entry extends Minz_Model { $src = $img->getAttribute('data-src'); } if ($src != null) { - $results[] = [ + $result = [ 'url' => $src, - 'alt' => $img->getAttribute('alt'), ]; + yield Minz_Helper::htmlspecialchars_utf8($result); } } } - return $results; } catch (Exception $ex) { - return $results; + Minz_Log::debug(__METHOD__ . ' ' . $ex->getMessage()); } } /** * @return array|null */ - public function thumbnail() { - foreach ($this->enclosures(true) as $enclosure) { - if (!empty($enclosure['url']) && empty($enclosure['type'])) { - return $enclosure; + public function thumbnail(bool $searchEnclosures = true) { + $thumbnail = $this->attributes('thumbnail'); + if (!empty($thumbnail['url'])) { + return $thumbnail; + } + if ($searchEnclosures) { + foreach ($this->enclosures(true) as $enclosure) { + if (self::enclosureIsImage($enclosure)) { + return $enclosure; + } } } return null; @@ -587,7 +697,7 @@ class FreshRSS_Entry extends Minz_Model { if ($entry) { // l’article existe déjà en BDD, en se contente de recharger ce contenu - $this->content = $entry->content(); + $this->content = $entry->content(false); } else { try { // The article is not yet in the database, so let’s fetch it @@ -629,7 +739,7 @@ class FreshRSS_Entry extends Minz_Model { 'guid' => $this->guid(), 'title' => $this->title(), 'author' => $this->authors(true), - 'content' => $this->content(), + 'content' => $this->content(false), 'link' => $this->link(), 'date' => $this->date(true), 'hash' => $this->hash(), @@ -677,7 +787,6 @@ class FreshRSS_Entry extends Minz_Model { 'published' => $this->date(true), // 'updated' => $this->date(true), 'title' => $this->title(), - 'summary' => ['content' => $this->content()], 'canonical' => [ ['href' => htmlspecialchars_decode($this->link(), ENT_QUOTES)], ], @@ -697,13 +806,16 @@ class FreshRSS_Entry extends Minz_Model { if ($mode === 'compat') { $item['title'] = escapeToUnicodeAlternative($this->title(), false); unset($item['alternate'][0]['type']); - if (mb_strlen($this->content(), 'UTF-8') > self::API_MAX_COMPAT_CONTENT_LENGTH) { - $item['summary']['content'] = mb_strcut($this->content(), 0, self::API_MAX_COMPAT_CONTENT_LENGTH, 'UTF-8'); - } - } elseif ($mode === 'freshrss') { + $item['summary'] = [ + 'content' => mb_strcut($this->content(true), 0, self::API_MAX_COMPAT_CONTENT_LENGTH, 'UTF-8'), + ]; + } else { + $item['content'] = [ + 'content' => $this->content(false), + ]; + } + if ($mode === 'freshrss') { $item['guid'] = $this->guid(); - unset($item['summary']); - $item['content'] = ['content' => $this->content()]; } if ($category != null && $mode !== 'freshrss') { $item['categories'][] = 'user/-/label/' . htmlspecialchars_decode($category->name(), ENT_QUOTES); @@ -718,10 +830,11 @@ class FreshRSS_Entry extends Minz_Model { } } foreach ($this->enclosures() as $enclosure) { - if (!empty($enclosure['url']) && !empty($enclosure['type'])) { + if (!empty($enclosure['url'])) { $media = [ 'href' => $enclosure['url'], - 'type' => $enclosure['type'], + 'type' => $enclosure['type'] ?? $enclosure['medium'] ?? + (self::enclosureIsImage($enclosure) ? 'image' : ''), ]; if (!empty($enclosure['length'])) { $media['length'] = intval($enclosure['length']); -- cgit v1.2.3 From 1d9d4e3e3c8dd020ab4d333436264eaa3ef201cd Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 9 Jan 2023 12:59:30 +0100 Subject: Update dev dependencies (#4993) Related to https://github.com/FreshRSS/FreshRSS/pull/4991 Required a few changes in code to pass the tests --- .github/workflows/tests.yml | 10 +- .typos.toml | 3 +- Makefile | 44 +- app/Controllers/updateController.php | 6 +- app/Models/Entry.php | 2 +- app/Models/Searchable.php | 4 + app/Models/UserQuery.php | 27 +- composer.json | 2 +- composer.lock | 62 +- docs/en/admins/05_Configuring_email_validation.md | 2 +- docs/en/developers/02_Github.md | 2 +- docs/en/internationalization.md | 2 +- lib/http-conditional.php | 2 +- p/ext.php | 1 - package-lock.json | 1509 ++++++++++++--------- package.json | 17 +- tests/app/Models/UserQueryTest.php | 12 +- 17 files changed, 955 insertions(+), 752 deletions(-) (limited to 'app/Models/Entry.php') diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5751f685b..6e1e6b0a6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,7 +55,7 @@ jobs: uses: actions/setup-node@v3 with: # https://nodejs.org/en/about/releases/ - node-version: '16' + node-version: '18' cache: 'npm' - run: npm ci @@ -79,14 +79,14 @@ jobs: uses: actions/cache@v3 with: path: bin - key: ${{ runner.os }}-bin-shfmt@v3.5.1-hadolint@v2.10.0-typos@v1.10.1 + key: ${{ runner.os }}-bin-shfmt@v3.6.0-hadolint@v2.12.0-typos@v1.13.6 - name: Add ./bin/ to $PATH run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH - name: Install shfmt if: steps.shell-cache.outputs.cache-hit != 'true' - run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.1 + run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.6.0 - name: Check shell script syntax # shellcheck is pre-installed https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md @@ -94,7 +94,7 @@ jobs: - name: Install hadolint if: steps.shell-cache.outputs.cache-hit != 'true' - run: curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.10.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ./bin/hadolint + run: curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ./bin/hadolint - name: Check Dockerfile syntax run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning @@ -103,7 +103,7 @@ jobs: if: steps.shell-cache.outputs.cache-hit != 'true' run: | cd bin ; - wget -q 'https://github.com/crate-ci/typos/releases/download/v1.10.1/typos-v1.10.1-x86_64-unknown-linux-musl.tar.gz' && + wget -q 'https://github.com/crate-ci/typos/releases/download/v1.13.6/typos-v1.13.6-x86_64-unknown-linux-musl.tar.gz' && tar -xvf *.tar.gz './typos' && chmod +x typos && rm *.tar.gz ; diff --git a/.typos.toml b/.typos.toml index f4b7d5f5a..38a2a1cee 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,7 +3,7 @@ ot = "ot" Ths2 = "Ths2" [default.extend-words] -ba = "ba" +referer = "referer" [files] extend-exclude = [ @@ -33,6 +33,7 @@ extend-exclude = [ "app/i18n/zh-cn/", "bin/", "CHANGELOG-old.md", + "composer.lock", "data/", "docs/fr/", "lib/phpgt/", diff --git a/Makefile b/Makefile index 6216dfcec..d94fd704a 100644 --- a/Makefile +++ b/Makefile @@ -60,40 +60,37 @@ stop: ## Stop FreshRSS container if any ## Tests and linter ## ###################### .PHONY: test -test: bin/phpunit ## Run the test suite - $(PHP) ./bin/phpunit --bootstrap ./tests/bootstrap.php ./tests +test: vendor/bin/phpunit ## Run the test suite + $(PHP) vendor/bin/phpunit --bootstrap ./tests/bootstrap.php ./tests .PHONY: lint -lint: bin/phpcs ## Run the linter on the PHP files - $(PHP) ./bin/phpcs . -p -s +lint: vendor/bin/phpcs ## Run the linter on the PHP files + $(PHP) vendor/bin/phpcs . -p -s .PHONY: lint-fix -lint-fix: bin/phpcbf ## Fix the errors detected by the linter - $(PHP) ./bin/phpcbf . -p -s +lint-fix: vendor/bin/phpcbf ## Fix the errors detected by the linter + $(PHP) vendor/bin/phpcbf . -p -s bin/composer: mkdir -p bin/ - wget 'https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer' -O - -q | php -- --quiet --install-dir='./bin/' --filename='composer' + wget 'https://raw.githubusercontent.com/composer/getcomposer.org/b5dbe5ebdec95ce71b3128b359bd5a85cb0a722d/web/installer' -O - -q | php -- --quiet --install-dir='./bin/' --filename='composer' -bin/phpunit: - mkdir -p bin/ - wget -O bin/phpunit 'https://phar.phpunit.de/phpunit-9.5.20.phar' - echo '6becad2da5c37f5ad101cc665ef05a2f1a6a45d2427c8edcc74f72c92fb1e05a bin/phpunit' | sha256sum -c - || rm bin/phpunit +vendor/bin/phpunit: bin/composer + bin/composer install --prefer-dist --no-progress + ln -s ../vendor/bin/phpunit bin/phpunit -bin/phpcs: - mkdir -p bin/ - wget -O bin/phpcs 'https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.1/phpcs.phar' - echo '7a14323a14af9f58302d15442492ee1076a8cd72c018a816cb44965bf3a9b015 bin/phpcs' | sha256sum -c - || rm bin/phpcs +vendor/bin/phpcs: bin/composer + bin/composer install --prefer-dist --no-progress + ln -s ../vendor/bin/phpcs bin/phpcs -bin/phpcbf: - mkdir -p bin/ - wget -O bin/phpcbf 'https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.7.1/phpcbf.phar' - echo 'c93c0e83cbda21c21f849ccf0f4b42979d20004a5a6172ed0ea270eca7ae6fa8 bin/phpcbf' | sha256sum -c - || rm bin/phpcbf +vendor/bin/phpcbf: bin/composer + bin/composer install --prefer-dist --no-progress + ln -s ../vendor/bin/phpcbf bin/phpcbf bin/typos: mkdir -p bin/ cd bin ; \ - wget -q 'https://github.com/crate-ci/typos/releases/download/v1.10.1/typos-v1.10.1-x86_64-unknown-linux-musl.tar.gz' && \ + wget -q 'https://github.com/crate-ci/typos/releases/download/v1.13.6/typos-v1.13.6-x86_64-unknown-linux-musl.tar.gz' && \ tar -xvf *.tar.gz './typos' && \ chmod +x typos && \ rm *.tar.gz ; \ @@ -102,6 +99,9 @@ bin/typos: node_modules/.bin/eslint: npm install +node_modules/.bin/rtlcss: + npm install + vendor/bin/phpstan: bin/composer bin/composer install --prefer-dist --no-progress @@ -181,8 +181,8 @@ endif ## TOOLS ## ########### .PHONY: rtl -rtl: ## Generate RTL CSS files - rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete +rtl: node_modules/.bin/rtlcss ## Generate RTL CSS files + npm run-script rtlcss .PHONY: pot pot: ## Generate POT templates for docs diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index ae7d613a7..f638ce96c 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -23,7 +23,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { if ($return != 0) { throw new Exception($errorMessage); } - $line = is_array($output) ? implode('', $output) : $output; + $line = implode('', $output); if ($line !== 'master' && $line !== 'dev') { return true; // not on master or dev, nothing to do } @@ -54,14 +54,14 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController { $output = []; exec('git status -sb --porcelain remote', $output, $return); } else { - $line = is_array($output) ? implode('; ', $output) : $output; + $line = implode('; ', $output); Minz_Log::warning('git fetch warning: ' . $line); } } catch (Exception $e) { Minz_Log::warning('git fetch error: ' . $e->getMessage()); } chdir($cwd); - $line = is_array($output) ? implode('; ', $output) : $output; + $line = implode('; ', $output); return $line == '' || strpos($line, '[behind') !== false || strpos($line, '[ahead') !== false || strpos($line, '[gone') !== false; } diff --git a/app/Models/Entry.php b/app/Models/Entry.php index ec7629253..16de8beb6 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -76,7 +76,7 @@ class FreshRSS_Entry extends Minz_Model { $dao['guid'] ?? '', $dao['title'] ?? '', $dao['author'] ?? '', - $dao['content'] ?? '', + $dao['content'], $dao['link'] ?? '', $dao['date'] ?? 0, $dao['is_read'] ?? false, diff --git a/app/Models/Searchable.php b/app/Models/Searchable.php index d5bcea49d..a15a44ed7 100644 --- a/app/Models/Searchable.php +++ b/app/Models/Searchable.php @@ -2,5 +2,9 @@ interface FreshRSS_Searchable { + /** + * @param int|string $id + * @return Minz_Model + */ public function searchById($id); } diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index 964324bf7..4c7e2a8f7 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -18,16 +18,17 @@ class FreshRSS_UserQuery { private $search; private $state; private $url; + /** @var FreshRSS_FeedDAO */ private $feed_dao; + /** @var FreshRSS_CategoryDAO */ private $category_dao; + /** @var FreshRSS_TagDAO */ private $tag_dao; /** * @param array $query - * @param FreshRSS_Searchable $feed_dao - * @param FreshRSS_Searchable $category_dao */ - public function __construct($query, FreshRSS_Searchable $feed_dao = null, FreshRSS_Searchable $category_dao = null, FreshRSS_Searchable $tag_dao = null) { + public function __construct($query, FreshRSS_FeedDAO $feed_dao = null, FreshRSS_CategoryDAO $category_dao = null, FreshRSS_TagDAO $tag_dao = null) { $this->category_dao = $category_dao; $this->feed_dao = $feed_dao; $this->tag_dao = $tag_dao; @@ -83,21 +84,22 @@ class FreshRSS_UserQuery { private function parseGet($get) { $this->get = $get; if (preg_match('/(?P[acfst])(_(?P\d+))?/', $get, $matches)) { + $id = intval($matches['id'] ?? '0'); switch ($matches['type']) { case 'a': $this->parseAll(); break; case 'c': - $this->parseCategory($matches['id']); + $this->parseCategory($id); break; case 'f': - $this->parseFeed($matches['id']); + $this->parseFeed($id); break; case 's': $this->parseFavorite(); break; case 't': - $this->parseTag($matches['id']); + $this->parseTag($id); break; } } @@ -114,11 +116,10 @@ class FreshRSS_UserQuery { /** * Parse the query string when it is a "category" query * - * @param integer $id * @throws FreshRSS_DAO_Exception */ - private function parseCategory($id) { - if (is_null($this->category_dao)) { + private function parseCategory(int $id) { + if ($this->category_dao === null) { throw new FreshRSS_DAO_Exception('Category DAO is not loaded in UserQuery'); } $category = $this->category_dao->searchById($id); @@ -133,11 +134,10 @@ class FreshRSS_UserQuery { /** * Parse the query string when it is a "feed" query * - * @param integer $id * @throws FreshRSS_DAO_Exception */ - private function parseFeed($id) { - if (is_null($this->feed_dao)) { + private function parseFeed(int $id) { + if ($this->feed_dao === null) { throw new FreshRSS_DAO_Exception('Feed DAO is not loaded in UserQuery'); } $feed = $this->feed_dao->searchById($id); @@ -152,10 +152,9 @@ class FreshRSS_UserQuery { /** * Parse the query string when it is a "tag" query * - * @param integer $id * @throws FreshRSS_DAO_Exception */ - private function parseTag($id) { + private function parseTag(int $id) { if ($this->tag_dao == null) { throw new FreshRSS_DAO_Exception('Tag DAO is not loaded in UserQuery'); } diff --git a/composer.json b/composer.json index bac516c34..d6cac9e9c 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "ext-phar": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "phpstan/phpstan": "~1.7.14", + "phpstan/phpstan": "~1.9.7", "phpunit/phpunit": "^9", "squizlabs/php_codesniffer": "^3.7" }, diff --git a/composer.lock b/composer.lock index 696088da1..a2234ddba 100644 --- a/composer.lock +++ b/composer.lock @@ -4,35 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a177c11dee892e1293efc7331465081b", + "content-hash": "d8f96ca83672be5007207d38e14e1c29", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -59,7 +59,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -75,7 +75,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "myclabs/deep-copy", @@ -305,16 +305,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.7.15", + "version": "1.9.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a" + "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a", - "reference": "cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0501435cd342eac7664bd62155b1ef907fc60b6f", + "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f", "shasum": "" }, "require": { @@ -338,9 +338,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.7.15" + "source": "https://github.com/phpstan/phpstan/tree/1.9.7" }, "funding": [ { @@ -351,29 +355,25 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-06-20T08:29:01+00:00" + "time": "2023-01-04T21:59:57+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.18", + "version": "9.2.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a" + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a", - "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", "shasum": "" }, "require": { @@ -429,7 +429,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" }, "funding": [ { @@ -437,7 +437,7 @@ "type": "github" } ], - "time": "2022-10-27T13:35:33+00:00" + "time": "2022-12-28T12:41:10+00:00" }, { "name": "phpunit/php-file-iterator", @@ -682,16 +682,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.26", + "version": "9.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", "shasum": "" }, "require": { @@ -764,7 +764,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" }, "funding": [ { @@ -780,7 +780,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T06:00:21+00:00" + "time": "2022-12-09T07:31:23+00:00" }, { "name": "sebastian/cli-parser", diff --git a/docs/en/admins/05_Configuring_email_validation.md b/docs/en/admins/05_Configuring_email_validation.md index 69a06b53f..aec6b8b75 100644 --- a/docs/en/admins/05_Configuring_email_validation.md +++ b/docs/en/admins/05_Configuring_email_validation.md @@ -68,7 +68,7 @@ Once you’re done, don’t forget to reconfigure your environment to `productio ## Access the validation URL during development -You might find painful to configure a SMTP server when you’re developping and +You might find painful to configure a SMTP server when you’re developing and `mail` function will not work on your local machine. For the moment, there is no easy way to access the validation URL unless forging it. You’ll need to information: diff --git a/docs/en/developers/02_Github.md b/docs/en/developers/02_Github.md index 4e6a84ab3..066d6ffb0 100644 --- a/docs/en/developers/02_Github.md +++ b/docs/en/developers/02_Github.md @@ -53,7 +53,7 @@ Now you can create a PR based on your branch. ## How to write a commit message -A commit message should succintly describe the changes on the first line. For example: +A commit message should succinctly describe the changes on the first line. For example: > Fix broken icon diff --git a/docs/en/internationalization.md b/docs/en/internationalization.md index 3feb4f57c..741a642c7 100644 --- a/docs/en/internationalization.md +++ b/docs/en/internationalization.md @@ -86,7 +86,7 @@ This command adds an IGNORE comment on the translation so the key can be conside ## Add/remove/update a key -If you’re developping a new part of the application, you might want to declare a new translation key. Your first impulse would be to add the key to each file manually: don’t do that, it’s very painful. We provide another command: +If you’re developing a new part of the application, you might want to declare a new translation key. Your first impulse would be to add the key to each file manually: don’t do that, it’s very painful. We provide another command: ```sh make i18n-add-key key=the.key.to.add value='Your string in English' diff --git a/lib/http-conditional.php b/lib/http-conditional.php index 853fdf983..6c7c89d32 100644 --- a/lib/http-conditional.php +++ b/lib/http-conditional.php @@ -7,7 +7,7 @@ - Possibility to control cache for client and proxies (public or private policy, life time). - When $feedMode is set to true, in the case of a RSS/ATOM feed, it puts a timestamp in the global variable $clientCacheDate to allow the sending of only the articles newer than the client's cache. - - When $compression is set to true, compress the data before sending it to the client and persitent connections are allowed. + - When $compression is set to true, compress the data before sending it to the client and persistent connections are allowed. - When $session is set to true, automatically checks if $_SESSION has been modified during the last generation the document. Interface: diff --git a/p/ext.php b/p/ext.php index 2979e2365..9427f8c20 100644 --- a/p/ext.php +++ b/p/ext.php @@ -60,7 +60,6 @@ function is_valid_path_extension($path, $extensionPath, $isStatic = true) { // Static files to serve must be under a `ext_dir/static/` directory. $path_relative_to_ext = substr($path, strlen($real_ext_path) + 1); - // @phpstan-ignore-next-line list(,$static,$file) = sscanf($path_relative_to_ext, '%[^/]/%[^/]/%s'); if (null === $file || 'static' !== $static) { return false; diff --git a/package-lock.json b/package-lock.json index c2c290987..d450ea5fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,47 +7,50 @@ "name": "freshrss", "license": "AGPL-3.0", "devDependencies": { - "eslint": "^8.10.0", + "eslint": "^8.31.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.2.3", - "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-n": "^15.6.0", + "eslint-plugin-promise": "^6.1.1", "markdownlint-cli": "^0.31.1", - "rtlcss": "^3.5.0", - "sass": "^1.52.3", - "stylelint": "^14.9.0", - "stylelint-config-recommended-scss": "^6.0.0", + "rtlcss": "^4.0.0", + "sass": "^1.57.0", + "stylelint": "^14.16.1", + "stylelint-config-recommended-scss": "^8.0.0", "stylelint-order": "^5.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.18.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", - "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -127,9 +130,9 @@ } }, "node_modules/@csstools/selector-specificity": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.1.tgz", - "integrity": "sha512-aG20vknL4/YjQF9BSV7ts4EWm/yrjagAN7OWBNmlbEOUiu0llj4OGrFoOKK3g2vey4/p2omKCoHrWtPxSwV3HA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz", + "integrity": "sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==", "dev": true, "engines": { "node": "^12 || ^14 || >=16" @@ -139,20 +142,20 @@ "url": "https://opencollective.com/csstools" }, "peerDependencies": { - "postcss": "^8.3", + "postcss": "^8.2", "postcss-selector-parser": "^6.0.10" } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", - "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.2", - "globals": "^13.15.0", + "espree": "^9.4.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -161,22 +164,38 @@ }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -243,9 +262,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -304,9 +323,9 @@ } }, "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "dependencies": { "normalize-path": "^3.0.0", @@ -323,15 +342,15 @@ "dev": true }, "node_modules/array-includes": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", - "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5", - "get-intrinsic": "^1.1.1", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", "is-string": "^1.0.7" }, "engines": { @@ -351,14 +370,14 @@ } }, "node_modules/array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -386,6 +405,18 @@ "node": ">=8" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -535,18 +566,6 @@ "node": ">= 6" } }, - "node_modules/clone-regexp": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", - "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", - "dev": true, - "dependencies": { - "is-regexp": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -566,9 +585,9 @@ "dev": true }, "node_modules/colord": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", - "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, "node_modules/commander": { @@ -587,9 +606,9 @@ "dev": true }, "node_modules/cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", "dev": true, "dependencies": { "@types/parse-json": "^4.0.0", @@ -664,9 +683,9 @@ } }, "node_modules/decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha512-ocLWuYzRPoS9bfiSdDd3cxvrzovVMZnRDVEzAs+hWIVXGDbHxWMECij2OBuyB/An0FFW/nLuq6Kv1i/YC5Qfzg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", "dev": true, "dependencies": { "decamelize": "^1.1.0", @@ -674,6 +693,9 @@ }, "engines": { "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/decamelize-keys/node_modules/map-obj": { @@ -765,34 +787,43 @@ } }, "node_modules/es-abstract": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", - "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.0.tgz", + "integrity": "sha512-GUGtW7eXQay0c+PRq0sGIKSdaBorfVqsCMhGHo4elP7YVqZu9nCZS4UkK4gv71gOWNMra/PaSKD3ao1oWExO0g==", "dev": true, "dependencies": { "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.0", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.1", + "get-intrinsic": "^1.1.3", "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", + "internal-slot": "^1.0.4", + "is-array-buffer": "^3.0.0", + "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.4.3", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" }, "engines": { "node": ">= 0.4" @@ -801,6 +832,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es-shim-unscopables": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", @@ -827,6 +872,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -840,13 +894,15 @@ } }, "node_modules/eslint": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", - "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -856,18 +912,21 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -878,8 +937,7 @@ "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" @@ -937,16 +995,20 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "dependencies": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "engines": { "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, "node_modules/eslint-module-utils/node_modules/debug": { @@ -958,73 +1020,6 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-module-utils/node_modules/find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "dependencies": { - "locate-path": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "dependencies": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "dependencies": { - "p-try": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "dependencies": { - "p-limit": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-module-utils/node_modules/path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/eslint-plugin-es": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", @@ -1123,19 +1118,19 @@ "dev": true }, "node_modules/eslint-plugin-n": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz", - "integrity": "sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw==", + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.6.0.tgz", + "integrity": "sha512-Hd/F7wz4Mj44Jp0H6Jtty13NcE69GNTY0rVlgTIj1XBnGGVI6UTdDrpE6vqu3AHo07bygq/N+7OH/lgz1emUJw==", "dev": true, "dependencies": { "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", "eslint-utils": "^3.0.0", "ignore": "^5.1.1", - "is-core-module": "^2.9.0", + "is-core-module": "^2.11.0", "minimatch": "^3.1.2", - "resolve": "^1.10.1", - "semver": "^7.3.7" + "resolve": "^1.22.1", + "semver": "^7.3.8" }, "engines": { "node": ">=12.22.0" @@ -1148,9 +1143,9 @@ } }, "node_modules/eslint-plugin-promise": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", - "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", + "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1209,17 +1204,20 @@ } }, "node_modules/espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "dependencies": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/esquery": { @@ -1264,18 +1262,6 @@ "node": ">=0.10.0" } }, - "node_modules/execall": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/execall/-/execall-2.0.0.tgz", - "integrity": "sha512-0FU2hZ5Hh6iQnarpRtQurM/aAvp3RIbfvgLHrcqJYzhXyV2KFruhuChf9NC6waAhiUR7FFtlugkI4p7f2Fqlow==", - "dev": true, - "dependencies": { - "clone-regexp": "^2.1.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -1283,9 +1269,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -1323,15 +1309,18 @@ "dev": true }, "node_modules/fastest-levenshtein": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", - "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", - "dev": true + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -1391,11 +1380,20 @@ } }, "node_modules/flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1440,12 +1438,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -1456,9 +1448,9 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", - "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", "dev": true, "dependencies": { "function-bind": "^1.1.1", @@ -1574,9 +1566,9 @@ } }, "node_modules/globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1588,6 +1580,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -1614,6 +1621,24 @@ "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", "dev": true }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -1665,6 +1690,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -1717,18 +1754,18 @@ } }, "node_modules/ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true, "engines": { "node": ">= 4" } }, "node_modules/immutable": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", - "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.2.2.tgz", + "integrity": "sha512-fTMKDwtbvO5tldky9QZ2fMX7slR0mYpY5nbnFWYp0fOzDhHqhgIw9KoYgxLWsoNTS9ZHGauHj18DTyEw6BK3Og==", "dev": true }, "node_modules/import-fresh": { @@ -1791,21 +1828,21 @@ "dev": true }, "node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-3.0.1.tgz", + "integrity": "sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ==", "dev": true, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz", + "integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.0", + "get-intrinsic": "^1.1.3", "has": "^1.0.3", "side-channel": "^1.0.4" }, @@ -1813,6 +1850,20 @@ "node": ">= 0.4" } }, + "node_modules/is-array-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz", + "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -1860,9 +1911,9 @@ } }, "node_modules/is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, "engines": { "node": ">= 0.4" @@ -1872,9 +1923,9 @@ } }, "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -1964,6 +2015,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -1998,15 +2058,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-regexp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", - "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", @@ -2049,6 +2100,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -2067,6 +2137,16 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2131,9 +2211,9 @@ } }, "node_modules/known-css-properties": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.25.0.tgz", - "integrity": "sha512-b0/9J1O9Jcyik1GC6KC42hJ41jKwdO/Mq8Mdo5sYN+IuRTXs2YFHZC3kZSx6ueusqa95x3wLYe/ytKjbAfGixA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", + "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", "dev": true }, "node_modules/levn": { @@ -2389,10 +2469,13 @@ } }, "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/minimist-options": { "version": "4.1.0", @@ -2475,14 +2558,14 @@ } }, "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, "engines": { @@ -2493,14 +2576,14 @@ } }, "node_modules/object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" }, "engines": { "node": ">= 0.4" @@ -2665,9 +2748,9 @@ } }, "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "dev": true, "funding": [ { @@ -2717,25 +2800,31 @@ } }, "node_modules/postcss-scss": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.4.tgz", - "integrity": "sha512-aBBbVyzA8b3hUL0MGrpydxxXKXFZc5Eqva0Q3V9qsBOLEMsjb6w49WfpsoWzpEgcqJGW4t7Rio8WXVU9Gd8vWg==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.6.tgz", + "integrity": "sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss-scss" + } + ], "engines": { "node": ">=12.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, "peerDependencies": { - "postcss": "^8.3.3" + "postcss": "^8.4.19" } }, "node_modules/postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", "dev": true, "dependencies": { "cssesc": "^3.0.0", @@ -3051,29 +3140,32 @@ } }, "node_modules/rtlcss": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/rtlcss/-/rtlcss-3.5.0.tgz", - "integrity": "sha512-wzgMaMFHQTnyi9YOwsx9LjOxYXJPzS8sYnFaKm6R5ysvTkwzHiB0vxnbHwchHQT65PTdBjDG21/kQBWI7q9O7A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/rtlcss/-/rtlcss-4.0.0.tgz", + "integrity": "sha512-j6oypPP+mgFwDXL1JkLCtm6U/DQntMUqlv5SOhpgHhdIE+PmBcjrtAHIpXfbIup47kD5Sgja9JDsDF1NNOsBwQ==", "dev": true, "dependencies": { - "find-up": "^5.0.0", + "escalade": "^3.1.1", "picocolors": "^1.0.0", - "postcss": "^8.3.11", + "postcss": "^8.4.6", "strip-json-comments": "^3.1.1" }, "bin": { "rtlcss": "bin/rtlcss.js" + }, + "engines": { + "node": ">=12.0.0" } }, "node_modules/run-con": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.10.tgz", - "integrity": "sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ==", + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.11.tgz", + "integrity": "sha512-NEMGsUT+cglWkzEr4IFK21P4Jca45HqiAbIIZIBdX5+UZTB24Mb/21iNGgz9xZa8tL6vbW7CXmq7MFN42+VjNQ==", "dev": true, "dependencies": { "deep-extend": "^0.6.0", - "ini": "~2.0.0", - "minimist": "^1.2.5", + "ini": "~3.0.0", + "minimist": "^1.2.6", "strip-json-comments": "~3.1.1" }, "bin": { @@ -3103,10 +3195,24 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/sass": { - "version": "1.52.3", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.52.3.tgz", - "integrity": "sha512-LNNPJ9lafx+j1ArtA7GyEJm9eawXN8KlA1+5dF6IZyoONg1Tyo/g+muOsENWJH/2Q1FHbbV4UwliU0cXMa/VIA==", + "version": "1.57.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz", + "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==", "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0", @@ -3121,9 +3227,9 @@ } }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -3238,9 +3344,9 @@ } }, "node_modules/spdx-license-ids": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", - "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", "dev": true }, "node_modules/string-width": { @@ -3258,28 +3364,28 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3337,51 +3443,49 @@ "dev": true }, "node_modules/stylelint": { - "version": "14.9.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.9.1.tgz", - "integrity": "sha512-RdAkJdPiLqHawCSnu21nE27MjNXaVd4WcOHA4vK5GtIGjScfhNnaOuWR2wWdfKFAvcWQPOYe311iveiVKSmwsA==", + "version": "14.16.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", + "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", "dev": true, "dependencies": { - "@csstools/selector-specificity": "^2.0.1", + "@csstools/selector-specificity": "^2.0.2", "balanced-match": "^2.0.0", - "colord": "^2.9.2", - "cosmiconfig": "^7.0.1", + "colord": "^2.9.3", + "cosmiconfig": "^7.1.0", "css-functions-list": "^3.1.0", "debug": "^4.3.4", - "execall": "^2.0.0", - "fast-glob": "^3.2.11", - "fastest-levenshtein": "^1.0.12", + "fast-glob": "^3.2.12", + "fastest-levenshtein": "^1.0.16", "file-entry-cache": "^6.0.1", - "get-stdin": "^8.0.0", "global-modules": "^2.0.0", "globby": "^11.1.0", "globjoin": "^0.1.4", "html-tags": "^3.2.0", - "ignore": "^5.2.0", + "ignore": "^5.2.1", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.25.0", + "known-css-properties": "^0.26.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", "picocolors": "^1.0.0", - "postcss": "^8.4.14", + "postcss": "^8.4.19", "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.10", + "postcss-selector-parser": "^6.0.11", "postcss-value-parser": "^4.2.0", "resolve-from": "^5.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "style-search": "^0.1.0", - "supports-hyperlinks": "^2.2.0", + "supports-hyperlinks": "^2.3.0", "svg-tags": "^1.0.0", - "table": "^6.8.0", + "table": "^6.8.1", "v8-compile-cache": "^2.3.0", - "write-file-atomic": "^4.0.1" + "write-file-atomic": "^4.0.2" }, "bin": { "stylelint": "bin/stylelint.js" @@ -3395,26 +3499,32 @@ } }, "node_modules/stylelint-config-recommended": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-7.0.0.tgz", - "integrity": "sha512-yGn84Bf/q41J4luis1AZ95gj0EQwRX8lWmGmBwkwBNSkpGSpl66XcPTulxGa/Z91aPoNGuIGBmFkcM1MejMo9Q==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-9.0.0.tgz", + "integrity": "sha512-9YQSrJq4NvvRuTbzDsWX3rrFOzOlYBmZP+o513BJN/yfEmGSr0AxdvrWs0P/ilSpVV/wisamAHu5XSk8Rcf4CQ==", "dev": true, "peerDependencies": { - "stylelint": "^14.4.0" + "stylelint": "^14.10.0" } }, "node_modules/stylelint-config-recommended-scss": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-6.0.0.tgz", - "integrity": "sha512-6QOe2/OzXV2AP5FE12A7+qtKdZik7Saf42SMMl84ksVBBPpTdrV+9HaCbPYiRMiwELY9hXCVdH4wlJ+YJb5eig==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-8.0.0.tgz", + "integrity": "sha512-BxjxEzRaZoQb7Iinc3p92GS6zRdRAkIuEu2ZFLTxJK2e1AIcCb5B5MXY9KOXdGTnYFZ+KKx6R4Fv9zU6CtMYPQ==", "dev": true, "dependencies": { "postcss-scss": "^4.0.2", - "stylelint-config-recommended": "^7.0.0", + "stylelint-config-recommended": "^9.0.0", "stylelint-scss": "^4.0.0" }, "peerDependencies": { - "stylelint": "^14.4.0" + "postcss": "^8.3.3", + "stylelint": "^14.10.0" + }, + "peerDependenciesMeta": { + "postcss": { + "optional": true + } } }, "node_modules/stylelint-order": { @@ -3431,9 +3541,9 @@ } }, "node_modules/stylelint-scss": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.2.0.tgz", - "integrity": "sha512-HHHMVKJJ5RM9pPIbgJ/XA67h9H0407G68Rm69H4fzFbFkyDMcTV1Byep3qdze5+fJ3c0U7mJrbj6S0Fg072uZA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.3.0.tgz", + "integrity": "sha512-GvSaKCA3tipzZHoz+nNO7S02ZqOsdBzMiCx9poSmLlb3tdJlGddEX/8QzCOD8O7GQan9bjsvLMsO5xiw6IhhIQ==", "dev": true, "dependencies": { "lodash": "^4.17.21", @@ -3452,18 +3562,6 @@ "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", "dev": true }, - "node_modules/stylelint/node_modules/get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/stylelint/node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -3486,9 +3584,9 @@ } }, "node_modules/supports-hyperlinks": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz", - "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", "dev": true, "dependencies": { "has-flag": "^4.0.0", @@ -3517,9 +3615,9 @@ "dev": true }, "node_modules/table": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", - "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", + "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", "dev": true, "dependencies": { "ajv": "^8.0.1", @@ -3533,9 +3631,9 @@ } }, "node_modules/table/node_modules/ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", @@ -3617,6 +3715,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/uc.micro": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", @@ -3700,6 +3812,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -3716,16 +3848,16 @@ "dev": true }, "node_modules/write-file-atomic": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", - "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/yallist": { @@ -3767,27 +3899,27 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.18.6" } }, "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", "dev": true }, "@babel/highlight": { - "version": "7.17.12", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", - "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -3851,22 +3983,22 @@ } }, "@csstools/selector-specificity": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.1.tgz", - "integrity": "sha512-aG20vknL4/YjQF9BSV7ts4EWm/yrjagAN7OWBNmlbEOUiu0llj4OGrFoOKK3g2vey4/p2omKCoHrWtPxSwV3HA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz", + "integrity": "sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==", "dev": true, "requires": {} }, "@eslint/eslintrc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.0.tgz", - "integrity": "sha512-UWW0TMTmk2d7hLcWD1/e2g5HDM/HQ3csaLSqXCfqwh4uNDuNqlaKWXmEsL4Cs41Z0KnILNvwbHAah3C2yt06kw==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", + "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.3.2", - "globals": "^13.15.0", + "espree": "^9.4.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -3875,16 +4007,22 @@ } }, "@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.11.8", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", + "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" } }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, "@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", @@ -3942,9 +4080,9 @@ "dev": true }, "acorn": { - "version": "8.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz", - "integrity": "sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==", + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", "dev": true }, "acorn-jsx": { @@ -3982,9 +4120,9 @@ } }, "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -3998,15 +4136,15 @@ "dev": true }, "array-includes": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", - "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", + "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5", - "get-intrinsic": "^1.1.1", + "es-abstract": "^1.20.4", + "get-intrinsic": "^1.1.3", "is-string": "^1.0.7" } }, @@ -4017,14 +4155,14 @@ "dev": true }, "array.prototype.flat": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz", - "integrity": "sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", + "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.2", + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4", "es-shim-unscopables": "^1.0.0" } }, @@ -4040,6 +4178,12 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -4150,15 +4294,6 @@ } } }, - "clone-regexp": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", - "integrity": "sha512-beMpP7BOtTipFuW8hrJvREQ2DrRu3BE7by0ZpibtfBA+qfHYvMGTc2Yb1JMYPKg/JUw0CHYvpg796aNTSW9z7Q==", - "dev": true, - "requires": { - "is-regexp": "^2.0.0" - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -4175,9 +4310,9 @@ "dev": true }, "colord": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", - "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.3.tgz", + "integrity": "sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw==", "dev": true }, "commander": { @@ -4193,9 +4328,9 @@ "dev": true }, "cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", + "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", "dev": true, "requires": { "@types/parse-json": "^4.0.0", @@ -4244,9 +4379,9 @@ "dev": true }, "decamelize-keys": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", - "integrity": "sha512-ocLWuYzRPoS9bfiSdDd3cxvrzovVMZnRDVEzAs+hWIVXGDbHxWMECij2OBuyB/An0FFW/nLuq6Kv1i/YC5Qfzg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", "dev": true, "requires": { "decamelize": "^1.1.0", @@ -4323,34 +4458,54 @@ } }, "es-abstract": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", - "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.0.tgz", + "integrity": "sha512-GUGtW7eXQay0c+PRq0sGIKSdaBorfVqsCMhGHo4elP7YVqZu9nCZS4UkK4gv71gOWNMra/PaSKD3ao1oWExO0g==", "dev": true, "requires": { "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.0", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "function.prototype.name": "^1.1.5", - "get-intrinsic": "^1.1.1", + "get-intrinsic": "^1.1.3", "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", "has": "^1.0.3", "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", + "internal-slot": "^1.0.4", + "is-array-buffer": "^3.0.0", + "is-callable": "^1.2.7", "is-negative-zero": "^2.0.2", "is-regex": "^1.1.4", "is-shared-array-buffer": "^1.0.2", "is-string": "^1.0.7", + "is-typed-array": "^1.1.10", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.4.3", - "string.prototype.trimend": "^1.0.5", - "string.prototype.trimstart": "^1.0.5", - "unbox-primitive": "^1.0.2" + "safe-regex-test": "^1.0.0", + "string.prototype.trimend": "^1.0.6", + "string.prototype.trimstart": "^1.0.6", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.9" + } + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" } }, "es-shim-unscopables": { @@ -4373,6 +4528,12 @@ "is-symbol": "^1.0.2" } }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -4380,13 +4541,15 @@ "dev": true }, "eslint": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz", - "integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==", + "version": "8.31.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.31.0.tgz", + "integrity": "sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.0", - "@humanwhocodes/config-array": "^0.9.2", + "@eslint/eslintrc": "^1.4.1", + "@humanwhocodes/config-array": "^0.11.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -4396,18 +4559,21 @@ "eslint-scope": "^7.1.1", "eslint-utils": "^3.0.0", "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.2", + "espree": "^9.4.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.15.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", @@ -4418,8 +4584,7 @@ "regexpp": "^3.2.0", "strip-ansi": "^6.0.1", "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" } }, "eslint-config-standard": { @@ -4451,13 +4616,12 @@ } }, "eslint-module-utils": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", - "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz", + "integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==", "dev": true, "requires": { - "debug": "^3.2.7", - "find-up": "^2.1.0" + "debug": "^3.2.7" }, "dependencies": { "debug": { @@ -4468,55 +4632,6 @@ "requires": { "ms": "^2.1.1" } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true } } }, @@ -4595,25 +4710,25 @@ } }, "eslint-plugin-n": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.2.3.tgz", - "integrity": "sha512-H+KC7U5R+3IWTeRnACm/4wlqLvS1Q7M6t7BGhn89qXDkZan8HTAEv3ouIONA0ifDwc2YzPFmyPzHuNLddNK4jw==", + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.6.0.tgz", + "integrity": "sha512-Hd/F7wz4Mj44Jp0H6Jtty13NcE69GNTY0rVlgTIj1XBnGGVI6UTdDrpE6vqu3AHo07bygq/N+7OH/lgz1emUJw==", "dev": true, "requires": { "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", "eslint-utils": "^3.0.0", "ignore": "^5.1.1", - "is-core-module": "^2.9.0", + "is-core-module": "^2.11.0", "minimatch": "^3.1.2", - "resolve": "^1.10.1", - "semver": "^7.3.7" + "resolve": "^1.22.1", + "semver": "^7.3.8" } }, "eslint-plugin-promise": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.0.0.tgz", - "integrity": "sha512-7GPezalm5Bfi/E22PnQxDWH2iW9GTvAlUNTztemeHb6c1BniSyoeTrM87JkC0wYdi6aQrZX9p2qEiAno8aTcbw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", + "integrity": "sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==", "dev": true, "requires": {} }, @@ -4651,12 +4766,12 @@ "dev": true }, "espree": { - "version": "9.3.2", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.2.tgz", - "integrity": "sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", + "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", "dev": true, "requires": { - "acorn": "^8.7.1", + "acorn": "^8.8.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^3.3.0" } @@ -4691,15 +4806,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "execall": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/execall/-/execall-2.0.0.tgz", - "integrity": "sha512-0FU2hZ5Hh6iQnarpRtQurM/aAvp3RIbfvgLHrcqJYzhXyV2KFruhuChf9NC6waAhiUR7FFtlugkI4p7f2Fqlow==", - "dev": true, - "requires": { - "clone-regexp": "^2.1.0" - } - }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -4707,9 +4813,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -4743,15 +4849,15 @@ "dev": true }, "fastest-levenshtein": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", - "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", "dev": true }, "fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", "dev": true, "requires": { "reusify": "^1.0.4" @@ -4796,11 +4902,20 @@ } }, "flatted": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", - "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4832,12 +4947,6 @@ "functions-have-names": "^1.2.2" } }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -4845,9 +4954,9 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", - "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", "dev": true, "requires": { "function-bind": "^1.1.1", @@ -4932,14 +5041,23 @@ } }, "globals": { - "version": "13.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz", - "integrity": "sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog==", + "version": "13.19.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", + "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", "dev": true, "requires": { "type-fest": "^0.20.2" } }, + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3" + } + }, "globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -4960,6 +5078,21 @@ "integrity": "sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg==", "dev": true }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "grapheme-splitter": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", + "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", + "dev": true + }, "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -4996,6 +5129,12 @@ "get-intrinsic": "^1.1.1" } }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true + }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -5027,15 +5166,15 @@ "dev": true }, "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", "dev": true }, "immutable": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz", - "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.2.2.tgz", + "integrity": "sha512-fTMKDwtbvO5tldky9QZ2fMX7slR0mYpY5nbnFWYp0fOzDhHqhgIw9KoYgxLWsoNTS9ZHGauHj18DTyEw6BK3Og==", "dev": true }, "import-fresh": { @@ -5083,22 +5222,33 @@ "dev": true }, "ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ini/-/ini-3.0.1.tgz", + "integrity": "sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ==", "dev": true }, "internal-slot": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", - "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz", + "integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==", "dev": true, "requires": { - "get-intrinsic": "^1.1.0", + "get-intrinsic": "^1.1.3", "has": "^1.0.3", "side-channel": "^1.0.4" } }, + "is-array-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz", + "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-typed-array": "^1.1.10" + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -5134,15 +5284,15 @@ } }, "is-callable": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", - "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true }, "is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", + "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", "dev": true, "requires": { "has": "^1.0.3" @@ -5199,6 +5349,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", @@ -5221,12 +5377,6 @@ "has-tostringtag": "^1.0.0" } }, - "is-regexp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-2.1.0.tgz", - "integrity": "sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA==", - "dev": true - }, "is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", @@ -5254,6 +5404,19 @@ "has-symbols": "^1.0.2" } }, + "is-typed-array": { + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", + "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, "is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -5269,6 +5432,12 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "js-sdsl": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", + "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5324,9 +5493,9 @@ "dev": true }, "known-css-properties": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.25.0.tgz", - "integrity": "sha512-b0/9J1O9Jcyik1GC6KC42hJ41jKwdO/Mq8Mdo5sYN+IuRTXs2YFHZC3kZSx6ueusqa95x3wLYe/ytKjbAfGixA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", + "integrity": "sha512-5FZRzrZzNTBruuurWpvZnvP9pum+fe0HcK8z/ooo+U+Hmp4vtbyp1/QDsqmufirXy4egGzbaH/y2uCZf+6W5Kg==", "dev": true }, "levn": { @@ -5525,9 +5694,9 @@ } }, "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", "dev": true }, "minimist-options": { @@ -5590,26 +5759,26 @@ "dev": true }, "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", "dev": true, "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", "object-keys": "^1.1.1" } }, "object.values": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", - "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", + "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", "dev": true, "requires": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" + "define-properties": "^1.1.4", + "es-abstract": "^1.20.4" } }, "once": { @@ -5723,9 +5892,9 @@ "dev": true }, "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "dev": true, "requires": { "nanoid": "^3.3.4", @@ -5753,16 +5922,16 @@ "requires": {} }, "postcss-scss": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.4.tgz", - "integrity": "sha512-aBBbVyzA8b3hUL0MGrpydxxXKXFZc5Eqva0Q3V9qsBOLEMsjb6w49WfpsoWzpEgcqJGW4t7Rio8WXVU9Gd8vWg==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.6.tgz", + "integrity": "sha512-rLDPhJY4z/i4nVFZ27j9GqLxj1pwxE80eAzUNRMXtcpipFYIeowerzBgG3yJhMtObGEXidtIgbUpQ3eLDsf5OQ==", "dev": true, "requires": {} }, "postcss-selector-parser": { - "version": "6.0.10", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", - "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz", + "integrity": "sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==", "dev": true, "requires": { "cssesc": "^3.0.0", @@ -5981,26 +6150,26 @@ } }, "rtlcss": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/rtlcss/-/rtlcss-3.5.0.tgz", - "integrity": "sha512-wzgMaMFHQTnyi9YOwsx9LjOxYXJPzS8sYnFaKm6R5ysvTkwzHiB0vxnbHwchHQT65PTdBjDG21/kQBWI7q9O7A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/rtlcss/-/rtlcss-4.0.0.tgz", + "integrity": "sha512-j6oypPP+mgFwDXL1JkLCtm6U/DQntMUqlv5SOhpgHhdIE+PmBcjrtAHIpXfbIup47kD5Sgja9JDsDF1NNOsBwQ==", "dev": true, "requires": { - "find-up": "^5.0.0", + "escalade": "^3.1.1", "picocolors": "^1.0.0", - "postcss": "^8.3.11", + "postcss": "^8.4.6", "strip-json-comments": "^3.1.1" } }, "run-con": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.10.tgz", - "integrity": "sha512-n7PZpYmMM26ZO21dd8y3Yw1TRtGABjRtgPSgFS/nhzfvbJMXFtJhJVyEgayMiP+w/23craJjsnfDvx4W4ue/HQ==", + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/run-con/-/run-con-1.2.11.tgz", + "integrity": "sha512-NEMGsUT+cglWkzEr4IFK21P4Jca45HqiAbIIZIBdX5+UZTB24Mb/21iNGgz9xZa8tL6vbW7CXmq7MFN42+VjNQ==", "dev": true, "requires": { "deep-extend": "^0.6.0", - "ini": "~2.0.0", - "minimist": "^1.2.5", + "ini": "~3.0.0", + "minimist": "^1.2.6", "strip-json-comments": "~3.1.1" } }, @@ -6013,10 +6182,21 @@ "queue-microtask": "^1.2.2" } }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } + }, "sass": { - "version": "1.52.3", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.52.3.tgz", - "integrity": "sha512-LNNPJ9lafx+j1ArtA7GyEJm9eawXN8KlA1+5dF6IZyoONg1Tyo/g+muOsENWJH/2Q1FHbbV4UwliU0cXMa/VIA==", + "version": "1.57.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.57.1.tgz", + "integrity": "sha512-O2+LwLS79op7GI0xZ8fqzF7X2m/m8WFfI02dHOdsK5R2ECeS5F62zrwg/relM1rjSLy7Vd/DiMNIvPrQGsA0jw==", "dev": true, "requires": { "chokidar": ">=3.0.0 <4.0.0", @@ -6025,9 +6205,9 @@ } }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -6115,9 +6295,9 @@ } }, "spdx-license-ids": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", - "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz", + "integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==", "dev": true }, "string-width": { @@ -6132,25 +6312,25 @@ } }, "string.prototype.trimend": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", - "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", + "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" } }, "string.prototype.trimstart": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", - "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", + "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", - "es-abstract": "^1.19.5" + "es-abstract": "^1.20.4" } }, "strip-ansi": { @@ -6190,51 +6370,49 @@ "dev": true }, "stylelint": { - "version": "14.9.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.9.1.tgz", - "integrity": "sha512-RdAkJdPiLqHawCSnu21nE27MjNXaVd4WcOHA4vK5GtIGjScfhNnaOuWR2wWdfKFAvcWQPOYe311iveiVKSmwsA==", + "version": "14.16.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.16.1.tgz", + "integrity": "sha512-ErlzR/T3hhbV+a925/gbfc3f3Fep9/bnspMiJPorfGEmcBbXdS+oo6LrVtoUZ/w9fqD6o6k7PtUlCOsCRdjX/A==", "dev": true, "requires": { - "@csstools/selector-specificity": "^2.0.1", + "@csstools/selector-specificity": "^2.0.2", "balanced-match": "^2.0.0", - "colord": "^2.9.2", - "cosmiconfig": "^7.0.1", + "colord": "^2.9.3", + "cosmiconfig": "^7.1.0", "css-functions-list": "^3.1.0", "debug": "^4.3.4", - "execall": "^2.0.0", - "fast-glob": "^3.2.11", - "fastest-levenshtein": "^1.0.12", + "fast-glob": "^3.2.12", + "fastest-levenshtein": "^1.0.16", "file-entry-cache": "^6.0.1", - "get-stdin": "^8.0.0", "global-modules": "^2.0.0", "globby": "^11.1.0", "globjoin": "^0.1.4", "html-tags": "^3.2.0", - "ignore": "^5.2.0", + "ignore": "^5.2.1", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.25.0", + "known-css-properties": "^0.26.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", "picocolors": "^1.0.0", - "postcss": "^8.4.14", + "postcss": "^8.4.19", "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.10", + "postcss-selector-parser": "^6.0.11", "postcss-value-parser": "^4.2.0", "resolve-from": "^5.0.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "style-search": "^0.1.0", - "supports-hyperlinks": "^2.2.0", + "supports-hyperlinks": "^2.3.0", "svg-tags": "^1.0.0", - "table": "^6.8.0", + "table": "^6.8.1", "v8-compile-cache": "^2.3.0", - "write-file-atomic": "^4.0.1" + "write-file-atomic": "^4.0.2" }, "dependencies": { "balanced-match": { @@ -6243,12 +6421,6 @@ "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", "dev": true }, - "get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true - }, "resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", @@ -6258,20 +6430,20 @@ } }, "stylelint-config-recommended": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-7.0.0.tgz", - "integrity": "sha512-yGn84Bf/q41J4luis1AZ95gj0EQwRX8lWmGmBwkwBNSkpGSpl66XcPTulxGa/Z91aPoNGuIGBmFkcM1MejMo9Q==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-9.0.0.tgz", + "integrity": "sha512-9YQSrJq4NvvRuTbzDsWX3rrFOzOlYBmZP+o513BJN/yfEmGSr0AxdvrWs0P/ilSpVV/wisamAHu5XSk8Rcf4CQ==", "dev": true, "requires": {} }, "stylelint-config-recommended-scss": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-6.0.0.tgz", - "integrity": "sha512-6QOe2/OzXV2AP5FE12A7+qtKdZik7Saf42SMMl84ksVBBPpTdrV+9HaCbPYiRMiwELY9hXCVdH4wlJ+YJb5eig==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-recommended-scss/-/stylelint-config-recommended-scss-8.0.0.tgz", + "integrity": "sha512-BxjxEzRaZoQb7Iinc3p92GS6zRdRAkIuEu2ZFLTxJK2e1AIcCb5B5MXY9KOXdGTnYFZ+KKx6R4Fv9zU6CtMYPQ==", "dev": true, "requires": { "postcss-scss": "^4.0.2", - "stylelint-config-recommended": "^7.0.0", + "stylelint-config-recommended": "^9.0.0", "stylelint-scss": "^4.0.0" } }, @@ -6286,9 +6458,9 @@ } }, "stylelint-scss": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.2.0.tgz", - "integrity": "sha512-HHHMVKJJ5RM9pPIbgJ/XA67h9H0407G68Rm69H4fzFbFkyDMcTV1Byep3qdze5+fJ3c0U7mJrbj6S0Fg072uZA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/stylelint-scss/-/stylelint-scss-4.3.0.tgz", + "integrity": "sha512-GvSaKCA3tipzZHoz+nNO7S02ZqOsdBzMiCx9poSmLlb3tdJlGddEX/8QzCOD8O7GQan9bjsvLMsO5xiw6IhhIQ==", "dev": true, "requires": { "lodash": "^4.17.21", @@ -6308,9 +6480,9 @@ } }, "supports-hyperlinks": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz", - "integrity": "sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", "dev": true, "requires": { "has-flag": "^4.0.0", @@ -6330,9 +6502,9 @@ "dev": true }, "table": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", - "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", + "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", "dev": true, "requires": { "ajv": "^8.0.1", @@ -6343,9 +6515,9 @@ }, "dependencies": { "ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -6410,6 +6582,17 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } + }, "uc.micro": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", @@ -6481,6 +6664,20 @@ "is-symbol": "^1.0.3" } }, + "which-typed-array": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", + "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.10" + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -6494,9 +6691,9 @@ "dev": true }, "write-file-atomic": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", - "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "requires": { "imurmurhash": "^0.1.4", diff --git a/package.json b/package.json index fe25a3f43..fc3e3c150 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,9 @@ "url": "https://github.com/FreshRSS/FreshRSS.git" }, "license": "AGPL-3.0", + "engines" : { + "node" : ">=12" + }, "scripts": { "eslint": "eslint --ext .js .", "eslint_fix": "eslint --fix --ext .js .", @@ -30,16 +33,16 @@ "fix": "npm run rtlcss && npm run stylelint_fix && npm run eslint_fix && npm run markdownlint_fix" }, "devDependencies": { - "eslint": "^8.10.0", + "eslint": "^8.31.0", "eslint-config-standard": "^17.0.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.2.3", - "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-n": "^15.6.0", + "eslint-plugin-promise": "^6.1.1", "markdownlint-cli": "^0.31.1", - "rtlcss": "^3.5.0", - "sass": "^1.52.3", - "stylelint": "^14.9.0", - "stylelint-config-recommended-scss": "^6.0.0", + "rtlcss": "^4.0.0", + "sass": "^1.57.0", + "stylelint": "^14.16.1", + "stylelint-config-recommended-scss": "^8.0.0", "stylelint-order": "^5.0.0" }, "rtlcssConfig": {} diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php index c876740e6..d56c4b743 100644 --- a/tests/app/Models/UserQueryTest.php +++ b/tests/app/Models/UserQueryTest.php @@ -34,7 +34,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { ->method('name') ->withAnyParameters() ->willReturn($category_name); - $cat_dao = $this->createMock('FreshRSS_Searchable'); + $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -60,7 +60,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { ->method('name') ->withAnyParameters() ->willReturn($feed_name); - $feed_dao = $this->createMock('FreshRSS_Searchable'); + $feed_dao = $this->createMock('FreshRSS_FeedDAO'); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -160,7 +160,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenCategoryExists_returnFalse() { $cat = $this->createMock('FreshRSS_Category'); - $cat_dao = $this->createMock('FreshRSS_Searchable'); + $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -171,7 +171,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { } public function testIsDeprecated_whenCategoryDoesNotExist_returnTrue() { - $cat_dao = $this->createMock('FreshRSS_Searchable'); + $cat_dao = $this->createMock('FreshRSS_CategoryDAO'); $cat_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -183,7 +183,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { public function testIsDeprecated_whenFeedExists_returnFalse() { $feed = $this->createMock('FreshRSS_Feed', array(), array('', false)); - $feed_dao = $this->createMock('FreshRSS_Searchable'); + $feed_dao = $this->createMock('FreshRSS_FeedDAO'); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() @@ -194,7 +194,7 @@ class UserQueryTest extends PHPUnit\Framework\TestCase { } public function testIsDeprecated_whenFeedDoesNotExist_returnTrue() { - $feed_dao = $this->createMock('FreshRSS_Searchable'); + $feed_dao = $this->createMock('FreshRSS_FeedDAO'); $feed_dao->expects($this->atLeastOnce()) ->method('searchById') ->withAnyParameters() -- cgit v1.2.3 From 4f316b2ed397bb331ef89f2cd2d8ce92a725ccba Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 29 Jan 2023 18:53:51 +0100 Subject: PHPStan level 9 for ./p/ and lib_rss.php (#5049) And app/FreshRSS.php Contributes to https://github.com/FreshRSS/FreshRSS/issues/4112 --- app/FreshRSS.php | 24 +- app/Models/Entry.php | 5 + app/Models/EntryDAO.php | 13 +- lib/Minz/ModelPdo.php | 2 +- lib/Minz/Translate.php | 4 +- lib/lib_rss.php | 158 ++-- p/api/fever.php | 190 ++--- p/api/greader.php | 1861 ++++++++++++++++++++++++----------------------- p/api/pshb.php | 17 +- p/ext.php | 16 +- p/f.php | 2 +- p/i/index.php | 4 +- 12 files changed, 1196 insertions(+), 1100 deletions(-) (limited to 'app/Models/Entry.php') diff --git a/app/FreshRSS.php b/app/FreshRSS.php index e374fa827..76ced841c 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -18,7 +18,7 @@ class FreshRSS extends Minz_FrontController { * - Init notifications * - Enable user extensions (need all the other initializations) */ - public function init() { + public function init(): void { if (!isset($_SESSION)) { Minz_Session::init('FreshRSS'); } @@ -71,10 +71,10 @@ class FreshRSS extends Minz_FrontController { Minz_ExtensionManager::callHook('freshrss_init'); } - private static function initAuth() { + private static function initAuth(): void { FreshRSS_Auth::init(); if (Minz_Request::isPost()) { - if (!(FreshRSS_Auth::isCsrfOk() || + if (FreshRSS_Context::$system_conf == null || !(FreshRSS_Auth::isCsrfOk() || (Minz_Request::controllerName() === 'auth' && Minz_Request::actionName() === 'login') || (Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'create' && !FreshRSS_Auth::hasAccess('admin')) || (Minz_Request::controllerName() === 'feed' && Minz_Request::actionName() === 'actualize' @@ -92,7 +92,7 @@ class FreshRSS extends Minz_FrontController { } } - private static function initI18n() { + private static function initI18n(): void { $userLanguage = isset(FreshRSS_Context::$user_conf) ? FreshRSS_Context::$user_conf->language : null; $systemLanguage = isset(FreshRSS_Context::$system_conf) ? FreshRSS_Context::$system_conf->language : null; $language = Minz_Translate::getLanguage($userLanguage, Minz_Request::getPreferredLanguages(), $systemLanguage); @@ -107,12 +107,15 @@ class FreshRSS extends Minz_FrontController { date_default_timezone_set($timezone); } - private static function getThemeFileUrl($theme_id, $filename) { + private static function getThemeFileUrl(string $theme_id, string $filename): string { $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename); return '/themes/' . $theme_id . '/' . $filename . '?' . $filetime; } - public static function loadStylesAndScripts() { + public static function loadStylesAndScripts(): void { + if (FreshRSS_Context::$user_conf == null) { + return; + } $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { foreach(array_reverse($theme['files']) as $file) { @@ -146,22 +149,23 @@ class FreshRSS extends Minz_FrontController { FreshRSS_View::prependScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); } - private static function loadNotifications() { + private static function loadNotifications(): void { $notif = Minz_Request::getNotification(); if ($notif) { FreshRSS_View::_param('notification', $notif); } } - public static function preLayout() { + public static function preLayout(): void { header("X-Content-Type-Options: nosniff"); FreshRSS_Share::load(join_path(APP_PATH, 'shares.php')); self::loadStylesAndScripts(); } - private static function checkEmailValidated() { - $email_not_verified = FreshRSS_Auth::hasAccess() && FreshRSS_Context::$user_conf->email_validation_token !== ''; + private static function checkEmailValidated(): void { + $email_not_verified = FreshRSS_Auth::hasAccess() && + FreshRSS_Context::$user_conf !== null && FreshRSS_Context::$user_conf->email_validation_token !== ''; $action_is_allowed = ( Minz_Request::is('user', 'validateEmail') || Minz_Request::is('user', 'sendValidationEmail') || diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 16de8beb6..81ece1ce4 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -17,10 +17,14 @@ class FreshRSS_Entry extends Minz_Model { */ private $guid; + /** @var string */ private $title; private $authors; + /** @var string */ private $content; + /** @var string */ private $link; + /** @var int */ private $date; private $date_added = 0; //In microseconds /** @@ -298,6 +302,7 @@ HTML; public function link(): string { return $this->link; } + /** @return string|int */ public function date(bool $raw = false) { if ($raw) { return $this->date; diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index cda51e5b4..3b7c1ac3f 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1165,10 +1165,12 @@ SQL; } } - public function listByIds($ids, $order = 'DESC') { + /** @param array $ids */ + public function listByIds(array $ids, string $order = 'DESC') { if (count($ids) < 1) { - yield false; - } elseif (count($ids) > FreshRSS_DatabaseDAO::MAX_VARIABLE_NUMBER) { + return; + } + if (count($ids) > FreshRSS_DatabaseDAO::MAX_VARIABLE_NUMBER) { // Split a query with too many variables parameters $idsChunks = array_chunk($ids, FreshRSS_DatabaseDAO::MAX_VARIABLE_NUMBER); foreach ($idsChunks as $idsChunk) { @@ -1195,15 +1197,16 @@ SQL; /** * For API + * @return array */ public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, - $order = 'DESC', $limit = 1, $firstId = '', $filters = null) { + $order = 'DESC', $limit = 1, $firstId = '', $filters = null): array { list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filters); $stm = $this->pdo->prepare($sql); $stm->execute($values); - return $stm->fetchAll(PDO::FETCH_COLUMN, 0); + return $stm->fetchAll(PDO::FETCH_COLUMN, 0) ?: []; } public function listHashForFeedGuids($id_feed, $guids) { diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 0f5b9efca..85796b53a 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -26,7 +26,7 @@ class Minz_ModelPdo { private static $sharedCurrentUser; /** - * @var Minz_Pdo|null + * @var Minz_Pdo */ protected $pdo; diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index 584f08aa0..07d48ec08 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -87,10 +87,10 @@ class Minz_Translate { * preferred languages then returns the default language * @param string|null $user the connected user language (nullable) * @param array $preferred an array of the preferred languages - * @param string $default the preferred language to use + * @param string|null $default the preferred language to use * @return string containing the language to use */ - public static function getLanguage($user, $preferred, $default) { + public static function getLanguage(?string $user, array $preferred, ?string $default): string { if (null !== $user) { return $user; } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index d1821b639..893bed8eb 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -4,8 +4,8 @@ if (version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION, '<')) { } if (!function_exists('mb_strcut')) { - function mb_strcut($str, $start, $length = null, $encoding = 'UTF-8') { - return substr($str, $start, $length); + function mb_strcut(string $str, int $start, ?int $length = null, string $encoding = 'UTF-8'): string { + return substr($str, $start, $length) ?: ''; } } @@ -34,7 +34,7 @@ function join_path(...$path_parts): string { } // -function classAutoloader($class) { +function classAutoloader(string $class): void { if (strpos($class, 'FreshRSS') === 0) { $components = explode('_', $class); switch (count($components)) { @@ -73,14 +73,10 @@ function classAutoloader($class) { spl_autoload_register('classAutoloader'); // -/** - * @param string $url - * @return string - */ -function idn_to_puny($url) { +function idn_to_puny(string $url): string { if (function_exists('idn_to_ascii')) { $idn = parse_url($url, PHP_URL_HOST); - if ($idn != '') { + if (is_string($idn) && $idn != '') { // https://wiki.php.net/rfc/deprecate-and-remove-intl_idna_variant_2003 if (defined('INTL_IDNA_VARIANT_UTS46')) { $puny = idn_to_ascii($idn, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46); @@ -90,7 +86,7 @@ function idn_to_puny($url) { $puny = idn_to_ascii($idn); } $pos = strpos($url, $idn); - if ($puny != '' && $pos !== false) { + if ($puny != false && $pos !== false) { $url = substr_replace($url, $puny, $pos, strlen($idn)); } } @@ -99,11 +95,9 @@ function idn_to_puny($url) { } /** - * @param string $url - * @param bool $fixScheme * @return string|false */ -function checkUrl($url, $fixScheme = true) { +function checkUrl(string $url, bool $fixScheme = true) { $url = trim($url); if ($url == '') { return ''; @@ -127,31 +121,19 @@ function checkUrl($url, $fixScheme = true) { * @return string */ function safe_ascii($text) { - return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); + return filter_var($text, FILTER_DEFAULT, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH) ?: ''; } if (function_exists('mb_convert_encoding')) { - /** - * @param string $text - * @return string - */ - function safe_utf8($text) { - return mb_convert_encoding($text, 'UTF-8', 'UTF-8'); + function safe_utf8(string $text): string { + return mb_convert_encoding($text, 'UTF-8', 'UTF-8') ?: ''; } } elseif (function_exists('iconv')) { - /** - * @param string $text - * @return string - */ - function safe_utf8($text) { - return iconv('UTF-8', 'UTF-8//IGNORE', $text); + function safe_utf8(string $text): string { + return iconv('UTF-8', 'UTF-8//IGNORE', $text) ?: ''; } } else { - /** - * @param string $text - * @return string - */ - function safe_utf8($text) { + function safe_utf8(string $text): string { return $text; } } @@ -178,14 +160,14 @@ function escapeToUnicodeAlternative($text, $extended = true) { return trim(str_replace($problem, $replace, $text)); } -function format_number($n, $precision = 0) { +function format_number(float $n, int $precision = 0): string { // number_format does not seem to be Unicode-compatible return str_replace(' ', ' ', // Thin non-breaking space number_format($n, $precision, '.', ' ') ); } -function format_bytes($bytes, $precision = 2, $system = 'IEC') { +function format_bytes(int $bytes, int $precision = 2, string $system = 'IEC'): string { if ($system === 'IEC') { $base = 1024; $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB'); @@ -202,7 +184,7 @@ function format_bytes($bytes, $precision = 2, $system = 'IEC') { return format_number($bytes, $precision) . ' ' . $units[$pow]; } -function timestamptodate ($t, $hour = true) { +function timestamptodate(int $t, bool $hour = true): string { $month = _t('gen.date.' . date('M', $t)); if ($hour) { $date = _t('gen.date.format_date_hour', $month); @@ -210,14 +192,13 @@ function timestamptodate ($t, $hour = true) { $date = _t('gen.date.format_date', $month); } - return @date ($date, $t); + return @date($date, $t) ?: ''; } /** * Decode HTML entities but preserve XML entities. - * @param string|null $text */ -function html_only_entity_decode($text): string { +function html_only_entity_decode(?string $text): string { static $htmlEntitiesOnly = null; if ($htmlEntitiesOnly === null) { $htmlEntitiesOnly = array_flip(array_diff( @@ -225,7 +206,7 @@ function html_only_entity_decode($text): string { get_html_translation_table(HTML_SPECIALCHARS, ENT_NOQUOTES, 'UTF-8') //Preserve XML entities )); } - return $text == '' ? '' : strtr($text, $htmlEntitiesOnly); + return $text == null ? '' : strtr($text, $htmlEntitiesOnly); } /** @@ -239,8 +220,10 @@ function sensitive_log($log) { foreach ($log as $k => $v) { if (in_array($k, ['api_key', 'Passwd', 'T'])) { $log[$k] = '██'; - } else { + } elseif (is_array($v) || is_string($v)) { $log[$k] = sensitive_log($v); + } else { + return ''; } } } elseif (is_string($log)) { @@ -248,7 +231,7 @@ function sensitive_log($log) { '/\b(auth=.*?\/)[^&]+/i', '/\b(Passwd=)[^&]+/i', '/\b(Authorization)[^&]+/i', - ], '$1█', $log); + ], '$1█', $log) ?? ''; } return $log; } @@ -257,6 +240,9 @@ function sensitive_log($log) { * @param array $attributes */ function customSimplePie($attributes = array()): SimplePie { + if (FreshRSS_Context::$system_conf === null) { + throw new FreshRSS_Context_Exception('System configuration not initialised!'); + } $limits = FreshRSS_Context::$system_conf->limits; $simplePie = new SimplePie(); $simplePie->set_useragent(FRESHRSS_USERAGENT); @@ -338,13 +324,13 @@ function customSimplePie($attributes = array()): SimplePie { } /** - * @param int|false $maxLength + * @param string $data */ -function sanitizeHTML($data, string $base = '', $maxLength = false) { - if (!is_string($data) || ($maxLength !== false && $maxLength <= 0)) { +function sanitizeHTML($data, string $base = '', ?int $maxLength = null): string { + if (!is_string($data) || ($maxLength !== null && $maxLength <= 0)) { return ''; } - if ($maxLength !== false) { + if ($maxLength !== null) { $data = mb_strcut($data, 0, $maxLength, 'UTF-8'); } static $simplePie = null; @@ -353,7 +339,7 @@ function sanitizeHTML($data, string $base = '', $maxLength = false) { $simplePie->init(); } $result = html_only_entity_decode($simplePie->sanitize->sanitize($data, SIMPLEPIE_CONSTRUCT_HTML, $base)); - if ($maxLength !== false && strlen($result) > $maxLength) { + if ($maxLength !== null && strlen($result) > $maxLength) { //Sanitizing has made the result too long so try again shorter $data = mb_strcut($result, 0, (2 * $maxLength) - strlen($result) - 2, 'UTF-8'); return sanitizeHTML($data, $base, $maxLength); @@ -361,9 +347,9 @@ function sanitizeHTML($data, string $base = '', $maxLength = false) { return $result; } -function cleanCache(int $hours = 720) { +function cleanCache(int $hours = 720): void { // N.B.: GLOB_BRACE is not available on all platforms - $files = array_merge(glob(CACHE_PATH . '/*.html', GLOB_NOSORT), glob(CACHE_PATH . '/*.spc', GLOB_NOSORT)); + $files = array_merge(glob(CACHE_PATH . '/*.html', GLOB_NOSORT) ?: [], glob(CACHE_PATH . '/*.spc', GLOB_NOSORT) ?: []); foreach ($files as $file) { if (substr($file, -10) === 'index.html') { continue; @@ -412,13 +398,16 @@ function enforceHttpEncoding(string $html, string $contentType = ''): string { * @param array $attributes */ function httpGet(string $url, string $cachePath, string $type = 'html', array $attributes = []): string { + if (FreshRSS_Context::$system_conf === null) { + throw new FreshRSS_Context_Exception('System configuration not initialised!'); + } $limits = FreshRSS_Context::$system_conf->limits; $feed_timeout = empty($attributes['timeout']) ? 0 : intval($attributes['timeout']); $cacheMtime = @filemtime($cachePath); if ($cacheMtime !== false && $cacheMtime > time() - intval($limits['cache_duration'])) { $body = @file_get_contents($cachePath); - if ($body != '') { + if ($body != false) { syslog(LOG_DEBUG, 'FreshRSS uses cache for ' . SimplePie_Misc::url_remove_credentials($url)); return $body; } @@ -472,7 +461,7 @@ function httpGet(string $url, string $cachePath, string $type = 'html', array $a } $body = curl_exec($ch); $c_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $c_content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); //TODO: Check if that may be null + $c_content_type = '' . curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $c_error = curl_error($ch); curl_close($ch); @@ -481,7 +470,7 @@ function httpGet(string $url, string $cachePath, string $type = 'html', array $a $body = ''; // TODO: Implement HTTP 410 Gone } - if ($body == false) { + if (!is_string($body)) { $body = ''; } else { $body = enforceHttpEncoding($body, $c_content_type); @@ -498,10 +487,9 @@ function httpGet(string $url, string $cachePath, string $type = 'html', array $a * Validate an email address, supports internationalized addresses. * * @param string $email The address to validate - * * @return bool true if email is valid, else false */ -function validateEmailAddress($email) { +function validateEmailAddress(string $email): bool { $mailer = new PHPMailer\PHPMailer\PHPMailer(); $mailer->CharSet = 'utf-8'; $punyemail = $mailer->punyencodeAddress($email); @@ -512,9 +500,8 @@ function validateEmailAddress($email) { * Add support of image lazy loading * Move content from src attribute to data-original * @param string $content is the text we want to parse - * @return string */ -function lazyimg($content) { +function lazyimg(string $content): string { return preg_replace([ '/<((?:img|iframe)[^>]+?)src="([^"]+)"([^>]*)>/i', "/<((?:img|iframe)[^>]+?)src='([^']+)'([^>]*)>/i", @@ -523,18 +510,15 @@ function lazyimg($content) { "<$1src='" . Minz_Url::display('/themes/icons/grey.gif') . "' data-original='$2'$3>", ], $content - ); + ) ?? ''; } -/** - * @return string - */ -function uTimeString() { +function uTimeString(): string { $t = @gettimeofday(); return $t['sec'] . str_pad('' . $t['usec'], 6, '0', STR_PAD_LEFT); } -function invalidateHttpCache($username = '') { +function invalidateHttpCache(string $username = ''): bool { if (!FreshRSS_user_Controller::checkUsername($username)) { Minz_Session::_param('touch', uTimeString()); $username = Minz_Session::param('currentUser', '_'); @@ -549,12 +533,12 @@ function invalidateHttpCache($username = '') { /** * @return array */ -function listUsers() { +function listUsers(): array { $final_list = array(); $base_path = join_path(DATA_PATH, 'users'); $dir_list = array_values(array_diff( - scandir($base_path), - array('..', '.', '_') + scandir($base_path) ?: [], + ['..', '.', '_'] )); foreach ($dir_list as $file) { if ($file[0] !== '.' && is_dir(join_path($base_path, $file)) && file_exists(join_path($base_path, $file, 'config.php'))) { @@ -567,12 +551,14 @@ function listUsers() { /** * Return if the maximum number of registrations has been reached. - * - * Note a max_regstrations of 0 means there is no limit. + * Note a max_registrations of 0 means there is no limit. * * @return boolean true if number of users >= max registrations, false else. */ -function max_registrations_reached() { +function max_registrations_reached(): bool { + if (FreshRSS_Context::$system_conf === null) { + throw new FreshRSS_Context_Exception('System configuration not initialised!'); + } $limit_registrations = FreshRSS_Context::$system_conf->limits['max_registrations']; $number_accounts = count(listUsers()); @@ -589,7 +575,7 @@ function max_registrations_reached() { * @param string $username the name of the user of which we want the configuration. * @return FreshRSS_UserConfiguration|null object, or null if the configuration cannot be loaded. */ -function get_user_configuration($username) { +function get_user_configuration(string $username) { if (!FreshRSS_user_Controller::checkUsername($username)) { return null; } @@ -621,7 +607,7 @@ function get_user_configuration($username) { */ function ipToBits(string $ip): string { $binaryip = ''; - foreach (str_split(inet_pton($ip)) as $char) { + foreach (str_split(inet_pton($ip) ?: '') as $char) { $binaryip .= str_pad(decbin(ord($char)), 8, '0', STR_PAD_LEFT); } return $binaryip; @@ -654,6 +640,9 @@ function checkCIDR(string $ip, string $range): bool { * @return boolean, true if the sender's IP is in one of the ranges defined in the configuration, else false */ function checkTrustedIP(): bool { + if (FreshRSS_Context::$system_conf === null) { + throw new FreshRSS_Context_Exception('System configuration not initialised!'); + } if (!empty($_SERVER['REMOTE_ADDR'])) { foreach (FreshRSS_Context::$system_conf->trusted_sources as $cidr) { if (checkCIDR($_SERVER['REMOTE_ADDR'], $cidr)) { @@ -664,10 +653,7 @@ function checkTrustedIP(): bool { return false; } -/** - * @return string - */ -function httpAuthUser() { +function httpAuthUser(): string { if (!empty($_SERVER['REMOTE_USER'])) { return $_SERVER['REMOTE_USER']; } elseif (!empty($_SERVER['HTTP_REMOTE_USER']) && checkTrustedIP()) { @@ -680,10 +666,7 @@ function httpAuthUser() { return ''; } -/** - * @return bool - */ -function cryptAvailable() { +function cryptAvailable(): bool { try { $hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG'; return $hash === @crypt('password', $hash); @@ -699,7 +682,7 @@ function cryptAvailable() { * * @return array of tested values. */ -function check_install_php() { +function check_install_php(): array { $pdo_mysql = extension_loaded('pdo_mysql'); $pdo_pgsql = extension_loaded('pdo_pgsql'); $pdo_sqlite = extension_loaded('pdo_sqlite'); @@ -723,7 +706,7 @@ function check_install_php() { * * @return array of tested values. */ -function check_install_files() { +function check_install_files(): array { return array( // @phpstan-ignore-next-line 'data' => DATA_PATH && touch(DATA_PATH . '/index.html'), // is_writable() is not reliable for a folder on NFS @@ -742,7 +725,7 @@ function check_install_files() { * * @return array of tested values. */ -function check_install_database() { +function check_install_database(): array { $status = array( 'connection' => true, 'tables' => false, @@ -773,17 +756,14 @@ function check_install_database() { /** * Remove a directory recursively. - * * From http://php.net/rmdir#110489 - * - * @param string $dir the directory to remove */ -function recursive_unlink($dir) { +function recursive_unlink(string $dir): bool { if (!is_dir($dir)) { return true; } - $files = array_diff(scandir($dir), array('.', '..')); + $files = array_diff(scandir($dir) ?: [], ['.', '..']); foreach ($files as $filename) { $filename = $dir . '/' . $filename; if (is_dir($filename)) { @@ -803,7 +783,7 @@ function recursive_unlink($dir) { * @param array> $queries an array of queries. * @return array> without queries where $get is appearing. */ -function remove_query_by_get($get, $queries) { +function remove_query_by_get(string $get, array $queries): array { $final_queries = array(); foreach ($queries as $key => $query) { if (empty($query['get']) || $query['get'] !== $get) { @@ -827,7 +807,11 @@ const SHORTCUT_KEYS = [ 'End', 'Enter', 'Escape', 'Home', 'Insert', 'PageDown', 'PageUp', 'Space', 'Tab', ]; -function getNonStandardShortcuts($shortcuts) { +/** + * @param array $shortcuts + * @return array + */ +function getNonStandardShortcuts(array $shortcuts): array { $standard = strtolower(implode(' ', SHORTCUT_KEYS)); $nonStandard = array_filter($shortcuts, function ($shortcut) use ($standard) { @@ -838,7 +822,7 @@ function getNonStandardShortcuts($shortcuts) { return $nonStandard; } -function errorMessageInfo($errorTitle, $error = '') { +function errorMessageInfo(string $errorTitle, string $error = ''): string { $errorTitle = htmlspecialchars($errorTitle, ENT_NOQUOTES, 'UTF-8'); $message = ''; diff --git a/p/api/fever.php b/p/api/fever.php index 13907f16d..88bd05d81 100644 --- a/p/api/fever.php +++ b/p/api/fever.php @@ -17,7 +17,7 @@ require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader FreshRSS_Context::initSystem(); // check if API is enabled globally -if (!FreshRSS_Context::$system_conf->api_enabled) { +if (FreshRSS_Context::$system_conf == null || !FreshRSS_Context::$system_conf->api_enabled) { Minz_Log::warning('Fever API: service unavailable!'); Minz_Log::debug('Fever API: serviceUnavailable() ' . debugInfo(), API_LOG); header('HTTP/1.1 503 Service Unavailable'); @@ -29,12 +29,9 @@ Minz_Session::init('FreshRSS', true); // ================================================================================================ // -$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576) ?: '';; -/** - * @return string - */ -function debugInfo() { +function debugInfo(): string { if (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); } else { //nginx http://php.net/getallheaders#84262 @@ -62,8 +59,12 @@ function debugInfo() { //Minz_Log::debug(debugInfo(), API_LOG); // -class FeverDAO extends Minz_ModelPdo +final class FeverDAO extends Minz_ModelPdo { + /** + * @param array $values + * @param array $bindArray + */ protected function bindParamArray(string $prefix, array $values, array &$bindArray): string { $str = ''; for ($i = 0; $i < count($values); $i++) { @@ -74,9 +75,11 @@ class FeverDAO extends Minz_ModelPdo } /** + * @param array $feed_ids + * @param array $entry_ids * @return FreshRSS_Entry[] */ - public function findEntries(array $feed_ids, array $entry_ids, string $max_id, string $since_id) { + public function findEntries(array $feed_ids, array $entry_ids, string $max_id, string $since_id): array { $values = array(); $order = ''; $entryDAO = FreshRSS_Factory::createEntryDao(); @@ -110,36 +113,34 @@ class FeverDAO extends Minz_ModelPdo $sql .= ' LIMIT 50'; $stm = $this->pdo->prepare($sql); - $stm->execute($values); - $result = $stm->fetchAll(PDO::FETCH_ASSOC); + if ($stm && $stm->execute($values)) { + $result = $stm->fetchAll(PDO::FETCH_ASSOC); - $entries = array(); - foreach ($result as $dao) { - $entries[] = FreshRSS_Entry::fromArray($dao); - } + $entries = array(); + foreach ($result as $dao) { + $entries[] = FreshRSS_Entry::fromArray($dao); + } - return $entries; + return $entries; + } + return []; } } /** * Class FeverAPI */ -class FeverAPI +final class FeverAPI { const API_LEVEL = 3; const STATUS_OK = 1; const STATUS_ERR = 0; - /** - * @var FreshRSS_EntryDAO|null - */ - private $entryDAO = null; + /** @var FreshRSS_EntryDAO */ + private $entryDAO; - /** - * @var FreshRSS_FeedDAO|null - */ - private $feedDAO = null; + /** @var FreshRSS_FeedDAO */ + private $feedDAO; /** * Authenticate the user @@ -148,6 +149,9 @@ class FeverAPI * your FreshRSS "username:your-api-password" combination */ private function authenticate(): bool { + if (FreshRSS_Context::$system_conf === null) { + throw new FreshRSS_Context_Exception('System configuration not initialised!'); + } FreshRSS_Context::$user_conf = null; Minz_Session::_param('currentUser'); $feverKey = empty($_POST['api_key']) ? '' : substr(trim($_POST['api_key']), 0, 128); @@ -176,16 +180,12 @@ class FeverAPI public function isAuthenticatedApiUser(): bool { $this->authenticate(); - - if (FreshRSS_Context::$user_conf !== null) { - return true; - } - - return false; + return FreshRSS_Context::$user_conf !== null; } /** * This does all the processing, since the fever api does not have a specific variable that specifies the operation + * @return array * @throws Exception */ public function process(): array { @@ -226,37 +226,54 @@ class FeverAPI $response_arr['saved_item_ids'] = $this->getSavedItemIds(); } - $id = isset($_REQUEST['id']) ? '' . $_REQUEST['id'] : ''; - if (isset($_REQUEST['mark'], $_REQUEST['as'], $_REQUEST['id']) && ctype_digit($id)) { - $method_name = 'set' . ucfirst($_REQUEST['mark']) . 'As' . ucfirst($_REQUEST['as']); - $allowedMethods = array( - 'setFeedAsRead', 'setGroupAsRead', 'setItemAsRead', - 'setItemAsSaved', 'setItemAsUnread', 'setItemAsUnsaved' - ); - if (in_array($method_name, $allowedMethods)) { - switch (strtolower($_REQUEST['mark'])) { - case 'item': - $this->{$method_name}($id); - break; - case 'feed': - case 'group': - $before = $_REQUEST['before'] ?? ''; - $this->{$method_name}($id, $before); - break; - } + if (isset($_REQUEST['mark'], $_REQUEST['as'], $_REQUEST['id']) && ctype_digit($_REQUEST['id'])) { + $id = intval($_REQUEST['id']); + $before = intval($_REQUEST['before'] ?? '0'); + switch (strtolower($_REQUEST['mark'])) { + case 'item': + switch ($_REQUEST['as']) { + case 'read': + $this->setItemAsRead($id); + break; + case 'saved': + $this->setItemAsSaved($id); + break; + case 'unread': + $this->setItemAsUnread($id); + break; + case 'unsaved': + $this->setItemAsUnsaved($id); + break; + } + break; + case 'feed': + switch ($_REQUEST['as']) { + case 'read': + $this->setFeedAsRead($id, $before); + break; + } + break; + case 'group': + switch ($_REQUEST['as']) { + case 'read': + $this->setFeedAsRead($id, $before); + break; + } + break; + } - switch ($_REQUEST['as']) { - case 'read': - case 'unread': - $response_arr['unread_item_ids'] = $this->getUnreadItemIds(); - break; + switch ($_REQUEST['as']) { + case 'read': + case 'unread': + $response_arr['unread_item_ids'] = $this->getUnreadItemIds(); + break; - case 'saved': - case 'unsaved': - $response_arr['saved_item_ids'] = $this->getSavedItemIds(); - break; - } + case 'saved': + case 'unsaved': + $response_arr['saved_item_ids'] = $this->getSavedItemIds(); + break; } + } return $response_arr; @@ -264,6 +281,7 @@ class FeverAPI /** * Returns the complete JSON, with 'api_version' and status as 'auth'. + * @param array $reply */ public function wrap(int $status, array $reply = array()): string { $arr = array('api_version' => self::API_LEVEL, 'auth' => $status); @@ -273,7 +291,7 @@ class FeverAPI $arr = array_merge($arr, $reply); } - return json_encode($arr); + return json_encode($arr) ?: ''; } /** @@ -292,6 +310,7 @@ class FeverAPI return $lastUpdate; } + /** @return array> */ protected function getFeeds(): array { $feeds = array(); $myFeeds = $this->feedDAO->listFeeds(); @@ -312,6 +331,7 @@ class FeverAPI return $feeds; } + /** @return array> */ protected function getGroups(): array { $groups = array(); @@ -329,12 +349,15 @@ class FeverAPI return $groups; } + /** @return array> */ protected function getFavicons(): array { + if (FreshRSS_Context::$system_conf == null) { + return []; + } $favicons = array(); $salt = FreshRSS_Context::$system_conf->salt; $myFeeds = $this->feedDAO->listFeeds(); - /** @var FreshRSS_Feed $feed */ foreach ($myFeeds as $feed) { $id = hash('crc32b', $salt . $feed->url()); @@ -345,7 +368,7 @@ class FeverAPI $favicons[] = array( 'id' => $feed->id(), - 'data' => image_type_to_mime_type(exif_imagetype($filename)) . ';base64,' . base64_encode(file_get_contents($filename)) + 'data' => image_type_to_mime_type(exif_imagetype($filename) ?: 0) . ';base64,' . base64_encode(file_get_contents($filename) ?: '') ); } @@ -359,17 +382,19 @@ class FeverAPI return $this->entryDAO->count(); } + /** + * @return array> + */ protected function getFeedsGroup(): array { $groups = array(); $ids = array(); $myFeeds = $this->feedDAO->listFeeds(); - /** @var FreshRSS_Feed $feed */ foreach ($myFeeds as $feed) { $ids[$feed->categoryId()][] = $feed->id(); } - foreach($ids as $category => $feedIds) { + foreach ($ids as $category => $feedIds) { $groups[] = array( 'group_id' => $category, 'feed_ids' => implode(',', $feedIds) @@ -381,13 +406,14 @@ class FeverAPI /** * AFAIK there is no 'hot links' alternative in FreshRSS + * @return array */ protected function getLinks(): array { return array(); } /** - * @param array $ids + * @param array $ids */ protected function entriesToIdList(array $ids = array()): string { return implode(',', array_values($ids)); @@ -398,10 +424,7 @@ class FeverAPI return $this->entriesToIdList($entries); } - /** - * @return string - */ - protected function getSavedItemIds() { + protected function getSavedItemIds(): string { $entries = $this->entryDAO->listIdsWhere('a', '', FreshRSS_Entry::STATE_FAVORITE, 'ASC', 0); return $this->entriesToIdList($entries); } @@ -409,31 +432,32 @@ class FeverAPI /** * @return integer|false */ - protected function setItemAsRead($id) { + protected function setItemAsRead(int $id) { return $this->entryDAO->markRead($id, true); } /** * @return integer|false */ - protected function setItemAsUnread($id) { + protected function setItemAsUnread(int $id) { return $this->entryDAO->markRead($id, false); } /** * @return integer|false */ - protected function setItemAsSaved($id) { + protected function setItemAsSaved(int $id) { return $this->entryDAO->markFavorite($id, true); } /** * @return integer|false */ - protected function setItemAsUnsaved($id) { + protected function setItemAsUnsaved(int $id) { return $this->entryDAO->markFavorite($id, false); } + /** @return array> */ protected function getItems(): array { $feed_ids = array(); $entry_ids = array(); @@ -448,16 +472,16 @@ class FeverAPI if (isset($_REQUEST['group_ids'])) { $categoryDAO = FreshRSS_Factory::createCategoryDao(); $group_ids = explode(',', $_REQUEST['group_ids']); + $feeds = []; foreach ($group_ids as $id) { - /** @var FreshRSS_Category $category */ $category = $categoryDAO->searchById($id); //TODO: Transform to SQL query without loop! Consider FreshRSS_CategoryDAO::listCategories(true) - /** @var FreshRSS_Feed $feed */ - $feeds = []; + if ($category == null) { + continue; + } foreach ($category->feeds() as $feed) { $feeds[] = $feed->id(); } } - $feed_ids = array_unique($feeds); } } @@ -511,30 +535,30 @@ class FeverAPI /** * TODO replace by a dynamic fetch for id <= $before timestamp */ - protected function convertBeforeToId(string $beforeTimestamp): string { - return $beforeTimestamp == '0' ? '0' : $beforeTimestamp . '000000'; + protected function convertBeforeToId(int $beforeTimestamp): string { + return $beforeTimestamp == 0 ? '0' : $beforeTimestamp . '000000'; } /** * @return integer|false */ - protected function setFeedAsRead(string $id, string $before) { + protected function setFeedAsRead(int $id, int $before) { $before = $this->convertBeforeToId($before); - return $this->entryDAO->markReadFeed(intval($id), $before); + return $this->entryDAO->markReadFeed($id, $before); } /** * @return integer|false */ - protected function setGroupAsRead(string $id, string $before) { + protected function setGroupAsRead(int $id, int $before) { $before = $this->convertBeforeToId($before); // special case to mark all items as read - if ($id == '0') { + if ($id == 0) { return $this->entryDAO->markReadEntries($before); } - return $this->entryDAO->markReadCat(intval($id), $before); + return $this->entryDAO->markReadCat($id, $before); } } diff --git a/p/api/greader.php b/p/api/greader.php index a3dad880e..5412bcf1d 100644 --- a/p/api/greader.php +++ b/p/api/greader.php @@ -26,23 +26,15 @@ Server-side API compatible with Google Reader API layer 2 require(__DIR__ . '/../../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader -$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, 1048576) ?: ''; if (PHP_INT_SIZE < 8) { //32-bit - /** - * @param string $hex - * @return string - */ - function hex2dec($hex) { + function hex2dec(string $hex): string { if (!ctype_xdigit($hex)) return '0'; return gmp_strval(gmp_init($hex, 16), 10); } } else { //64-bit - /** - * @param string $hex - * @return string - */ - function hex2dec($hex) { + function hex2dec(string $hex): string { if (!ctype_xdigit($hex)) return '0'; return '' . hexdec($hex); } @@ -50,24 +42,28 @@ if (PHP_INT_SIZE < 8) { //32-bit define('JSON_OPTIONS', JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); -function headerVariable($headerName, $varName) { +function headerVariable(string $headerName, string $varName): string { $header = ''; $upName = 'HTTP_' . strtoupper($headerName); if (isset($_SERVER[$upName])) { - $header = $_SERVER[$upName]; + $header = '' . $_SERVER[$upName]; } elseif (isset($_SERVER['REDIRECT_' . $upName])) { - $header = $_SERVER['REDIRECT_' . $upName]; + $header = '' . $_SERVER['REDIRECT_' . $upName]; } elseif (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); if (isset($ALL_HEADERS[$headerName])) { - $header = $ALL_HEADERS[$headerName]; + $header = '' . $ALL_HEADERS[$headerName]; } } parse_str($header, $pairs); - return isset($pairs[$varName]) ? $pairs[$varName] : null; + if (empty($pairs[$varName])) { + return ''; + } + return is_string($pairs[$varName]) ? $pairs[$varName] : ''; } -function multiplePosts($name) { +/** @return array */ +function multiplePosts(string $name): array { //https://bugs.php.net/bug.php?id=51633 global $ORIGINAL_INPUT; $inputs = explode('&', $ORIGINAL_INPUT); @@ -82,10 +78,7 @@ function multiplePosts($name) { return $result; } -/** - * @return string - */ -function debugInfo() { +function debugInfo(): string { if (function_exists('getallheaders')) { $ALL_HEADERS = getallheaders(); } else { //nginx http://php.net/getallheaders#84262 @@ -109,1027 +102,1107 @@ function debugInfo() { return print_r($log, true); } -function badRequest() { - Minz_Log::warning('GReader API: ' . __METHOD__, API_LOG); - Minz_Log::debug('badRequest() ' . debugInfo(), API_LOG); - header('HTTP/1.1 400 Bad Request'); - header('Content-Type: text/plain; charset=UTF-8'); - die('Bad Request!'); -} +final class GReaderAPI { -function unauthorized() { - Minz_Log::warning('GReader API: ' . __METHOD__, API_LOG); - Minz_Log::debug('unauthorized() ' . debugInfo(), API_LOG); - header('HTTP/1.1 401 Unauthorized'); - header('Content-Type: text/plain; charset=UTF-8'); - header('Google-Bad-Token: true'); - die('Unauthorized!'); -} + /** @return never */ + private static function badRequest() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('HTTP/1.1 400 Bad Request'); + header('Content-Type: text/plain; charset=UTF-8'); + die('Bad Request!'); + } -function notImplemented() { - Minz_Log::warning('GReader API: ' . __METHOD__, API_LOG); - Minz_Log::debug('notImplemented() ' . debugInfo(), API_LOG); - header('HTTP/1.1 501 Not Implemented'); - header('Content-Type: text/plain; charset=UTF-8'); - die('Not Implemented!'); -} + /** @return never */ + private static function unauthorized() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('HTTP/1.1 401 Unauthorized'); + header('Content-Type: text/plain; charset=UTF-8'); + header('Google-Bad-Token: true'); + die('Unauthorized!'); + } -function serviceUnavailable() { - Minz_Log::warning('GReader API: ' . __METHOD__, API_LOG); - Minz_Log::debug('serviceUnavailable() ' . debugInfo(), API_LOG); - header('HTTP/1.1 503 Service Unavailable'); - header('Content-Type: text/plain; charset=UTF-8'); - die('Service Unavailable!'); -} + /** @return never */ + private static function internalServerError() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('HTTP/1.1 500 Internal Server Error'); + header('Content-Type: text/plain; charset=UTF-8'); + die('Internal Server Error!'); + } -function checkCompatibility() { - Minz_Log::warning('GReader API: ' . __METHOD__, API_LOG); - Minz_Log::debug('checkCompatibility() ' . debugInfo(), API_LOG); - header('Content-Type: text/plain; charset=UTF-8'); - if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) { - die('FAIL 64-bit or GMP extension! Wrong PHP configuration.'); + /** @return never */ + private static function notImplemented() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('HTTP/1.1 501 Not Implemented'); + header('Content-Type: text/plain; charset=UTF-8'); + die('Not Implemented!'); } - $headerAuth = headerVariable('Authorization', 'GoogleLogin_auth'); - if ($headerAuth == '') { - die('FAIL get HTTP Authorization header! Wrong Web server configuration.'); + + /** @return never */ + private static function serviceUnavailable() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('HTTP/1.1 503 Service Unavailable'); + header('Content-Type: text/plain; charset=UTF-8'); + die('Service Unavailable!'); } - echo 'PASS'; - exit(); -} -function authorizationToUser() { - //Input is 'GoogleLogin auth', but PHP replaces spaces by '_' http://php.net/language.variables.external - $headerAuth = headerVariable('Authorization', 'GoogleLogin_auth'); - if ($headerAuth != '') { - $headerAuthX = explode('/', $headerAuth, 2); - if (count($headerAuthX) === 2) { - $user = $headerAuthX[0]; - if (FreshRSS_user_Controller::checkUsername($user)) { - FreshRSS_Context::initUser($user); - if (FreshRSS_Context::$user_conf == null) { - Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.'); - unauthorized(); - } - if (!FreshRSS_Context::$user_conf->enabled) { - Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.'); - unauthorized(); - } - if ($headerAuthX[1] === sha1(FreshRSS_Context::$system_conf->salt . $user . FreshRSS_Context::$user_conf->apiPasswordHash)) { - return $user; + /** @return never */ + private static function checkCompatibility() { + Minz_Log::warning(__METHOD__, API_LOG); + Minz_Log::debug(__METHOD__ . ' ' . debugInfo(), API_LOG); + header('Content-Type: text/plain; charset=UTF-8'); + if (PHP_INT_SIZE < 8 && !function_exists('gmp_init')) { + die('FAIL 64-bit or GMP extension! Wrong PHP configuration.'); + } + $headerAuth = headerVariable('Authorization', 'GoogleLogin_auth'); + if ($headerAuth == '') { + die('FAIL get HTTP Authorization header! Wrong Web server configuration.'); + } + echo 'PASS'; + exit(); + } + + private static function authorizationToUser(): string { + //Input is 'GoogleLogin auth', but PHP replaces spaces by '_' http://php.net/language.variables.external + $headerAuth = headerVariable('Authorization', 'GoogleLogin_auth'); + if ($headerAuth != '') { + $headerAuthX = explode('/', $headerAuth, 2); + if (count($headerAuthX) === 2) { + $user = $headerAuthX[0]; + if (FreshRSS_user_Controller::checkUsername($user)) { + FreshRSS_Context::initUser($user); + if (FreshRSS_Context::$user_conf == null || FreshRSS_Context::$system_conf == null) { + Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.'); + self::unauthorized(); + } + if (!FreshRSS_Context::$user_conf->enabled) { + Minz_Log::warning('Invalid API user ' . $user . ': configuration cannot be found.'); + self::unauthorized(); + } + if ($headerAuthX[1] === sha1(FreshRSS_Context::$system_conf->salt . $user . FreshRSS_Context::$user_conf->apiPasswordHash)) { + return $user; + } else { + Minz_Log::warning('Invalid API authorisation for user ' . $user); + self::unauthorized(); + } } else { - Minz_Log::warning('Invalid API authorisation for user ' . $user); - unauthorized(); + self::badRequest(); } - } else { - badRequest(); } } + return ''; } - return ''; -} -function clientLogin($email, $pass) { - //https://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html - if (FreshRSS_user_Controller::checkUsername($email)) { - FreshRSS_Context::initUser($email); - if (FreshRSS_Context::$user_conf == null) { - Minz_Log::warning('Invalid API user ' . $email . ': configuration cannot be found.'); - unauthorized(); - } + /** @return never */ + private static function clientLogin(string $email, string $pass) { + //https://web.archive.org/web/20130604091042/http://undoc.in/clientLogin.html + if (FreshRSS_user_Controller::checkUsername($email)) { + FreshRSS_Context::initUser($email); + if (FreshRSS_Context::$user_conf == null || FreshRSS_Context::$system_conf == null) { + Minz_Log::warning('Invalid API user ' . $email . ': configuration cannot be found.'); + self::unauthorized(); + } - if (FreshRSS_Context::$user_conf->apiPasswordHash != '' && password_verify($pass, FreshRSS_Context::$user_conf->apiPasswordHash)) { - header('Content-Type: text/plain; charset=UTF-8'); - $auth = $email . '/' . sha1(FreshRSS_Context::$system_conf->salt . $email . FreshRSS_Context::$user_conf->apiPasswordHash); - echo 'SID=', $auth, "\n", - 'LSID=null', "\n", //Vienna RSS - 'Auth=', $auth, "\n"; - exit(); + if (FreshRSS_Context::$user_conf->apiPasswordHash != '' && password_verify($pass, FreshRSS_Context::$user_conf->apiPasswordHash)) { + header('Content-Type: text/plain; charset=UTF-8'); + $auth = $email . '/' . sha1(FreshRSS_Context::$system_conf->salt . $email . FreshRSS_Context::$user_conf->apiPasswordHash); + echo 'SID=', $auth, "\n", + 'LSID=null', "\n", //Vienna RSS + 'Auth=', $auth, "\n"; + exit(); + } else { + Minz_Log::warning('Password API mismatch for user ' . $email); + self::unauthorized(); + } } else { - Minz_Log::warning('Password API mismatch for user ' . $email); - unauthorized(); + self::badRequest(); } - } else { - badRequest(); } - die(); -} -function token($conf) { -//http://blog.martindoms.com/2009/08/15/using-the-google-reader-api-part-1/ -//https://github.com/ericmann/gReader-Library/blob/master/greader.class.php - $user = Minz_Session::param('currentUser', '_'); - //Minz_Log::debug('token('. $user . ')', API_LOG); //TODO: Implement real token that expires - $token = str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z'); //Must have 57 characters - echo $token, "\n"; - exit(); -} + /** + * @return never + */ + private static function token(?FreshRSS_UserConfiguration $conf) { + //http://blog.martindoms.com/2009/08/15/using-the-google-reader-api-part-1/ + //https://github.com/ericmann/gReader-Library/blob/master/greader.class.php + if ($conf == null || FreshRSS_Context::$system_conf == null) { + self::unauthorized(); + } + $user = Minz_Session::param('currentUser', '_'); + //Minz_Log::debug('token('. $user . ')', API_LOG); //TODO: Implement real token that expires + $token = str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z'); //Must have 57 characters + echo $token, "\n"; + exit(); + } -function checkToken(FreshRSS_UserConfiguration $conf, string $token) { -//http://code.google.com/p/google-reader-api/wiki/ActionToken - $user = Minz_Session::param('currentUser', '_'); - if ($user !== '_' && ( //TODO: Check security consequences - $token == '' || //FeedMe - $token === 'x')) { //Reeder - return true; + private static function checkToken(?FreshRSS_UserConfiguration $conf, string $token): bool { + //http://code.google.com/p/google-reader-api/wiki/ActionToken + if ($conf == null || FreshRSS_Context::$system_conf == null) { + self::unauthorized(); + } + $user = Minz_Session::param('currentUser', '_'); + if ($user !== '_' && ( //TODO: Check security consequences + $token == '' || //FeedMe + $token === 'x')) { //Reeder + return true; + } + if ($token === str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z')) { + return true; + } + Minz_Log::warning('Invalid POST token: ' . $token, API_LOG); + self::unauthorized(); } - if ($token === str_pad(sha1(FreshRSS_Context::$system_conf->salt . $user . $conf->apiPasswordHash), 57, 'Z')) { - return true; + + /** @return never */ + private static function userInfo() { + //https://github.com/theoldreader/api#user-info + if (FreshRSS_Context::$user_conf == null) { + self::unauthorized(); + } + $user = Minz_Session::param('currentUser', '_'); + exit(json_encode(array( + 'userId' => $user, + 'userName' => $user, + 'userProfileId' => $user, + 'userEmail' => FreshRSS_Context::$user_conf->mail_login, + ), JSON_OPTIONS)); } - Minz_Log::warning('Invalid POST token: ' . $token, API_LOG); - unauthorized(); -} -function userInfo() { - //https://github.com/theoldreader/api#user-info - $user = Minz_Session::param('currentUser', '_'); - exit(json_encode(array( - 'userId' => $user, - 'userName' => $user, - 'userProfileId' => $user, - 'userEmail' => FreshRSS_Context::$user_conf->mail_login, - ), JSON_OPTIONS)); -} + /** @return never */ + private static function tagList() { + header('Content-Type: application/json; charset=UTF-8'); -function tagList() { - header('Content-Type: application/json; charset=UTF-8'); - - $tags = array( - array('id' => 'user/-/state/com.google/starred'), - //array('id' => 'user/-/state/com.google/broadcast', 'sortid' => '2'), - ); - - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $categories = $categoryDAO->listCategories(true, false); - foreach ($categories as $cat) { - $tags[] = array( - 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), - //'sortid' => $cat->name(), - 'type' => 'folder', //Inoreader + $tags = array( + array('id' => 'user/-/state/com.google/starred'), + //array('id' => 'user/-/state/com.google/broadcast', 'sortid' => '2'), ); - } - $tagDAO = FreshRSS_Factory::createTagDao(); - $labels = $tagDAO->listTags(true); - foreach ($labels as $label) { - $tags[] = array( - 'id' => 'user/-/label/' . htmlspecialchars_decode($label->name(), ENT_QUOTES), - //'sortid' => $label->name(), - 'type' => 'tag', //Inoreader - 'unread_count' => $label->nbUnread(), //Inoreader - ); - } + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $categories = $categoryDAO->listCategories(true, false); + foreach ($categories as $cat) { + $tags[] = array( + 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), + //'sortid' => $cat->name(), + 'type' => 'folder', //Inoreader + ); + } - echo json_encode(array('tags' => $tags), JSON_OPTIONS), "\n"; - exit(); -} + $tagDAO = FreshRSS_Factory::createTagDao(); + $labels = $tagDAO->listTags(true); + foreach ($labels as $label) { + $tags[] = array( + 'id' => 'user/-/label/' . htmlspecialchars_decode($label->name(), ENT_QUOTES), + //'sortid' => $label->name(), + 'type' => 'tag', //Inoreader + 'unread_count' => $label->nbUnread(), //Inoreader + ); + } -function subscriptionExport() { - $user = Minz_Session::param('currentUser', '_'); - $export_service = new FreshRSS_Export_Service($user); - list($filename, $content) = $export_service->generateOpml(); - header('Content-Type: application/xml; charset=UTF-8'); - header('Content-disposition: attachment; filename="' . $filename . '"'); - echo $content; - exit(); -} + echo json_encode(array('tags' => $tags), JSON_OPTIONS), "\n"; + exit(); + } -function subscriptionImport($opml) { - $user = Minz_Session::param('currentUser', '_'); - $importService = new FreshRSS_Import_Service($user); - $importService->importOpml($opml); - if ($importService->lastStatus()) { - list($nbUpdatedFeeds, $feed, $nbNewArticles) = FreshRSS_feed_Controller::actualizeFeed(0, '', true); - invalidateHttpCache($user); - exit('OK'); - } else { - badRequest(); + /** @return never */ + private static function subscriptionExport() { + $user = '' . Minz_Session::param('currentUser', '_'); + $export_service = new FreshRSS_Export_Service($user); + list($filename, $content) = $export_service->generateOpml(); + header('Content-Type: application/xml; charset=UTF-8'); + header('Content-disposition: attachment; filename="' . $filename . '"'); + echo $content; + exit(); } -} -function subscriptionList() { - header('Content-Type: application/json; charset=UTF-8'); - - $salt = FreshRSS_Context::$system_conf->salt; - $faviconsUrl = Minz_Url::display('/f.php?', '', true); - $faviconsUrl = str_replace('/api/greader.php/reader/api/0/subscription', '', $faviconsUrl); //Security if base_url is not set properly - $subscriptions = array(); - - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - foreach ($categoryDAO->listCategories(true, true) as $cat) { - foreach ($cat->feeds() as $feed) { - $subscriptions[] = [ - 'id' => 'feed/' . $feed->id(), - 'title' => escapeToUnicodeAlternative($feed->name(), true), - 'categories' => [ - [ - 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), - 'label' => htmlspecialchars_decode($cat->name(), ENT_QUOTES), - ], - ], - //'sortid' => $feed->name(), - //'firstitemmsec' => 0, - 'url' => htmlspecialchars_decode($feed->url(), ENT_QUOTES), - 'htmlUrl' => htmlspecialchars_decode($feed->website(), ENT_QUOTES), - 'iconUrl' => $faviconsUrl . hash('crc32b', $salt . $feed->url()), - ]; + /** @return never */ + private static function subscriptionImport(string $opml) { + $user = '' . Minz_Session::param('currentUser', '_'); + $importService = new FreshRSS_Import_Service($user); + $importService->importOpml($opml); + if ($importService->lastStatus()) { + FreshRSS_feed_Controller::actualizeFeed(0, '', true); + invalidateHttpCache($user); + exit('OK'); + } else { + self::badRequest(); } } - echo json_encode(array('subscriptions' => $subscriptions), JSON_OPTIONS), "\n"; - exit(); -} + /** @return never */ + private static function subscriptionList() { + if (FreshRSS_Context::$system_conf == null) { + self::internalServerError(); + } + header('Content-Type: application/json; charset=UTF-8'); + $salt = FreshRSS_Context::$system_conf->salt; + $faviconsUrl = Minz_Url::display('/f.php?', '', true); + $faviconsUrl = str_replace('/api/greader.php/reader/api/0/subscription', '', $faviconsUrl); //Security if base_url is not set properly + $subscriptions = array(); -function subscriptionEdit($streamNames, $titles, $action, $add = '', $remove = '') { - //https://github.com/mihaip/google-reader-api/blob/master/wiki/ApiSubscriptionEdit.wiki - switch ($action) { - case 'subscribe': - case 'unsubscribe': - case 'edit': - break; - default: - badRequest(); - } - $addCatId = 0; - $categoryDAO = null; - if ($add != '' || $remove != '') { $categoryDAO = FreshRSS_Factory::createCategoryDao(); - } - $c_name = ''; - if ($add != '' && strpos($add, 'user/') === 0) { //user/-/label/Example ; user/username/label/Example - if (strpos($add, 'user/-/label/') === 0) { - $c_name = substr($add, 13); - } else { - $user = Minz_Session::param('currentUser', '_'); - $prefix = 'user/' . $user . '/label/'; - if (strpos($add, $prefix) === 0) { - $c_name = substr($add, strlen($prefix)); - } else { - $c_name = ''; + foreach ($categoryDAO->listCategories(true, true) as $cat) { + foreach ($cat->feeds() as $feed) { + $subscriptions[] = [ + 'id' => 'feed/' . $feed->id(), + 'title' => escapeToUnicodeAlternative($feed->name(), true), + 'categories' => [ + [ + 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), + 'label' => htmlspecialchars_decode($cat->name(), ENT_QUOTES), + ], + ], + //'sortid' => $feed->name(), + //'firstitemmsec' => 0, + 'url' => htmlspecialchars_decode($feed->url(), ENT_QUOTES), + 'htmlUrl' => htmlspecialchars_decode($feed->website(), ENT_QUOTES), + 'iconUrl' => $faviconsUrl . hash('crc32b', $salt . $feed->url()), + ]; } } - $c_name = htmlspecialchars($c_name, ENT_COMPAT, 'UTF-8'); - $cat = $categoryDAO->searchByName($c_name); - $addCatId = $cat == null ? 0 : $cat->id(); - } elseif ($remove != '' && strpos($remove, 'user/-/label/') === 0) { - $addCatId = 1; //Default category - } - $feedDAO = FreshRSS_Factory::createFeedDao(); - if (!is_array($streamNames) || count($streamNames) < 1) { - badRequest(); + + echo json_encode(array('subscriptions' => $subscriptions), JSON_OPTIONS), "\n"; + exit(); } - for ($i = count($streamNames) - 1; $i >= 0; $i--) { - $streamUrl = $streamNames[$i]; //feed/http://example.net/sample.xml ; feed/338 - if (strpos($streamUrl, 'feed/') === 0) { - $streamUrl = preg_replace('%^(feed/)+%', '', $streamUrl); - $feedId = 0; - if (ctype_digit($streamUrl)) { - if ($action === 'subscribe') { - continue; - } - $feedId = $streamUrl; + + /** + * @param array $streamNames + * @param array $titles + * @return never + */ + private static function subscriptionEdit(array $streamNames, array $titles, string $action, string $add = '', string $remove = '') { + //https://github.com/mihaip/google-reader-api/blob/master/wiki/ApiSubscriptionEdit.wiki + switch ($action) { + case 'subscribe': + case 'unsubscribe': + case 'edit': + break; + default: + self::badRequest(); + } + $addCatId = 0; + $categoryDAO = null; + if ($add != '' || $remove != '') { + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + } + $c_name = ''; + if ($add != '' && strpos($add, 'user/') === 0) { //user/-/label/Example ; user/username/label/Example + if (strpos($add, 'user/-/label/') === 0) { + $c_name = substr($add, 13); } else { - $streamUrl = htmlspecialchars($streamUrl, ENT_COMPAT, 'UTF-8'); - $feed = $feedDAO->searchByUrl($streamUrl); - $feedId = $feed == null ? -1 : $feed->id(); + $user = Minz_Session::param('currentUser', '_'); + $prefix = 'user/' . $user . '/label/'; + if (strpos($add, $prefix) === 0) { + $c_name = substr($add, strlen($prefix)); + } else { + $c_name = ''; + } } - $title = isset($titles[$i]) ? $titles[$i] : ''; - $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); - switch ($action) { - case 'subscribe': - if ($feedId <= 0) { - $http_auth = ''; - try { - $feed = FreshRSS_feed_Controller::addFeed($streamUrl, $title, $addCatId, $c_name, $http_auth); - continue 2; - } catch (Exception $e) { - Minz_Log::error('subscriptionEdit error subscribe: ' . $e->getMessage(), API_LOG); - } - } - badRequest(); - break; - case 'unsubscribe': - if (!($feedId > 0 && FreshRSS_feed_Controller::deleteFeed($feedId))) { - badRequest(); + $c_name = htmlspecialchars($c_name, ENT_COMPAT, 'UTF-8'); + $cat = $categoryDAO->searchByName($c_name); + $addCatId = $cat == null ? 0 : $cat->id(); + } elseif ($remove != '' && strpos($remove, 'user/-/label/') === 0) { + $addCatId = 1; //Default category + } + $feedDAO = FreshRSS_Factory::createFeedDao(); + if (!is_array($streamNames) || count($streamNames) < 1) { + self::badRequest(); + } + for ($i = count($streamNames) - 1; $i >= 0; $i--) { + $streamUrl = $streamNames[$i]; //feed/http://example.net/sample.xml ; feed/338 + if (strpos($streamUrl, 'feed/') === 0) { + $streamUrl = '' . preg_replace('%^(feed/)+%', '', $streamUrl); + $feedId = 0; + if (ctype_digit($streamUrl)) { + if ($action === 'subscribe') { + continue; } - break; - case 'edit': - if ($feedId > 0) { - if ($addCatId > 0 || $c_name != '') { - FreshRSS_feed_Controller::moveFeed($feedId, $addCatId, $c_name); + $feedId = $streamUrl; + } else { + $streamUrl = htmlspecialchars($streamUrl, ENT_COMPAT, 'UTF-8'); + $feed = $feedDAO->searchByUrl($streamUrl); + $feedId = $feed == null ? -1 : $feed->id(); + } + $title = isset($titles[$i]) ? $titles[$i] : ''; + $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); + switch ($action) { + case 'subscribe': + if ($feedId <= 0) { + $http_auth = ''; + try { + $feed = FreshRSS_feed_Controller::addFeed($streamUrl, $title, $addCatId, $c_name, $http_auth); + continue 2; + } catch (Exception $e) { + Minz_Log::error('subscriptionEdit error subscribe: ' . $e->getMessage(), API_LOG); + } } - if ($title != '') { - FreshRSS_feed_Controller::renameFeed($feedId, $title); + self::badRequest(); + // Always exits + case 'unsubscribe': + if (!($feedId > 0 && FreshRSS_feed_Controller::deleteFeed($feedId))) { + self::badRequest(); } - } else { - badRequest(); - } - break; + break; + case 'edit': + if ($feedId > 0) { + if ($addCatId > 0 || $c_name != '') { + FreshRSS_feed_Controller::moveFeed($feedId, $addCatId, $c_name); + } + if ($title != '') { + FreshRSS_feed_Controller::renameFeed($feedId, $title); + } + } else { + self::badRequest(); + } + break; + } } } + exit('OK'); } - exit('OK'); -} -function quickadd($url) { - try { - $url = htmlspecialchars($url, ENT_COMPAT, 'UTF-8'); - if (substr($url, 0, 5) === 'feed/') { - $url = substr($url, 5); + /** @return never */ + private static function quickadd(string $url) { + try { + $url = htmlspecialchars($url, ENT_COMPAT, 'UTF-8'); + if (substr($url, 0, 5) === 'feed/') { + $url = substr($url, 5); + } + $feed = FreshRSS_feed_Controller::addFeed($url); + exit(json_encode(array( + 'numResults' => 1, + 'query' => $feed->url(), + 'streamId' => 'feed/' . $feed->id(), + 'streamName' => $feed->name(), + ), JSON_OPTIONS)); + } catch (Exception $e) { + Minz_Log::error('quickadd error: ' . $e->getMessage(), API_LOG); + die(json_encode(array( + 'numResults' => 0, + 'error' => $e->getMessage(), + ), JSON_OPTIONS)); } - $feed = FreshRSS_feed_Controller::addFeed($url); - exit(json_encode(array( - 'numResults' => 1, - 'query' => $feed->url(), - 'streamId' => 'feed/' . $feed->id(), - 'streamName' => $feed->name(), - ), JSON_OPTIONS)); - } catch (Exception $e) { - Minz_Log::error('quickadd error: ' . $e->getMessage(), API_LOG); - die(json_encode(array( - 'numResults' => 0, - 'error' => $e->getMessage(), - ), JSON_OPTIONS)); } -} - -function unreadCount() { - //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count - header('Content-Type: application/json; charset=UTF-8'); - $totalUnreads = 0; - $totalLastUpdate = 0; + /** @return never */ + private static function unreadCount() { + //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#unread-count + header('Content-Type: application/json; charset=UTF-8'); - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $feedDAO = FreshRSS_Factory::createFeedDao(); - $feedsNewestItemUsec = $feedDAO->listFeedsNewestItemUsec(); + $totalUnreads = 0; + $totalLastUpdate = 0; - foreach ($categoryDAO->listCategories(true, true) as $cat) { - $catLastUpdate = 0; - foreach ($cat->feeds() as $feed) { - $lastUpdate = isset($feedsNewestItemUsec['f_' . $feed->id()]) ? $feedsNewestItemUsec['f_' . $feed->id()] : 0; + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feedsNewestItemUsec = $feedDAO->listFeedsNewestItemUsec(); + + foreach ($categoryDAO->listCategories(true, true) as $cat) { + $catLastUpdate = 0; + foreach ($cat->feeds() as $feed) { + $lastUpdate = isset($feedsNewestItemUsec['f_' . $feed->id()]) ? $feedsNewestItemUsec['f_' . $feed->id()] : 0; + $unreadcounts[] = array( + 'id' => 'feed/' . $feed->id(), + 'count' => $feed->nbNotRead(), + 'newestItemTimestampUsec' => '' . $lastUpdate, + ); + if ($catLastUpdate < $lastUpdate) { + $catLastUpdate = $lastUpdate; + } + } $unreadcounts[] = array( - 'id' => 'feed/' . $feed->id(), - 'count' => $feed->nbNotRead(), - 'newestItemTimestampUsec' => '' . $lastUpdate, + 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), + 'count' => $cat->nbNotRead(), + 'newestItemTimestampUsec' => '' . $catLastUpdate, ); - if ($catLastUpdate < $lastUpdate) { - $catLastUpdate = $lastUpdate; + $totalUnreads += $cat->nbNotRead(); + if ($totalLastUpdate < $catLastUpdate) { + $totalLastUpdate = $catLastUpdate; } } - $unreadcounts[] = array( - 'id' => 'user/-/label/' . htmlspecialchars_decode($cat->name(), ENT_QUOTES), - 'count' => $cat->nbNotRead(), - 'newestItemTimestampUsec' => '' . $catLastUpdate, - ); - $totalUnreads += $cat->nbNotRead(); - if ($totalLastUpdate < $catLastUpdate) { - $totalLastUpdate = $catLastUpdate; + + $tagDAO = FreshRSS_Factory::createTagDao(); + $tagsNewestItemUsec = $tagDAO->listTagsNewestItemUsec(); + foreach ($tagDAO->listTags(true) as $label) { + $lastUpdate = isset($tagsNewestItemUsec['t_' . $label->id()]) ? $tagsNewestItemUsec['t_' . $label->id()] : 0; + $unreadcounts[] = array( + 'id' => 'user/-/label/' . htmlspecialchars_decode($label->name(), ENT_QUOTES), + 'count' => $label->nbUnread(), + 'newestItemTimestampUsec' => '' . $lastUpdate, + ); } - } - $tagDAO = FreshRSS_Factory::createTagDao(); - $tagsNewestItemUsec = $tagDAO->listTagsNewestItemUsec(); - foreach ($tagDAO->listTags(true) as $label) { - $lastUpdate = isset($tagsNewestItemUsec['t_' . $label->id()]) ? $tagsNewestItemUsec['t_' . $label->id()] : 0; $unreadcounts[] = array( - 'id' => 'user/-/label/' . htmlspecialchars_decode($label->name(), ENT_QUOTES), - 'count' => $label->nbUnread(), - 'newestItemTimestampUsec' => '' . $lastUpdate, + 'id' => 'user/-/state/com.google/reading-list', + 'count' => $totalUnreads, + 'newestItemTimestampUsec' => '' . $totalLastUpdate, ); - } - $unreadcounts[] = array( - 'id' => 'user/-/state/com.google/reading-list', - 'count' => $totalUnreads, - 'newestItemTimestampUsec' => '' . $totalLastUpdate, - ); - - echo json_encode(array( - 'max' => $totalUnreads, - 'unreadcounts' => $unreadcounts, - ), JSON_OPTIONS), "\n"; - exit(); -} - -function entriesToArray($entries) { - if (empty($entries)) { - return array(); + echo json_encode(array( + 'max' => $totalUnreads, + 'unreadcounts' => $unreadcounts, + ), JSON_OPTIONS), "\n"; + exit(); } - $catDAO = FreshRSS_Factory::createCategoryDao(); - $categories = $catDAO->listCategories(true); - $tagDAO = FreshRSS_Factory::createTagDao(); - $entryIdsTagNames = $tagDAO->getEntryIdsTagNames($entries); - if ($entryIdsTagNames == false) { - $entryIdsTagNames = array(); - } + /** + * @param array $entries + * @return array> + */ + private static function entriesToArray(array $entries): array { + if (empty($entries)) { + return array(); + } + $catDAO = FreshRSS_Factory::createCategoryDao(); + $categories = $catDAO->listCategories(true); - $items = array(); - foreach ($entries as $item) { - /** @var FreshRSS_Entry $entry */ - $entry = Minz_ExtensionManager::callHook('entry_before_display', $item); - if ($entry == null) { - continue; + $tagDAO = FreshRSS_Factory::createTagDao(); + $entryIdsTagNames = $tagDAO->getEntryIdsTagNames($entries); + if ($entryIdsTagNames == false) { + $entryIdsTagNames = array(); } - $feed = FreshRSS_CategoryDAO::findFeed($categories, $entry->feedId()); - $entry->_feed($feed); + $items = array(); + foreach ($entries as $item) { + /** @var FreshRSS_Entry $entry */ + $entry = Minz_ExtensionManager::callHook('entry_before_display', $item); + if ($entry == null) { + continue; + } - if (isset($entryIdsTagNames['e_' . $entry->id()])) { - $entry->_tags($entryIdsTagNames['e_' . $entry->id()]); - } + $feed = FreshRSS_CategoryDAO::findFeed($categories, $entry->feedId()); + $entry->_feed($feed); - $items[] = $entry->toGReader('compat'); + if (isset($entryIdsTagNames['e_' . $entry->id()])) { + $entry->_tags($entryIdsTagNames['e_' . $entry->id()]); + } + + $items[] = $entry->toGReader('compat'); + } + return $items; } - return $items; -} -function streamContentsFilters($type, $streamId, $filter_target, $exclude_target, $start_time, $stop_time) { - switch ($type) { - case 'f': //feed - if ($streamId != '' && !ctype_digit($streamId)) { - $feedDAO = FreshRSS_Factory::createFeedDao(); + /** + * @return array + */ + private static function streamContentsFilters(string $type, string $streamId, + string $filter_target, string $exclude_target, int $start_time, int $stop_time): array { + switch ($type) { + case 'f': //feed + if ($streamId != '' && !ctype_digit($streamId)) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $streamId = htmlspecialchars($streamId, ENT_COMPAT, 'UTF-8'); + $feed = $feedDAO->searchByUrl($streamId); + $streamId = $feed == null ? -1 : $feed->id(); + } + break; + case 'c': //category or label + $categoryDAO = FreshRSS_Factory::createCategoryDao(); $streamId = htmlspecialchars($streamId, ENT_COMPAT, 'UTF-8'); - $feed = $feedDAO->searchByUrl($streamId); - $streamId = $feed == null ? -1 : $feed->id(); - } - break; - case 'c': //category or label - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $streamId = htmlspecialchars($streamId, ENT_COMPAT, 'UTF-8'); - $cat = $categoryDAO->searchByName($streamId); - if ($cat != null) { - $type = 'c'; - $streamId = $cat->id(); - } else { - $tagDAO = FreshRSS_Factory::createTagDao(); - $tag = $tagDAO->searchByName($streamId); - if ($tag != null) { - $type = 't'; - $streamId = $tag->id(); + $cat = $categoryDAO->searchByName($streamId); + if ($cat != null) { + $type = 'c'; + $streamId = $cat->id(); } else { - $type = 'A'; - $streamId = -1; + $tagDAO = FreshRSS_Factory::createTagDao(); + $tag = $tagDAO->searchByName($streamId); + if ($tag != null) { + $type = 't'; + $streamId = $tag->id(); + } else { + $type = 'A'; + $streamId = -1; + } } - } - break; - } + break; + } - switch ($filter_target) { - case 'user/-/state/com.google/read': - $state = FreshRSS_Entry::STATE_READ; - break; - case 'user/-/state/com.google/unread': - $state = FreshRSS_Entry::STATE_NOT_READ; - break; - case 'user/-/state/com.google/starred': - $state = FreshRSS_Entry::STATE_FAVORITE; - break; - default: - $state = FreshRSS_Entry::STATE_ALL; - break; - } + switch ($filter_target) { + case 'user/-/state/com.google/read': + $state = FreshRSS_Entry::STATE_READ; + break; + case 'user/-/state/com.google/unread': + $state = FreshRSS_Entry::STATE_NOT_READ; + break; + case 'user/-/state/com.google/starred': + $state = FreshRSS_Entry::STATE_FAVORITE; + break; + default: + $state = FreshRSS_Entry::STATE_ALL; + break; + } - switch ($exclude_target) { - case 'user/-/state/com.google/read': - $state &= FreshRSS_Entry::STATE_NOT_READ; - break; - case 'user/-/state/com.google/unread': - $state &= FreshRSS_Entry::STATE_READ; - break; - case 'user/-/state/com.google/starred': - $state &= FreshRSS_Entry::STATE_NOT_FAVORITE; - break; - } + switch ($exclude_target) { + case 'user/-/state/com.google/read': + $state &= FreshRSS_Entry::STATE_NOT_READ; + break; + case 'user/-/state/com.google/unread': + $state &= FreshRSS_Entry::STATE_READ; + break; + case 'user/-/state/com.google/starred': + $state &= FreshRSS_Entry::STATE_NOT_FAVORITE; + break; + } - $searches = new FreshRSS_BooleanSearch(''); - if ($start_time != '') { - $search = new FreshRSS_Search(''); - $search->setMinDate($start_time); - $searches->add($search); - } - if ($stop_time != '') { - $search = new FreshRSS_Search(''); - $search->setMaxDate($stop_time); - $searches->add($search); + $searches = new FreshRSS_BooleanSearch(''); + if ($start_time != '') { + $search = new FreshRSS_Search(''); + $search->setMinDate($start_time); + $searches->add($search); + } + if ($stop_time != '') { + $search = new FreshRSS_Search(''); + $search->setMaxDate($stop_time); + $searches->add($search); + } + + return array($type, $streamId, $state, $searches); } - return array($type, $streamId, $state, $searches); -} + /** @return never */ + private static function streamContents(string $path, string $include_target, int $start_time, int $stop_time, int $count, + string $order, string $filter_target, string $exclude_target, string $continuation) { + //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI + //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed + header('Content-Type: application/json; charset=UTF-8'); + + switch ($path) { + case 'reading-list': + $type = 'A'; + break; + case 'starred': + $type = 's'; + break; + case 'feed': + $type = 'f'; + break; + case 'label': + $type = 'c'; + break; + default: + $type = 'A'; + break; + } -function streamContents($path, $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation) { -//http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI -//http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - header('Content-Type: application/json; charset=UTF-8'); + list($type, $include_target, $state, $searches) = + self::streamContentsFilters($type, $include_target, $filter_target, $exclude_target, $start_time, $stop_time); - switch ($path) { - case 'reading-list': - $type = 'A'; - break; - case 'starred': - $type = 's'; - break; - case 'feed': - $type = 'f'; - break; - case 'label': - $type = 'c'; - break; - default: - $type = 'A'; - break; - } + if ($continuation != '') { + $count++; //Shift by one element + } - list($type, $include_target, $state, $searches) = streamContentsFilters($type, $include_target, $filter_target, $exclude_target, $start_time, $stop_time); + $entryDAO = FreshRSS_Factory::createEntryDao(); + $entries = $entryDAO->listWhere($type, $include_target, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, $searches); + $entries = iterator_to_array($entries); //TODO: Improve - if ($continuation != '') { - $count++; //Shift by one element - } + $items = self::entriesToArray($entries); - $entryDAO = FreshRSS_Factory::createEntryDao(); - $entries = $entryDAO->listWhere($type, $include_target, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, $searches); - $entries = iterator_to_array($entries); //TODO: Improve + if ($continuation != '') { + array_shift($items); //Discard first element that was already sent in the previous response + $count--; + } - $items = entriesToArray($entries); + $response = array( + 'id' => 'user/-/state/com.google/reading-list', + 'updated' => time(), + 'items' => $items, + ); + if (count($entries) >= $count) { + $entry = end($entries); + if ($entry != false) { + $response['continuation'] = '' . $entry->id(); + } + } - if ($continuation != '') { - array_shift($items); //Discard first element that was already sent in the previous response - $count--; + echo json_encode($response, JSON_OPTIONS), "\n"; + exit(); } - $response = array( - 'id' => 'user/-/state/com.google/reading-list', - 'updated' => time(), - 'items' => $items, - ); - if (count($entries) >= $count) { - $entry = end($entries); - if ($entry != false) { - $response['continuation'] = '' . $entry->id(); + /** @return never */ + private static function streamContentsItemsIds(string $streamId, int $start_time, int $stop_time, int $count, + string $order, string $filter_target, string $exclude_target, string $continuation) { + //http://code.google.com/p/google-reader-api/wiki/ApiStreamItemsIds + //http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI + //http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed + $type = 'A'; + $id = ''; + if ($streamId === 'user/-/state/com.google/reading-list') { + $type = 'A'; + } elseif ($streamId === 'user/-/state/com.google/starred') { + $type = 's'; + } elseif (strpos($streamId, 'feed/') === 0) { + $type = 'f'; + $streamId = substr($streamId, 5); + } elseif (strpos($streamId, 'user/-/label/') === 0) { + $type = 'c'; + $streamId = substr($streamId, 13); } - } - - echo json_encode($response, JSON_OPTIONS), "\n"; - exit(); -} -function streamContentsItemsIds($streamId, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation) { -//http://code.google.com/p/google-reader-api/wiki/ApiStreamItemsIds -//http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI -//http://blog.martindoms.com/2009/10/16/using-the-google-reader-api-part-2/#feed - $type = 'A'; - $id = ''; - if ($streamId === 'user/-/state/com.google/reading-list') { - $type = 'A'; - } elseif ($streamId === 'user/-/state/com.google/starred') { - $type = 's'; - } elseif (strpos($streamId, 'feed/') === 0) { - $type = 'f'; - $streamId = substr($streamId, 5); - } elseif (strpos($streamId, 'user/-/label/') === 0) { - $type = 'c'; - $streamId = substr($streamId, 13); - } + list($type, $id, $state, $searches) = self::streamContentsFilters($type, $streamId, $filter_target, $exclude_target, $start_time, $stop_time); - list($type, $id, $state, $searches) = streamContentsFilters($type, $streamId, $filter_target, $exclude_target, $start_time, $stop_time); + if ($continuation != '') { + $count++; //Shift by one element + } - if ($continuation != '') { - $count++; //Shift by one element - } + $entryDAO = FreshRSS_Factory::createEntryDao(); + $ids = $entryDAO->listIdsWhere($type, $id, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, $searches); + if ($ids === false) { + self::internalServerError(); + } - $entryDAO = FreshRSS_Factory::createEntryDao(); - $ids = $entryDAO->listIdsWhere($type, $id, $state, $order === 'o' ? 'ASC' : 'DESC', $count, $continuation, $searches); + if ($continuation != '') { + array_shift($ids); //Discard first element that was already sent in the previous response + $count--; + } - if ($continuation != '') { - array_shift($ids); //Discard first element that was already sent in the previous response - $count--; - } + if (empty($ids) && isset($_GET['client']) && $_GET['client'] === 'newsplus') { + $ids = [ 0 ]; //For News+ bug https://github.com/noinnion/newsplus/issues/84#issuecomment-57834632 + } + $itemRefs = array(); + foreach ($ids as $id) { + $itemRefs[] = array( + 'id' => '' . $id, //64-bit decimal + ); + } - if (empty($ids) && isset($_GET['client']) && $_GET['client'] === 'newsplus') { - $ids[] = 0; //For News+ bug https://github.com/noinnion/newsplus/issues/84#issuecomment-57834632 - } - $itemRefs = array(); - foreach ($ids as $id) { - $itemRefs[] = array( - 'id' => '' . $id, //64-bit decimal + $response = array( + 'itemRefs' => $itemRefs, ); - } - - $response = array( - 'itemRefs' => $itemRefs, - ); - if (count($ids) >= $count) { - $id = end($ids); - if ($id != false) { - $response['continuation'] = '' . $id; + if (count($ids) >= $count) { + $id = end($ids); + if ($id != false) { + $response['continuation'] = '' . $id; + } } - } - echo json_encode($response, JSON_OPTIONS), "\n"; - exit(); -} + echo json_encode($response, JSON_OPTIONS), "\n"; + exit(); + } -function streamContentsItems($e_ids, $order) { - header('Content-Type: application/json; charset=UTF-8'); + /** + * @param array $e_ids + * @return never + */ + private static function streamContentsItems(array $e_ids, string $order) { + header('Content-Type: application/json; charset=UTF-8'); - foreach ($e_ids as $i => $e_id) { - // https://feedhq.readthedocs.io/en/latest/api/terminology.html#items - if (!ctype_digit($e_id) || $e_id[0] === '0') { - $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' + foreach ($e_ids as $i => $e_id) { + // https://feedhq.readthedocs.io/en/latest/api/terminology.html#items + if (!ctype_digit($e_id) || $e_id[0] === '0') { + $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' + } } - } - $entryDAO = FreshRSS_Factory::createEntryDao(); - $entries = $entryDAO->listByIds($e_ids, $order === 'o' ? 'ASC' : 'DESC'); - $entries = iterator_to_array($entries); //TODO: Improve + $entryDAO = FreshRSS_Factory::createEntryDao(); + $entries = $entryDAO->listByIds($e_ids, $order === 'o' ? 'ASC' : 'DESC'); + $entries = iterator_to_array($entries); //TODO: Improve - $items = entriesToArray($entries); + $items = self::entriesToArray($entries); - $response = array( - 'id' => 'user/-/state/com.google/reading-list', - 'updated' => time(), - 'items' => $items, - ); + $response = array( + 'id' => 'user/-/state/com.google/reading-list', + 'updated' => time(), + 'items' => $items, + ); - echo json_encode($response, JSON_OPTIONS), "\n"; - exit(); -} + echo json_encode($response, JSON_OPTIONS), "\n"; + exit(); + } -function editTag($e_ids, $a, $r) { - foreach ($e_ids as $i => $e_id) { - if (!ctype_digit($e_id) || $e_id[0] === '0') { - $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' + /** + * @param array $e_ids + * @return never + */ + private static function editTag(array $e_ids, string $a, string $r): void { + foreach ($e_ids as $i => $e_id) { + if (!ctype_digit($e_id) || $e_id[0] === '0') { + $e_ids[$i] = hex2dec(basename($e_id)); //Strip prefix 'tag:google.com,2005:reader/item/' + } } - } - $entryDAO = FreshRSS_Factory::createEntryDao(); - $tagDAO = FreshRSS_Factory::createTagDao(); - - switch ($a) { - case 'user/-/state/com.google/read': - $entryDAO->markRead($e_ids, true); - break; - case 'user/-/state/com.google/starred': - $entryDAO->markFavorite($e_ids, true); - break; - /*case 'user/-/state/com.google/tracking-kept-unread': - break; - case 'user/-/state/com.google/like': - break; - case 'user/-/state/com.google/broadcast': - break;*/ - default: - $tagName = ''; - if (strpos($a, 'user/-/label/') === 0) { - $tagName = substr($a, 13); - } else { - $user = Minz_Session::param('currentUser', '_'); - $prefix = 'user/' . $user . '/label/'; - if (strpos($a, $prefix) === 0) { - $tagName = substr($a, strlen($prefix)); + $entryDAO = FreshRSS_Factory::createEntryDao(); + $tagDAO = FreshRSS_Factory::createTagDao(); + + switch ($a) { + case 'user/-/state/com.google/read': + $entryDAO->markRead($e_ids, true); + break; + case 'user/-/state/com.google/starred': + $entryDAO->markFavorite($e_ids, true); + break; + /*case 'user/-/state/com.google/tracking-kept-unread': + break; + case 'user/-/state/com.google/like': + break; + case 'user/-/state/com.google/broadcast': + break;*/ + default: + $tagName = ''; + if (strpos($a, 'user/-/label/') === 0) { + $tagName = substr($a, 13); + } else { + $user = Minz_Session::param('currentUser', '_'); + $prefix = 'user/' . $user . '/label/'; + if (strpos($a, $prefix) === 0) { + $tagName = substr($a, strlen($prefix)); + } } - } - if ($tagName != '') { - $tagName = htmlspecialchars($tagName, ENT_COMPAT, 'UTF-8'); - $tag = $tagDAO->searchByName($tagName); - if ($tag == null) { - $tagDAO->addTag(array('name' => $tagName)); + if ($tagName != '') { + $tagName = htmlspecialchars($tagName, ENT_COMPAT, 'UTF-8'); $tag = $tagDAO->searchByName($tagName); - } - if ($tag != null) { - foreach ($e_ids as $e_id) { - $tagDAO->tagEntry($tag->id(), $e_id, true); + if ($tag == null) { + $tagDAO->addTag(array('name' => $tagName)); + $tag = $tagDAO->searchByName($tagName); + } + if ($tag != null) { + foreach ($e_ids as $e_id) { + $tagDAO->tagEntry($tag->id(), $e_id, true); + } } } - } - break; - } - switch ($r) { - case 'user/-/state/com.google/read': - $entryDAO->markRead($e_ids, false); - break; - case 'user/-/state/com.google/starred': - $entryDAO->markFavorite($e_ids, false); - break; - default: - if (strpos($r, 'user/-/label/') === 0) { - $tagName = substr($r, 13); - $tagName = htmlspecialchars($tagName, ENT_COMPAT, 'UTF-8'); - $tag = $tagDAO->searchByName($tagName); - if ($tag != null) { - foreach ($e_ids as $e_id) { - $tagDAO->tagEntry($tag->id(), $e_id, false); + break; + } + switch ($r) { + case 'user/-/state/com.google/read': + $entryDAO->markRead($e_ids, false); + break; + case 'user/-/state/com.google/starred': + $entryDAO->markFavorite($e_ids, false); + break; + default: + if (strpos($r, 'user/-/label/') === 0) { + $tagName = substr($r, 13); + $tagName = htmlspecialchars($tagName, ENT_COMPAT, 'UTF-8'); + $tag = $tagDAO->searchByName($tagName); + if ($tag != null) { + foreach ($e_ids as $e_id) { + $tagDAO->tagEntry($tag->id(), $e_id, false); + } } } - } - break; - } + break; + } - exit('OK'); -} + exit('OK'); + } -function renameTag($s, $dest) { - if ($s != '' && strpos($s, 'user/-/label/') === 0 && - $dest != '' && strpos($dest, 'user/-/label/') === 0) { - $s = substr($s, 13); - $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); - $dest = substr($dest, 13); - $dest = htmlspecialchars($dest, ENT_COMPAT, 'UTF-8'); + /** @return never */ + private static function renameTag(string $s, string $dest) { + if ($s != '' && strpos($s, 'user/-/label/') === 0 && + $dest != '' && strpos($dest, 'user/-/label/') === 0) { + $s = substr($s, 13); + $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); + $dest = substr($dest, 13); + $dest = htmlspecialchars($dest, ENT_COMPAT, 'UTF-8'); - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $cat = $categoryDAO->searchByName($s); - if ($cat != null) { - $categoryDAO->updateCategory($cat->id(), array('name' => $dest)); - exit('OK'); - } else { - $tagDAO = FreshRSS_Factory::createTagDao(); - $tag = $tagDAO->searchByName($s); - if ($tag != null) { - $tagDAO->updateTag($tag->id(), array('name' => $dest)); + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $cat = $categoryDAO->searchByName($s); + if ($cat != null) { + $categoryDAO->updateCategory($cat->id(), array('name' => $dest)); exit('OK'); + } else { + $tagDAO = FreshRSS_Factory::createTagDao(); + $tag = $tagDAO->searchByName($s); + if ($tag != null) { + $tagDAO->updateTag($tag->id(), array('name' => $dest)); + exit('OK'); + } } } + self::badRequest(); } - badRequest(); -} -function disableTag($s) { - if ($s != '' && strpos($s, 'user/-/label/') === 0) { - $s = substr($s, 13); - $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $cat = $categoryDAO->searchByName($s); - if ($cat != null) { - $feedDAO = FreshRSS_Factory::createFeedDao(); - $feedDAO->changeCategory($cat->id(), 0); - if ($cat->id() > 1) { - $categoryDAO->deleteCategory($cat->id()); - } - exit('OK'); - } else { - $tagDAO = FreshRSS_Factory::createTagDao(); - $tag = $tagDAO->searchByName($s); - if ($tag != null) { - $tagDAO->deleteTag($tag->id()); + /** @return never */ + private static function disableTag(string $s) { + if ($s != '' && strpos($s, 'user/-/label/') === 0) { + $s = substr($s, 13); + $s = htmlspecialchars($s, ENT_COMPAT, 'UTF-8'); + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $cat = $categoryDAO->searchByName($s); + if ($cat != null) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $feedDAO->changeCategory($cat->id(), 0); + if ($cat->id() > 1) { + $categoryDAO->deleteCategory($cat->id()); + } exit('OK'); + } else { + $tagDAO = FreshRSS_Factory::createTagDao(); + $tag = $tagDAO->searchByName($s); + if ($tag != null) { + $tagDAO->deleteTag($tag->id()); + exit('OK'); + } } } + self::badRequest(); } - badRequest(); -} -function markAllAsRead($streamId, $olderThanId) { - $entryDAO = FreshRSS_Factory::createEntryDao(); - if (strpos($streamId, 'feed/') === 0) { - $f_id = basename($streamId); - if (!ctype_digit($f_id)) { - badRequest(); - } - $f_id = intval($f_id); - $entryDAO->markReadFeed($f_id, $olderThanId); - } elseif (strpos($streamId, 'user/-/label/') === 0) { - $c_name = substr($streamId, 13); - $c_name = htmlspecialchars($c_name, ENT_COMPAT, 'UTF-8'); - $categoryDAO = FreshRSS_Factory::createCategoryDao(); - $cat = $categoryDAO->searchByName($c_name); - if ($cat != null) { - $entryDAO->markReadCat($cat->id(), $olderThanId); - } else { - $tagDAO = FreshRSS_Factory::createTagDao(); - $tag = $tagDAO->searchByName($c_name); - if ($tag != null) { - $entryDAO->markReadTag($tag->id(), $olderThanId); + /** @return never */ + private static function markAllAsRead(string $streamId, string $olderThanId) { + $entryDAO = FreshRSS_Factory::createEntryDao(); + if (strpos($streamId, 'feed/') === 0) { + $f_id = basename($streamId); + if (!ctype_digit($f_id)) { + self::badRequest(); + } + $f_id = intval($f_id); + $entryDAO->markReadFeed($f_id, $olderThanId); + } elseif (strpos($streamId, 'user/-/label/') === 0) { + $c_name = substr($streamId, 13); + $c_name = htmlspecialchars($c_name, ENT_COMPAT, 'UTF-8'); + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $cat = $categoryDAO->searchByName($c_name); + if ($cat != null) { + $entryDAO->markReadCat($cat->id(), $olderThanId); } else { - badRequest(); + $tagDAO = FreshRSS_Factory::createTagDao(); + $tag = $tagDAO->searchByName($c_name); + if ($tag != null) { + $entryDAO->markReadTag($tag->id(), $olderThanId); + } else { + self::badRequest(); + } } + } elseif ($streamId === 'user/-/state/com.google/reading-list') { + $entryDAO->markReadEntries($olderThanId, false, -1); + } else { + self::badRequest(); } - } elseif ($streamId === 'user/-/state/com.google/reading-list') { - $entryDAO->markReadEntries($olderThanId, false, -1); - } else { - badRequest(); + exit('OK'); } - exit('OK'); -} -$pathInfo = ''; -if (empty($_SERVER['PATH_INFO'])) { - if (!empty($_SERVER['ORIG_PATH_INFO'])) { - // Compatibility https://php.net/reserved.variables.server - $pathInfo = $_SERVER['ORIG_PATH_INFO']; - } -} else { - $pathInfo = $_SERVER['PATH_INFO']; -} -$pathInfo = urldecode($pathInfo); -$pathInfo = preg_replace('%^(/api)?(/greader\.php)?%', '', $pathInfo); //Discard common errors -if ($pathInfo == '') { - exit('OK'); -} -$pathInfos = explode('/', $pathInfo); -if (count($pathInfos) < 3) { - badRequest(); -} + /** @return never */ + public static function parse() { + global $ORIGINAL_INPUT; -FreshRSS_Context::initSystem(); + $pathInfo = ''; + if (empty($_SERVER['PATH_INFO'])) { + if (!empty($_SERVER['ORIG_PATH_INFO'])) { + // Compatibility https://php.net/reserved.variables.server + $pathInfo = $_SERVER['ORIG_PATH_INFO']; + } + } else { + $pathInfo = $_SERVER['PATH_INFO']; + } + $pathInfo = urldecode($pathInfo); + $pathInfo = '' . preg_replace('%^(/api)?(/greader\.php)?%', '', $pathInfo); //Discard common errors + if ($pathInfo == '') { + exit('OK'); + } + $pathInfos = explode('/', $pathInfo); + if (count($pathInfos) < 3) { + self::badRequest(); + } -//Minz_Log::debug('----------------------------------------------------------------', API_LOG); -//Minz_Log::debug(debugInfo(), API_LOG); + FreshRSS_Context::initSystem(); -if (!FreshRSS_Context::$system_conf->api_enabled) { - serviceUnavailable(); -} elseif ($pathInfos[1] === 'check' && $pathInfos[2] === 'compatibility') { - checkCompatibility(); -} + //Minz_Log::debug('----------------------------------------------------------------', API_LOG); + //Minz_Log::debug(debugInfo(), API_LOG); -Minz_Session::init('FreshRSS', true); + if (FreshRSS_Context::$system_conf == null || !FreshRSS_Context::$system_conf->api_enabled) { + self::serviceUnavailable(); + } elseif ($pathInfos[1] === 'check' && $pathInfos[2] === 'compatibility') { + self::checkCompatibility(); + } -if ($pathInfos[1] !== 'accounts') { - authorizationToUser(); -} -if (FreshRSS_Context::$user_conf != null) { - Minz_Translate::init(FreshRSS_Context::$user_conf->language); - Minz_ExtensionManager::init(); - Minz_ExtensionManager::enableByList(FreshRSS_Context::$user_conf->extensions_enabled); -} else { - Minz_Translate::init(); -} + Minz_Session::init('FreshRSS', true); -if ($pathInfos[1] === 'accounts') { - if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) { - clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']); - } -} elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { - if (Minz_Session::param('currentUser', '') == '') { - unauthorized(); - } - $timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching. - switch ($pathInfos[4]) { - case 'stream': - /* xt=[exclude target] : Used to exclude certain items from the feed. - * For example, using xt=user/-/state/com.google/read will exclude items - * that the current user has marked as read, or xt=feed/[feedurl] will - * exclude items from a particular feed (obviously not useful in this - * request, but xt appears in other listing requests). */ - $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; - $filter_target = isset($_GET['it']) ? $_GET['it'] : ''; - //n=[integer] : The maximum number of results to return. - $count = isset($_GET['n']) ? intval($_GET['n']) : 20; - //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order. - $order = isset($_GET['r']) ? $_GET['r'] : 'd'; - /* ot=[unix timestamp] : The time from which you want to retrieve - * items. Only items that have been crawled by Google Reader after - * this time will be returned. */ - $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; - $stop_time = isset($_GET['nt']) ? intval($_GET['nt']) : 0; - /* Continuation token. If a StreamContents response does not represent - * all items in a timestamp range, it will have a continuation attribute. - * The same request can be re-issued with the value of that attribute put - * in this parameter to get more items */ - $continuation = isset($_GET['c']) ? trim($_GET['c']) : ''; - if (!ctype_digit($continuation)) { - $continuation = ''; + if ($pathInfos[1] !== 'accounts') { + self::authorizationToUser(); + } + if (FreshRSS_Context::$user_conf != null) { + Minz_Translate::init(FreshRSS_Context::$user_conf->language); + Minz_ExtensionManager::init(); + Minz_ExtensionManager::enableByList(FreshRSS_Context::$user_conf->extensions_enabled); + } else { + Minz_Translate::init(); + } + + if ($pathInfos[1] === 'accounts') { + if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) { + self::clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']); + } + } elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) { + if (Minz_Session::param('currentUser', '') == '') { + self::unauthorized(); } - if (isset($pathInfos[5]) && $pathInfos[5] === 'contents') { - if (!isset($pathInfos[6]) && isset($_GET['s'])) { - // Compatibility BazQux API https://github.com/bazqux/bazqux-api#fetching-streams - $streamIdInfos = explode('/', $_GET['s']); - foreach ($streamIdInfos as $streamIdInfo) { - $pathInfos[] = $streamIdInfo; + $timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching. + switch ($pathInfos[4]) { + case 'stream': + /* xt=[exclude target] : Used to exclude certain items from the feed. + * For example, using xt=user/-/state/com.google/read will exclude items + * that the current user has marked as read, or xt=feed/[feedurl] will + * exclude items from a particular feed (obviously not useful in this + * request, but xt appears in other listing requests). */ + $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; + $filter_target = isset($_GET['it']) ? $_GET['it'] : ''; + //n=[integer] : The maximum number of results to return. + $count = isset($_GET['n']) ? intval($_GET['n']) : 20; + //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order. + $order = isset($_GET['r']) ? $_GET['r'] : 'd'; + /* ot=[unix timestamp] : The time from which you want to retrieve + * items. Only items that have been crawled by Google Reader after + * this time will be returned. */ + $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; + $stop_time = isset($_GET['nt']) ? intval($_GET['nt']) : 0; + /* Continuation token. If a StreamContents response does not represent + * all items in a timestamp range, it will have a continuation attribute. + * The same request can be re-issued with the value of that attribute put + * in this parameter to get more items */ + $continuation = isset($_GET['c']) ? trim($_GET['c']) : ''; + if (!ctype_digit($continuation)) { + $continuation = ''; } - } - if (isset($pathInfos[6]) && isset($pathInfos[7])) { - if ($pathInfos[6] === 'feed') { - $include_target = $pathInfos[7]; - if ($include_target != '' && !ctype_digit($include_target)) { - $include_target = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI']; - if (preg_match('#/reader/api/0/stream/contents/feed/([A-Za-z0-9\'!*()%$_.~+-]+)#', $include_target, $matches) && isset($matches[1])) { - $include_target = urldecode($matches[1]); - } else { - $include_target = ''; + if (isset($pathInfos[5]) && $pathInfos[5] === 'contents') { + if (!isset($pathInfos[6]) && isset($_GET['s'])) { + // Compatibility BazQux API https://github.com/bazqux/bazqux-api#fetching-streams + $streamIdInfos = explode('/', $_GET['s']); + foreach ($streamIdInfos as $streamIdInfo) { + $pathInfos[] = $streamIdInfo; } } - streamContents($pathInfos[6], $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation); - } elseif ($pathInfos[6] === 'user' && isset($pathInfos[8]) && isset($pathInfos[9])) { - if ($pathInfos[8] === 'state') { - if ($pathInfos[9] === 'com.google' && isset($pathInfos[10])) { - if ($pathInfos[10] === 'reading-list' || $pathInfos[10] === 'starred') { - $include_target = ''; - streamContents($pathInfos[10], $include_target, $start_time, $stop_time, $count, $order, - $filter_target, $exclude_target, $continuation); + if (isset($pathInfos[6]) && isset($pathInfos[7])) { + if ($pathInfos[6] === 'feed') { + $include_target = $pathInfos[7]; + if ($include_target != '' && !ctype_digit($include_target)) { + $include_target = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI']; + if (preg_match('#/reader/api/0/stream/contents/feed/([A-Za-z0-9\'!*()%$_.~+-]+)#', $include_target, $matches)) { + $include_target = urldecode($matches[1]); + } else { + $include_target = ''; + } + } + self::streamContents($pathInfos[6], $include_target, $start_time, $stop_time, + $count, $order, $filter_target, $exclude_target, $continuation); + } elseif ($pathInfos[6] === 'user' && isset($pathInfos[8]) && isset($pathInfos[9])) { + if ($pathInfos[8] === 'state') { + if ($pathInfos[9] === 'com.google' && isset($pathInfos[10])) { + if ($pathInfos[10] === 'reading-list' || $pathInfos[10] === 'starred') { + $include_target = ''; + self::streamContents($pathInfos[10], $include_target, $start_time, $stop_time, $count, $order, + $filter_target, $exclude_target, $continuation); + } + } + } elseif ($pathInfos[8] === 'label') { + $include_target = $pathInfos[9]; + self::streamContents($pathInfos[8], $include_target, $start_time, $stop_time, + $count, $order, $filter_target, $exclude_target, $continuation); } } - } elseif ($pathInfos[8] === 'label') { - $include_target = $pathInfos[9]; - streamContents($pathInfos[8], $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation); + } else { //EasyRSS, FeedMe + $include_target = ''; + self::streamContents('reading-list', $include_target, $start_time, $stop_time, + $count, $order, $filter_target, $exclude_target, $continuation); } - } - } else { //EasyRSS, FeedMe - $include_target = ''; - streamContents('reading-list', $include_target, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation); - } - } elseif ($pathInfos[5] === 'items') { - if ($pathInfos[6] === 'ids' && isset($_GET['s'])) { - /* StreamId for which to fetch the item IDs. The parameter may - * be repeated to fetch the item IDs from multiple streams at once - * (more efficient from a backend perspective than multiple requests). */ - $streamId = $_GET['s']; - streamContentsItemsIds($streamId, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation); - } elseif ($pathInfos[6] === 'contents' && isset($_POST['i'])) { //FeedMe - $e_ids = multiplePosts('i'); //item IDs - streamContentsItems($e_ids, $order); - } - } - break; - case 'tag': - if (isset($pathInfos[5]) && $pathInfos[5] === 'list') { - $output = isset($_GET['output']) ? $_GET['output'] : ''; - if ($output !== 'json') notImplemented(); - tagList(); - } - break; - case 'subscription': - if (isset($pathInfos[5])) { - switch ($pathInfos[5]) { - case 'export': - subscriptionExport(); - break; - case 'import': - if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && $ORIGINAL_INPUT != '') { - subscriptionImport($ORIGINAL_INPUT); + } elseif ($pathInfos[5] === 'items') { + if ($pathInfos[6] === 'ids' && isset($_GET['s'])) { + /* StreamId for which to fetch the item IDs. The parameter may + * be repeated to fetch the item IDs from multiple streams at once + * (more efficient from a backend perspective than multiple requests). */ + $streamId = $_GET['s']; + self::streamContentsItemsIds($streamId, $start_time, $stop_time, $count, $order, $filter_target, $exclude_target, $continuation); + } elseif ($pathInfos[6] === 'contents' && isset($_POST['i'])) { //FeedMe + $e_ids = multiplePosts('i'); //item IDs + self::streamContentsItems($e_ids, $order); } - break; - case 'list': + } + break; + case 'tag': + if (isset($pathInfos[5]) && $pathInfos[5] === 'list') { $output = isset($_GET['output']) ? $_GET['output'] : ''; - if ($output !== 'json') notImplemented(); - subscriptionList(); - break; - case 'edit': - if (isset($_REQUEST['s']) && isset($_REQUEST['ac'])) { - //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once - $streamNames = empty($_POST['s']) && isset($_GET['s']) ? array($_GET['s']) : multiplePosts('s'); - /* Title to use for the subscription. For the `subscribe` action, - * if not specified then the feed’s current title will be used. Can - * be used with the `edit` action to rename a subscription */ - $titles = empty($_POST['t']) && isset($_GET['t']) ? array($_GET['t']) : multiplePosts('t'); - $action = $_REQUEST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit` - $add = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; //StreamId to add the subscription to (generally a user label) - $remove = isset($_REQUEST['r']) ? $_REQUEST['r'] : ''; //StreamId to remove the subscription from (generally a user label) - subscriptionEdit($streamNames, $titles, $action, $add, $remove); - } - break; - case 'quickadd': //https://github.com/theoldreader/api - if (isset($_REQUEST['quickadd'])) { - quickadd($_REQUEST['quickadd']); + if ($output !== 'json') self::notImplemented(); + self::tagList(); + } + break; + case 'subscription': + if (isset($pathInfos[5])) { + switch ($pathInfos[5]) { + case 'export': + self::subscriptionExport(); + // Always exits + case 'import': + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST' && $ORIGINAL_INPUT != '') { + self::subscriptionImport($ORIGINAL_INPUT); + } + break; + case 'list': + $output = isset($_GET['output']) ? $_GET['output'] : ''; + if ($output !== 'json') self::notImplemented(); + self::subscriptionList(); + // Always exits + case 'edit': + if (isset($_REQUEST['s']) && isset($_REQUEST['ac'])) { + //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once + $streamNames = empty($_POST['s']) && isset($_GET['s']) ? array($_GET['s']) : multiplePosts('s'); + /* Title to use for the subscription. For the `subscribe` action, + * if not specified then the feed’s current title will be used. Can + * be used with the `edit` action to rename a subscription */ + $titles = empty($_POST['t']) && isset($_GET['t']) ? array($_GET['t']) : multiplePosts('t'); + $action = $_REQUEST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit` + $add = isset($_REQUEST['a']) ? $_REQUEST['a'] : ''; //StreamId to add the subscription to (generally a user label) + $remove = isset($_REQUEST['r']) ? $_REQUEST['r'] : ''; //StreamId to remove the subscription from (generally a user label) + self::subscriptionEdit($streamNames, $titles, $action, $add, $remove); + } + break; + case 'quickadd': //https://github.com/theoldreader/api + if (isset($_REQUEST['quickadd'])) { + self::quickadd($_REQUEST['quickadd']); + } + break; } - break; - } - } - break; - case 'unread-count': - $output = isset($_GET['output']) ? $_GET['output'] : ''; - if ($output !== 'json') notImplemented(); - unreadCount(); - break; - case 'edit-tag': //http://blog.martindoms.com/2010/01/20/using-the-google-reader-api-part-3/ - $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken(FreshRSS_Context::$user_conf, $token); - $a = isset($_POST['a']) ? $_POST['a'] : ''; //Add: user/-/state/com.google/read user/-/state/com.google/starred - $r = isset($_POST['r']) ? $_POST['r'] : ''; //Remove: user/-/state/com.google/read user/-/state/com.google/starred - $e_ids = multiplePosts('i'); //item IDs - editTag($e_ids, $a, $r); - break; - case 'rename-tag': //https://github.com/theoldreader/api - $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken(FreshRSS_Context::$user_conf, $token); - $s = isset($_POST['s']) ? $_POST['s'] : ''; //user/-/label/Folder - $dest = isset($_POST['dest']) ? $_POST['dest'] : ''; //user/-/label/NewFolder - renameTag($s, $dest); - break; - case 'disable-tag': //https://github.com/theoldreader/api - $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken(FreshRSS_Context::$user_conf, $token); - $s_s = multiplePosts('s'); - foreach ($s_s as $s) { - disableTag($s); //user/-/label/Folder - } - break; - case 'mark-all-as-read': - $token = isset($_POST['T']) ? trim($_POST['T']) : ''; - checkToken(FreshRSS_Context::$user_conf, $token); - $streamId = $_POST['s'] ?? ''; - $ts = isset($_POST['ts']) ? $_POST['ts'] : '0'; //Older than timestamp in nanoseconds - if (!ctype_digit($ts)) { - badRequest(); + } + break; + case 'unread-count': + $output = isset($_GET['output']) ? $_GET['output'] : ''; + if ($output !== 'json') self::notImplemented(); + self::unreadCount(); + // Always exits + case 'edit-tag': //http://blog.martindoms.com/2010/01/20/using-the-google-reader-api-part-3/ + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + self::checkToken(FreshRSS_Context::$user_conf, $token); + $a = isset($_POST['a']) ? $_POST['a'] : ''; //Add: user/-/state/com.google/read user/-/state/com.google/starred + $r = isset($_POST['r']) ? $_POST['r'] : ''; //Remove: user/-/state/com.google/read user/-/state/com.google/starred + $e_ids = multiplePosts('i'); //item IDs + self::editTag($e_ids, $a, $r); + // Always exits + case 'rename-tag': //https://github.com/theoldreader/api + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + self::checkToken(FreshRSS_Context::$user_conf, $token); + $s = isset($_POST['s']) ? $_POST['s'] : ''; //user/-/label/Folder + $dest = isset($_POST['dest']) ? $_POST['dest'] : ''; //user/-/label/NewFolder + self::renameTag($s, $dest); + // Always exits + case 'disable-tag': //https://github.com/theoldreader/api + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + self::checkToken(FreshRSS_Context::$user_conf, $token); + $s_s = multiplePosts('s'); + foreach ($s_s as $s) { + self::disableTag($s); //user/-/label/Folder + } + // Always exits + case 'mark-all-as-read': + $token = isset($_POST['T']) ? trim($_POST['T']) : ''; + self::checkToken(FreshRSS_Context::$user_conf, $token); + $streamId = trim($_POST['s'] ?? ''); + $ts = trim($_POST['ts'] ?? '0'); //Older than timestamp in nanoseconds + if (!ctype_digit($ts)) { + self::badRequest(); + } + self::markAllAsRead($streamId, $ts); + // Always exits + case 'token': + self::token(FreshRSS_Context::$user_conf); + // Always exits + case 'user-info': + self::userInfo(); + // Always exits } - markAllAsRead($streamId, $ts); - break; - case 'token': - token(FreshRSS_Context::$user_conf); - break; - case 'user-info': - userInfo(); - break; + } + + self::badRequest(); } } -badRequest(); +GReaderAPI::parse(); diff --git a/p/api/pshb.php b/p/api/pshb.php index 26d1e125b..b3e3f400f 100644 --- a/p/api/pshb.php +++ b/p/api/pshb.php @@ -7,9 +7,13 @@ const MAX_PAYLOAD = 3145728; header('Content-Type: text/plain; charset=UTF-8'); header('X-Content-Type-Options: nosniff'); -$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, MAX_PAYLOAD); +$ORIGINAL_INPUT = file_get_contents('php://input', false, null, 0, MAX_PAYLOAD) ?: ''; FreshRSS_Context::initSystem(); +if (FreshRSS_Context::$system_conf == null) { + header('HTTP/1.1 500 Internal Server Error'); + die('Invalid system init!'); +} FreshRSS_Context::$system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) //Minz_Log::debug(print_r(array('_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, 'INPUT' => $ORIGINAL_INPUT), true), PSHB_LOG); @@ -41,7 +45,7 @@ if ($hubFile === false) { die('Feed info not found!'); } $hubJson = json_decode($hubFile, true); -if (!$hubJson || empty($hubJson['key']) || $hubJson['key'] !== $key) { +if (!is_array($hubJson) || empty($hubJson['key']) || $hubJson['key'] !== $key) { header('HTTP/1.1 500 Internal Server Error'); Minz_Log::error('Error: Invalid key cross-check!: ' . $key, PSHB_LOG); die('Invalid key cross-check!'); @@ -120,15 +124,12 @@ foreach ($users as $userFilename) { try { FreshRSS_Context::initUser($username); - if (FreshRSS_Context::$user_conf != null) { - Minz_ExtensionManager::enableByList(FreshRSS_Context::$user_conf->extensions_enabled); - Minz_Translate::reset(FreshRSS_Context::$user_conf->language); - } - - if (!FreshRSS_Context::$user_conf->enabled) { + if (FreshRSS_Context::$user_conf == null || !FreshRSS_Context::$user_conf->enabled) { Minz_Log::warning('FreshRSS skip disabled user ' . $username); continue; } + Minz_ExtensionManager::enableByList(FreshRSS_Context::$user_conf->extensions_enabled); + Minz_Translate::reset(FreshRSS_Context::$user_conf->language); list($updated_feeds, $feed, $nb_new_articles) = FreshRSS_feed_Controller::actualizeFeed(0, $self, false, $simplePie); if ($updated_feeds > 0 || $feed != false) { diff --git a/p/ext.php b/p/ext.php index 9427f8c20..abc07ad12 100644 --- a/p/ext.php +++ b/p/ext.php @@ -13,10 +13,7 @@ const SUPPORTED_TYPES = [ 'svg' => 'image/svg+xml', ]; -/** - * @return string - */ -function get_absolute_filename(string $file_name) { +function get_absolute_filename(string $file_name): string { $core_extension = realpath(CORE_EXTENSIONS_PATH . '/' . $file_name); if (false !== $core_extension) { return $core_extension; @@ -40,9 +37,12 @@ function get_absolute_filename(string $file_name) { return ''; } -function is_valid_path_extension($path, $extensionPath, $isStatic = true) { +function is_valid_path_extension(string $path, string $extensionPath, bool $isStatic = true): bool { // It must be under the extension path. $real_ext_path = realpath($extensionPath); + if ($real_ext_path == false) { + return false; + } //Windows compatibility $real_ext_path = str_replace('\\', '/', $real_ext_path); @@ -60,7 +60,7 @@ function is_valid_path_extension($path, $extensionPath, $isStatic = true) { // Static files to serve must be under a `ext_dir/static/` directory. $path_relative_to_ext = substr($path, strlen($real_ext_path) + 1); - list(,$static,$file) = sscanf($path_relative_to_ext, '%[^/]/%[^/]/%s'); + list(, $static, $file) = sscanf($path_relative_to_ext, '%[^/]/%[^/]/%s') ?? [null, null, null]; if (null === $file || 'static' !== $static) { return false; } @@ -78,16 +78,18 @@ function is_valid_path_extension($path, $extensionPath, $isStatic = true) { * @return bool true if it can be served, false otherwise. * */ -function is_valid_path($path) { +function is_valid_path(string $path): bool { return is_valid_path_extension($path, CORE_EXTENSIONS_PATH) || is_valid_path_extension($path, THIRDPARTY_EXTENSIONS_PATH) || is_valid_path_extension($path, USERS_PATH, false); } +/** @return never */ function sendBadRequestResponse(string $message = null) { header('HTTP/1.1 400 Bad Request'); die($message); } +/** @return never */ function sendNotFoundResponse() { header('HTTP/1.1 404 Not Found'); die(); diff --git a/p/f.php b/p/f.php index d856256aa..7837407e2 100644 --- a/p/f.php +++ b/p/f.php @@ -4,7 +4,7 @@ require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader require(LIB_PATH . '/favicons.php'); require(LIB_PATH . '/http-conditional.php'); -function show_default_favicon($cacheSeconds = 3600) { +function show_default_favicon(int $cacheSeconds = 3600): void { $default_mtime = @filemtime(DEFAULT_FAVICON); if (!httpConditional($default_mtime, $cacheSeconds, 2)) { header('Content-Type: image/x-icon'); diff --git a/p/i/index.php b/p/i/index.php index 48cedfc92..360a858ca 100755 --- a/p/i/index.php +++ b/p/i/index.php @@ -35,8 +35,8 @@ if (!file_exists($applied_migrations_path)) { require(LIB_PATH . '/http-conditional.php'); $currentUser = Minz_Session::param('currentUser', ''); $dateLastModification = $currentUser === '' ? time() : max( - @filemtime(join_path(USERS_PATH, $currentUser, LOG_FILENAME)), - @filemtime(join_path(DATA_PATH, 'config.php')) + @filemtime(USERS_PATH . '/' . $currentUser . '/' . LOG_FILENAME), + @filemtime(DATA_PATH . '/config.php') ); if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) { Minz_Session::init('FreshRSS'); -- cgit v1.2.3