mirror of
https://github.com/woodchen-ink/openai-billing-query.git
synced 2025-07-18 05:51:59 +08:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
55c266975c | ||
|
e5efcbd3f3 | ||
|
e17d22f6d7 | ||
|
10473ef9b5 | ||
65218d4d78 | |||
b512ae25de | |||
|
31f05dbda1 | ||
|
75a66371f0 | ||
|
896fe279cd | ||
|
1bdc566c45 | ||
|
63ff54c29d | ||
|
12885d66a1 | ||
|
82af4c8351 | ||
|
063e12e55a | ||
|
4c65ee7a71 | ||
|
853855d819 | ||
|
c93807a2f7 | ||
d63b02957a | |||
0eb792da0a | |||
|
01be618870 | ||
|
94fe780b48 | ||
|
598ee4864c | ||
|
8878b8fdc3 | ||
|
befd543d57 | ||
|
2e90adc476 | ||
6df15c2796 | |||
4cfdee7ca5 | |||
|
09c40f92a5 |
51
.github/workflows/jekyll-gh-pages.yml
vendored
Normal file
51
.github/workflows/jekyll-gh-pages.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
|
||||||
|
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Runs on pushes targeting the default branch
|
||||||
|
push:
|
||||||
|
branches: ["mdui2"]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Build job
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
|
- name: Build with Jekyll
|
||||||
|
uses: actions/jekyll-build-pages@v1
|
||||||
|
with:
|
||||||
|
source: ./
|
||||||
|
destination: ./_site
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
|
||||||
|
# Deployment job
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
20
README.md
20
README.md
@ -3,24 +3,25 @@
|
|||||||
|
|
||||||
star,please.
|
star,please.
|
||||||
|
|
||||||
Telegram交流群:https://t.me/ai_cn2023
|
[](https://edgeone.ai/pages/new?repository-url=https%3A%2F%2Fgithub.com%2Fwoodchen-ink%2Fopenai-billing-query)
|
||||||
QQ群:https://qm.qq.com/q/cCKTiXSn3G
|
|
||||||
|
|
||||||
|
|
||||||
## 在线访问(使用Cloudflare Pages部署)
|
## 在线访问(使用Cloudflare Pages部署)
|
||||||
新版本:https://o-b.woodchen.ink/ 或者 https://o-b.pages.dev
|
新版本:https://openai-billing-query.czl.net/
|
||||||
daisyUI版本:https://daisyui.o-b.pages.dev/
|
daisyUI版本:https://daisyui.o-b.pages.dev/
|
||||||
|
|
||||||
## [English](README_EN.md)
|
## [English](README_EN.md)
|
||||||
|
|
||||||
## 最新示意图(2023.08.28)
|
## 最新示意图(2023.08.28)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## SESS ID获取方法
|
## SESS ID获取方法
|
||||||
|
|
||||||
请见我的个人博客,提供视频教程:https://woodchen.ink/1266.html
|
[请见我的个人博客,提供视频教程](https://woodchen.ink/archives/how-to-query-the-balance-of-openai-in-batches-expires-gpt4-whether-to-tie-cards-1ov1aw)
|
||||||
|
|
||||||
## 支持自定义反代接口
|
## 支持自定义反代接口
|
||||||
在第361行添加自己的接口代码
|
在第361行添加自己的接口代码
|
||||||
@ -32,9 +33,6 @@ daisyUI版本:https://daisyui.o-b.pages.dev/
|
|||||||
## 怎么部署
|
## 怎么部署
|
||||||
下载index.html直接打开就行,除了背景图片,没有任何外部资源。
|
下载index.html直接打开就行,除了背景图片,没有任何外部资源。
|
||||||
|
|
||||||
## 赞赏码,如果觉得好用,可以请我喝杯咖啡
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## 贡献列表
|
## 贡献列表
|
||||||
|
|
||||||
@ -43,6 +41,10 @@ daisyUI版本:https://daisyui.o-b.pages.dev/
|
|||||||
| [qiyue](https://github.com/qiyue-rgb) | 技术协助 |
|
| [qiyue](https://github.com/qiyue-rgb) | 技术协助 |
|
||||||
| 🙊 | cloudflare反代地址 |
|
| 🙊 | cloudflare反代地址 |
|
||||||
|
|
||||||
|
## CDN acceleration and security protection for this project are sponsored by Tencent EdgeOne.
|
||||||
|
|
||||||
|
[Best Asian CDN, Edge, and Secure Solutions - Tencent EdgeOne](https://edgeone.ai/?from=github)
|
||||||
|
[](https://edgeone.ai/?from=github)
|
||||||
|
|
||||||
## 广告
|
## 广告
|
||||||
- [CZL Chat](https://chat.czl.net),稳定商业版AI服务。
|
- [CZL Chat](https://chat.czl.net),稳定商业版AI服务。
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
<mdui-menu-item value="https://api.openai.com">[官网线路]api.openai.com</mdui-menu-item>
|
<mdui-menu-item value="https://api.openai.com">[官网线路]api.openai.com</mdui-menu-item>
|
||||||
<mdui-menu-item value="https://oapi.czl.net">[CZLoapi线路]oapi.czl.net</mdui-menu-item>
|
<mdui-menu-item value="https://oapi.czl.net">[CZLoapi线路]oapi.czl.net</mdui-menu-item>
|
||||||
<mdui-menu-item value="https://openai.996.lat">[群友CF反代]openai.996.lat</mdui-menu-item>
|
<mdui-menu-item value="https://openai.996.lat">[群友CF反代]openai.996.lat</mdui-menu-item>
|
||||||
|
<mdui-menu-item value="https://gateway.ai.cloudflare.com/v1/feedd0aa8abd6875052d86a94f1baf83/test/openai">CF Gateway</mdui-menu-item>
|
||||||
<mdui-menu-item value="custom">[已前置https]自定义</mdui-menu-item>
|
<mdui-menu-item value="custom">[已前置https]自定义</mdui-menu-item>
|
||||||
</mdui-select>
|
</mdui-select>
|
||||||
|
|
||||||
@ -79,13 +80,13 @@
|
|||||||
<!-- 下半部分 -->
|
<!-- 下半部分 -->
|
||||||
<h4>页面列表</h4>
|
<h4>页面列表</h4>
|
||||||
<mdui-menu style="width:100%;margin-top:20px;">
|
<mdui-menu style="width:100%;margin-top:20px;">
|
||||||
<mdui-menu-item icon="search" href="index.html">查API信息</mdui-menu-item>
|
<mdui-menu-item icon="search" href="index.html">查API信息</mdui-menu-item>
|
||||||
<mdui-menu-item icon="vpn_key" href="get_sess.html">通过access token获取sess</mdui-menu-item>
|
<mdui-menu-item icon="vpn_key" href="get_sess.html">通过access token获取sess</mdui-menu-item>
|
||||||
<mdui-menu-item icon="build" href="https://woodchen.ink/1266.html"
|
<mdui-menu-item icon="vpn_key" href="get_sess2.html">通过PandoraNext获取sess</mdui-menu-item>
|
||||||
target="_blank">手动获取sess的方法</mdui-menu-item>
|
<mdui-menu-item icon="vpn_key" href="refresh_see.html">刷新Platform相关信息刷新sess</mdui-menu-item>
|
||||||
<mdui-menu-item icon="account_tree" href="https://github.com/pandora-next/deploy"
|
<mdui-menu-item icon="build" href="https://woodchen.ink/1266.html"
|
||||||
target="_blank">pandora无痛获取access</mdui-menu-item>
|
target="_blank">手动获取sess的方法</mdui-menu-item>
|
||||||
</mdui-menu>
|
</mdui-menu>
|
||||||
|
|
||||||
<div style="margin-top:20px;">
|
<div style="margin-top:20px;">
|
||||||
<mdui-chip elevated icon="code"> 本网页由<a href="https://woodchen.ink"
|
<mdui-chip elevated icon="code"> 本网页由<a href="https://woodchen.ink"
|
||||||
|
158
get_sess2.html
Normal file
158
get_sess2.html
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="mdui-theme-light" lang="zh-cmn-Hans">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>通过PandoraNext来获取Sensitive Id</title>
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="批量快速查询OPENAI的余额,支持可视化展现已用比例、额度、已用量、未用量、是否GPT-4、是否GPT4-32K、是否绑卡、绑卡信息、组织信息、是否有效"
|
||||||
|
/>
|
||||||
|
<link rel="stylesheet" href="./static/css-1.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="./static/mdui/mdui.css" />
|
||||||
|
<script src="./static/mdui/mdui.global.js"></script>
|
||||||
|
<script
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.6.3/axios.min.js"
|
||||||
|
integrity="sha512-JWQFV6OCC2o2x8x46YrEeFEQtzoNV++r9im8O8stv91YwHNykzIS2TbvAlFdeH0GVlpnyd79W0ZGmffcRi++Bw=="
|
||||||
|
crossorigin="anonymous"
|
||||||
|
referrerpolicy="no-referrer"
|
||||||
|
></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
mdui.setColorScheme("#0d2d44");
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
cursor: pointer; /* 添加鼠标指针样式 */
|
||||||
|
white-space: normal; /* 设置为normal使内容自动换行 */
|
||||||
|
word-wrap: break-word; /* 设置为break-word以确保长单词/链接被截断换行 */
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
/* 复制按钮样式 */
|
||||||
|
.copy-button {
|
||||||
|
height: 36px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #4caf50;
|
||||||
|
color: white;
|
||||||
|
padding: 8px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 8px 0;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<mdui-layout>
|
||||||
|
<mdui-layout-main>
|
||||||
|
<div class="mdui-main-container">
|
||||||
|
<div style="display: flex">
|
||||||
|
<h2 style="flex: 1">查询结果</h2>
|
||||||
|
<button class="copy-button" onclick="copySess()">复制sess</button>
|
||||||
|
<button class="copy-button" onclick="copyTable()">
|
||||||
|
复制全部内容
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="mdui-table">
|
||||||
|
<table id="result-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>邮箱账户</th>
|
||||||
|
<th>手机号</th>
|
||||||
|
<th>Sensitive ID</th>
|
||||||
|
<th>Refresh Token</th>
|
||||||
|
<th>Access Token</th>
|
||||||
|
<th>Sensitive ID创建时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="result-tbody" style="max-width: 100%">
|
||||||
|
<!-- 表格内容 -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mdui-layout-main>
|
||||||
|
|
||||||
|
<mdui-top-app-bar>
|
||||||
|
<mdui-button-icon
|
||||||
|
icon="menu"
|
||||||
|
close-on-overlay-click
|
||||||
|
id="toggle-button"
|
||||||
|
style="color: white"
|
||||||
|
></mdui-button-icon>
|
||||||
|
<mdui-top-app-bar-title style="text-align: center; color: white"
|
||||||
|
>通过PandoraNext来获取Sensitive Id</mdui-top-app-bar-title
|
||||||
|
>
|
||||||
|
</mdui-top-app-bar>
|
||||||
|
|
||||||
|
<mdui-navigation-drawer open class="left-drawer" close-on-overlay-click>
|
||||||
|
<div class="left-drawer-main">
|
||||||
|
<h3>输入 API KEY</h3>
|
||||||
|
<p>本站不保存 KEY 信息,查询后请自行保存</p>
|
||||||
|
<mdui-text-field
|
||||||
|
id="api-key-input"
|
||||||
|
placeholder="请输入账号密码,格式为'账号|密码|MFA验证码',多个请换行"
|
||||||
|
label="username|password|MFA"
|
||||||
|
rows="6"
|
||||||
|
></mdui-text-field>
|
||||||
|
|
||||||
|
<mdui-text-field
|
||||||
|
type="text"
|
||||||
|
id="custom-url-input"
|
||||||
|
placeholder="输入PandoraNext的API地址和前缀"
|
||||||
|
></mdui-text-field>
|
||||||
|
|
||||||
|
<div style="height: 2rem"></div>
|
||||||
|
|
||||||
|
<mdui-button
|
||||||
|
full-width
|
||||||
|
id="query-button"
|
||||||
|
icon="search"
|
||||||
|
onclick="sendRequest()"
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</mdui-button>
|
||||||
|
|
||||||
|
<!-- 下半部分 -->
|
||||||
|
<h4>页面列表</h4>
|
||||||
|
<mdui-menu style="width: 100%; margin-top: 20px">
|
||||||
|
<mdui-menu-item icon="search" href="index.html"
|
||||||
|
>查API信息</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="get_sess.html"
|
||||||
|
>通过access token获取sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="get_sess2.html"
|
||||||
|
>通过PandoraNext获取sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="refresh_see.html"
|
||||||
|
>刷新Platform相关信息刷新sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item
|
||||||
|
icon="build"
|
||||||
|
href="https://woodchen.ink/1266.html"
|
||||||
|
target="_blank"
|
||||||
|
>手动获取Sensitive Id的方法</mdui-menu-item
|
||||||
|
>
|
||||||
|
</mdui-menu>
|
||||||
|
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<mdui-chip elevated icon="code">
|
||||||
|
本网页由<a href="https://woodchen.ink" target="_blank">woodchen</a
|
||||||
|
>开源于<a
|
||||||
|
href="https://github.com/woodchen-ink/openai-billing-query"
|
||||||
|
target="_blank"
|
||||||
|
>Github</a
|
||||||
|
>
|
||||||
|
</mdui-chip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mdui-navigation-drawer>
|
||||||
|
</mdui-layout>
|
||||||
|
<script src="./static/getsess2.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
index.html
13
index.html
@ -60,12 +60,11 @@
|
|||||||
<mdui-select id="api-url-select" icon="airline_stops" label="查询线路" value="https://api.openai.com"
|
<mdui-select id="api-url-select" icon="airline_stops" label="查询线路" value="https://api.openai.com"
|
||||||
onchange="toggleCustomUrlInput()">
|
onchange="toggleCustomUrlInput()">
|
||||||
<mdui-menu-item value="https://api.openai.com">[官网线路]api.openai.com</mdui-menu-item>
|
<mdui-menu-item value="https://api.openai.com">[官网线路]api.openai.com</mdui-menu-item>
|
||||||
<mdui-menu-item value="https://oapi.czl.net">[CZLoapi线路]oapi.czl.net</mdui-menu-item>
|
|
||||||
<mdui-menu-item value="https://openai.996.lat">[群友CF反代]openai.996.lat</mdui-menu-item>
|
|
||||||
<mdui-menu-item value="custom">[已前置https]自定义</mdui-menu-item>
|
<mdui-menu-item value="custom">[已前置https]自定义</mdui-menu-item>
|
||||||
|
|
||||||
</mdui-select>
|
</mdui-select>
|
||||||
|
|
||||||
<mdui-text-field type="text" id="custom-url-input" placeholder="输入自定义API,填域名即可,无需https://"
|
<mdui-text-field type="text" id="custom-url-input" placeholder="如无前缀,自动添加https://"
|
||||||
class="hidden"></mdui-text-field>
|
class="hidden"></mdui-text-field>
|
||||||
|
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
@ -90,10 +89,10 @@
|
|||||||
<mdui-menu style="width:100%;margin-top:20px;">
|
<mdui-menu style="width:100%;margin-top:20px;">
|
||||||
<mdui-menu-item icon="search" href="index.html">查API信息</mdui-menu-item>
|
<mdui-menu-item icon="search" href="index.html">查API信息</mdui-menu-item>
|
||||||
<mdui-menu-item icon="vpn_key" href="get_sess.html">通过access token获取sess</mdui-menu-item>
|
<mdui-menu-item icon="vpn_key" href="get_sess.html">通过access token获取sess</mdui-menu-item>
|
||||||
<mdui-menu-item icon="build" href="https://woodchen.ink/1266.html"
|
<mdui-menu-item icon="vpn_key" href="get_sess2.html">通过PandoraNext获取sess</mdui-menu-item>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="refresh_see.html">刷新Platform相关信息刷新sess</mdui-menu-item>
|
||||||
|
<mdui-menu-item icon="build" href="https://woodchen.ink/archives/how-to-query-the-balance-of-openai-in-batches-expires-gpt4-whether-to-tie-cards-1ov1aw"
|
||||||
target="_blank">手动获取sess的方法</mdui-menu-item>
|
target="_blank">手动获取sess的方法</mdui-menu-item>
|
||||||
<mdui-menu-item icon="account_tree" href="https://github.com/pandora-next/deploy"
|
|
||||||
target="_blank">pandora无痛获取access</mdui-menu-item>
|
|
||||||
</mdui-menu>
|
</mdui-menu>
|
||||||
|
|
||||||
<div style="margin-top:20px;">
|
<div style="margin-top:20px;">
|
||||||
@ -111,4 +110,4 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
167
refresh_see.html
Normal file
167
refresh_see.html
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="mdui-theme-light" lang="zh-cmn-Hans">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>刷新Platform相关信息刷新sess</title>
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="批量快速查询OPENAI的余额,支持可视化展现已用比例、额度、已用量、未用量、是否GPT-4、是否GPT4-32K、是否绑卡、绑卡信息、组织信息、是否有效"
|
||||||
|
/>
|
||||||
|
<link rel="stylesheet" href="./static/css-1.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="./static/mdui/mdui.css" />
|
||||||
|
<script src="./static/mdui/mdui.global.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
mdui.setColorScheme("#0d2d44");
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
cursor: pointer; /* 添加鼠标指针样式 */
|
||||||
|
white-space: normal; /* 设置为normal使内容自动换行 */
|
||||||
|
word-wrap: break-word; /* 设置为break-word以确保长单词/链接被截断换行 */
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
/* 复制按钮样式 */
|
||||||
|
.copy-button {
|
||||||
|
height: 36px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #4caf50;
|
||||||
|
color: white;
|
||||||
|
padding: 8px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 8px 0;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<mdui-layout>
|
||||||
|
<mdui-layout-main>
|
||||||
|
<div class="mdui-main-container">
|
||||||
|
<div style="display: flex">
|
||||||
|
<h2 style="flex: 1">查询结果</h2>
|
||||||
|
<button class="copy-button" onclick="copySess()">复制sess</button>
|
||||||
|
<button class="copy-button" onclick="copyTable()">
|
||||||
|
复制全部内容
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="mdui-table">
|
||||||
|
<table id="result-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>邮箱账户</th>
|
||||||
|
<th>手机号</th>
|
||||||
|
<th>Sensitive ID</th>
|
||||||
|
<th>Refresh Token</th>
|
||||||
|
<th>Access Token</th>
|
||||||
|
<th>Sensitive ID创建时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="result-tbody" style="max-width: 100%">
|
||||||
|
<!-- 表格内容 -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mdui-layout-main>
|
||||||
|
|
||||||
|
<mdui-top-app-bar>
|
||||||
|
<mdui-button-icon
|
||||||
|
icon="menu"
|
||||||
|
close-on-overlay-click
|
||||||
|
id="toggle-button"
|
||||||
|
style="color: white"
|
||||||
|
></mdui-button-icon>
|
||||||
|
<mdui-top-app-bar-title style="text-align: center; color: white"
|
||||||
|
>刷新Platform相关信息刷新sess</mdui-top-app-bar-title
|
||||||
|
>
|
||||||
|
</mdui-top-app-bar>
|
||||||
|
|
||||||
|
<mdui-navigation-drawer open class="left-drawer" close-on-overlay-click>
|
||||||
|
<div class="left-drawer-main">
|
||||||
|
<h3>输入 API KEY</h3>
|
||||||
|
<p>本站不保存 KEY 信息,查询后请自行保存</p>
|
||||||
|
<mdui-text-field
|
||||||
|
id="api-key-input"
|
||||||
|
placeholder="请输入 refresh_token,多个请回车换行"
|
||||||
|
label="refresh_token"
|
||||||
|
rows="6"
|
||||||
|
></mdui-text-field>
|
||||||
|
|
||||||
|
<mdui-select
|
||||||
|
id="api-url-select"
|
||||||
|
icon="airline_stops"
|
||||||
|
label="查询线路"
|
||||||
|
value="https://ai.fakeopen.com"
|
||||||
|
onchange="toggleCustomUrlInput()"
|
||||||
|
>
|
||||||
|
<mdui-menu-item value="https://ai.fakeopen.com"
|
||||||
|
>[FkopenAi]ai.fakeopen.com</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item value="custom">[已前置https]自定义PandoraNext API</mdui-menu-item>
|
||||||
|
</mdui-select>
|
||||||
|
|
||||||
|
<mdui-text-field
|
||||||
|
type="text"
|
||||||
|
id="custom-url-input"
|
||||||
|
placeholder="请输入PandoraNext的API地址和前缀"
|
||||||
|
label="PandoraNext API地址和前缀"
|
||||||
|
class="hidden"
|
||||||
|
></mdui-text-field>
|
||||||
|
|
||||||
|
<div style="height: 2rem"></div>
|
||||||
|
|
||||||
|
<mdui-button
|
||||||
|
full-width
|
||||||
|
id="query-button"
|
||||||
|
icon="search"
|
||||||
|
onclick="sendRequest()"
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</mdui-button>
|
||||||
|
|
||||||
|
<!-- 下半部分 -->
|
||||||
|
<h4>页面列表</h4>
|
||||||
|
<mdui-menu style="width: 100%; margin-top: 20px">
|
||||||
|
<mdui-menu-item icon="search" href="index.html"
|
||||||
|
>查API信息</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="get_sess.html"
|
||||||
|
>通过access token获取sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="get_sess2.html"
|
||||||
|
>通过PandoraNext获取sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item icon="vpn_key" href="refresh_see.html"
|
||||||
|
>刷新Platform相关信息刷新sess</mdui-menu-item
|
||||||
|
>
|
||||||
|
<mdui-menu-item
|
||||||
|
icon="build"
|
||||||
|
href="https://woodchen.ink/1266.html"
|
||||||
|
target="_blank"
|
||||||
|
>手动获取sess的方法</mdui-menu-item
|
||||||
|
>
|
||||||
|
</mdui-menu>
|
||||||
|
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<mdui-chip elevated icon="code">
|
||||||
|
本网页由<a href="https://woodchen.ink" target="_blank">woodchen</a
|
||||||
|
>开源于<a
|
||||||
|
href="https://github.com/woodchen-ink/openai-billing-query"
|
||||||
|
target="_blank"
|
||||||
|
>Github</a
|
||||||
|
>
|
||||||
|
</mdui-chip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mdui-navigation-drawer>
|
||||||
|
</mdui-layout>
|
||||||
|
<script src="./static/refresh_see.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
File diff suppressed because one or more lines are too long
@ -8,7 +8,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: url('https://cdn-img-r2.czl.net/2023/05/23/pjbczr.webp') no-repeat center center fixed;
|
background: url('https://random-api.czl.net/pic/ecy') no-repeat center center fixed;
|
||||||
/* 自定义背景图 */
|
/* 自定义背景图 */
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
|
Binary file not shown.
@ -47,10 +47,6 @@ async function checkBilling(apiKey, apiUrl) {
|
|||||||
|
|
||||||
//查询函数
|
//查询函数
|
||||||
async function sendRequest() {
|
async function sendRequest() {
|
||||||
let button = document.querySelector("button");
|
|
||||||
button.textContent = "加载中...";
|
|
||||||
button.disabled = true;
|
|
||||||
button.classList.add("loading")
|
|
||||||
|
|
||||||
let apiKeyInput = document.getElementById("api-key-input");
|
let apiKeyInput = document.getElementById("api-key-input");
|
||||||
let apiUrlSelect = document.getElementById("api-url-select");
|
let apiUrlSelect = document.getElementById("api-url-select");
|
||||||
@ -76,12 +72,23 @@ async function sendRequest() {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
apiUrl = customUrlInput.value.trim();
|
apiUrl = customUrlInput.value.trim();
|
||||||
|
|
||||||
if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
|
if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
|
||||||
apiUrl = "https://" + apiUrl;
|
apiUrl = "https://" + apiUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!apiUrl.startsWith("https://gateway.ai.cloudflare.com")) {
|
||||||
|
apiUrl += "/v1"; // 如果不是,则添加路径‘/v1’
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
apiUrl = apiUrlSelect.value;
|
apiUrl = apiUrlSelect.value;
|
||||||
|
|
||||||
|
if (apiUrlSelect.value === "https://gateway.ai.cloudflare.com/v1/feedd0aa8abd6875052d86a94f1baf83/test/openai") {
|
||||||
|
apiUrl = apiUrl.replace("/v1", ""); // 如果用户选择的选项是https://gateway.ai.cloudflare.com开头,则删除/v1
|
||||||
|
} else {
|
||||||
|
apiUrl += "/v1"; // 如果不是,则添加路径‘/v1’
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let apiKeys = apiKeyInput.value.split(/[,\s,\n]+/);
|
let apiKeys = apiKeyInput.value.split(/[,\s,\n]+/);
|
||||||
@ -160,12 +167,6 @@ async function sendRequest() {
|
|||||||
queriedApiKeys = [];
|
queriedApiKeys = [];
|
||||||
}
|
}
|
||||||
serialNumber++;
|
serialNumber++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
button.textContent = "查询";
|
|
||||||
button.disabled = false;
|
|
||||||
button.classList.remove("loading");
|
|
||||||
}
|
}
|
||||||
hideLoadingAnimation();
|
hideLoadingAnimation();
|
||||||
}
|
}
|
||||||
@ -209,4 +210,15 @@ function hideLoadingAnimation() {
|
|||||||
// 将原始按钮元素替代回来
|
// 将原始按钮元素替代回来
|
||||||
progressElement.parentElement.replaceChild(button, progressElement);
|
progressElement.parentElement.replaceChild(button, progressElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let isOpen = true;
|
||||||
|
|
||||||
|
toggleButton.addEventListener("click", () => {
|
||||||
|
isOpen = !isOpen;
|
||||||
|
if (isOpen) {
|
||||||
|
navigationDrawer.open = true;
|
||||||
|
} else {
|
||||||
|
navigationDrawer.open = false;
|
||||||
|
}
|
||||||
|
});
|
247
static/getsess2.js
Normal file
247
static/getsess2.js
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
let serialNumber = 1;
|
||||||
|
|
||||||
|
function checkBilling(apiKey, apiUrl) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
const headers = {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
};
|
||||||
|
const urlGetsess = `${apiUrl}/api/auth/platform/login`;
|
||||||
|
var urlencoded = new URLSearchParams();
|
||||||
|
for (var i in apiKey) {
|
||||||
|
urlencoded.append(i, apiKey[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.post(urlGetsess, urlencoded, {
|
||||||
|
headers: headers,
|
||||||
|
maxRedirects: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const getsessdata = response.data;
|
||||||
|
if (getsessdata && getsessdata.login_info && getsessdata.token_info) {
|
||||||
|
resolve(getsessdata); // 返回getsessdata对象
|
||||||
|
} else {
|
||||||
|
reject(getsessdata);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//查询函数
|
||||||
|
async function sendRequest() {
|
||||||
|
let apiKeyInput = document.getElementById("api-key-input");
|
||||||
|
let customUrlInput = document.getElementById("custom-url-input");
|
||||||
|
|
||||||
|
document
|
||||||
|
.getElementById("result-table")
|
||||||
|
.getElementsByTagName("tbody")[0].innerHTML = "";
|
||||||
|
|
||||||
|
let apiUrl = customUrlInput.value.trim();
|
||||||
|
if (apiUrl.endsWith('/')) {
|
||||||
|
apiUrl = apiUrl.slice(0, -1); // 去掉末尾的"/"
|
||||||
|
}
|
||||||
|
let userList = apiKeyInput.value.split(/[,\s,\n]+/);
|
||||||
|
if (!apiUrl) {
|
||||||
|
mdui.alert({
|
||||||
|
headline: "无查询线路",
|
||||||
|
description: "请输入PandoraNext Api的地址",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
|
||||||
|
apiUrl = "https://" + apiUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userList.length === 0) {
|
||||||
|
mdui.alert({
|
||||||
|
headline: "请检查输入内容",
|
||||||
|
description: "请填写账户信息",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let userData = [];
|
||||||
|
for (var i = 0; i < userList.length; i++) {
|
||||||
|
var userInfo = userList[i].split(/\|/);
|
||||||
|
if (userInfo.length > 3 || userInfo.length < 2) {
|
||||||
|
mdui.alert({
|
||||||
|
headline: "请检查输入内容",
|
||||||
|
description: "请按格式输入账户信息",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
userData.push({
|
||||||
|
username: userInfo[0],
|
||||||
|
password: userInfo[1],
|
||||||
|
mfa_code: userInfo[2] ? userInfo[2] : "",
|
||||||
|
prompt: "login",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoadingAnimation();
|
||||||
|
|
||||||
|
let tableBody = document.querySelector("#result-table tbody");
|
||||||
|
let properties = [
|
||||||
|
"email",
|
||||||
|
"phone_number",
|
||||||
|
"sensitive_id",
|
||||||
|
"refresh_token",
|
||||||
|
"access_token",
|
||||||
|
"created",
|
||||||
|
];
|
||||||
|
for (let i = 0; i < userData.length; i++) {
|
||||||
|
let userInfo = userData[i];
|
||||||
|
let row = document.createElement("tr");
|
||||||
|
let serialNumberCell = document.createElement("td");
|
||||||
|
serialNumberCell.textContent = serialNumber;
|
||||||
|
row.appendChild(serialNumberCell);
|
||||||
|
|
||||||
|
try {
|
||||||
|
let data = await checkBilling(userInfo, apiUrl);
|
||||||
|
let user = data.login_info.user;
|
||||||
|
let session = user.session;
|
||||||
|
let token_info = data.token_info;
|
||||||
|
let cell = document.createElement("td");
|
||||||
|
let cellValue = '';
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
console.log(prop);
|
||||||
|
let cell = document.createElement("td");
|
||||||
|
if (prop === "created") {
|
||||||
|
cellValue = new Date(session["created"] * 1000).toLocaleString();
|
||||||
|
} else if (prop === "sensitive_id") {
|
||||||
|
cellValue = session[prop]; // 获取 session 对象中的 sensitive_id
|
||||||
|
cell.onclick = function () {
|
||||||
|
copyCell(cell, `Sensitive ID复制成功`);
|
||||||
|
};
|
||||||
|
} else if (prop === "refresh_token" || prop === "access_token") {
|
||||||
|
cellValue = token_info[prop];
|
||||||
|
cell.onclick = function () {
|
||||||
|
copyCell(cell, `${prop === "refresh_token" ? 'Refresh Token' : 'Access Token'}复制成功`);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
cellValue = user[prop] ? user[prop] : ''; // 确保在user[prop]为空时,cellValue被赋予空字符串
|
||||||
|
}
|
||||||
|
|
||||||
|
cell.textContent = cellValue && cellValue.length > 50 ? cellValue.substring(0, 57) + "..." : cellValue; // 如果长度超过60,显示"..."
|
||||||
|
cell.innerHTML = `<span title="${cellValue}">${cell.textContent}</span>`; // 在悬停时显示全部内容
|
||||||
|
row.appendChild(cell);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
let username = document.createElement("td");
|
||||||
|
username.textContent = userInfo.username;
|
||||||
|
row.appendChild(username);
|
||||||
|
let errorMessageCell = document.createElement("td");
|
||||||
|
errorMessageCell.colSpan = "8";
|
||||||
|
errorMessageCell.classList.add("status-error");
|
||||||
|
// 在这里检查错误信息是否为 "error request login url"
|
||||||
|
if (error === 'error request login url') {
|
||||||
|
errorMessageCell.textContent = '请求错误,请稍后重试';
|
||||||
|
} else {
|
||||||
|
errorMessageCell.textContent = error && error.detail ? error.detail : error;
|
||||||
|
}
|
||||||
|
row.appendChild(errorMessageCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
tableBody.appendChild(row);
|
||||||
|
serialNumber++;
|
||||||
|
}
|
||||||
|
hideLoadingAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyCell(cell, message) {
|
||||||
|
// 创建一个新的textarea元素
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
// 设置textarea的值为单元格的文本内容
|
||||||
|
textarea.value = cell.innerText;
|
||||||
|
// 将textarea元素添加到body中
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
// 选择textarea的文本内容
|
||||||
|
textarea.select();
|
||||||
|
// 执行复制命令
|
||||||
|
document.execCommand("copy");
|
||||||
|
// 移除textarea元素
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: message,
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyTable() {
|
||||||
|
// 这个函数可以保留,以便你仍然可以复制整个表格内容
|
||||||
|
var tableBody = document.getElementById("result-tbody");
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
textarea.value = tableBody.innerText;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: "复制成功",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copySess() {
|
||||||
|
var sensitiveCells = document.querySelectorAll("tbody td:nth-child(4) span"); // 选择所有的Sensitive ID单元格
|
||||||
|
var sensitiveIds = Array.from(sensitiveCells).map((cell) => cell.title); // 从单元格中获取所有的Sensitive ID
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
textarea.value = sensitiveIds.join("\n"); // 用换行符连接所有的Sensitive ID
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: "Sensitive ID复制成功",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLoadingAnimation() {
|
||||||
|
const button = document.getElementById("query-button");
|
||||||
|
|
||||||
|
// 创建一个新的 <mdui-linear-progress> 元素
|
||||||
|
const progressElement = document.createElement("mdui-linear-progress");
|
||||||
|
progressElement.id = "query-progress";
|
||||||
|
|
||||||
|
// 将新元素替代原始按钮元素
|
||||||
|
button.parentElement.replaceChild(progressElement, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideLoadingAnimation() {
|
||||||
|
const progressElement = document.querySelector("mdui-linear-progress");
|
||||||
|
|
||||||
|
if (progressElement) {
|
||||||
|
const button = document.createElement("mdui-button");
|
||||||
|
button.id = "query-button";
|
||||||
|
button.innerHTML = "查询";
|
||||||
|
button.setAttribute("full-width", "");
|
||||||
|
button.setAttribute("icon", "search");
|
||||||
|
button.setAttribute("onclick", "sendRequest()");
|
||||||
|
|
||||||
|
// 将原始按钮元素替代回来
|
||||||
|
progressElement.parentElement.replaceChild(button, progressElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const navigationDrawer = document.querySelector(".left-drawer");
|
||||||
|
const toggleButton = document.getElementById("toggle-button");
|
||||||
|
|
||||||
|
let isOpen = true;
|
||||||
|
|
||||||
|
toggleButton.addEventListener("click", () => {
|
||||||
|
isOpen = !isOpen;
|
||||||
|
if (isOpen) {
|
||||||
|
navigationDrawer.open = true;
|
||||||
|
} else {
|
||||||
|
navigationDrawer.open = false;
|
||||||
|
}
|
||||||
|
});
|
279
static/refresh_see.js
Normal file
279
static/refresh_see.js
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
let serialNumber = 1;
|
||||||
|
|
||||||
|
// 线路选择框
|
||||||
|
function toggleCustomUrlInput() {
|
||||||
|
// 获取id为"api-url-select"的元素
|
||||||
|
const selectElement = document.getElementById("api-url-select");
|
||||||
|
// 获取id为"custom-url-input"的元素
|
||||||
|
const customUrlInput = document.getElementById("custom-url-input");
|
||||||
|
|
||||||
|
// 如果selectElement的值为"custom"
|
||||||
|
if (selectElement.value === "custom") {
|
||||||
|
// 从customUrlInput的classList中移除"hidden"
|
||||||
|
customUrlInput.classList.remove("hidden");
|
||||||
|
} else {
|
||||||
|
// 给customUrlInput的classList添加"hidden"
|
||||||
|
customUrlInput.classList.add("hidden");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkBilling(apiKey, apiUrl) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
try {
|
||||||
|
// 拼接url
|
||||||
|
var tokenUrl = `${apiUrl}`;
|
||||||
|
var loginUrl = `${apiUrl}/v1/dashboard/onboarding/login`;
|
||||||
|
// 使用"/auth/platform/refresh",潘多拉则需要加上/api
|
||||||
|
if (!apiUrl.startsWith("https://ai.fakeopen.com")) {
|
||||||
|
tokenUrl += "/api";
|
||||||
|
}
|
||||||
|
tokenUrl += "/auth/platform/refresh";
|
||||||
|
|
||||||
|
var urlencoded = new URLSearchParams();
|
||||||
|
urlencoded.append("refresh_token", apiKey);
|
||||||
|
|
||||||
|
let response = await fetch(tokenUrl, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
|
body: urlencoded,
|
||||||
|
redirect: "follow",
|
||||||
|
});
|
||||||
|
const rdata = await response.json();
|
||||||
|
if (rdata && rdata.access_token && rdata.refresh_token) {
|
||||||
|
// 查询sess
|
||||||
|
const get_sess = await fetch(loginUrl, {
|
||||||
|
method: "POST", // 设置请求方法为 POST
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + rdata.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({}), // 此处放置要发送的数据
|
||||||
|
});
|
||||||
|
const getsessdata = await get_sess.json();
|
||||||
|
if (getsessdata && getsessdata.user && getsessdata.user.session) {
|
||||||
|
resolve({ token_info: rdata, ...getsessdata });
|
||||||
|
} else {
|
||||||
|
reject(getsessdata);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reject(rdata);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询函数
|
||||||
|
async function sendRequest() {
|
||||||
|
let apiKeyInput = document.getElementById("api-key-input");
|
||||||
|
let apiUrlSelect = document.getElementById("api-url-select");
|
||||||
|
let customUrlInput = document.getElementById("custom-url-input");
|
||||||
|
|
||||||
|
document
|
||||||
|
.getElementById("result-table")
|
||||||
|
.getElementsByTagName("tbody")[0].innerHTML = "";
|
||||||
|
let apiUrl = apiUrlSelect.value;
|
||||||
|
if (apiUrlSelect.value === "custom") {
|
||||||
|
apiUrl = customUrlInput.value.trim();
|
||||||
|
}
|
||||||
|
if (!apiUrl) {
|
||||||
|
mdui.alert({
|
||||||
|
headline: "无查询线路",
|
||||||
|
description: "请选择或自定义配置查询Sess线路",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
|
||||||
|
apiUrl = "https://" + apiUrl;
|
||||||
|
}
|
||||||
|
if (apiUrl && apiUrl.endsWith("/")) {
|
||||||
|
apiUrl = apiUrl.slice(0, -1); // 去掉末尾的"/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let tokenList = apiKeyInput.value.split(/[,\s,\n]+/);
|
||||||
|
if (!apiKeyInput.value || tokenList.length === 0) {
|
||||||
|
mdui.alert({
|
||||||
|
headline: "请输入Token",
|
||||||
|
description: "请检查输入refresh_token",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showLoadingAnimation();
|
||||||
|
|
||||||
|
let tableBody = document.querySelector("#result-table tbody");
|
||||||
|
|
||||||
|
let properties = [
|
||||||
|
"email",
|
||||||
|
"phone_number",
|
||||||
|
"sensitive_id",
|
||||||
|
"refresh_token",
|
||||||
|
"access_token",
|
||||||
|
"created",
|
||||||
|
];
|
||||||
|
|
||||||
|
for (let i = 0; i < tokenList.length; i++) {
|
||||||
|
let token = tokenList[i].trim();
|
||||||
|
if (token) {
|
||||||
|
let row = document.createElement("tr");
|
||||||
|
let serialNumberCell = document.createElement("td");
|
||||||
|
serialNumberCell.textContent = serialNumber;
|
||||||
|
row.appendChild(serialNumberCell);
|
||||||
|
try {
|
||||||
|
let data = await checkBilling(token, apiUrl);
|
||||||
|
let user = data.user;
|
||||||
|
let session = user.session;
|
||||||
|
let token_info = data.token_info;
|
||||||
|
properties.forEach((prop) => {
|
||||||
|
let cellValue = "";
|
||||||
|
let cell = document.createElement("td");
|
||||||
|
if (prop === "created") {
|
||||||
|
cellValue = new Date(session["created"] * 1000).toLocaleString();
|
||||||
|
} else if (prop === "sensitive_id") {
|
||||||
|
cellValue = session[prop]; // 获取 session 对象中的 sensitive_id
|
||||||
|
cell.onclick = function () {
|
||||||
|
copyCell(cell, `Sensitive ID复制成功`);
|
||||||
|
};
|
||||||
|
} else if (prop === "refresh_token" || prop === "access_token") {
|
||||||
|
cellValue = token_info[prop];
|
||||||
|
cell.onclick = function () {
|
||||||
|
copyCell(
|
||||||
|
cell,
|
||||||
|
`${
|
||||||
|
prop === "refresh_token" ? "Refresh Token" : "Access Token"
|
||||||
|
}复制成功`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
cellValue = user[prop] ? user[prop] : ""; // 确保在user[prop]为空时,cellValue被赋予空字符串
|
||||||
|
}
|
||||||
|
|
||||||
|
cell.textContent =
|
||||||
|
cellValue && cellValue.length > 50
|
||||||
|
? cellValue.substring(0, 57) + "..."
|
||||||
|
: cellValue; // 如果长度超过60,显示"..."
|
||||||
|
cell.innerHTML = `<span title="${cellValue}">${cell.textContent}</span>`; // 在悬停时显示全部内容
|
||||||
|
row.appendChild(cell);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
let username = document.createElement("td");
|
||||||
|
username.textContent = token.replace(/^(.{10}).*(.{8})$/, "$1***$2");
|
||||||
|
row.appendChild(username);
|
||||||
|
let errorMessageCell = document.createElement("td");
|
||||||
|
errorMessageCell.colSpan = "8";
|
||||||
|
errorMessageCell.classList.add("status-error");
|
||||||
|
// 在这里检查错误信息是否为 "error request login url"
|
||||||
|
if (error === "error request login url") {
|
||||||
|
errorMessageCell.textContent = "请求错误,请稍后重试";
|
||||||
|
} else {
|
||||||
|
errorMessageCell.textContent =
|
||||||
|
error && error.detail ? error.detail : error;
|
||||||
|
}
|
||||||
|
row.appendChild(errorMessageCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
tableBody.appendChild(row);
|
||||||
|
serialNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hideLoadingAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyCell(cell, message) {
|
||||||
|
// 创建一个新的textarea元素
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
// 设置textarea的值为单元格的文本内容
|
||||||
|
textarea.value = cell.innerText;
|
||||||
|
// 将textarea元素添加到body中
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
// 选择textarea的文本内容
|
||||||
|
textarea.select();
|
||||||
|
// 执行复制命令
|
||||||
|
document.execCommand("copy");
|
||||||
|
// 移除textarea元素
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: message,
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyTable() {
|
||||||
|
// 这个函数可以保留,以便你仍然可以复制整个表格内容
|
||||||
|
var tableBody = document.getElementById("result-tbody");
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
textarea.value = tableBody.innerText;
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: "复制成功",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function copySess() {
|
||||||
|
var sensitiveCells = document.querySelectorAll("tbody td:nth-child(4) span"); // 选择所有的Sensitive ID单元格
|
||||||
|
var sensitiveIds = Array.from(sensitiveCells).map((cell) => cell.title); // 从单元格中获取所有的Sensitive ID
|
||||||
|
var textarea = document.createElement("textarea");
|
||||||
|
textarea.value = sensitiveIds.join("\n"); // 用换行符连接所有的Sensitive ID
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
mdui.alert({
|
||||||
|
headline: "提示",
|
||||||
|
description: "Sensitive ID复制成功",
|
||||||
|
confirmText: "OK",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLoadingAnimation() {
|
||||||
|
const button = document.getElementById("query-button");
|
||||||
|
|
||||||
|
// 创建一个新的 <mdui-linear-progress> 元素
|
||||||
|
const progressElement = document.createElement("mdui-linear-progress");
|
||||||
|
progressElement.id = "query-progress";
|
||||||
|
|
||||||
|
// 将新元素替代原始按钮元素
|
||||||
|
button.parentElement.replaceChild(progressElement, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideLoadingAnimation() {
|
||||||
|
const progressElement = document.querySelector("mdui-linear-progress");
|
||||||
|
|
||||||
|
if (progressElement) {
|
||||||
|
const button = document.createElement("mdui-button");
|
||||||
|
button.id = "query-button";
|
||||||
|
button.innerHTML = "查询";
|
||||||
|
button.setAttribute("full-width", "");
|
||||||
|
button.setAttribute("icon", "search");
|
||||||
|
button.setAttribute("onclick", "sendRequest()");
|
||||||
|
|
||||||
|
// 将原始按钮元素替代回来
|
||||||
|
progressElement.parentElement.replaceChild(button, progressElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const navigationDrawer = document.querySelector(".left-drawer");
|
||||||
|
const toggleButton = document.getElementById("toggle-button");
|
||||||
|
|
||||||
|
let isOpen = true;
|
||||||
|
|
||||||
|
toggleButton.addEventListener("click", () => {
|
||||||
|
isOpen = !isOpen;
|
||||||
|
if (isOpen) {
|
||||||
|
navigationDrawer.open = true;
|
||||||
|
} else {
|
||||||
|
navigationDrawer.open = false;
|
||||||
|
}
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user