GetTokenForKIPAPP

Kirim Token

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         GetTokenForKIPAPP
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Kirim Token
// @author       Anda
// @match        https://webapps.bps.go.id/kipapp/*
// @grant        GM_xmlhttpRequest
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/localstorage-slim.js
// @license MIT
// ==/UserScript==


(function() {
    'use strict';

    let button = document.createElement("button");
    button.innerText = "Kirim Token";
    button.style.position = "fixed";
    button.style.bottom = "20px";
    button.style.right = "20px";
    button.style.zIndex = "1000";
    button.style.padding = "10px 15px";
    button.style.backgroundColor = "#28a745";
    button.style.color = "white";
    button.style.border = "none";
    button.style.borderRadius = "5px";
    button.style.cursor = "pointer";

    document.body.appendChild(button);

    let data;
    function waitForLS(callback) {
        if (typeof ls !== "undefined") {
            callback();
        } else {
            setTimeout(() => waitForLS(callback), 100);
        }
    }

    waitForLS(() => {
        console.debug("localstorage-slim tersedia!");

       // data = localStorage.getItem('ka-p-fa0de6036011042cc37f296a888475a2');
        //console.debug(data);
        data = ls.get('ka-p-fa0de6036011042cc37f296a888475a2', {decrypt: true, secret: 2188321});
      //  console.debug(ls.get('ka-p-fa0de6036011042cc37f296a888475a2', {decrypt: true, secret: 2188321}));

    });

    function sendDataToForm() {
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://203.194.113.246:88/token",  // Ubah URL jika diperlukan
            headers: { "Content-Type": "application/x-www-form-urlencoded" },
            data: "textarea_input=" + encodeURIComponent(data), // Format x-www-form-urlencoded
            onload: function(response) {
                if (response.status === 200) {
                    alert("Token berhasil dikirim");
                    console.log("Response:", response.responseText);
                } else {
                    alert("Gagal mengirim Token! Status: " + response.status);
                }
            },
            onerror: function(error) {
                alert("Terjadi kesalahan saat mengirim data!");
                console.error("Error:", error);
            }
        });
    }

    button.addEventListener("click", function() {
        sendDataToForm();  // Kirim data ketika tombol diklik
    });

})();