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

Subscriptions #61

Closed
8 tasks done
makew0rld opened this issue Aug 3, 2020 · 6 comments
Closed
8 tasks done

Subscriptions #61

makew0rld opened this issue Aug 3, 2020 · 6 comments
Assignees
Labels
enhancement New feature or request roadmap A user-facing feature on the roadmap. UI Deals with the visual user interface
Milestone

Comments

@makew0rld
Copy link
Owner

makew0rld commented Aug 3, 2020

  • A dynamically constructed (but possibly cached) feed viewer page, similar to the way CAPCOM and Spacewalk look
  • Automatic detection of feed files
    • Filenames: atom.xml, feed.xml, *.rss, *.atom, feed.json
    • Mimetypes: application/atom+xml, application/rss+xml, application/json+feed
    • User will be prompted to add the feed
  • Some shortcut or button to add a URL at any time
    • If it's a valid feed it will be added as one, otherwise the page will be tracked
  • A way to edit the feed list and remove feeds
    • Maybe by visiting the page or any post URL and doing a delete shortcut?
  • Pagination

When should the feed view be regenerated?

  • On hard-reload of the feed viewer
  • On every X load of the feed viewer
  • At browser start
  • Every X minutes in a separate thread (30 mins by default)
@makew0rld makew0rld added enhancement New feature or request UI Deals with the visual user interface roadmap A user-facing feature on the roadmap. labels Aug 3, 2020
@makew0rld makew0rld added this to the v1.5.0 milestone Aug 3, 2020
@makew0rld
Copy link
Owner Author

makew0rld commented Aug 7, 2020

gofeed will be used for RSS, Atom, and JSON feed parsing.

Development is on the feeds branch.

@makew0rld makew0rld modified the milestones: v1.5.0, v1.6.0 Aug 30, 2020
@makew0rld makew0rld modified the milestones: v1.6.0, v1.7.0 Oct 1, 2020
@makew0rld
Copy link
Owner Author

makew0rld commented Nov 20, 2020

The name for this needs to be unified before merging. Feeds are "subscribed" to, pages are "tracked", but also feeds are "tracked", etc. The name "feeds" is used throughout the code, but this is not representative due to the page tracking functionality.

Maybe just "Subscriptions"?

  • subscribe to this feed
  • subscribe to this page
  • remove this subscription / unsubscribe
  • refresh/update this subscription

@makew0rld makew0rld mentioned this issue Nov 20, 2020
16 tasks
@makew0rld makew0rld self-assigned this Nov 23, 2020
@makew0rld
Copy link
Owner Author

makew0rld commented Nov 27, 2020

The "gemini feed format" (gemini://gemini.circumlunar.space/docs/companion/subscription.gmi) will not be supported initially. A separate issue will be opened, and it will likely be in a later release.

I plan on supporting it, but the UX of that is not super clean. To an unaware user, the difference between subscribing to the page vs subscribing to the page as a feed is not obvious. It might have to come in a future release, as I think the current features cover most use cases for now.

  • me, on Mastodon

Right now when visiting a page or feed, you can press Ctrl-X and it will ask you if you want to track it. One solution would be to check if the page is a valid gemini feed when Ctrl-X is pressed. But then you need to ask the user whether they want to track it as a page, or a gemini feed, and that's sorta hard to explain.

  • me, on IRC

@makew0rld
Copy link
Owner Author

makew0rld commented Nov 28, 2020

Sometimes corrupted JSON files are being written. This is critical error that must be discovered and fixed before merging into master. Here is an example of the bottom of a corrupted file:

    },
    "gemini://republic.circumlunar.space/users/xkp/gemlog/": {
      "hash": "24860ed36333d360817b5d35614fdd714266df360c54e35a2f1ac1ce7375d82a",
      "changed": "2020-11-24T18:34:49.418540845Z"
    }
  }
}
r.space/users/xkp/gemlog/": {
      "hash": "24860ed36333d360817b5d35614fdd714266df360c54e35a2f1ac1ce7375d82a",
      "changed": "2020-11-24T18:34:49.418540845Z"
    }
  }
}
.space/users/xkp/gemlog/": {
      "hash": "24860ed36333d360817b5d35614fdd714266df360c54e35a2f1ac1ce7375d82a",
      "changed": "2020-11-24T18:34:49.418540845Z"
    }
  }
}

The corrupted part begins on line 8. The entries don't have preceding quotes, and are also not inside the final closing brace on line 7. The hash and times are the same, suggesting this is maybe some sort of double write issue. Maybe mutexes are not being used in some function where they should be.

Another issue was discovered where the entire file was appended to itself a second time.

Even after adding f.Sync(), which should have been there originally, this still happens.

Additionally, Amfora starts even if the JSON file is malformed, which it should not. Fixed by using json.Unmarshal instead of json.Decoder. See here for more details.


This appears to have been solved (not committed yet) by replacing json.Encoder with json.Marshal and then writing those bytes to the file with ioutil.WriteFile. Although json.Encoder is intended for streams (see link above) and was misused here, I'm confused as to what the issue was, it still shouldn't be causing the bad writes described above.

In any case, it seems to be fixed. The errors were quite regular and now have not occurred at all when updating, adding, and removing subscriptions. This fix should be fully confirmed through more testing before merging to master.

This was all resolved in 1a2fba9.

makew0rld added a commit that referenced this issue Dec 6, 2020
More info on corrupt reads and writes:
#61 (comment)

The panic was occuring due to lines like:

    if u[:6] == "about:"

These would cause panics for URIs that were shorter than 6, like "docs/".
strings.HasPrefix was used instead to fix this.
@makew0rld makew0rld changed the title Feed subscription & page changes Subscriptions Dec 6, 2020
makew0rld added a commit that referenced this issue Dec 7, 2020
See #61 for details on this feature.
@makew0rld
Copy link
Owner Author

Merged in 6d8e823! 😄

@makew0rld makew0rld mentioned this issue Dec 11, 2020
24 tasks
@makew0rld
Copy link
Owner Author

Other issues related to subscription: #144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request roadmap A user-facing feature on the roadmap. UI Deals with the visual user interface
Projects
None yet
Development

No branches or pull requests

1 participant