Skip to content
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

Edit feed url easily. FEATURE REQUEST #666

Closed
kalak-sudo opened this issue Apr 17, 2020 · 15 comments
Closed

Edit feed url easily. FEATURE REQUEST #666

kalak-sudo opened this issue Apr 17, 2020 · 15 comments

Comments

@kalak-sudo
Copy link

Hello!

I am a happy user of NEWS, and sometimes some feeds just chage the url, and I have to delete them and add them again with a new url.

Is there a way to edit urls of the feeds? With right-click would be great, next to the "rename" option for example.

Cheers!

@bendem
Copy link

bendem commented Apr 21, 2020

This. Otherwise you lose the history of your feed.

@SMillerDev
Copy link
Contributor

The only way to identify a feed is through it's URL. It's technically impossible to change the feed URL since that would make it another feed.

@powerpaul17
Copy link
Contributor

Seems unlikely that a feed does not have an id in the database...

@bendem
Copy link

bendem commented Apr 21, 2020

If I follow what you are saying, the feature request cannot be implemented because it requires being implemented? If the current way to identify a feed is by its url, then the fix is to add another way to identify the feed.

Updating existing feeds is not a crazy feature so it should imo be supported in news. If it's too hard to refactor the code to use an id where needed, the existing items can be updated so their url point to the updated feed.
At least leave the issue open.

@bendem
Copy link

bendem commented Apr 21, 2020

Seems unlikely that a feed does not have an id in the database...

Heh, I thought I'd trust the maintainer, but yeah, feeds are not identified by their url at all.

/**
* @NoAdminRequired
*
* @param int $feedId
* @param bool $pinned
* @param bool $fullTextEnabled
* @param int $updateMode
* @param int $ordering
* @param int $folderId
* @param string $title
*/
public function patch(
$feedId,
$pinned = null,
$fullTextEnabled = null,
$updateMode = null,
$ordering = null,
$title = null,
$folderId = null
) {

@SMillerDev
Copy link
Contributor

The feedID is a hash of the URL when you look in the data structure instead of the API. It can be changed but that would means that a lot of operations that get done on the URL will break. Just tell the author to stop changing the URL of the RSS feed, your RSS aggregator shouldn't have to work around it.

@bendem
Copy link

bendem commented Apr 21, 2020

The feedID is a hash of the URL when you look in the data structure instead of the API.

It is not: GET /index.php/apps/news/items?id=44&limit=40&oldestFirst=false&search=&showAll=true&type=0

@SMillerDev
Copy link
Contributor

The feedID is a hash of the URL when you look in the data structure instead of the API.

It is not: GET /index.php/apps/news/items?id=44&limit=40&oldestFirst=false&search=&showAll=true&type=0

That's the API. https://github.com/nextcloud/news/blob/master/lib/Service/FeedService.php#L108 this is the data structure.

@bendem
Copy link

bendem commented Apr 21, 2020

Yes, in which the url hash is only used to check if a feed already exists for that url.

$hash = $feed->getUrlHash();
$this->feedMapper->findByUrlHash($hash, $userId);
throw new ServiceConflictException(
$this->l10n->t('Can not add feed: Exists already')
);

The item is linked to the feed using the feed id.

$item->setFeedId($existingFeed->getId());

@SMillerDev
Copy link
Contributor

Yes, in which the url hash is only used to check if a feed already exists for that url.

That seems like a pretty useful feature.

If you want to make a pull request changing all this and making sure no existing features break be my guest, but you don't need to have an open issue for that so I'm keeping this closed.

@bendem
Copy link

bendem commented Apr 21, 2020

This is completely beside the point. Having a hash of the feed's url doesn't disallow updating said url in any way.

PATCH /.../news/feed/:id
{ "url": "new url" }

The method already exists, it just needs to support a new field. Sure the url_hash field will need to be recomputed and maybe we will need to hit the database to check if there isn't another feed with that updated hash.

I'm not sure why you keep focussing on that url hash which is not used in any way related to this feature request.

@bendem
Copy link

bendem commented Apr 21, 2020

For the ones that actually need this, if you have access to the database, you can use this method (I don't think sqlite has a md5 function so beware):

nextcloud=> select
  id, url, link, location, url_hash, md5(url), url_hash = md5(url)
from oc_news_feeds
where url ilike '%grafana%';
-[ RECORD 1 ]--------------------------------
id       | 47
url      | https://grafana.com/blog/index.xml
link     | https://grafana.com/blog/
location | https://grafana.com/blog/index.xml
url_hash | 02bc001ad71492850555fe4a260a8455
md5      | 02bc001ad71492850555fe4a260a8455
?column? | t

nextcloud=> update oc_news_feeds
set
  url = 'https://grafana.com/blog/index.xml',
  location = 'https://grafana.com/blog/index.xml',
  link = 'https://grafana.com/blog/',
  url_hash = md5('https://grafana.com/blog/index.xml')
where id = 47;
UPDATE 1

@elperepat
Copy link

Thanks bendem: My national newspaper just changed it's feeds' url and was stuck to lose history by recreating a new feed. I updated the table directly like you suggested using phpmyadmin and it worked.

The solution proposed by SMillerDev asking them not to change their feed is not really a good one. It doesn't seem to bother him, but I guess they'll implement this when it happens to them.

Thanks again!

@Terrox
Copy link

Terrox commented Jun 8, 2020

This should be reopened, the url_hash issue does not make it impossible since it only is used to check for duplicates.

@centralscrutinizer21
Copy link

I also would like to reopen this issue. My use case is that I have several feeds from nitter istances, and those tends to stop working for any reason after sometime. Being able to modify the URL would be just perfect

@nextcloud nextcloud locked and limited conversation to collaborators Aug 14, 2022
@Grotax Grotax closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants