1Password 活动车 查看订阅信息 到期时间

1Password 活动车 查看订阅信息 到期时间
1Password 活动车 查看订阅信息 到期时间

Powerd by DeepSeek-v4-Pro

打开 1Password — Password Manager for Teams, Businesses, and Families 登陆账号
F12 控制台 粘贴以下代码
然后点击左侧的 账单
就会输出完整信息

image

// 粘贴到 F12 Console,刷新页面即可拦截
// https://my.1password.com/api/v3/account?attrs=billing,tier,promotions,counts

(function() {
  const TARGET = '/api/v3/account';
  window.__1p = { raw: null, decrypted: null, events: [] };

  const fmt = {
    money: (c) => (c / 100).toLocaleString('en-US', { style: 'currency', currency: 'USD' }),
    date:  (d) => new Date(d).toLocaleString('zh-CN', { hour12: false }),
    type:  (t) => ({ F:'家庭', B:'企业', P:'个人' })[t] || t,
    state: (s) => ({ A:'活跃', S:'暂停', F:'冻结' })[s] || s,
    bill:  (s) => ({ A:'活跃', T:'试用中', P:'逾期', C:'取消' })[s] || s,
    yn:    (b) => b ? '是' : '否',
  };

  // ── 展示 ──
  function display(data) {
    const { billing, tier, counts, promotions, ...acct } = data;
    const plans = tier?.plans || [];

    console.clear();
    console.log(`${acct.name}  [${fmt.type(acct.type)} · ${fmt.state(acct.state)}]`);

    console.groupCollapsed('账户信息');
    console.log('  UUID      ', acct.uuid);
    console.log('  创建时间  ', fmt.date(acct.createdAt));
    console.log('  域名      ', acct.domain + '.1password.com');
    console.log('  已用存储  ', acct.storageUsed + ' MB');
    console.groupEnd();

    console.groupCollapsed('计费');
    console.log('  状态      ', fmt.bill(billing.status));
    console.log('  试用开始  ', fmt.date(billing.trialStartedAt));
    console.log('  试用余天  ', billing.trialDays);
    console.log('  冻结到期  ', fmt.date(billing.freezesAt));
    console.log('  成员      ', billing.members);
    console.log('  访客      ', billing.guests);
    console.log('  UBP       ', fmt.yn(billing.isUbpEnrolled));
    if (billing.settings?.billingEmails) console.log('  账单邮箱  ', billing.settings.billingEmails);
    console.groupEnd();

    console.groupCollapsed('套餐 — ' + tier.name);
    console.log('  ID        ', tier.tierId);
    console.log('  账号类型  ', tier.accountType === 'F' ? '家庭版' : tier.accountType);
    console.log('  试用天数  ', tier.trialDays);
    console.log('  备份保留  ', tier.backupDays + ' 天');
    console.log('  成员      ', tier.membersIncluded + ' - ' + tier.maxMembers + ' 人');
    console.log('  访客      ', tier.guestsIncluded + ' / ' + tier.maxGuests + ' 人');
    console.log('  存储/用户 ', tier.storagePerUser / 1024 + ' GB');
    if (tier.features?.length) {
      console.groupCollapsed('功能列表 (' + tier.features.length + ' 项)');
      tier.features.forEach(f => console.log('  - ' + f));
      console.groupEnd();
    }
    console.groupEnd();

    if (plans.length) {
      console.groupCollapsed('定价');
      console.log('  周期    总价          月均      加座/月    备注');
      plans.forEach(p => {
        const d = p.display || {};
        const add = d.additionalSeats?.members ? fmt.money(d.additionalSeats.members.amount) : '—';
        console.log('  ' + [
          (p.frequency === 'Y' ? '年付' : '月付').padEnd(8),
          fmt.money(d.amount).padEnd(12),
          ('$' + (d.monthlyRate || '—')).padEnd(10),
          add.padEnd(10),
          d.priceDescription || ''
        ].join(''));
      });
      plans.forEach(p => console.log('  Stripe ' + p.stripePlanUid));
      console.groupEnd();
    }

    console.groupCollapsed('用量统计');
    [
      ['用户',    counts.users,           20],
      ['保险库',  counts.vaults,          20],
      ['群组',    counts.groups,          10],
      ['邀请',    counts.invitations,     10],
      ['活跃用户',counts.activeUsers,      20],
      ['活跃访客',counts.activeGuests,     10],
    ].forEach(([label, val, max]) => {
      const n = Math.round(Math.min(1, val / max) * 20);
      console.log('  ' + label.padEnd(6) + '  ' + '█'.repeat(n) + '░'.repeat(20 - n) + ' ' + val);
    });
    console.groupEnd();

    if (promotions && promotions.length) {
      console.groupCollapsed('促销 (' + promotions.length + ' 项)');
      promotions.forEach((p, i) => {
        if (p.name)  console.log('  [' + (i + 1) + '] ' + p.name);
        if (p.description) console.log('       ' + p.description);
        if (p.trialDays) console.log('       试用天数: ' + p.trialDays);
        console.log('       叠加试用: ' + fmt.yn(p.addTrialDays) + '  隐藏描述: ' + fmt.yn(p.suppressPromotionDescription) + '  显示计费: ' + fmt.yn(p.showBilling));
        if (p.thirdPartyBilling) console.log('       第三方计费: ' + fmt.yn(p.thirdPartyBilling));
        if (p.automatedPartnership) console.log('       自动合作: ' + fmt.yn(p.automatedPartnership));
      });
      console.groupEnd();
    }

    console.log('数据已存入 window.__1p.decrypted');
  }

  // ── 拦截 ──
  let shown = false;

  const _parse = JSON.parse;
  JSON.parse = function(text, reviver) {
    let r;
    try { r = _parse.call(this, text, reviver); }
    catch(_) { return _parse.call(this, text, reviver); }

    if (r && typeof r === 'object' && r.billing && r.tier) {
      window.__1p.rawText = text;
      window.__1p.decrypted = r;
      window.__1p.events.push({ type: 'decrypted', data: r, ts: Date.now() });

      if (!shown || r.promotions) {
        shown = true;
        display(r);
      }
    }
    return r;
  };

  const _fetch = window.fetch;
  window.fetch = function(input, init) {
    let url = typeof input === 'string' ? input : input?.url;
    const p = _fetch.call(window, input, init);
    if (url && url.includes(TARGET)) {
      p.then(res => {
        res.clone().text().then(t => {
          window.__1p.raw = t;
          window.__1p.events.push({ type: 'fetch', data: t, ts: Date.now(), url });
        });
      });
    }
    return p;
  };

  const _open = XMLHttpRequest.prototype.open;
  const _send = XMLHttpRequest.prototype.send;
  XMLHttpRequest.prototype.open = function(method, url) {
    this.__1p_url = url;
    return _open.call(this, method, url);
  };
  XMLHttpRequest.prototype.send = function() {
    if (this.__1p_url && this.__1p_url.includes(TARGET)) {
      this.addEventListener('load', () => {
        window.__1p.events.push({ type: 'xhr', data: this.responseText, ts: Date.now() });
      });
    }
    return _send.apply(this, arguments);
  };

  console.log('已激活 — 点击左侧账单页面即可触发');
})();

1 个帖子 - 1 位参与者

阅读完整话题

来源: LinuxDo 最新话题查看原文