v0.1.4-p3
parent
775572e07c
commit
cf354d6bed
|
|
@ -58,9 +58,8 @@ function AuthenticatedApp() {
|
||||||
const isCompactShell = compactMode;
|
const isCompactShell = compactMode;
|
||||||
const hideHeader = route.kind === 'dashboard' && compactMode;
|
const hideHeader = route.kind === 'dashboard' && compactMode;
|
||||||
const forcedBot = forcedBotId ? activeBots[forcedBotId] : undefined;
|
const forcedBot = forcedBotId ? activeBots[forcedBotId] : undefined;
|
||||||
const fromPanelOpen = typeof window !== 'undefined' && (new URLSearchParams(window.location.search).get('from_panel') || '').trim() === '1';
|
|
||||||
const shouldPromptSingleBotPassword = Boolean(
|
const shouldPromptSingleBotPassword = Boolean(
|
||||||
route.kind === 'bot' && forcedBotId && forcedBot?.has_access_password && !singleBotUnlocked && !fromPanelOpen,
|
route.kind === 'bot' && forcedBotId && forcedBot?.has_access_password && !singleBotUnlocked,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import { useLucentPrompt } from '../../components/lucent/LucentPromptProvider';
|
||||||
import { LucentIconButton } from '../../components/lucent/LucentIconButton';
|
import { LucentIconButton } from '../../components/lucent/LucentIconButton';
|
||||||
import { PlatformSettingsModal } from './components/PlatformSettingsModal';
|
import { PlatformSettingsModal } from './components/PlatformSettingsModal';
|
||||||
import { TemplateManagerModal } from './components/TemplateManagerModal';
|
import { TemplateManagerModal } from './components/TemplateManagerModal';
|
||||||
import { appendPanelAccessPassword } from '../../utils/panelAccess';
|
|
||||||
import {
|
import {
|
||||||
normalizePlatformPageSize,
|
normalizePlatformPageSize,
|
||||||
readCachedPlatformPageSize,
|
readCachedPlatformPageSize,
|
||||||
|
|
@ -73,10 +72,7 @@ function formatDateTime(value: string | null | undefined, locale: string) {
|
||||||
|
|
||||||
function buildBotPanelHref(botId: string) {
|
function buildBotPanelHref(botId: string) {
|
||||||
const encodedId = encodeURIComponent(String(botId || '').trim());
|
const encodedId = encodeURIComponent(String(botId || '').trim());
|
||||||
const params = new URLSearchParams();
|
return `/bot/${encodedId}`;
|
||||||
params.set('from_panel', '1');
|
|
||||||
const query = params.toString();
|
|
||||||
return appendPanelAccessPassword(`/bot/${encodedId}${query ? `?${query}` : ''}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PlatformDashboardPageProps {
|
interface PlatformDashboardPageProps {
|
||||||
|
|
@ -809,7 +805,7 @@ export function PlatformDashboardPage({ compactMode }: PlatformDashboardPageProp
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
void toggleBot(bot);
|
void toggleBot(bot);
|
||||||
}}
|
}}
|
||||||
disabled={!enabled || operatingBotId === bot.id}
|
disabled={operatingBotId === bot.id}
|
||||||
tooltip={running ? (isZh ? '停止' : 'Stop') : (isZh ? '启动' : 'Start')}
|
tooltip={running ? (isZh ? '停止' : 'Stop') : (isZh ? '启动' : 'Start')}
|
||||||
aria-label={running ? (isZh ? '停止' : 'Stop') : (isZh ? '启动' : 'Start')}
|
aria-label={running ? (isZh ? '停止' : 'Stop') : (isZh ? '启动' : 'Start')}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { appendPanelAccessPassword } from './panelAccess';
|
|
||||||
|
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
const memoryMap = new Map<string, string>();
|
const memoryMap = new Map<string, string>();
|
||||||
|
|
||||||
|
|
@ -67,7 +65,7 @@ export function isBotUnauthorizedError(error: any, botId?: string): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildMonitorWsUrl(base: string, botId: string): string {
|
export function buildMonitorWsUrl(base: string, botId: string): string {
|
||||||
return appendPanelAccessPassword(`${String(base || '').replace(/\/$/, '')}/${encodeURIComponent(botId)}`);
|
return `${String(base || '').replace(/\/$/, '')}/${encodeURIComponent(botId)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupBotAccessAuth(): void {
|
export function setupBotAccessAuth(): void {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue