mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-19 01:56:37 +08:00
feat: token copy web url
- Update `COPY_OPTIONS` object in `TokensTable.js` - Modify the `onCopy` function to use a different url variable - Fix pagination logic in the `onPaginationChange` function - Remove unnecessary code and comments in `TokensTable.js`
This commit is contained in:
parent
a0dc7e6fd6
commit
b2e46a33ac
@ -7,8 +7,7 @@ import { ITEMS_PER_PAGE } from '../constants';
|
|||||||
import { renderQuota } from '../helpers/render';
|
import { renderQuota } from '../helpers/render';
|
||||||
|
|
||||||
const COPY_OPTIONS = [
|
const COPY_OPTIONS = [
|
||||||
{ key: 'next', text: 'ChatGPT Next Web', value: 'next' },
|
{ key: 'web', text: 'Web', value: 'web' },
|
||||||
{ key: 'ama', text: 'AMA 问天', value: 'ama' },
|
|
||||||
{ key: 'opencat', text: 'OpenCat', value: 'opencat' },
|
{ key: 'opencat', text: 'OpenCat', value: 'opencat' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -92,14 +91,14 @@ const TokensTable = () => {
|
|||||||
serverAddress = window.location.origin;
|
serverAddress = window.location.origin;
|
||||||
}
|
}
|
||||||
let encodedServerAddress = encodeURIComponent(serverAddress);
|
let encodedServerAddress = encodeURIComponent(serverAddress);
|
||||||
const nextLink = localStorage.getItem('chat_link');
|
// const nextLink = localStorage.getItem('chat_link');
|
||||||
let nextUrl;
|
// let nextUrl;
|
||||||
|
|
||||||
if (nextLink) {
|
// if (nextLink) {
|
||||||
nextUrl = nextLink + `/#/?settings={"key":"laisky-${key}","url":"${serverAddress}"}`;
|
// nextUrl = nextLink + `/#/?settings={"key":"laisky-${key}","url":"${serverAddress}"}`;
|
||||||
} else {
|
// } else {
|
||||||
nextUrl = `https://chat.oneapi.pro/#/?settings={"key":"laisky-${key}","url":"${serverAddress}"}`;
|
// nextUrl = `https://chat.oneapi.pro/#/?settings={"key":"laisky-${key}","url":"${serverAddress}"}`;
|
||||||
}
|
// }
|
||||||
|
|
||||||
let url;
|
let url;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -109,8 +108,8 @@ const TokensTable = () => {
|
|||||||
case 'opencat':
|
case 'opencat':
|
||||||
url = `opencat://team/join?domain=${encodedServerAddress}&token=laisky-${key}`;
|
url = `opencat://team/join?domain=${encodedServerAddress}&token=laisky-${key}`;
|
||||||
break;
|
break;
|
||||||
case 'next':
|
case 'web':
|
||||||
url = nextUrl;
|
url = `https://chat.laisky.com?apikey=laisky-${key}`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
url = `laisky-${key}`;
|
url = `laisky-${key}`;
|
||||||
@ -353,28 +352,6 @@ const TokensTable = () => {
|
|||||||
/>
|
/>
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
{' '}
|
{' '}
|
||||||
<Button.Group color='blue' size={'small'}>
|
|
||||||
<Button
|
|
||||||
size={'small'}
|
|
||||||
positive
|
|
||||||
onClick={() => {
|
|
||||||
onOpenLink('', token.key);
|
|
||||||
}}>
|
|
||||||
聊天
|
|
||||||
</Button>
|
|
||||||
<Dropdown
|
|
||||||
className="button icon"
|
|
||||||
floating
|
|
||||||
options={OPEN_LINK_OPTIONS.map(option => ({
|
|
||||||
...option,
|
|
||||||
onClick: async () => {
|
|
||||||
await onOpenLink(option.value, token.key);
|
|
||||||
}
|
|
||||||
}))}
|
|
||||||
trigger={<></>}
|
|
||||||
/>
|
|
||||||
</Button.Group>
|
|
||||||
{' '}
|
|
||||||
<Popup
|
<Popup
|
||||||
trigger={
|
trigger={
|
||||||
<Button size='small' negative>
|
<Button size='small' negative>
|
||||||
|
Loading…
Reference in New Issue
Block a user