GetTokenForKIPAPP

Kirim Token

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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
    });

})();