Ori

joined 1 year ago
[–] [email protected] 52 points 11 months ago

As always, you're so considerate and thorough. Looking forward to seeing what becomes of /kbin.

[–] [email protected] 1 points 11 months ago (1 children)

@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

[–] [email protected] 0 points 1 year ago (1 children)

@Rhaedas

Figured out a solution for kbin-federation-awareness, will take longer for KCH. New link here.

[–] [email protected] 0 points 1 year ago (1 children)

@gabriell - Thanks for sharing. I'm going to share my full edit of the script, replace your local version with the one below and see if your issues resolve.

pastebin - kbin Feed Curator

[–] [email protected] 0 points 1 year ago (3 children)

Ah! That's why. The specs for gm_info are different for ViolentMonkey and TamperMonkey. That's insane to me, but I've got a fix! Again, really sorry for the hijack CodingAndCoffee.

Updated kbin-code-highlighting
Updated kbin-federation-awareness

[–] [email protected] 0 points 1 year ago (5 children)

Do you use TamperMonkey, or something else?

[–] [email protected] 0 points 1 year ago (8 children)

Weird - I'm using LibreWolf, for all intents and purposes - Firefox. Example

[–] [email protected] 0 points 1 year ago (10 children)

I don't want to hijack @CodingAndCoffee 's thread, but... look here. And if you choose to use that, check your options menu out. Though, I only allow it on the left side for articles in the options because I don't like overwriting the waterfall on the left (probably one of my extensions if you don't know what I'm talking about).

[–] [email protected] 0 points 1 year ago (3 children)

Odd. Your console say anything? (F12 -> Console)

[–] [email protected] 0 points 1 year ago (13 children)

I changed the script a little bit more to use a class instead, but I've modified my class style to the original lookup style. Should work.

// And highlight to right of article/comment and changed green to blue.
GM_addStyle('[data-is-strictly-moderated="true"] { box-shadow:1px 0 0 #ff0000, 2px 0 0 #ff0000, 3px 0 0 #c80000, 4px 0 0 #960000, 5px 0 0 #640000; }');
GM_addStyle('[data-is-federated-content="true"] { box-shadow:1px 0 0 #009bff, 2px 0 0 #009bff, 3px 0 0 #0064fa, 4px 0 0 #0032c8, 5px 0 0 #000096; }');

[–] [email protected] 3 points 1 year ago (1 children)

I tend to use .local

[–] [email protected] 2 points 1 year ago (6 children)

@fiofiofio

It may be worthwhile to add a check around your removeButtons.querySelectorAll("button").forEach(button => { section. For instance:

if (removeButtons.length > 0) {
    removeButtons.querySelectorAll("button").forEach(button => {
        button.style.backgroundColor = 'var(--kbin-vote-bg)';
        button.style.color = 'var(--kbin-vote-text-color)';
        button.style.marginLeft = 'var(--kbin-entry-element-spacing)';
        button.style.padding = '2px';
        button.style.border = 'var(--kbin-section-border)';
    });
}

view more: ‹ prev next ›