DbSettings.kt
composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/database/DbSettings.kt
1package eu.friedcutlet.yokan.database23import kotlinx.serialization.Serializable4import kotlinx.serialization.ExperimentalSerializationApi5import kotlinx.serialization.json.JsonNames67@Serializable8enum class DbNovelReadingMode { Scroll, Paged }910@Serializable11enum class DbNovelPageMode { Single, Double, Auto }1213@Serializable14enum class DbGlobalStatusVisibility {15 Automatic,16 AlwaysVisible,17 Hidden,18}1920@Serializable21data class DbTitleMetadata(22 val mangaId: Long,23 val metadataServerId: String? = null,24 val metadataSource: String? = null,25 val titles: List<String> = emptyList(),26 val updatedAt: Long = 0,27)2829@Serializable30data class DbAutomaticReaderLayout(val mangaId: Long, val enabled: Boolean = true, val fallback: DbReaderMode? = null)3132@OptIn(ExperimentalSerializationApi::class)33@Serializable34data class DbSettings(35 @JsonNames("home")36 @Serializable(with = DbFeaturePreferencesSerializer::class)37 val features: DbFeaturePreferences = DbFeaturePreferences(),38 val id: Long = 227,39 val updatedAt: Long = 0,40 val completedOnboardingVersion: Int = 0,41 val displayType: DbDisplayType = DbDisplayType.CompactGrid,42 val libraryFilterMangasDownloadType: Int = 0,43 val libraryFilterMangasUnreadType: Int = 0,44 val libraryFilterMangasStartedType: Int = 0,45 val libraryFilterMangasBookMarkedType: Int = 0,46 val libraryShowCategoryTabs: Boolean = false,47 val libraryDownloadedChapters: Boolean = false,48 val libraryShowLanguage: Boolean = false,49 val libraryShowSource: Boolean = false,50 val libraryShowNumbersOfItems: Boolean = false,51 val libraryShowContinueReadingButton: Boolean = false,52 val libraryLocalSource: Boolean? = null,53 val librarySearchQuery: String = "",54 val sortLibraryManga: DbSortLibraryManga? = null,55 val sortChapterList: List<DbSortChapter>? = null,56 val chapterFilterDownloadedList: List<DbChapterFilter>? = null,57 val chapterFilterUnreadList: List<DbChapterFilter>? = null,58 val chapterFilterBookmarkedList: List<DbChapterFilter>? = null,59 val flexColorSchemeBlendLevel: Double = 10.0,60 val dateFormat: String = "M/d/y",61 val relativeTimesTamps: Int = 2,62 val flexSchemeColorIndex: Int = 2,63 val themeIsDark: Boolean = false,64 val followSystemTheme: Boolean = false,65 val incognitoMode: Boolean = false,66 val showPagesNumber: Boolean = true,67 val chapterPageIndexList: List<DbChapterPageIndex>? = null,68 val userAgent: String = DefaultUserAgent,69 val cookiesList: List<DbCookie>? = null,70 val defaultReaderMode: DbReaderMode = DbReaderMode.Vertical,71 val automaticReaderLayout: Boolean = false,72 val readerHoldToScroll: Boolean = false,73 /** E-ink display: monochrome theme, no motion, grayscale pages and periodic full refresh. Device-local. */74 val einkMode: Boolean = false,75 val einkPreset: DbEinkPreset = DbEinkPreset.KindlePaperwhite,76 val einkRefreshEveryPages: Int = 6,77 /** With [einkMode], manga page downloads are stored as grayscale JPEGs sized for [einkPreset]. */78 val einkOptimizeDownloads: Boolean = false,79 val automaticReaderLayouts: List<DbAutomaticReaderLayout> = emptyList(),80 val personalReaderModeList: List<DbPersonalReaderMode>? = null,81 val animatePageTransitions: Boolean = true,82 val doubleTapAnimationSpeed: Int = 1,83 val onlyIncludePinnedSources: Boolean = false,84 val pureBlackDarkMode: Boolean = false,85 val downloadOnlyOnWifi: Boolean = false,86 val saveAsCBZArchive: Boolean = false,87 val deleteDownloadAfterReading: Boolean = false,88 val concurrentDownloads: Int = 2,89 val allowConcurrentDownloads: Boolean = true,90 val downloadDelaySeconds: Int = 0,91 val downloadQueueOrder: List<Long> = emptyList(),92 val networkDownloadSpeedLimitKib: Int = 0,93 val networkUploadSpeedLimitKib: Int = 0,94 val downloadLocation: String = "",95 val filterScanlatorList: List<DbFilterScanlator>? = null,96 val chapterReleasePreferences: List<DbChapterReleasePreference> = emptyList(),97 val autoExtensionsUpdates: Boolean = false,98 /** Relaxes host-only safety gates for local development, e.g. recipe catalogs served from `http://127.0.0.1`. */99 val developerMode: Boolean = false,100 /** Hub URLs the user added next to the published list; may be LAN or loopback, so device-local. */101 val customHubServers: List<String> = emptyList(),102 val cropBorders: Boolean = false,103 val locale: DbL10nLocale? = null,104 val defaultSubtitleLang: DbL10nLocale? = null,105 val animeDisplayType: DbDisplayType = DbDisplayType.CompactGrid,106 val libraryFilterAnimeDownloadType: Int = 0,107 val libraryFilterAnimeUnreadType: Int = 0,108 val libraryFilterAnimeStartedType: Int = 0,109 val libraryFilterAnimeBookMarkedType: Int = 0,110 val animeLibraryShowCategoryTabs: Boolean = false,111 val animeLibraryDownloadedChapters: Boolean = false,112 val animeLibraryShowLanguage: Boolean = false,113 val animeLibraryShowSource: Boolean = false,114 val animeLibraryShowNumbersOfItems: Boolean = false,115 val animeLibraryShowContinueReadingButton: Boolean = false,116 val animeLibraryLocalSource: Boolean? = null,117 val animeLibrarySearchQuery: String = "",118 val sortLibraryAnime: DbSortLibraryManga? = null,119 val pagePreloadAmount: Int = 6,120 val enableLogs: Boolean = false,121 val checkForAppUpdates: Boolean = true,122 val checkForExtensionUpdates: Boolean = true,123 val scaleType: DbScaleType = DbScaleType.FitScreen,124 val backgroundColor: DbBackgroundColor = DbBackgroundColor.Black,125 val personalPageModeList: List<DbPersonalPageMode>? = null,126 val startDateBackup: Long? = null,127 val backupFrequency: Int? = null,128 val backupListOptions: List<Int>? = null,129 val autoBackupLocation: String? = null,130 val usePageTapZones: Boolean = true,131 val alwaysShowChrome: Boolean = false,132 val autoScrollPages: List<DbAutoScrollPages>? = null,133 val autoScrollSpeed: Double = 4.0,134 /**135 * Opt-in: when true, `AppLogger` / `ExtensionLogger` / network logging136 * append timestamped lines to a log file at137 * `LocalFileService.cacheRoot/logs/yokan.log`. Always off by default;138 * stdout output is unaffected.139 */140 val enableFileLogging: Boolean = false,141 val markEpisodeAsSeenType: Int = 85,142 val defaultSkipIntroLength: Int = 85,143 val defaultDoubleTapToSkipLength: Int = 10,144 val defaultPlaybackSpeed: Double = 1.0,145 val fullScreenPlayer: Boolean = false,146 val forceLandscapePlayer: Boolean = false,147 /** Retained only for compatibility with existing serialized settings; no longer used. */148 val desktopUseVlcj: Boolean = false,149 val updateProgressAfterReading: Boolean = true,150 val enableAniSkip: Boolean? = null,151 val enableAutoSkip: Boolean? = null,152 val aniSkipTimeoutLength: Int? = null,153 val customDns: String = "",154 val dohEnabled: Boolean = false,155 val dohProviderId: Int = 0,156 val customDohUrl: String = "",157 val cloudflareBypassProxyUrl: String = "",158 val btServerAddress: String = "127.0.0.1",159 val btServerPort: Int? = null,160 val fullScreenReader: Boolean = true,161 val customColorFilter: DbCustomColorFilter? = null,162 val enableCustomColorFilter: Boolean = false,163 val colorFilterBlendMode: DbColorFilterBlendMode = DbColorFilterBlendMode.None,164 val playerSubtitleSettings: DbPlayerSubtitleSettings? = null,165 val mangaHomeDisplayType: DbDisplayType = DbDisplayType.ComfortableGrid,166 val appFontFamily: String? = null,167 /** UI density scale (1.0 = system default). Multiplies LocalDensity.density and fontScale. */168 val uiScale: Double = 1.0,169 val autoUiScale: Boolean = false,170 val mangaGridSize: Int? = null,171 val animeGridSize: Int? = null,172 val novelGridSize: Int? = null,173 val mangaExtensionsRepo: List<DbRepo>? = null,174 val animeExtensionsRepo: List<DbRepo>? = null,175 val novelExtensionsRepo: List<DbRepo>? = null,176 val androidProxyServer: String? = null,177 val jrePath: String = "",178 val extensionServerPath: String = "",179 val disableSectionType: DbSectionType = DbSectionType.All,180 val useLibass: Boolean = true,181 val hwdecMode: String = "auto",182 val enableHardwareAcceleration: Boolean? = null,183 val libraryFilterNovelDownloadType: Int = 0,184 val libraryFilterNovelUnreadType: Int = 0,185 val libraryFilterNovelStartedType: Int = 0,186 val libraryFilterNovelBookMarkedType: Int = 0,187 val novelLibraryShowCategoryTabs: Boolean = false,188 val novelLibraryDownloadedChapters: Boolean = false,189 val novelLibraryShowLanguage: Boolean = false,190 val novelLibraryShowSource: Boolean = false,191 val novelLibraryShowNumbersOfItems: Boolean = false,192 val novelLibraryShowContinueReadingButton: Boolean = false,193 val novelLibraryLocalSource: Boolean? = null,194 val novelLibrarySearchQuery: String = "",195 val sortLibraryNovel: DbSortLibraryManga? = null,196 val novelDisplayType: DbDisplayType = DbDisplayType.ComfortableGrid,197 val novelFontSize: Int = 14,198 val novelReadingMode: DbNovelReadingMode = DbNovelReadingMode.Scroll,199 val novelPageMode: DbNovelPageMode = DbNovelPageMode.Auto,200 val novelFontFamily: String = "Default",201 val novelTextAlign: DbNovelTextAlign = DbNovelTextAlign.Left,202 val novelReaderTheme: String = "#292832",203 val novelReaderTextColor: String = "#CCCCCC",204 val novelReaderPadding: Int = 16,205 val novelReaderLineHeight: Double = 1.5,206 val novelShowScrollPercentage: Boolean = true,207 val novelRemoveExtraParagraphSpacing: Boolean = false,208 val novelTapToScroll: Boolean = false,209 val navigationOrder: List<String>? = null,210 val hideItems: List<String>? = null,211 val clearChapterCacheOnAppLaunch: Boolean = false,212 val lastTrackerLibraryLocation: String? = null,213 val mergeLibraryNavMobile: Boolean = false,214 val showLocalLibraryNavigation: Boolean = false,215 val enableDiscordRpc: Boolean = true,216 val hideDiscordRpcInIncognito: Boolean = true,217 val rpcShowReadingWatchingProgress: Boolean = true,218 val rpcShowTitle: Boolean = true,219 val rpcShowCoverImage: Boolean = true,220 val useMpvConfig: Boolean = true,221 val debandingType: DbDebandingType = DbDebandingType.None,222 val enableGpuNext: Boolean = false,223 val useYuv420p: Boolean = false,224 val audioPreferredLanguages: String? = null,225 val enableAudioPitchCorrection: Boolean? = null,226 val audioChannels: DbAudioChannel = DbAudioChannel.AutoSafe,227 val volumeBoostCap: Int? = null,228 val downloadedOnlyMode: Boolean = false,229 val globalStatusVisibility: DbGlobalStatusVisibility = DbGlobalStatusVisibility.Automatic,230 val algorithmWeights: DbAlgorithmWeights? = null,231 val sourcePreferences: List<DbSourcePreference>? = null,232 val savedSearches: List<DbSavedSearch>? = null,233 val updateErrors: List<DbUpdateError>? = null,234 val tvUiScale: Double? = null,235 val animeOnlyTvMode: Boolean? = null,236 val tvHomeStyle: Boolean? = null,237 val trackerOrder: List<Int>? = null,238 /** Legacy custom local folders stored before folders had user-facing names. Migrated to [namedLocalFolders] on access. */239 val localFolders: List<String>? = null,240 val namedLocalFolders: List<DbLocalFolder>? = null,241 val downloadLocalFolderName: String? = null,242 val askDownloadDestination: Boolean = true,243 /** ARGB-packed seed color used by MaterialKolor. Null = derive from [flexSchemeColorIndex] for backwards compat. */244 val themeSeedColor: Int? = null,245 /** Path to an image whose dominant color seeds the palette. Takes precedence over [themeSeedColor] when set. */246 val themeSeedImagePath: String? = null,247 /** Material You: on Android 12+ derive scheme from the device wallpaper. Ignored on other platforms. */248 val materialYou: Boolean = false,249 /** Material Expressive: enables MaterialExpressiveTheme and the SPEC_2025 expressive color spec. */250 val materialExpressive: Boolean = false,251 /** PaletteStyle name (TonalSpot, Vibrant, Expressive, Monochrome, …). Defaults to Tonal Spot. */252 val themePaletteStyle: String = "TonalSpot",253 val appLockEnabled: Boolean = false,254 val libraryFilterMangasCompletedType: Int = 0,255 val libraryFilterAnimeCompletedType: Int = 0,256 val libraryFilterNovelCompletedType: Int = 0,257 val libraryFilterMangasTrackingType: Int = 0,258 val libraryFilterAnimeTrackingType: Int = 0,259 val libraryFilterNovelTrackingType: Int = 0,260 val keepScreenOnReader: Boolean = true,261 val webtoonSidePadding: Int = 0,262 val showPageGaps: Boolean = true,263 val autoReadDuplicateChapters: Boolean = false,264 val invertColors: Boolean = false,265 val grayscale: Boolean = false,266 val readerBrightness: Double = 0.0,267 val readerContrast: Double = 1.0,268 val readerSaturation: Double = 1.0,269 val readerNavigationLayout: Int = 0,270 val backupCompressionLevel: Int? = null,271 val backupEncryptionEnabled: Boolean = false,272 val backupEncryptionPassword: String? = null,273 val showNsfw: Boolean = false,274 val ttsSpeechRate: Double = 0.5,275 val ttsPitch: Double = 1.0,276 val ttsLanguage: String? = null,277 val ttsVoice: String? = null,278 /** Base URL for a self-hosted / third-party metadata API server. */279 val metadataServerUrl: String = "http://127.0.0.1:3000",280 /** Opt-in automatic metadata enrichment. Manual checks still use [metadataServerUrl]. */281 val metadataServerEnabled: Boolean = false,282 /** Periodic metadata refresh cadence; zero disables the job. */283 val metadataRefreshFrequencySeconds: Int = 0,284 /** Optional Bearer token used when the metadata server tracker endpoints are enabled. */285 val metadataServerToken: String = "",286 /** Periodic manga/anime/novel library update cadence; zero disables the job. */287 val libraryUpdateFrequencySeconds: Int = 0,288 /**289 * Minutes after local midnight for a fixed daily library update; `-1` means repeat every290 * [libraryUpdateFrequencySeconds] instead. Only honoured while the job is enabled.291 */292 val libraryUpdateDailyAtMinutes: Int = -1,293 /** Desktop only: closing the window hides to the tray so scheduled tasks keep running. Device-local. */294 val desktopCloseToTray: Boolean = false,295 /** Desktop only: register an OS login item that starts Yokan hidden in the tray. Device-local. */296 val desktopLaunchAtLogin: Boolean = false,297 /** Per-entry scraped metadata kept in the settings blob to avoid Room row migrations. */298 val titleMetadata: List<DbTitleMetadata>? = null,299 /** Set once [eu.friedcutlet.yokan.database.sync.SyncIdentityMigration] has rewritten local ids to stable hub ids. Device-local. */300 val syncIdentityVersion: Int = 0,301) {302 val home: DbHomePreferences get() = features.home303}304305const val DefaultUserAgent =306 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120 Safari/537.36"307