NATION

PASSWORD

Dossier Bug?

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Quebecshire
Ambassador
 
Posts: 1617
Founded: Mar 17, 2017
Democratic Socialists

Dossier Bug?

Postby Quebecshire » Sat Jul 02, 2022 2:57 pm

Sorry if this has already been brought up, but essentially, whenever I go to dossier a nation that has ceased to exist (through the button to do so on the boneyard page), it tells me I have failed a security check and does not go through. I've been able to get around this and dossier by using the upload feature for the advanced dossier, but since some other people off-site mentioned having the same issue, I figured I would raise it.

Is this a bug, or is there something I'm doing that's causing it?

User avatar
Jar Wattinree
Ambassador
 
Posts: 1542
Founded: Dec 14, 2016
Psychotic Dictatorship

Postby Jar Wattinree » Sat Jul 02, 2022 3:27 pm

I'll add that while you can dossier nations that are alive, and remove both CTE and alive nations from your dossier, it says "This request failed a security check" if you try and dossier a CTE nation.

User avatar
Roavin
Technical Moderator
 
Posts: 1566
Founded: Apr 07, 2016
Scandinavian Liberal Paradise

Postby Roavin » Sat Jul 02, 2022 4:38 pm

Quebecshire wrote:Is this a bug, or is there something I'm doing that's causing it?


It's a bug. The Tampermonkey script below fixes it - all you have to do is visit a (live) nation page once with the script, and then you can dossier CTE'd nations. The script should be smart enough to be dormant when the bug is fixed.

@Admin: boneyard's dossier form is missing the chk input.

Code: Select all
// ==UserScript==
// @name         NS: Fix buggy nation dossiers
// @description  Adds missing "chk" inputs for forms
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       Roavin
// @match        https://www.nationstates.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=nationstates.net
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

(function() {
    'use strict';

    // if the page includes a chk code, store it
    var chkElement = document.querySelector("input[name='chk']");
    if (chkElement !== null) {
        GM_setValue("chk", chkElement.value);
    }

    // search for relevant forms that may be buggy
    var forms = document.querySelectorAll("form[action='page=dossier']");
    forms.forEach(form => {
        // does it have a chk input field?
        var chkElement = form.querySelector("input[name='chk']");
        if (chkElement == null) {
            // it does not - add it!
            var elm = document.createElement("input");
            elm.type = "hidden";
            elm.name = "chk";
            elm.value = GM_getValue("chk");
            form.appendChild(elm);
        }
    });
})();
Last edited by Roavin on Sat Jul 02, 2022 4:46 pm, edited 1 time in total.
Helpful Resources: One Stop Rules Shop | API documentation | NS Coders Discord
About me: Longest serving Prime Minister in TSP | Former First Warden of TGW | aka Curious Observations

Feel free to TG me, but not about moderation matters.

User avatar
[violet]
Site Admin
 
Posts: 16038
Founded: Antiquity

Postby [violet] » Sun Jul 03, 2022 3:22 pm

Quebecshire wrote:whenever I go to dossier a nation that has ceased to exist (through the button to do so on the boneyard page), it tells me I have failed a security check and does not go through.

Now fixed, thanks for the report.

User avatar
Jar Wattinree
Ambassador
 
Posts: 1542
Founded: Dec 14, 2016
Psychotic Dictatorship

Postby Jar Wattinree » Sun Jul 03, 2022 5:24 pm

[violet] wrote:
Quebecshire wrote:whenever I go to dossier a nation that has ceased to exist (through the button to do so on the boneyard page), it tells me I have failed a security check and does not go through.

Now fixed, thanks for the report.

Many thanks.


Return to Technical

Who is online

Users browsing this forum: Querria

Advertisement

Remove ads