-
-
Notifications
You must be signed in to change notification settings - Fork 856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: shareable user query #6052
Conversation
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs. Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people. Also add a new HTML output for people without an RSS reader. fix FreshRSS#3066 (comment) fix FreshRSS#3178 (comment)
Not completely done, but ready for tests and comments.
|
I realised that the current implementation of the user queries was doing lots of redundant SQL queries, also when the user queries were not used. So I did some more refactoring to fix that. |
I have addressed the latest details, so all done here for now (several improvements in particular of the HTML output view are left to future work). |
## Share your user queries | ||
|
||
A prerequisite is that the FreshRSS API(s) must be enabled in FreshRSS authentication settings. | ||
|
||
From the configuration page of the user queries, | ||
it is possible to share the output of the user queries with external users, | ||
in the formats HTML, RSS, and OPML: | ||
|
||
![Share user query](../img/users/user-query-share.png) | ||
|
||
> ℹ️ Note that the sharing as OPML is only available for user queries based on all feeds, a category, or a feed. | ||
> Sharing by OPML is **not** available for queries based on user labels or favourites or important feeds, | ||
> to avoid leaking some feed details in an unintended manner. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us think to give a note here, that this feature will be available with 1.24 (it will note, that it is not yet available)
<div class="form-group"> | ||
<div class="group-controls"> | ||
<label class="checkbox" for="shareRss"> | ||
<input type="checkbox" name="query[shareRss]" id="shareRss" value="1" <?= $this->query->shareRss() ? 'checked="checked"' : ''?> /> | ||
<?= _t('conf.query.filter.shareRss') ?> | ||
</label> | ||
<?php if ($this->query->sharedUrlRss() !== ''): ?> | ||
<ul> | ||
<li><a href="<?= $this->query->sharedUrlHtml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.html') ?></a></li> | ||
<li><a href="<?= $this->query->sharedUrlRss() ?>"><?= _i('link') ?> <?= _t('conf.query.share.rss') ?></a></li> | ||
</ul> | ||
<?php endif; ?> | ||
</div> | ||
<div class="group-controls"> | ||
<label class="checkbox" for="shareOpml"> | ||
<input type="checkbox" name="query[shareOpml]" id="shareOpml" value="1" <?= $this->query->shareOpml() && $this->query->safeForOpml() ? 'checked="checked"' : '' ?> | ||
<?= $this->query->safeForOpml() ? '' : 'disabled="disabled"' ?> /> | ||
<?= _t('conf.query.filter.shareOpml') ?> | ||
</label> | ||
<?php if ($this->query->sharedUrlOpml() !== ''): ?> | ||
<ul> | ||
<li><a href="<?= $this->query->sharedUrlOpml() ?>"><?= _i('link') ?> <?= _t('conf.query.share.opml') ?></a></li> | ||
</ul> | ||
<?php endif; ?> | ||
</div> | ||
<p class="help"><?= _i('help') ?> <?= _t('conf.query.share.help') ?></a></p> | ||
<p class="help"><?= _i('help') ?> <?= _t('conf.query.help') ?></a></p> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed now used for more than the mobile apps.
Note that WebSub, which is also an API, has its own internal option
There is no log entry if the user query is not available for sharing ( |
Inded (Edit: Now that I think about it, what I did in the main page is to fetch 1 article more than demanded to know whether there is more or not)
Yes, this is by design as this can better be seen and reacted upon from the Web server logs (e.g. with Fail2Ban or similar) as I would rather avoid giving the possibility to an external client to too easily flood the FreshRSS user logs. We return different HTTP status codes (404, 422, 503...), which are visible in the Web server logs. |
* OPML regression due to *shared user queries* (the XPath attributes were not exported anymore) FreshRSS#6052 * Add master token to HTML Meta RSS link and OPML link FreshRSS#6159 (reply in thread)
* OPML regression due to *shared user queries* (the XPath attributes were not exported anymore) #6052 * Add master token to HTML Meta RSS link and OPML link #6159 (reply in thread)
'state' => 'State', | ||
'tags' => 'Display by label', | ||
'type' => 'Type', | ||
), | ||
'get_all' => 'Display all articles', | ||
'get_all_labels' => 'Display articles with any label', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it obsolete? I cannot find any place where it is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, I cannot find all this "get_...." labels used somewhere....
@Alkarex Could you help me please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is because they are used by string concatenation (which I would like to get rid of precisely because it makes validation and maintenance quite challenging). And there is another layer of property with another name for the getter, which makes it even more difficult to search:
<li class="item"><?= _t('conf.query.get_' . $query->getGetType(), $query->getGetName()) ?></li> |
<?php if (!empty($remainingTags)): // more than 7 tags: show dropdown menu ?> | ||
<li class="item tag"> | ||
<div class="dropdown"> | ||
<div id="dropdown-tags2-<?= $this->entry->id() ?>" class="dropdown-target"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes an regression :/
If the tags are shown above and below an article the ID needs to be different from eachother (above: tags
and below tags2
).
With tags.html
, It is always tags2
. Any idea how to handle it?
ping @Alkarex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick suggestion: #6990
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would fix it but it does not make me happy because of the very large number that is added.
It would be useful if a variable could be set in normal.html (i.e. $foo = 1 for header tags and $foo = 2 for footer tags). And in tags.html $foo
is used. But I cannot find a solution that makes it possible to have the variable setter in normal.phtml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the issue with the number? It is rarely used
* Fix tag ID uniqueness fix #6052 (comment) * Update app/views/helpers/index/tags.phtml Co-authored-by: maTh <[email protected]> --------- Co-authored-by: maTh <[email protected]>
Share the output of a user query by RSS / HTML / OPML with other people through unique URLs.
Replaces the global admin token, which was the only option (but unsafe) to share RSS outputs with other people.
Also add a new HTML output for people without an RSS reader.
fix #3066 (comment)
fix #3178 (comment)