Keep settings when using private window/clearing site data

Dex-chan lover
Joined
Mar 6, 2019
Messages
180
Greetings,

I love the new implements you added so far but every time I log in using my PC (Firefox with DuckDuckGo, so always private window) all the preferences are reset, which turns to be time consuming. I basically need to put again the Items per Page to the maximum, display Pornographic, language filters and group blocks. For some reason it does not happen when I log in with my smartphone (Android and using Brave as a browser). I would like this to be addressed and I will be happy to help if you need me to do any checkings.

Yours sincerelly,
one of your fans.
 
Last edited:
Upvote 3
Joined
Jan 31, 2023
Messages
3
Proposal

My proposal is that certain mainsite settings should be saved to users' accounts on the server side, and restored whenever they log back in, even if their browser's cookies have been cleared since their last visit. There are others which make sense to keep on a per-session basis (e.g., to facilitate different viewing settings on mobile vs. desktop). See the "specific settings" section below for my suggestions as to which settings belong in which group.

Background

For the sake of privacy and reliability, I'm one of those people who has configured their browser to wipe all state (cookies, cache, etc.) every time I completely close it out. For 99.9% of websites I visit, this is not an issue, as I can simply log back into my accounts, and all of my preferences are restored.

However, it appears that MangaDex stores all settings on a per-session basis (I assume, in its cookies), so every time I log back in, I need to re-configure everything.

Specific settings

These settings should persist across sessions, and therefore should be saved to a user's account on the server:
  • Chapter Language Filter
  • Original Language Filter
  • Group Block
  • Uploader Block
These settings can continue being configured per-session, as they are today:
  • Items per page (makes sense that one might set this differently on different screens)
  • Theme (ditto)
  • Ambient (ditto)
  • One Row Chapters (ditto)
  • Use Port 443 for MangaDex@Home (might need to have this set differently when on a cellular vs. home network)
  • Data Saver (ditto)
  • Content Filter (e.g., to ensure porn doesn't pop up on your phone in public)
For the per-session settings, you could optionally add the ability to save a default to your account, but allow it to be overridden on a per-session basis.
 
Last edited:
Contributor
Joined
Jan 19, 2018
Messages
442
For those that do not know, it is still planned to eventually move some settings server side (i.e. just like it was in V3). Other things to do are just higher priority.

Things that will probably be saved server side:
  • Anything under "User Settings"
Things that will never get saved server side:
  • Anything releated to "Reader settings"
 
Staff
Super Moderator
Joined
Jan 7, 2023
Messages
84
@Manko-sensei

So uhh, i've actually personally dealt with this issue myself by writing a userscript for myself as a workaround.

TL;DR: the userscript basically checks if the "md" localStorage key exists or not and creates it with my personal preferred settings if it doesn't already exist. Otherwise, if it already exists, it will just leave it alone.

FYI: This is not a MangaDex approved script despite me being a staff member. This is a personal script that I am sharing that was created prior to becoming MD Staff and operates outside of the site.

Below is a gutted version of my full script with other things for anyone to use as a base. You can install a userscript extension in your browser like tampermonkey and copy and paste the code in as a new script. To modify the settings to your personal preferences, you can either edit the setting values or simply find your own setting values and replace the variable value in the code with your own. I have left a few comments in the script itself for general directions on how to do this.

FYI: If MangaDex updates the localStorage settings format, this script may need to be updated with the new format.

Edit: There has already been an updated to the settings format since the time of the original post. The scripts below will definitely need to be updated with new settings.


If you do have any questions about this script or have any issues you can try to reach me on discord via:
glad barfs#1788

Userscript file:
Auto-set_Mangadex_Reader_localStorage_Settings.user.js

// ==UserScript==
// @name Auto-set Mangadex Reader localStorage Settings
// @namespace http://mangadex.org
// @version 0.1
// @description Auto-set MD reader settings to user preferred settings
// @author You
// @match https://*.mangadex.org/*
// @icon https://www.google.com/s2/favicons?domain=mangadex.org
// @run-at document-start
// @grant none
// ==/UserScript==

(function () {

'use strict';

// Replace reader_settings with your own settings
// Navigate to browser Dev Tools and the Application/Storage tab and look for Local Storage
// Find the "md" Key and copy the Value contents to the 'localStorageSettings' varable below

// You can also use a json formatter to make things neater.
// Example json formatter site: https://jsonformatter.org

let localStorageSettings = {
"readerMenu": {
"readStyle": 1,
"headerStyle": 0,
"_viewStyle": 1,
"_limitWidth": true,
"_limitHeight": true,
"_scrollLock": {
"width": true,
"height": true,
"none": true
},
"_longStripMargin": 4,
"maxWidth": -1,
"maxHeight": -1,
"limitMaxWidth": false,
"limitMaxHeight": false,
"dimPages": false,
"dimWithDark": false,
"pageDim": 0.2,
"progressHeight": 12,
"progressMode": 2,
"progressSide": 1,
"backgroundColor": "transparent",
"cursorHints": 0,
"doAutoAdvance": true,
"_growPages": true,
"historyMode": 1,
"immersiveTap": true,
"keys": {
"toggleMenu": [
"KeyM",
"NumpadDecimal:0"
],
"pageForward": [
"ArrowRight",
"Numpad6"
],
"pageBackward": [
"ArrowLeft",
"Numpad4"
],
"chapterForward": [
"Period",
null
],
"chapterBackward": [
"Comma",
null
],
"immersiveMode": [
"KeyF",
null
],
"offsetSpread": [
"KeyO",
"KeyQ"
]
},
"lockOffset": 0,
"showPageNumber": false,
"turnPages": 0,
"turnPagesByScrolling": 0,
"hasImmersiveBefore": true,
"_showMenuButton": true,
"menuOpen": true,
"menuPinned": true,
"offsetDoubles": {}
},
"userPreferences": {
"filteredLanguages": [
"en"
],
"originLanguages": [
"ja"
],
"paginationCount": 48,
"listMultiplier": 3,
"showSafe": true,
"showErotic": true,
"showSuggestive": true,
"showHentai": false,
"theme": "light",
"mdahPort443": false,
"dataSaver": false,
"groupBlacklist": [],
"userBlacklist": [],
"locale": "en"
},
"metadata": {
"version": 0,
"modified": 1675626044243
},
"preferredLayout": {
"listStyle": 1,
"listStyleNoArt": 1,
"feedStyle": 1,
"oneLine": true,
"bottomNavPadding": 0,
"ambient": true
},
"announcements": {
"hidden": [
"sus"
]
},
"readingHistory": {
"_readingHistory": []
}
}

// update localStorage with preferred reader settings if md item doesn't exist
if (!localStorage.getItem('md')){
localStorage.setItem('md', JSON.stringify(localStorageSettings));
}
})();
 
Last edited:

Users who are viewing this thread

Top