From 1aa9aeebca36b4647f687158fc045a21f77b8b89 Mon Sep 17 00:00:00 2001
From: wood
Date: Wed, 30 Aug 2023 21:38:37 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E9=80=9A=E8=BF=87access=20token=20?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96sess=20Fixes=20#14?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
get_sess.html | 53 ---------------
get_sess1.html | 69 ++++++++++++++++++++
index.html | 2 +-
static/sess.js | 70 --------------------
static/sess1.js | 170 ++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 240 insertions(+), 124 deletions(-)
delete mode 100644 get_sess.html
create mode 100644 get_sess1.html
delete mode 100644 static/sess.js
create mode 100644 static/sess1.js
diff --git a/get_sess.html b/get_sess.html
deleted file mode 100644
index 755654d..0000000
--- a/get_sess.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
- 获取SESS
-
-
-
-
-
-
-
-
-
-
输入 API KEY
-
通过fakeopen.com获取,自行考虑风险。
-
-
-
-
-
- 查询结果
-
-
-
- 序号 |
- 邮箱 |
- user-id |
- sess |
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/get_sess1.html b/get_sess1.html
new file mode 100644
index 0000000..25dd3cb
--- /dev/null
+++ b/get_sess1.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ 通过access_token来获取sess
+
+
+
+
+
+
+
+
+
+
输入 Access Token
+
本站不保存 KEY 信息,查询后请自行保存
+
+
+
+
+
+
+
选择查询线路
+
支持自定义线路,官网线路需要魔法
+
+
+
+
+
+
+
+
+ 查询结果
+
+
+
+ 序号 |
+ Access_Token |
+ sess id |
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.html b/index.html
index eafed87..e5f2149 100644
--- a/index.html
+++ b/index.html
@@ -13,7 +13,7 @@
OpenAI API 信息查询
7月22日更新后,需使用sess码进行查询。使用key只能查询总额度、绑卡、GPT4和组织ID。
-
+ 页面列表:查API信息 通过access token获取sess
diff --git a/static/sess.js b/static/sess.js
deleted file mode 100644
index 557de67..0000000
--- a/static/sess.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// 定义一个异步函数来发送请求
-async function sendRequest() {
- //获取用户输入的账号和密码
- let input = document.getElementById('api-key-input').value.split('\n');
- let users = input.map(user => {
- const [username, password] = user.split(' --- ');
- return { username, password };
- });
-
- //获取前一天的日期
- let day = new Date();
- day.setDate(day.getDate() - 1);
- let yesterday = day.toISOString().slice(0, 10).replace(/-/g, '');
-
- for (let i = 0; i < users.length; i++) {
- let user = users[i];
-
- //发送第一个请求
- const response1 = await fetch('https://ai-' + yesterday + '.fakeopen.com/auth/login', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Origin': `https://ai-${yesterday}.fakeopen.com`,
- 'Referer': `https://ai-${yesterday}.fakeopen.com/auth1`
- },
- body: new URLSearchParams({
- username: user.username,
- password: user.password,
- mfa_code: ''
- }),
- });
-
- const data1 = await response1.json();
- const accessToken = data1.access_token;
-
- //发送第二个请求
- const response2 = await fetch('https://ai.fakeopen.com/dashboard/onboarding/login', {
- method: 'GET',
- headers: {
- 'Authorization': 'Bearer ' + accessToken,
- },
- });
-
- const data2 = await response2.json();
-
- //打印结果到 #result 表格
- let result = document.getElementById('result');
- result.style.visibility = 'visible';
- result.innerHTML += `
${i + 1} | ${data2.user.email} | ${data2.user.id} | ${data2.user.session.sensitive_id} |
`;
- }
-
- //显示结果标题
- document.getElementById('result-head').style.visibility = 'visible';
-
- //为每个用户添加一个按钮,点击复制 sensitive_id
- let button = document.createElement('button');
- button.innerText = '复制 sensitive_id';
- document.body.appendChild(button);
- let sensitive_ids = Array.from(document.getElementById('result').querySelectorAll('tr td:nth-child(4)')).map(td => td.innerText);
- button.addEventListener('click', function () {
- let copyText = sensitive_ids.join('\n');
- navigator.clipboard.writeText(copyText)
- .then(() => {
- alert('Copied!');
- })
- .catch(err => {
- alert('Error in copying text: ', err);
- });
- });
-}
diff --git a/static/sess1.js b/static/sess1.js
new file mode 100644
index 0000000..2cc7336
--- /dev/null
+++ b/static/sess1.js
@@ -0,0 +1,170 @@
+let queriedApiKeys = [];
+let serialNumber = 1;
+
+
+async function checkBilling(apiKey, apiUrl) {
+ const headers = {
+ "Authorization": "Bearer " + apiKey,
+ "Content-Type": "application/json"
+ };
+ const urlGetsess = `${apiUrl}/dashboard/onboarding/login`;
+
+ try {
+ let getSess;
+ try {
+ const response = await fetch(urlGetsess, {
+ method: "POST", // 设置请求方法为 POST
+ headers: headers,
+ body: JSON.stringify({}) // 此处放置要发送的数据
+ });
+
+ const getsessdata = await response.json();
+ console.log(getsessdata);
+
+ // 获取"sensitive_id"
+ const sensitiveId = getsessdata.user.session.sensitive_id;
+
+ // 现在,sensitiveId 包含了"sensitive_id"的值
+ console.log(sensitiveId);
+ return [sensitiveId];
+ } catch (error) {
+ console.error(error);
+ }
+
+ } catch (error) {
+ console.error(error);
+ return [null];
+ }
+}
+
+//查询函数
+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 apiUrlSelect = document.getElementById("api-url-select");
+ let customUrlInput = document.getElementById("custom-url-input");
+ let table = document.getElementById("result-table");
+ let h2 = document.getElementById("result-head");
+ h2.style.visibility = "visible";
+ table.style.visibility = "visible";
+
+ if (apiKeyInput.value.trim() === "") {
+ alert("请填写API KEY");
+ return;
+ }
+
+ document.getElementById("result-table").getElementsByTagName('tbody')[0].innerHTML = "";
+
+ let apiUrl = "";
+ if (apiUrlSelect.value === "custom") {
+ if (customUrlInput.value.trim() === "") {
+ alert("请设置API链接");
+ return;
+ } else {
+ apiUrl = customUrlInput.value.trim();
+ if (!apiUrl.startsWith("http://") && !apiUrl.startsWith("https://")) {
+ apiUrl = "https://" + apiUrl;
+ }
+ }
+ } else {
+ apiUrl = apiUrlSelect.value;
+ }
+
+ let apiKeys = apiKeyInput.value.split(/[,\s,\n]+/);
+
+ if (apiKeys.length === 0) {
+ alert("未匹配到 API-KEY,请检查输入内容");
+ return;
+ }
+
+ alert("成功匹配到 API Key,确认后开始查询:" + apiKeys);
+
+ let tableBody = document.querySelector("#result-table tbody");
+ for (let i = 0; i < apiKeys.length; i++) {
+ let apiKey = apiKeys[i].trim();
+
+ if (queriedApiKeys.includes(apiKey)) {
+ console.log(`API KEY ${apiKey} 已查询过,跳过此次查询`);
+ continue;
+ }
+ queriedApiKeys.push(apiKey);
+
+ // 使用 await 关键字等待 checkBilling 的结果
+ let data = await checkBilling(apiKey, apiUrl);
+
+ data = data.map(item => {
+ if (item === undefined || item === null) {
+ return 'Not Found.'
+ } else {
+ return item;
+ }
+ })
+
+
+ let row = document.createElement("tr");
+
+ checkBilling(apiKey, apiUrl).then((data) => {
+ data = data.map(item => {
+ if (item === undefined) {
+ return 'Not Found.'
+ } else {
+ return item
+ }
+ }
+ )
+
+ let row = document.createElement("tr");
+
+ let serialNumberCell = document.createElement("td"); // 创建序列号单元格
+ serialNumberCell.textContent = serialNumber; // 设置序列号文本
+ row.appendChild(serialNumberCell); // 将序列号单元格添加到行中
+
+ let apiKeyCell = document.createElement("td");
+ apiKeyCell.textContent = apiKey.replace(/^(.{10}).*(.{8})$/, "$1***$2");
+ row.appendChild(apiKeyCell);
+
+ console.log('查看查询结果', data); // 添加 console.log 以查看 data 的值
+
+ if (data[0] === undefined) {
+ let errorMessageCell = document.createElement("td");
+ errorMessageCell.colSpan = "8";
+ errorMessageCell.classList.add("status-error");
+ errorMessageCell.textContent = "不正确或已失效的API-KEY";
+ row.appendChild(errorMessageCell);
+ } else {
+ let sensitiveIdResult = document.createElement("td");
+ sensitiveIdResult.textContent = data[0];
+ row.appendChild(sensitiveIdResult);
+ }
+ tableBody.appendChild(row);
+
+ if (i === apiKeys.length - 1) {
+ queriedApiKeys = [];
+ }
+ serialNumber++; // 增加序列号
+ h2.style.display = 'block';
+ table.style.display = 'table';
+
+ button.textContent = "查询";
+ button.disabled = false;
+ button.classList.remove("loading")
+ })
+
+ }
+}
+
+let apiUrlSelect = document.getElementById("api-url-select");
+let customUrlInput = document.getElementById("custom-url-input");
+
+apiUrlSelect.addEventListener("change", function () {
+ if (apiUrlSelect.value === "custom") {
+ customUrlInput.style.display = "inline-block";
+ customUrlInput.style.marginTop = "5px";
+ } else {
+ customUrlInput.style.display = "none";
+ }
+});
\ No newline at end of file
From d1059d3b6e41996a09b7df590aa24f60fc3d66df Mon Sep 17 00:00:00 2001
From: wood
Date: Wed, 30 Aug 2023 21:42:28 +0800
Subject: [PATCH 2/4] update
---
static/css.css | 3 +++
1 file changed, 3 insertions(+)
diff --git a/static/css.css b/static/css.css
index 5a16db3..c1b1e8f 100644
--- a/static/css.css
+++ b/static/css.css
@@ -272,6 +272,7 @@ input#custom-url-input {
height: 20px;
padding: 10px 5px;
text-align: left;
+ border-radius: 8px;
/* border: 1px solid #dcdcdc; */
}
@@ -280,6 +281,7 @@ input#custom-url-input {
height: 20px;
text-align: left;
padding: 10px 5px;
+ border-radius: 8px;
/* border: 1px solid #d3d3d3; */
}
@@ -446,3 +448,4 @@ button.loading::before {
+
From 7f936e54e441bf3403c2f64a0b05d803fabc6d87 Mon Sep 17 00:00:00 2001
From: wood
Date: Wed, 30 Aug 2023 21:44:55 +0800
Subject: [PATCH 3/4] update
---
static/css.css | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/static/css.css b/static/css.css
index c1b1e8f..7c32f02 100644
--- a/static/css.css
+++ b/static/css.css
@@ -272,7 +272,6 @@ input#custom-url-input {
height: 20px;
padding: 10px 5px;
text-align: left;
- border-radius: 8px;
/* border: 1px solid #dcdcdc; */
}
@@ -281,10 +280,13 @@ input#custom-url-input {
height: 20px;
text-align: left;
padding: 10px 5px;
- border-radius: 8px;
/* border: 1px solid #d3d3d3; */
}
+#result-table tr{
+ border-radius: 8px;
+}
+
/* 下面的代码定义了结果表格奇数行的背景颜色 */
#result-table tbody tr:nth-child(odd) {
background-color: #252422;
From 232b613aeefc7cd24a5cab76ee50ebeb21928c0b Mon Sep 17 00:00:00 2001
From: wood
Date: Wed, 30 Aug 2023 21:47:02 +0800
Subject: [PATCH 4/4] update
---
static/css.css | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/static/css.css b/static/css.css
index 7c32f02..d9321ad 100644
--- a/static/css.css
+++ b/static/css.css
@@ -283,9 +283,9 @@ input#custom-url-input {
/* border: 1px solid #d3d3d3; */
}
-#result-table tr{
+/* #result-table tr{
border-radius: 8px;
-}
+} */
/* 下面的代码定义了结果表格奇数行的背景颜色 */
#result-table tbody tr:nth-child(odd) {