Skip Navigation

Kbin Notifications Panel

greasyfork.org Kbin Notifications Panel

Adds a notification panel to the navigation bar

Userscript that adds a notification panel to the navigation bar.

37

You're viewing a single thread.

37 comments
  • @blobcat
    I love this - definitely something that should be in native kbin, albeit supported natively without a frame. I do have a couple notes.

    The first is that I noticed you match multiple instances - which is great! However, you've hard-coded the notification path for kbin.social. To fix this, I've change the following:

    // Line 60 in the original script. Change the following:
    iframe.src = 'https://kbin.social/settings/notifications';
    // To this:
    iframe.src = 'https://' + window.location.hostname + '/settings/notifications';
    
    

    The second is more a note for any instance admins who would like to support this...
    The default config for kbin, at least the bare metal (I haven't dug into the docker setup at all), is to set add_header X-Frame-Options DENY; in nginx. First is that X-Frame-Options is obsolete anyway, and the second is that the frame won't work with DENY being the setting.
    More reading: X-Frame-Options | MDN
    More reading: Content-Security-Policy | MDN

    Below are the steps you should take to enable functionality for this and to update away from X-Frame-Options:

    # I'm assuming you followed either the current or the soon-to-be bare-metal configuration.
    # First, login to your instance as a user with sudo.
    sudo nano /etc/nginx/sites-available/kbin.conf
    
    # Locate the following line near the bottom: add_header X-Frame-Options DENY;
    # Comment it out by adding a # in front. Create a new line under it and enter the following (replace domain.tld with your domain):
    add_header Content-Security-Policy "from-ancestors 'self' https://domain.tld https://www.domain.tld";
    # Save and exit, <CTRL>+x, y, <ENTER>
    
    # Restart nginx
    sudo systemctl restart nginx
    
    
37 comments