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

Make default home page configurable

This commit is contained in:
Romain de Laage 2022-07-20 22:07:55 +02:00 committed by Frédéric Guillot
parent 45a9fd5af6
commit 03a1cfcd5e
30 changed files with 125 additions and 14 deletions

16
model/home_page.go Normal file
View file

@ -0,0 +1,16 @@
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package model // import "miniflux.app/model"
// HomePages returns the list of available home pages.
func HomePages() map[string]string {
return map[string]string{
"unread": "menu.unread",
"starred": "menu.starred",
"history": "menu.history",
"feeds": "menu.feeds",
"categories": "menu.categories",
}
}

View file

@ -32,6 +32,7 @@ type User struct {
DisplayMode string `json:"display_mode"`
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
}
// UserCreationRequest represents the request to create a user.
@ -63,6 +64,7 @@ type UserModificationRequest struct {
DisplayMode *string `json:"display_mode"`
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
}
// Patch updates the User object with the modification request.
@ -138,6 +140,10 @@ func (u *UserModificationRequest) Patch(user *User) {
if u.CJKReadingSpeed != nil {
user.CJKReadingSpeed = *u.CJKReadingSpeed
}
if u.DefaultHomePage != nil {
user.DefaultHomePage = *u.DefaultHomePage
}
}
// UseTimezone converts last login date to the given timezone.