hohMiyazawa / Automail

An enhancement collection for anilist.co
GNU General Public License v3.0
158 stars 31 forks source link

Cannot submit custom CSS #85

Closed Minitajfun closed 3 years ago

Minitajfun commented 3 years ago

Description

When trying to set custom CSS, the changes do not take place. My profile keeps it's default look. When checking console it shows this error:

image

Browser: Firefox Version 89.0 (64bit) Script manager: Violentmonkey v2.13.0

Steps to reproduce

  1. Go into Settings > Apps
  2. Make sure you have Enable custom profile CSS and pinned activities on so the option appears
  3. Add custom CSS into text area
  4. Press Submit
hohMiyazawa commented 3 years ago

That's weird, that's an object Anilist provides.

What do you get from this in the console? JSON.parse(localStorage.getItem("auth"))

Minitajfun commented 3 years ago
{
  "id": 684496,
  "name": "minitajfun",
  "about": null,
  "avatar": {
    "large": "https://s4.anilist.co/file/anilistcdn/user/avatar/large/b684496-7MfAJdVddW64.jpg"
  },
  "bannerImage": "https://s4.anilist.co/file/anilistcdn/user/banner/b684496-XNDM1sJbVEpg.jpg",
  "unreadNotificationCount": 0,
  "donatorTier": 0,
  "donatorBadge": "Donator",
  "moderatorRoles": null,
  "options": {
    "titleLanguage": "ROMAJI",
    "airingNotifications": true,
    "displayAdultContent": true,
    "profileColor": "purple",
    "notificationOptions": [
      {
        "type": "ACTIVITY_MESSAGE",
        "enabled": true
      },
      {
        "type": "ACTIVITY_REPLY",
        "enabled": true
      },
      {
        "type": "FOLLOWING",
        "enabled": true
      },
      {
        "type": "ACTIVITY_MENTION",
        "enabled": true
      },
      {
        "type": "THREAD_COMMENT_MENTION",
        "enabled": true
      },
      {
        "type": "THREAD_SUBSCRIBED",
        "enabled": true
      },
      {
        "type": "THREAD_COMMENT_REPLY",
        "enabled": true
      },
      {
        "type": "AIRING",
        "enabled": true
      },
      {
        "type": "ACTIVITY_LIKE",
        "enabled": true
      },
      {
        "type": "ACTIVITY_REPLY_LIKE",
        "enabled": true
      },
      {
        "type": "THREAD_LIKE",
        "enabled": true
      },
      {
        "type": "THREAD_COMMENT_LIKE",
        "enabled": true
      },
      {
        "type": "ACTIVITY_REPLY_SUBSCRIBED",
        "enabled": true
      }
    ]
  },
  "mediaListOptions": {
    "scoreFormat": "POINT_5",
    "rowOrder": "updatedAt",
    "animeList": {
      "customLists": [],
      "sectionOrder": [
        "Watching",
        "Rewatching",
        "Completed",
        "Paused",
        "Dropped",
        "Planning"
      ],
      "splitCompletedSectionByFormat": false,
      "advancedScoring": [
        "Story",
        "Characters",
        "Visuals",
        "Audio",
        "Enjoyment"
      ],
      "advancedScoringEnabled": false
    },
    "mangaList": {
      "customLists": [],
      "sectionOrder": [
        "Reading",
        "Rereading",
        "Completed",
        "Paused",
        "Dropped",
        "Planning"
      ],
      "splitCompletedSectionByFormat": false,
      "advancedScoring": [
        "Story",
        "Characters",
        "Visuals",
        "Audio",
        "Enjoyment"
      ],
      "advancedScoringEnabled": false
    }
  },
  "nameId": "minitajfun"
}
hohMiyazawa commented 3 years ago

I see, you don't have a bio. That's were the CSS gets saved.

I will try adding some code to manage that edge case.

hohMiyazawa commented 3 years ago

Creating an empty bio if there's none is probably the solution: https://github.com/hohMiyazawa/Automail/commit/e1f673b4b93cec607778c3d75a0d2c828941b3bc

hohMiyazawa commented 3 years ago

Live in 9.99.40