Show Privy Token from Cookies

Show and copy only privy-token from cookies on screen (as seen in image)

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Show Privy Token from Cookies
// @namespace    https://t.me/forestarmy
// @version      1.0
// @description  Show and copy only privy-token from cookies on screen (as seen in image)
// @author       itsmesatyavir
// @match        *://*/*
// @grant        GM_setClipboard
// ==/UserScript==

(function () {
  'use strict';

  function getPrivyToken() {
    const match = document.cookie.match(/privy-token=([^;]+)/);
    return match ? decodeURIComponent(match[1]) : null;
  }

  function showToken(token) {
    const box = document.createElement("div");
    box.innerHTML = `
      <div style="
        background: #111;
        color: #0ff;
        padding: 12px;
        font-family: monospace;
        font-size: 12px;
        border: 2px solid #0ff;
        border-radius: 8px;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 99999;
        max-width: 90vw;
        word-break: break-all;
      ">
        <strong>privy-token:</strong><br>${token}<br><br>
        <button id="copyPrivyBtn" style="
          background: #0ff;
          color: #000;
          border: none;
          padding: 6px 12px;
          border-radius: 6px;
          cursor: pointer;
        ">📋 Copy Token</button>
      </div>
    `;
    document.body.appendChild(box);

    document.getElementById("copyPrivyBtn").onclick = () => {
      GM_setClipboard(token);
      document.getElementById("copyPrivyBtn").innerText = "✅ Copied!";
      setTimeout(() => {
        document.getElementById("copyPrivyBtn").innerText = "📋 Copy Token";
      }, 1500);
    };
  }

  window.addEventListener("load", () => {
    const token = getPrivyToken();
    if (token) {
      showToken(token);
      console.log("✅ privy-token found:", token);
    } else {
      console.warn("⚠️ privy-token not found in cookies.");
    }
  });
})();