Merge branch 'master' into main

This commit is contained in:
fiifff 2025-05-13 20:39:40 +08:00 committed by GitHub
commit 4b25e47a04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 102 additions and 31 deletions

View file

@ -157,3 +157,7 @@ There are some FreshRSS extensions out there, developed by community members:
### By [@LiangWei88](https://github.com/LiangWei88)
* [ArticleSummary](https://github.com/LiangWei88/xExtension-ArticleSummary): A powerful article summarization plugin for FreshRSS that allows users to generate summaries using a language model API conforming to the OpenAI API specification.
### By [@Niehztog](https://github.com/Niehztog)
* [Article Full Text](https://github.com/Niehztog/freshrss-af-readability): Fetches full article contents and adds them to feed items by using [Fivefilters Readability.php library](https://github.com/fivefilters/readability.php) (no docker containers required).

View file

@ -1,6 +1,17 @@
{
"version": 0.1,
"extensions": [
{
"name": "Af_Readability",
"author": "niehztog",
"description": "Try to inline article content using Readability",
"version": "0.1",
"entrypoint": "Af_Readability",
"type": "user",
"url": "https://github.com/Niehztog/freshrss-af-readability",
"method": "git",
"directory": "."
},
{
"name": "Always togglable menu",
"author": "nicofrand",
@ -302,7 +313,7 @@
"name": "Quick Collapse",
"author": "romibi and Marien Fressinaud",
"description": "Quickly change from folded to unfolded articles",
"version": "1.0.1",
"version": "1.0.2",
"entrypoint": "QuickCollapse",
"type": "user",
"url": "https://github.com/FreshRSS/Extensions",
@ -399,9 +410,9 @@
},
{
"name": "ShowFeedID",
"author": "math-GH",
"author": "math-GH, Inverle",
"description": "Show the ID of feed and category",
"version": "0.3.1",
"version": "0.4.0",
"entrypoint": "ShowFeedID",
"type": "user",
"url": "https://github.com/FreshRSS/Extensions",

View file

@ -91,4 +91,7 @@
}, {
"url": "https://github.com/LiangWei88/xExtension-ArticleSummary",
"type": "git"
}, {
"url": "https://github.com/Niehztog/freshrss-af-readability",
"type": "git"
}]

View file

@ -13,15 +13,17 @@ final class QuickCollapseExtension extends Minz_Extension {
}
/**
* @return array<string, string|array<string, string>>
* @param array<string,mixed> $vars
* @return array<string,mixed>
*/
public function jsVars(): array {
return [
public function jsVars(array $vars): array {
$vars['quick_collapse'] = [
'icon_url_in' => $this->getFileUrl('in.svg'),
'icon_url_out' => $this->getFileUrl('out.svg'),
'i18n' => [
'toggle_collapse' => _t('gen.js.toggle_collapse'),
],
]
];
return $vars;
}
}

View file

@ -2,7 +2,7 @@
"name": "Quick Collapse",
"author": "romibi and Marien Fressinaud",
"description": "Quickly change from folded to unfolded articles",
"version": "1.0.1",
"version": "1.0.2",
"entrypoint": "QuickCollapse",
"type": "user"
}

View file

@ -32,9 +32,9 @@
}
const toggleElem = document.getElementById('toggle-collapse');
toggleElem.title = context.extensions.i18n.toggle_collapse;
toggleElem.innerHTML = `<img class="icon uncollapse" src="${context.extensions.icon_url_out}" alt="↕" />`;
toggleElem.innerHTML += `<img class="icon collapse" src="${context.extensions.icon_url_in}" alt="✖" />`;
toggleElem.title = context.extensions.quick_collapse.i18n.toggle_collapse;
toggleElem.innerHTML = `<img class="icon uncollapse" src="${context.extensions.quick_collapse.icon_url_out}" alt="↕" />`;
toggleElem.innerHTML += `<img class="icon collapse" src="${context.extensions.quick_collapse.icon_url_in}" alt="✖" />`;
if (context.hide_posts) {
toggleElem.classList.add('collapsed');

View file

@ -1,4 +1,4 @@
Extension for FressRSS (<https://github.com/FreshRSS>)
Extension for FreshRSS (<https://github.com/FreshRSS>)
It helps to find the feed IDs of each feed.

View file

@ -5,6 +5,22 @@ declare(strict_types=1);
final class ShowFeedIdExtension extends Minz_Extension {
#[\Override]
public function init(): void {
if (Minz_Request::paramString('c') === 'subscription') {
$this->registerTranslates();
$this->registerHook('js_vars', [$this, 'jsVars']);
Minz_View::appendScript($this->getFileUrl('showfeedid.js'));
}
}
/**
* @param array<string,mixed> $vars
* @return array<string,mixed>
*/
public function jsVars(array $vars): array {
$vars['showfeedid_i18n'] = [
'show' => _t('ext.showfeedid.show'),
'hide' => _t('ext.showfeedid.hide')
];
return $vars;
}
}

View file

@ -0,0 +1,8 @@
<?php
return array(
'showfeedid' => array(
'show' => 'Show IDs',
'hide' => 'Hide IDs',
),
);

View file

@ -0,0 +1,9 @@
<?php
return array(
'showfeedid' => array(
'show' => 'Pokaż ID',
'hide' => 'Ukryj ID',
),
);

View file

@ -1,8 +1,8 @@
{
"name": "ShowFeedID",
"author": "math-GH",
"author": "math-GH, Inverle",
"description": "Show the ID of feed and category",
"version": "0.3.1",
"version": "0.4.0",
"entrypoint": "ShowFeedID",
"type": "user"
}

View file

@ -1,38 +1,56 @@
'use strict';
const url = new URL(window.location);
if (url.searchParams.get('c') === 'subscription') {
window.addEventListener("load", function () {
// eslint-disable-next-line no-undef
const i18n = context.extensions.showfeedid_i18n;
const div = document.querySelector('h1 ~ div');
const button = document.createElement('Button');
const button = document.createElement('button');
button.classList.add('btn');
button.id = 'showFeedId';
button.innerHTML = '<img class="icon" src="../themes/icons/look.svg" /> Show IDs';
button.innerHTML = '<img class="icon" src="../themes/icons/look.svg" /> <span>' + i18n.show + '</span>';
if (new URLSearchParams(location.search).get('error')) {
button.style.display = 'block';
button.style.marginTop = '1rem';
}
div.appendChild(button);
document.getElementById('showFeedId').addEventListener('click', function (e) {
const buttonText = button.querySelector('span');
button.addEventListener('click', function () {
if (document.querySelector('.feed-id, .cat-id')) {
buttonText.innerText = i18n.show;
} else {
buttonText.innerText = i18n.hide;
}
const feeds = document.querySelectorAll('li.item.feed');
let feedId;
let feedname_elem;
feeds.forEach(function (feed) {
feedId = feed.dataset.feedId;
feedname_elem = feed.getElementsByClassName('item-title')[0];
const feedId = feed.dataset.feedId;
const feedname_elem = feed.getElementsByClassName('item-title')[0];
if (feedname_elem) {
feedname_elem.innerHTML = feedname_elem.textContent + ' (ID: ' + feedId + ')';
if (!feedname_elem.querySelector('.feed-id')) {
feedname_elem.insertAdjacentHTML('beforeend', '<span class="feed-id"> (ID: ' + feedId + ')</span>');
return;
}
feedname_elem.querySelector('.feed-id').remove();
}
});
const cats = document.querySelectorAll('div.box > ul.box-content');
let catId;
let catname_elem;
cats.forEach(function (cat) {
catId = cat.dataset.catId;
catname_elem = cat.parentElement.querySelectorAll('div.box-title > h2')[0];
const catId = cat.dataset.catId;
const catname_elem = cat.parentElement.querySelectorAll('div.box-title > h2')[0];
if (catname_elem) {
catname_elem.innerHTML = catname_elem.textContent + ' (ID: ' + catId + ')';
if (!catname_elem.querySelector('.cat-id')) {
catname_elem.insertAdjacentHTML('beforeend', '<span class="cat-id"> (ID: ' + catId + ')</span>');
return;
}
catname_elem.querySelector('.cat-id').remove();
}
});
});
}
});