1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00
Commit graph

1979 commits

Author SHA1 Message Date
dependabot[bot]
c81e17c20d build(deps): bump github.com/PuerkitoBio/goquery from 1.10.0 to 1.10.1
Bumps [github.com/PuerkitoBio/goquery](https://github.com/PuerkitoBio/goquery) from 1.10.0 to 1.10.1.
- [Release notes](https://github.com/PuerkitoBio/goquery/releases)
- [Commits](https://github.com/PuerkitoBio/goquery/compare/v1.10.0...v1.10.1)

---
updated-dependencies:
- dependency-name: github.com/PuerkitoBio/goquery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 15:08:35 -08:00
Frédéric Guillot
5549f75dd7 fix(sanitizer): allow <hr> tags 2024-12-27 13:56:06 -08:00
Frédéric Guillot
fc3c4873e5 doc: add note regarding validateUsername 2024-12-26 15:05:15 -08:00
Frédéric Guillot
b87c547a07 ci: run Docker tests only when the Dockerfiles are modified 2024-12-26 14:58:32 -08:00
Frédéric Guillot
3466e9e2d6
ci: avoid building Linux packages for each pull-request 2024-12-26 14:57:52 -08:00
Julien Voisin
8df4b780a8
refactor(readingtime): replace whatlanggo with an ad-hoc implementation
The package `github.com/abadojack/whatlanggo` is unmaintained since 5 years, is
overkill for simply detecting CJK, and is quite slow.
2024-12-26 14:21:07 -08:00
Julien Voisin
e22520fc55
feat: validate usernames upon creation
The validation doesn't apply to already created usernames.

This should close #925
2024-12-26 14:14:07 -08:00
Julien Voisin
518bc4d6ff
refactor(database): add special handling for PostgreSQL-specific migrations 2024-12-26 14:09:37 -08:00
Julien Voisin
89620a7dd2
refactor(oauth2): no need to use io.WriteString when sha256 provides a way to obtain a sum in a single call 2024-12-26 10:39:55 -08:00
Julien Voisin
bbfe39722a
ci: tighten the CodeQL rules
- don't run CodeQL on test files
- don't run CodeQL if no `.go` nor `.js` file have been modified.
2024-12-26 10:33:41 -08:00
Julien Voisin
f3989cdb2f
ci: checkout before installing Go
Obtaining the code before deploying go allows better caching, as the go.sum
file becomes available.

See https://github.com/actions/setup-go/issues/281
2024-12-23 21:24:22 -08:00
Julien Voisin
195b75d185
refactor(rewriter): use custom title case converter implementation instead of golang.org/x/text/cases.Title()
The implementation is equivalent to
`cases.Title(language.English).String(strings.ToLower(…))`,
and this is the only place in miniflux where
"golang.org/x/text/cases" and "golang.org/x/text/language"
are (directly) used.

This reduces the binary size from 27015590 to
26686112 on my machine.

Kudos to https://gsa.zxilly.dev for making it straightforward to catch things
like this.
2024-12-23 21:16:02 -08:00
Julien Voisin
f52411f734
ci: only run -race -cover on Ubuntu
The coverage information isn't used anywhere in the CI, so no need to have it
for every OS. As for `-race`, there is no point in using it everywhere, one
time should be enough, especially since it's taking a lot of time on Windows.
2024-12-23 11:45:45 -08:00
Julien Voisin
b93543f416
feat: replace %{?systemd_requires} with %{?systemd_ordering}
As said [in the documentation](https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_dependencies_on_the_systemd_package):

> If the package wants to use systemd tools if they are available, but does not
want to declare a dependency, then the `%{?systemd_ordering}` macro MAY be used
as a weaker form of %{?systemd_requires} that only declares an ordering during
an RPM transaction.

See 2424b6bd71
and https://pagure.io/packaging-committee/issue/644 for more information.

And also use `--setopt=install_weak_deps=False` to avoid installing a lot of
useless dependencies.
2024-12-23 11:34:29 -08:00
Julien Voisin
057f760196
ci: don't run go vet ./... as it's run as part of golangci-lint
See https://golangci-lint.run/usage/linters/#govet
2024-12-22 22:04:00 -08:00
Julien Voisin
28fe053329
ci: don't specify languages for CodeQL
As stated in the [documentation](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#changing-the-languages-that-are-analyzed):

> CodeQL code scanning automatically detects code written in the supported languages.

This will also reduce the number of CodeQL jobs from two to one.

See #3029
2024-12-22 22:00:06 -08:00
Frédéric Guillot
d345c87376 docs(changelog): update release notes for version 2.2.4 2024-12-20 13:05:52 -08:00
jvoisin
bd91e5f320 Add more referer spoofing
Based on #2261. For moyu.im/jandan.net, see https://github.com/DIYgod/RSSHub/issues/11528
2024-12-20 11:53:38 -08:00
dependabot[bot]
276b2d8b0b build(deps): bump golang.org/x/net from 0.32.0 to 0.33.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-18 17:41:28 -08:00
Sevi.C
bca9bea676
feat: add date-based entry filtering rules 2024-12-16 20:38:20 -08:00
dependabot[bot]
7346d751cc build(deps): bump library/alpine in /packaging/docker/alpine
Bumps library/alpine from 3.20 to 3.21.

---
updated-dependencies:
- dependency-name: library/alpine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-16 19:35:31 -08:00
jvoisin
7939b54341 Resize favicons to 32x32 to account of scaling
As suggested by @michaelkuhn in https://github.com/miniflux/v2/pull/2998#issuecomment-2546702212
2024-12-16 19:28:38 -08:00
jvoisin
a06657b74d Factorise a line in internal/ui/static/js/app.js 2024-12-15 20:54:17 -08:00
jvoisin
2df59b4865 Refactor internal/reader/readability/testdata
- Use chained strings.Contains instead of a regex for
  blacklistCandidatesRegexp, as this is a bit faster
- Simplify a Find.Each.Remove to Find.Remove
- Don't concatenate id and class for removeUnlikelyCandidates, as it makes no
  sense to match on overlaps. It might also marginally improve performances, as
  regex now have to run on two strings separately, instead of both.
- Add a small benchmark
2024-12-15 20:52:32 -08:00
Julien Voisin
777d0dd248
feat: resize favicons before storing them
Some websites are using images of O(10kB) when not )O(100kB) for their
favicons. As miniflux only displays them with a 16x16 resolution, let's do our
best to resize them before storing them in the database. This should make
miniflux consume less bandwidth when serving pages, for the joy of mobile users
on a small data plan.

Of course, images that already are 16x16 aren't resized.
2024-12-15 20:47:19 -08:00
Julien Voisin
cfda948c3a
refactor(rewriter): avoid the use of regex in addDynamicImage
See https://dustri.org/b/parsing-noscript-tags-with-goquery.html for the whole
story.
2024-12-15 17:56:39 -08:00
jvoisin
14a6e8ed3a Factorise .pagination-next and .pagination-last together 2024-12-15 17:03:09 -08:00
jvoisin
c3e842eba6 Remove -webkit-clip-path
https://caniuse.com/?search=clip-path says that `clip-path`
is supported since Safari 13.1
2024-12-15 17:03:09 -08:00
jvoisin
fd9cfd757a Replace -ms-text-size-adjust with text-size-adjust
https://caniuse.com/?search=text-size-adjust says that
`ms-text-size-adjust` is supported in Edge.
2024-12-15 17:03:09 -08:00
Julien Voisin
945d436055
refactor(rewriter): replace regex with URL parsing for referrer override
No need for brittle regex when matching plain strings or domain names.
This should save some negligible amount of heap memory as well as
tremendously speeding up the matching.
2024-12-13 14:50:12 -08:00
Frédéric Guillot
c3649bd6b1 refactor(rewrite): remove unused function arguments 2024-12-12 21:10:35 -08:00
Julien Voisin
6ad5ad0bb2
refactor(readability): various improvements and optimizations
- Replace a completely overkill regex
- Use `.Remove()` instead of a hand-rolled loop
- Use a strings.Builder instead of a bytes.NewBufferString
- Replace a call to Fprintf with string concatenation, as the latter are much
  faster
- Remove a superfluous cast
- Delay some computations
- Add some tests
2024-12-12 20:41:56 -08:00
Frédéric Guillot
113abeea59 test(rewrite): add unit test for referer rewrite function 2024-12-12 20:11:47 -08:00
Julien Voisin
e6185b1393
refactor: use min/max instead of math.Min/math.Max
This saves a couple of back'n'forth casts.
2024-12-11 19:43:14 -08:00
Julien Voisin
1b0b8b9c42
refactor: use a better construct than doc.Find(…).First()
As mentioned in goquery's documentation (https://pkg.go.dev/github.com/PuerkitoBio/goquery#Single):

> By default, Selection.Find and other functions that accept a selector string
to select nodes will use all matches corresponding to that selector. By using
the Matcher returned by Single, at most the first match will be selected.
>
> The one using Single is optimized to be potentially much faster on large documents.
2024-12-11 19:40:55 -08:00
dependabot[bot]
68448b4abb build(deps): bump golang.org/x/crypto from 0.30.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 19:31:26 -08:00
Julien Voisin
3caa16ac31
refactor(processor): use URL parsing instead of a regex 2024-12-11 19:30:59 -08:00
Julien Voisin
637fb85de0
refactor(handler): delay store.UserByID as much as possible
In internal/reader/handler/handler.go:RefreshFeed, there is a call to
store.UserByID pretty early, which is only used for
originalFeed.WithTranslatedErrorMessage(localizedError.Translate(user.Language)
Its only other usage is in processor.ProcessFeedEntries(store, originalFeed,
user, forceRefresh), which is pretty late in RefreshFeed, and only called if
there are new items in the feed. It makes sense to only fetch the user's
language if the error localization function is used.

Calls to `store.UserByID` take around 10% of the CPU time of RefreshFeed in my
profiling.

This commit also makes `processor.ProcessFeedEntries` take a `userID` instead
of a `user`, to make the code a bit more concise.

This should close #2984
2024-12-09 19:32:59 -08:00
Julien Voisin
02c6d14659
refactor(subscription): use strings.HasSuffix instead of a regex in FindSubscriptionsFromYouTubePlaylistPage 2024-12-09 17:19:28 -08:00
Julien Voisin
728423339a
refactor(sanitizer): improve rewriteIframeURL()
- Use `url.Parse` instead of a regex, as this is much faster and way more robust
- Add support for Vimeo's Do Not Track parameter
2024-12-09 17:14:54 -08:00
Julien Voisin
eed3fcf92a
refactor(locale): delay parsing of translations until they're used
While doing some profiling for #2900, I noticed that
`miniflux.app/v2/internal/locale.LoadCatalogMessages` is responsible for more
than 10% of the consumed memory. As most miniflux instances won't have enough
diverse users to use all the available translations at the same time, it
makes sense to load them on demand.

The overhead is a single function call and a check in a map, per call to
translation-related functions.
2024-12-09 17:05:14 -08:00
Qeynos
d5cfcf8956
feat(locale): update Chinese translation 2024-12-08 17:06:29 -08:00
Julien Voisin
dea46ac0ea
refactor: optimize sanitizeAttributes
- Use string concatenation instead of `Sprintf`, as this is much faster, and the
  call to `Sprintf` is responsible for 30% of the CPU time of the function
- Anchor the youtube regex, to allow it to bail early, as this also account for
  another 30% of the CPU time. It might be worth chaining calls to `TrimPrefix`
  and check if the string has been trimmed instead of using a regex, to speed
  things up even more, but this needs to be benchmarked properly.
2024-12-08 14:42:18 -08:00
Julien Voisin
30c44380e0
refactor: get rid of numberOfPluralFormsPerLanguage test-only variable
The `numberOfPluralFormsPerLanguage` variable is only used for tests, so it
should be declared in the test file.
2024-12-08 14:39:11 -08:00
Julien Voisin
a913f3f75f
feat(rewrite)!: remove parse_markdown rewrite rule
It was added in 2022 by #1513, to support blog.laravel.com, which has
since switched to HTML. The Atom 0.3/1.0, RSS 1.0/2.0, RDF, and JSON formats
don't support markdown in their spec, and any website serving it there should
be considered as buggy and fixed.

This shaves off 2MB from the miniflux binary, which is quite steep for a
feature that nobody is/should be using, and remove a dependency which is always
a good thing.
2024-12-08 14:34:47 -08:00
AiraNadih
c1ef986cab fix(consistency): align feed modification behavior between API and UI 2024-12-08 10:49:14 -08:00
Julien Voisin
2671f57edd
refactor(readability): simplify the regexes in internal/reader/readability/readability.go
- Use strings.ToLower() instead of having case-insensitive regex
- Remove overlapping words in the regex
- Split a condition to increase readability
2024-12-07 16:56:19 -08:00
jvoisin
2f56ebd3a6 Remove a now-useless function 2024-12-07 16:50:18 -08:00
jvoisin
059f5c0905 Inline a condition 2024-12-07 16:50:18 -08:00
jvoisin
58178d90cb Refactor Sanitize
- Use `token.String()` instead of `html.EscapeString(token.Data)`
- Refactor conditions to highlight their similitude, enabling further
  refactoring

This refactoring brings forth at least one bug: `tagStack` is never emptied.
2024-12-07 16:50:18 -08:00