[feature] Preserve 'mastodon-settings' from localStorage on logout (#66)

This preserves the settings for the FE, things like theme, etc.

---

Retains the `mastodon-settings` object from localStorage on logout. I think this is safe to do, it doesn't appear there's any instance-specific or otherwise sensitive info in this object:

```json
{
  "side_arm_reply_mode": "keep",
  "media": {
    "use_blurhash": true,
    "letterbox": false,
    "fullwidth": true,
    "reveal_behind_cw": false,
    "pop_in_player": true,
    "pop_in_position": "right"
  },
  "stretch": true,
  "inline_preview_cards": true,
  "hicolor_privacy_icons": false,
  "notifications": {
    "favicon_badge": false,
    "tab_badge": true
  },
  "confirm_missing_media_description": false,
  "theme": "mastodon",
  "layout": "mobile",
  "preselect_on_reply": false,
  "status_icons": {
    "language": true,
    "reply": true,
    "local_only": true,
    "media": true,
    "visibility": true
  },
  "prepend_cw_re": false,
  "confirm_boost_missing_media_description": false,
  "tag_misleading_links": true,
  "side_arm": "none",
  "collapsed": {
    "enabled": true,
    "auto": {
      "all": false,
      "notifications": false,
      "lengthy": true,
      "reblogs": false,
      "replies": false,
      "media": false,
      "height": 400
    },
    "backgrounds": {
      "user_backgrounds": false,
      "preview_images": false
    },
    "show_action_bar": true
  },
  "show_reply_count": false,
  "confirm_before_clearing_draft": true,
  "rewrite_mentions": "no",
  "content_warnings": {
    "auto_unfold": false,
    "filter": null,
    "media_outside": true,
    "shared_state": true
  },
  "always_show_spoilers_field": true,
  "show_content_type_choice": true
}

```

Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/66
Co-authored-by: Matthew Jorgensen <me@prplecake.com>
Co-committed-by: Matthew Jorgensen <me@prplecake.com>
This commit is contained in:
Matthew Jorgensen
2025-10-01 14:03:18 +02:00
committed by tobi
parent c6eb0b1927
commit e36d764aaa

View File

@@ -4,7 +4,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Logout | Masto-FE (🦥 flavour)</title> <title>Logout | Masto-FE (🦥 flavour)</title>
<script> <script>
const preserveSettings = localStorage.getItem("mastodon-settings");
localStorage.clear(); localStorage.clear();
if (preserveSettings !== null) {
localStorage.setItem("mastodon-settings", preserveSettings);
}
window.location.href = "/login.html"; window.location.href = "/login.html";
</script> </script>
</head> </head>