mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-27 04:54:45 +03:00
perf(subscription): batch render settings per request (#7203)
Every raw, JSON and Clash subscription request read its eight presentation settings (host sort mode, datepicker, identity and info-node toggles, the expired and depleted templates, inclusive expiry and its timezone) with one query each. Read them in one query per request preparation. Missing keys, stored empty strings, duplicate keys and malformed booleans resolve as the single-key getters did, and a failed batch falls back to those getters so a readable setting keeps its value. Closes #7201
This commit is contained in:
@@ -35,6 +35,9 @@ func TestSubHosts_Postgres(t *testing.T) {
|
||||
{"base64", TestSub_HostOrderBase64AndInfoNode},
|
||||
{"balancer", TestSub_HostOrderBalancerSlots},
|
||||
{"deleted binding", TestSub_ClientHostRule_DeletedHostClosesOnlyItsInbound},
|
||||
{"render query budget", TestSubscriptionRenderSettingsQueryBudget},
|
||||
{"render setting values", TestSubscriptionRenderSettingsValues},
|
||||
{"partial render read failure", TestSubscriptionRenderSettingsPartialReadFailure},
|
||||
} {
|
||||
t.Run(scenario.name, func(t *testing.T) {
|
||||
cleanup, err := testpg.IsolatePackage("host_order")
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func seedSubDB(t *testing.T) {
|
||||
func seedSubDB(t testing.TB) {
|
||||
t.Helper()
|
||||
dbDir := t.TempDir()
|
||||
t.Setenv("XUI_DB_FOLDER", dbDir)
|
||||
@@ -31,7 +31,7 @@ func seedSubDB(t *testing.T) {
|
||||
|
||||
// seedSubInbound creates a VLESS inbound with one client wired into the
|
||||
// normalized clients/client_inbounds tables so getInboundsBySubId resolves it.
|
||||
func seedSubInbound(t *testing.T, subId, tag string, port, subSortIndex int, stream string) *model.Inbound {
|
||||
func seedSubInbound(t testing.TB, subId, tag string, port, subSortIndex int, stream string) *model.Inbound {
|
||||
t.Helper()
|
||||
db := database.GetDB()
|
||||
uuid := "11111111-2222-4333-8444-" + fmt.Sprintf("%012d", port)
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package sub
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/op/go-logging"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/logger"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/testpg"
|
||||
)
|
||||
|
||||
func BenchmarkSubscriptionRenderSettings(b *testing.B) {
|
||||
logger.InitLogger(logging.ERROR)
|
||||
if os.Getenv("XUI_DB_TYPE") == "postgres" {
|
||||
cleanup, err := testpg.IsolatePackage("subscription_render_bench")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.Cleanup(cleanup)
|
||||
}
|
||||
seedSubDB(b)
|
||||
rows := []model.Setting{
|
||||
{Key: "subHostSortMode", Value: "hosts-first"},
|
||||
{Key: "datepicker", Value: "gregorian"},
|
||||
{Key: "subShowIdentityOnAllLinks", Value: "true"},
|
||||
{Key: "subInfoNodeEnable", Value: "false"},
|
||||
{Key: "subExpiredTemplate", Value: "Expired"},
|
||||
{Key: "subTrafficDepletedTemplate", Value: "Depleted"},
|
||||
{Key: "subCalendarExpireInclusive", Value: "true"},
|
||||
{Key: "timeLocation", Value: "UTC"},
|
||||
}
|
||||
for i := range 182 {
|
||||
rows = append(rows, model.Setting{Key: fmt.Sprintf("fixture-%03d", i), Value: "fixture-value"})
|
||||
}
|
||||
seedRenderSettings(b, rows...)
|
||||
for i := range 12 {
|
||||
seedSubInbound(b, "bench-sub", fmt.Sprintf("fixture-%02d", i), 4900+i, i, wsTLSStream)
|
||||
}
|
||||
gin.SetMode(gin.TestMode)
|
||||
router := newSubscriptionTestRouter(subscriptionTestRouterConfig{})
|
||||
base := NewSubService("")
|
||||
reads := countRenderSettingQueries(b)
|
||||
|
||||
for _, route := range []string{"prepare", "sub", "json", "clash"} {
|
||||
b.Run(route, func(b *testing.B) {
|
||||
request := func() {
|
||||
if route == "prepare" {
|
||||
_ = base.ForRequest("sub.example.com")
|
||||
return
|
||||
}
|
||||
res := httptest.NewRecorder()
|
||||
router.ServeHTTP(res, httptest.NewRequest(http.MethodGet, "http://sub.example.com/"+route+"/bench-sub", nil))
|
||||
if res.Code != http.StatusOK {
|
||||
b.Errorf("%s: HTTP %d: %s", route, res.Code, res.Body.String())
|
||||
}
|
||||
}
|
||||
for range 8 {
|
||||
request()
|
||||
}
|
||||
reads.Store(0)
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
request()
|
||||
}
|
||||
})
|
||||
b.StopTimer()
|
||||
b.ReportMetric(float64(reads.Load())/float64(b.N), "render-sql/op")
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package sub
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/op/go-logging"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/logger"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/web/service"
|
||||
)
|
||||
|
||||
func seedRenderSettings(t testing.TB, rows ...model.Setting) {
|
||||
t.Helper()
|
||||
if err := database.GetDB().Create(&rows).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func isRenderSettingQuery(db *gorm.DB) bool {
|
||||
if db.Statement.Table != "settings" {
|
||||
return false
|
||||
}
|
||||
for _, arg := range db.Statement.Vars {
|
||||
switch arg {
|
||||
case "subHostSortMode", "datepicker", "subShowIdentityOnAllLinks", "subInfoNodeEnable",
|
||||
"subExpiredTemplate", "subTrafficDepletedTemplate", "subCalendarExpireInclusive", "timeLocation":
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func countRenderSettingQueries(t testing.TB) *atomic.Int64 {
|
||||
t.Helper()
|
||||
var reads atomic.Int64
|
||||
db := database.GetDB()
|
||||
const name = "test:count_render_settings"
|
||||
if err := db.Callback().Query().After("gorm:query").Register(name, func(tx *gorm.DB) {
|
||||
if isRenderSettingQuery(tx) {
|
||||
reads.Add(1)
|
||||
}
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Callback().Query().Remove(name) })
|
||||
return &reads
|
||||
}
|
||||
|
||||
func TestSubscriptionRenderSettingsQueryBudget(t *testing.T) {
|
||||
seedSubDB(t)
|
||||
seedSubInbound(t, "render-settings", "render-link", 4932, 1, wsTLSStream)
|
||||
seedRenderSettings(t, model.Setting{Key: "subCalendarExpireInclusive", Value: "1"},
|
||||
model.Setting{Key: "timeLocation", Value: "UTC"})
|
||||
gin.SetMode(gin.TestMode)
|
||||
router := newSubscriptionTestRouter(subscriptionTestRouterConfig{})
|
||||
reads := countRenderSettingQueries(t)
|
||||
|
||||
for _, format := range []string{"sub", "json", "clash"} {
|
||||
t.Run(format, func(t *testing.T) {
|
||||
reads.Store(0)
|
||||
res := httptest.NewRecorder()
|
||||
router.ServeHTTP(res, httptest.NewRequest(http.MethodGet, "http://sub.example.com/"+format+"/render-settings", nil))
|
||||
body := res.Body.String()
|
||||
if format == "sub" {
|
||||
raw, err := base64.StdEncoding.DecodeString(body)
|
||||
if err != nil {
|
||||
t.Fatalf("decode subscription: %v", err)
|
||||
}
|
||||
body = string(raw)
|
||||
}
|
||||
if res.Code != http.StatusOK || !strings.Contains(body, "render-link") {
|
||||
t.Fatalf("expected rendered inbound, status=%d body=%q", res.Code, body)
|
||||
}
|
||||
if got := reads.Load(); got != 1 {
|
||||
t.Fatalf("render settings queries = %d, want 1", got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubscriptionRenderSettingsValues(t *testing.T) {
|
||||
seedSubDB(t)
|
||||
logger.InitLogger(logging.ERROR)
|
||||
base := NewSubService("")
|
||||
checkDefaults := func(req *SubService) {
|
||||
t.Helper()
|
||||
if req.hostsFirst || req.datepicker != "gregorian" || req.showIdentityOnAllLinks || req.subInfoNodeEnable ||
|
||||
req.subExpiredTemplate != service.DefaultSubExpiredTemplate ||
|
||||
req.subTrafficDepletedTemplate != service.DefaultSubTrafficDepletedTemplate ||
|
||||
req.subCalendarExpireInclusive || req.calendarExpireLocation != nil {
|
||||
t.Fatalf("wrong defaults: date=%q expired=%q depleted=%q hosts=%v identity=%v info=%v inclusive=%v tz=%v",
|
||||
req.datepicker, req.subExpiredTemplate, req.subTrafficDepletedTemplate, req.hostsFirst,
|
||||
req.showIdentityOnAllLinks, req.subInfoNodeEnable, req.subCalendarExpireInclusive, req.calendarExpireLocation)
|
||||
}
|
||||
}
|
||||
checkDefaults(base.ForRequest("sub.example.com"))
|
||||
|
||||
seedRenderSettings(t,
|
||||
model.Setting{Key: "subHostSortMode", Value: "hosts-first"},
|
||||
model.Setting{Key: "subHostSortMode", Value: "inbound-first"},
|
||||
model.Setting{Key: "datepicker", Value: ""},
|
||||
model.Setting{Key: "datepicker", Value: "jalali"},
|
||||
model.Setting{Key: "subShowIdentityOnAllLinks", Value: "TRUE"},
|
||||
model.Setting{Key: "subInfoNodeEnable", Value: "invalid"},
|
||||
model.Setting{Key: "subExpiredTemplate", Value: ""},
|
||||
model.Setting{Key: "subTrafficDepletedTemplate", Value: "out-of-quota"},
|
||||
model.Setting{Key: "subCalendarExpireInclusive", Value: "T"},
|
||||
model.Setting{Key: "timeLocation", Value: "invalid-zone"},
|
||||
)
|
||||
base.datepicker = "jalali"
|
||||
base.subExpiredTemplate = "custom-expired"
|
||||
first := base.ForRequest("sub.example.com")
|
||||
if !first.hostsFirst || first.datepicker != "jalali" || !first.showIdentityOnAllLinks || first.subInfoNodeEnable ||
|
||||
first.subExpiredTemplate != "custom-expired" || first.subTrafficDepletedTemplate != "out-of-quota" ||
|
||||
!first.subCalendarExpireInclusive || first.calendarExpireLocation != time.Local {
|
||||
t.Fatalf("legacy values were not preserved: date=%q expired=%q depleted=%q hosts=%v identity=%v info=%v inclusive=%v tz=%v",
|
||||
first.datepicker, first.subExpiredTemplate, first.subTrafficDepletedTemplate, first.hostsFirst,
|
||||
first.showIdentityOnAllLinks, first.subInfoNodeEnable, first.subCalendarExpireInclusive, first.calendarExpireLocation)
|
||||
}
|
||||
// A blank timezone is UTC, whereas a missing timezone uses Local.
|
||||
db := database.GetDB()
|
||||
if err := db.Exec("UPDATE settings SET value = ? WHERE key = ?", "", "timeLocation").Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if req := base.ForRequest("sub.example.com"); req.calendarExpireLocation != time.UTC {
|
||||
t.Fatalf("empty timezone = %v, want UTC", req.calendarExpireLocation)
|
||||
}
|
||||
if err := db.Exec("DELETE FROM settings WHERE key = ?", "subExpiredTemplate").Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := db.Exec("UPDATE settings SET value = ? WHERE key = ?", "", "subCalendarExpireInclusive").Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var requests sync.WaitGroup
|
||||
for i := range 8 {
|
||||
requests.Go(func() {
|
||||
host := fmt.Sprintf("sub%d.example.com", i)
|
||||
req := base.ForRequest(host)
|
||||
if req.address != host || req.subExpiredTemplate != service.DefaultSubExpiredTemplate ||
|
||||
req.subCalendarExpireInclusive || req.calendarExpireLocation != nil {
|
||||
t.Errorf("request %s: address=%q expired=%q inclusive=%v tz=%v", host, req.address,
|
||||
req.subExpiredTemplate, req.subCalendarExpireInclusive, req.calendarExpireLocation)
|
||||
}
|
||||
})
|
||||
}
|
||||
requests.Wait()
|
||||
if base.address != "" || base.subExpiredTemplate != "custom-expired" || first.subExpiredTemplate != "custom-expired" {
|
||||
t.Fatal("later requests mutated the base or prior request")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubscriptionRenderSettingsPartialReadFailure(t *testing.T) {
|
||||
seedSubDB(t)
|
||||
seedRenderSettings(t, model.Setting{Key: "datepicker", Value: "jalali"},
|
||||
model.Setting{Key: "subExpiredTemplate", Value: "custom-expired"},
|
||||
model.Setting{Key: "subTrafficDepletedTemplate", Value: "custom-depleted"},
|
||||
model.Setting{Key: "subCalendarExpireInclusive", Value: "true"},
|
||||
model.Setting{Key: "timeLocation", Value: "UTC"})
|
||||
db := database.GetDB()
|
||||
const name = "test:fail_some_render_settings"
|
||||
if err := db.Callback().Query().Before("gorm:query").Register(name, func(tx *gorm.DB) {
|
||||
if tx.Statement.Table != "settings" {
|
||||
return
|
||||
}
|
||||
if _, single := tx.Statement.Dest.(*model.Setting); !single {
|
||||
tx.Where("missing_test_column = 1")
|
||||
return
|
||||
}
|
||||
where, _ := tx.Statement.Clauses["WHERE"].Expression.(clause.Where)
|
||||
for _, expr := range where.Exprs {
|
||||
if condition, ok := expr.(clause.Expr); ok && len(condition.Vars) == 1 &&
|
||||
(condition.Vars[0] == "subExpiredTemplate" || condition.Vars[0] == "timeLocation") {
|
||||
tx.Where("missing_test_column = 1")
|
||||
}
|
||||
}
|
||||
}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = db.Callback().Query().Remove(name) })
|
||||
req := NewSubService("").ForRequest("sub.example.com")
|
||||
if req.datepicker != "jalali" || req.subExpiredTemplate != service.DefaultSubExpiredTemplate ||
|
||||
req.subTrafficDepletedTemplate != "custom-depleted" || !req.subCalendarExpireInclusive || req.calendarExpireLocation != nil {
|
||||
t.Fatalf("partial failure: date=%q expired=%q depleted=%q inclusive=%v tz=%v",
|
||||
req.datepicker, req.subExpiredTemplate, req.subTrafficDepletedTemplate, req.subCalendarExpireInclusive, req.calendarExpireLocation)
|
||||
}
|
||||
}
|
||||
+17
-23
@@ -168,15 +168,12 @@ func (s *SubService) PrepareForRequest(host string) {
|
||||
s.sharedGroupSni = nil
|
||||
s.rendered = 0
|
||||
s.wireguardDeviceSelected = false
|
||||
mode, _ := s.settingService.GetSubHostSortMode()
|
||||
s.hostsFirst = mode == "hosts-first"
|
||||
settings := s.settingService.GetSubscriptionRenderSettings()
|
||||
s.hostsFirst = settings.HostSortMode == "hosts-first"
|
||||
s.loadNodes()
|
||||
s.loadRemarkSettings()
|
||||
s.subCalendarExpireInclusive, _ = s.settingService.GetSubCalendarExpireInclusive()
|
||||
s.calendarExpireLocation = nil
|
||||
if s.subCalendarExpireInclusive {
|
||||
s.calendarExpireLocation, _ = s.settingService.GetTimeLocation()
|
||||
}
|
||||
s.loadRemarkSettings(settings)
|
||||
s.subCalendarExpireInclusive = settings.CalendarExpireInclusive
|
||||
s.calendarExpireLocation = settings.CalendarExpireLocation
|
||||
}
|
||||
|
||||
// primeLinkClients caches clients (first occurrence per email, matching the
|
||||
@@ -336,11 +333,8 @@ func (s *SubService) amneziaWGServerForLink(inbound *model.Inbound) *amneziawg.S
|
||||
return parsed.Server
|
||||
}
|
||||
|
||||
// loadRemarkSettings populates the per-request remark formatting state so
|
||||
// every subscription format — raw, JSON, Clash — renders remarks the same way
|
||||
// (the date formatter reads datepicker). Loading it only in getSubs left
|
||||
// JSON/Clash with the zero value.
|
||||
func (s *SubService) loadRemarkSettings() {
|
||||
// loadRemarkSettings keeps the base remark fallbacks when settings are empty or unreadable.
|
||||
func (s *SubService) loadRemarkSettings(settings service.SubscriptionRenderSettings) {
|
||||
if s.datepicker == "" {
|
||||
s.datepicker = "gregorian"
|
||||
}
|
||||
@@ -350,20 +344,20 @@ func (s *SubService) loadRemarkSettings() {
|
||||
if s.subTrafficDepletedTemplate == "" {
|
||||
s.subTrafficDepletedTemplate = service.DefaultSubTrafficDepletedTemplate
|
||||
}
|
||||
if datepicker, err := s.settingService.GetDatepicker(); err == nil && datepicker != "" {
|
||||
s.datepicker = datepicker
|
||||
if settings.Datepicker != "" {
|
||||
s.datepicker = settings.Datepicker
|
||||
}
|
||||
if enabled, err := s.settingService.GetSubShowIdentityOnAllLinks(); err == nil && enabled {
|
||||
s.showIdentityOnAllLinks = enabled
|
||||
if settings.ShowIdentityOnAllLinks {
|
||||
s.showIdentityOnAllLinks = true
|
||||
}
|
||||
if enabled, err := s.settingService.GetSubInfoNodeEnable(); err == nil && enabled {
|
||||
s.subInfoNodeEnable = enabled
|
||||
if settings.InfoNodeEnabled {
|
||||
s.subInfoNodeEnable = true
|
||||
}
|
||||
if tmpl, err := s.settingService.GetSubExpiredTemplate(); err == nil && tmpl != "" {
|
||||
s.subExpiredTemplate = tmpl
|
||||
if settings.ExpiredTemplate != "" {
|
||||
s.subExpiredTemplate = settings.ExpiredTemplate
|
||||
}
|
||||
if tmpl, err := s.settingService.GetSubTrafficDepletedTemplate(); err == nil && tmpl != "" {
|
||||
s.subTrafficDepletedTemplate = tmpl
|
||||
if settings.TrafficDepletedTemplate != "" {
|
||||
s.subTrafficDepletedTemplate = settings.TrafficDepletedTemplate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -900,6 +900,10 @@ func (s *SettingService) GetTimeLocation() (*time.Location, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return loadSettingTimeLocation(l), nil
|
||||
}
|
||||
|
||||
func loadSettingTimeLocation(l string) *time.Location {
|
||||
location, err := time.LoadLocation(l)
|
||||
if err != nil {
|
||||
defaultLocation := defaultValueMap["timeLocation"]
|
||||
@@ -907,11 +911,10 @@ func (s *SettingService) GetTimeLocation() (*time.Location, error) {
|
||||
location, err = time.LoadLocation(defaultLocation)
|
||||
if err != nil {
|
||||
logger.Errorf("failed to load default location, using UTC: %v", err)
|
||||
return time.UTC, nil
|
||||
return time.UTC
|
||||
}
|
||||
return location, nil
|
||||
}
|
||||
return location, nil
|
||||
return location
|
||||
}
|
||||
|
||||
func (s *SettingService) GetSubEnable() (bool, error) {
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
||||
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
||||
)
|
||||
|
||||
type SubscriptionRenderSettings struct {
|
||||
HostSortMode string
|
||||
Datepicker string
|
||||
ShowIdentityOnAllLinks bool
|
||||
InfoNodeEnabled bool
|
||||
ExpiredTemplate string
|
||||
TrafficDepletedTemplate string
|
||||
CalendarExpireInclusive bool
|
||||
CalendarExpireLocation *time.Location
|
||||
}
|
||||
|
||||
// GetSubscriptionRenderSettings loads the presentation settings for one preparation.
|
||||
// Fall back to single-key reads on query failure to preserve partial results.
|
||||
func (s *SettingService) GetSubscriptionRenderSettings() SubscriptionRenderSettings {
|
||||
keys := []string{
|
||||
"subHostSortMode", "datepicker", "subShowIdentityOnAllLinks", "subInfoNodeEnable",
|
||||
"subExpiredTemplate", "subTrafficDepletedTemplate", "subCalendarExpireInclusive", "timeLocation",
|
||||
}
|
||||
get := s.getString
|
||||
var rows []model.Setting
|
||||
if err := database.GetDB().Select("key", "value").Where("key IN ?", keys).Order("id").Find(&rows).Error; err == nil {
|
||||
values := make(map[string]string, len(keys))
|
||||
for _, row := range rows {
|
||||
// The single-key getters use First, so keep the lowest id for duplicate keys.
|
||||
if _, exists := values[row.Key]; !exists {
|
||||
values[row.Key] = row.Value
|
||||
}
|
||||
}
|
||||
get = func(key string) (string, error) {
|
||||
if value, exists := values[key]; exists {
|
||||
return value, nil
|
||||
}
|
||||
return defaultValueMap[key], nil
|
||||
}
|
||||
}
|
||||
|
||||
getBool := func(key string) bool {
|
||||
value, err := get(key)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
enabled, _ := strconv.ParseBool(effectiveSettingValue(key, value))
|
||||
return enabled
|
||||
}
|
||||
var settings SubscriptionRenderSettings
|
||||
settings.HostSortMode, _ = get("subHostSortMode")
|
||||
settings.Datepicker, _ = get("datepicker")
|
||||
settings.ShowIdentityOnAllLinks = getBool("subShowIdentityOnAllLinks")
|
||||
settings.InfoNodeEnabled = getBool("subInfoNodeEnable")
|
||||
settings.ExpiredTemplate, _ = get("subExpiredTemplate")
|
||||
settings.TrafficDepletedTemplate, _ = get("subTrafficDepletedTemplate")
|
||||
settings.CalendarExpireInclusive = getBool("subCalendarExpireInclusive")
|
||||
if settings.CalendarExpireInclusive {
|
||||
if value, err := get("timeLocation"); err == nil {
|
||||
settings.CalendarExpireLocation = loadSettingTimeLocation(value)
|
||||
}
|
||||
}
|
||||
return settings
|
||||
}
|
||||
Reference in New Issue
Block a user