miniflux_sanity 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -21
- data/assets/{miniflux-sanity_cli.png → miniflux-sanity_cli_v0.1.0.png} +0 -0
- data/assets/miniflux-sanity_cli_v0.2.0.png +0 -0
- data/lib/miniflux_sanity.rb +10 -10
- data/miniflux_sanity.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24b4e6944c19140cb9d85c4a51ac6b60882c7ed5b4768bba220121bd986ac1cb
|
4
|
+
data.tar.gz: 3640ca287dd6a50314b766a77c0738ec79245ee5753f2e906501b33623b25168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '028d766d3c96ba1f98d742168e9d7fe73cc2c0ac27fb933d0e9a59a74ab9d51477085a91c5e42614f4c3edfc63add41a8482df6887d5a7ca3f4506e5a0b47ef2'
|
7
|
+
data.tar.gz: 216ca906079de0dc2254f01a7152d5b4362e3d50a758c135ed5b437e40b07723f739d873a387faf97e2aa7420deb0ca9f75462abfd2787d1ec53b2b1ef0e514f
|
data/README.md
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
# miniflux-sanity
|
2
2
|
|
3
|
-
|
3
|
+

|
4
4
|
|
5
|
-
|
5
|
+
👩💻 A Ruby command-line utility to mark older entries as read on your Miniflux app. Defaults to items older than a conservative 30 days.
|
6
6
|
|
7
|
-
|
7
|
+
🚀 Switch to 1 day and run daily to wake up to a fresh feed.
|
8
8
|
|
9
|
-
|
9
|
+
⭐ Please star the project if you like it or use it -- and want to send some internet support. 🥰
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-

|
11
|
+

|
14
12
|
|
15
13
|
## Motivation
|
16
14
|
|
17
|
-
If I haven't read something in the preceding
|
15
|
+
If I haven't read something in the preceding week, it's unlikely I ever will. Miniflux doesn't offer an _archive_ option so we mark entries as read instead. All it really does is offer me a saner overview of "unread" items at the top.
|
18
16
|
|
19
17
|
As is usually the case for me, I wanted to build something meaningful as I pick up Ruby again. This was a small use-case that was a good first challenge to tackle.
|
20
18
|
|
@@ -24,15 +22,24 @@ The code is admittedly not perfect. I welcome any constructive criticism or feed
|
|
24
22
|
|
25
23
|
- Uses token authentication
|
26
24
|
- Supports cloud and self-hosted Miniflux apps
|
27
|
-
-
|
25
|
+
- Configurable number of days before which to mark items as read
|
28
26
|
- Resumes marking as read if interrupted
|
29
27
|
|
28
|
+
~Note: A common concern might be if this muddies your actual read history. Thanks to the way Miniflux works, this surprisingly does not meddle with _your_ history. It only marks items as read. That is it!~ This was untrue, my apologies!
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
You must have Ruby available on your system/shell.
|
33
|
+
|
34
|
+
Install by running `gem install miniflux_sanity`.
|
35
|
+
|
36
|
+
All command line options can be viewed by running `miniflux_sanity --help`.
|
37
|
+
|
30
38
|
## To-do
|
31
39
|
|
32
|
-
- [ ] Publish as a RubyGem for easier usage (see the [feature/rubygem](https://github.com/hirusi/miniflux-sanity/tree/feature/rubygem) branch)
|
33
40
|
- [ ] Unit testing
|
34
41
|
- [ ] Resume fetching if command crashes in between
|
35
|
-
- [ ]
|
42
|
+
- [ ] Optionally, if an item is starred _and_ unread, don't mark it as read.
|
36
43
|
- This could lend itself to a nice workflow where my "to-read" can be starred while scanning through items.
|
37
44
|
|
38
45
|
## Goals
|
@@ -43,22 +50,22 @@ The code is admittedly not perfect. I welcome any constructive criticism or feed
|
|
43
50
|
- Work with Ruby's `File` API
|
44
51
|
- Interact with an API using an HTTP library
|
45
52
|
|
46
|
-
## Usage
|
47
|
-
|
48
|
-
You must have Ruby available on your system/shell.
|
49
|
-
|
50
|
-
Install by running `gem install miniflux_sanity`. All command line options can be viewed by running `miniflux_sanity --help`.
|
51
|
-
|
52
53
|
## Development
|
53
54
|
|
54
55
|
The Ruby version is specified in `.ruby-version`. `rbenv` is able to read and set the correct local version in your shell.
|
55
56
|
|
56
57
|
- `git clone git@github.com:hirusi/miniflux-sanity.git`
|
57
58
|
- `cd miniflux-sanity`
|
58
|
-
- `cp .env.template .env`
|
59
|
-
- Update the `.env` file as required.
|
60
|
-
- You'll need a token from your Miniflux app under `Settings > API Keys -> Create a new API key`
|
61
59
|
- Install the dependencies: `bundle`
|
62
|
-
-
|
60
|
+
- After making desired changes, install locally without publishing to RubyGems: `bundle exec rake install`
|
61
|
+
- I don't know a better workflow at the moment, sorry. 🤷♀️
|
62
|
+
- Run the utility: `miniflux_sanity`
|
63
|
+
- You'll need a token from your Miniflux app under `Settings > API Keys -> Create a new API key`
|
63
64
|
|
64
65
|
If you have a Docker setup to contribute using Alpine OS as its base, I'd be very happy to merge your PR.
|
66
|
+
|
67
|
+
## Publishing
|
68
|
+
|
69
|
+
- Test changes locally with an install: `bundle exec rake install`
|
70
|
+
- Update version in gemspec, commit
|
71
|
+
- Publish when happy: `bundle exec rake release`
|
File without changes
|
Binary file
|
data/lib/miniflux_sanity.rb
CHANGED
@@ -18,7 +18,7 @@ class MinifluxSanity
|
|
18
18
|
if @@cache_client.last_fetched.nil?
|
19
19
|
false
|
20
20
|
else
|
21
|
-
Date.parse(@@cache_client.last_fetched) == Date.today
|
21
|
+
Date.parse(@@cache_client.last_fetched.to_s) == Date.today
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -33,6 +33,7 @@ class MinifluxSanity
|
|
33
33
|
def fetch_entries
|
34
34
|
if self.last_fetched_today?
|
35
35
|
puts "Last run was today, skipping fetch."
|
36
|
+
exit
|
36
37
|
else
|
37
38
|
puts "Now collecting all unread entries before the specified date."
|
38
39
|
end
|
@@ -42,7 +43,7 @@ class MinifluxSanity
|
|
42
43
|
size = 0
|
43
44
|
limit = 250
|
44
45
|
count = limit
|
45
|
-
until count < limit
|
46
|
+
until count < limit do
|
46
47
|
|
47
48
|
entries = @@miniflux_client.get_entries before: @@config.cutoff_timestamp, offset: size, limit: limit
|
48
49
|
|
@@ -51,14 +52,8 @@ class MinifluxSanity
|
|
51
52
|
exit true
|
52
53
|
end
|
53
54
|
|
54
|
-
entries.
|
55
|
-
|
56
|
-
unless is_older_than_cutoff? published_at: entry["published_at"]
|
57
|
-
true
|
58
|
-
else
|
59
|
-
false
|
60
|
-
end
|
61
|
-
end
|
55
|
+
# TODO This *should* be a bang-style method based on how Ruby is written. It should modify the entries list itself. Probably if we modeled an Entry and Entries... we could add this as a method on the Entries Model.
|
56
|
+
entries = self.filter_before_cutoff entries: entries
|
62
57
|
|
63
58
|
count = entries.count
|
64
59
|
size = size + count
|
@@ -74,6 +69,11 @@ class MinifluxSanity
|
|
74
69
|
end
|
75
70
|
end
|
76
71
|
|
72
|
+
def filter_before_cutoff(entries:)
|
73
|
+
# Just for some extra resilience, we make sure to check the published_at date before we filter it. This would be helpful where the Miniflux API itself has a bug with its before filter, for example.
|
74
|
+
entries.filter { |entry| is_older_than_cutoff? published_at: entry["published_at"] }
|
75
|
+
end
|
76
|
+
|
77
77
|
def mark_entries_as_read
|
78
78
|
start = 0
|
79
79
|
interval = 10
|
data/miniflux_sanity.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'miniflux_sanity'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.1'
|
4
4
|
s.required_ruby_version = Gem::Requirement.new(">= 2.7.1")
|
5
|
-
s.date = '2020-09-
|
5
|
+
s.date = '2020-09-23'
|
6
6
|
s.summary = "Mark items older than specified time as read in Miniflux."
|
7
7
|
s.description = "Command line utility to mark items older than specified time as read in Miniflux."
|
8
8
|
s.authors = ["hirusi"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miniflux_sanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hirusi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Command line utility to mark items older than specified time as read
|
14
14
|
in Miniflux.
|
@@ -29,7 +29,8 @@ files:
|
|
29
29
|
- Rakefile
|
30
30
|
- assets/miniflux-sanity_after.png
|
31
31
|
- assets/miniflux-sanity_before.png
|
32
|
-
- assets/miniflux-
|
32
|
+
- assets/miniflux-sanity_cli_v0.1.0.png
|
33
|
+
- assets/miniflux-sanity_cli_v0.2.0.png
|
33
34
|
- bin/miniflux_sanity
|
34
35
|
- lib/config.rb
|
35
36
|
- lib/hash.rb
|