1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

feat(ui): add user setting to control target="_blank" on links

Rationale: Opening links in the current tab is the default browser behavior.

Using `target="_blank"` on external links can lead to accessibility issues and override user preferences. It may also interfere with assistive technologies and expected browser behavior.

To maintain backward compatibility, this option is enabled by default (`true`), which adds `target="_blank"` to links.
This commit is contained in:
Frédéric Guillot 2025-06-08 20:47:57 -07:00
parent 699deea72c
commit 8db637cb39
39 changed files with 345 additions and 259 deletions

View file

@ -97,7 +97,8 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m
media_playback_rate,
block_filter_entry_rules,
keep_filter_entry_rules,
always_open_external_links
always_open_external_links,
open_external_links_in_new_tab
`
tx, err := s.db.Begin()
@ -142,6 +143,7 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m
&user.BlockFilterEntryRules,
&user.KeepFilterEntryRules,
&user.AlwaysOpenExternalLinks,
&user.OpenExternalLinksInNewTab,
)
if err != nil {
tx.Rollback()
@ -207,9 +209,10 @@ func (s *Storage) UpdateUser(user *model.User) error {
media_playback_rate=$26,
block_filter_entry_rules=$27,
keep_filter_entry_rules=$28,
always_open_external_links=$29
always_open_external_links=$29,
open_external_links_in_new_tab=$30
WHERE
id=$30
id=$31
`
_, err = s.db.Exec(
@ -243,6 +246,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
user.BlockFilterEntryRules,
user.KeepFilterEntryRules,
user.AlwaysOpenExternalLinks,
user.OpenExternalLinksInNewTab,
user.ID,
)
if err != nil {
@ -278,9 +282,10 @@ func (s *Storage) UpdateUser(user *model.User) error {
media_playback_rate=$25,
block_filter_entry_rules=$26,
keep_filter_entry_rules=$27,
always_open_external_links=$28
always_open_external_links=$28,
open_external_links_in_new_tab=$29
WHERE
id=$29
id=$30
`
_, err := s.db.Exec(
@ -313,6 +318,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
user.BlockFilterEntryRules,
user.KeepFilterEntryRules,
user.AlwaysOpenExternalLinks,
user.OpenExternalLinksInNewTab,
user.ID,
)
@ -367,7 +373,8 @@ func (s *Storage) UserByID(userID int64) (*model.User, error) {
media_playback_rate,
block_filter_entry_rules,
keep_filter_entry_rules,
always_open_external_links
always_open_external_links,
open_external_links_in_new_tab
FROM
users
WHERE
@ -409,7 +416,8 @@ func (s *Storage) UserByUsername(username string) (*model.User, error) {
media_playback_rate,
block_filter_entry_rules,
keep_filter_entry_rules,
always_open_external_links
always_open_external_links,
open_external_links_in_new_tab
FROM
users
WHERE
@ -451,7 +459,8 @@ func (s *Storage) UserByField(field, value string) (*model.User, error) {
media_playback_rate,
block_filter_entry_rules,
keep_filter_entry_rules,
always_open_external_links
always_open_external_links,
open_external_links_in_new_tab
FROM
users
WHERE
@ -500,7 +509,8 @@ func (s *Storage) UserByAPIKey(token string) (*model.User, error) {
media_playback_rate,
u.block_filter_entry_rules,
u.keep_filter_entry_rules,
u.always_open_external_links
u.always_open_external_links,
u.open_external_links_in_new_tab
FROM
users u
LEFT JOIN
@ -544,6 +554,7 @@ func (s *Storage) fetchUser(query string, args ...interface{}) (*model.User, err
&user.BlockFilterEntryRules,
&user.KeepFilterEntryRules,
&user.AlwaysOpenExternalLinks,
&user.OpenExternalLinksInNewTab,
)
if err == sql.ErrNoRows {
@ -658,7 +669,8 @@ func (s *Storage) Users() (model.Users, error) {
media_playback_rate,
block_filter_entry_rules,
keep_filter_entry_rules,
always_open_external_links
always_open_external_links,
open_external_links_in_new_tab
FROM
users
ORDER BY username ASC
@ -703,6 +715,7 @@ func (s *Storage) Users() (model.Users, error) {
&user.BlockFilterEntryRules,
&user.KeepFilterEntryRules,
&user.AlwaysOpenExternalLinks,
&user.OpenExternalLinksInNewTab,
)
if err != nil {