mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
generate API token in frontend page
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<f7-list strong inset dividers media-list class="margin-top" v-else-if="!loading">
|
||||
<f7-list-item class="list-item-media-valign-middle" swipeout
|
||||
:id="session.domId"
|
||||
:title="session.deviceType === 'mcp' ? 'MCP' : (tt(session.isCurrent ? 'Current' : 'Other Device'))"
|
||||
:title="tt(session.deviceName)"
|
||||
:text="session.deviceInfo"
|
||||
:key="session.tokenId"
|
||||
v-for="session in sessions">
|
||||
@@ -55,7 +55,7 @@ import { useTokensStore } from '@/stores/token.ts';
|
||||
|
||||
import { itemAndIndex, reversedItemAndIndex } from '@/core/base.ts';
|
||||
import { TextDirection } from '@/core/text.ts';
|
||||
import { type TokenInfoResponse, SessionInfo } from '@/models/token.ts';
|
||||
import { type TokenInfoResponse, SessionDeviceType, SessionInfo } from '@/models/token.ts';
|
||||
|
||||
import { isEquals } from '@/lib/common.ts';
|
||||
import { parseSessionInfo } from '@/lib/session.ts';
|
||||
@@ -66,7 +66,7 @@ class MobilePageSessionInfo extends SessionInfo {
|
||||
public readonly lastSeenDateTime: string;
|
||||
|
||||
public constructor(sessionInfo: SessionInfo) {
|
||||
super(sessionInfo.tokenId, sessionInfo.isCurrent, sessionInfo.deviceType, sessionInfo.deviceInfo, sessionInfo.createdByCli, sessionInfo.lastSeen);
|
||||
super(sessionInfo.tokenId, sessionInfo.isCurrent, sessionInfo.deviceType, sessionInfo.deviceInfo, sessionInfo.deviceName, sessionInfo.lastSeen);
|
||||
this.domId = getTokenDomId(sessionInfo.tokenId);
|
||||
this.icon = getTokenIcon(sessionInfo.deviceType);
|
||||
this.lastSeenDateTime = sessionInfo.lastSeen ? formatUnixTimeToLongDateTime(sessionInfo.lastSeen) : '-';
|
||||
@@ -103,19 +103,19 @@ const sessions = computed<MobilePageSessionInfo[]>(() => {
|
||||
return sessions;
|
||||
});
|
||||
|
||||
function getTokenIcon(deviceType: string): string {
|
||||
if (deviceType === 'phone') {
|
||||
function getTokenIcon(deviceType: SessionDeviceType): string {
|
||||
if (deviceType === SessionDeviceType.Phone) {
|
||||
return 'device_phone_portrait';
|
||||
} else if (deviceType === 'wearable') {
|
||||
} else if (deviceType === SessionDeviceType.Wearable) {
|
||||
return 'device_phone_portrait';
|
||||
} else if (deviceType === 'tablet') {
|
||||
} else if (deviceType === SessionDeviceType.Tablet) {
|
||||
return 'device_tablet_portrait';
|
||||
} else if (deviceType === 'tv') {
|
||||
} else if (deviceType === SessionDeviceType.TV) {
|
||||
return 'tv';
|
||||
} else if (deviceType === 'mcp') {
|
||||
return 'sparkles';
|
||||
} else if (deviceType === 'cli') {
|
||||
} else if (deviceType === SessionDeviceType.Api) {
|
||||
return 'chevron_left_slash_chevron_right';
|
||||
} else if (deviceType === SessionDeviceType.MCP) {
|
||||
return 'sparkles';
|
||||
} else {
|
||||
return 'device_desktop';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user