mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-23 23:09:25 +01:00
build: web component build error (#858)
* build: build error * docs: update notes
This commit is contained in:
@@ -33,6 +33,7 @@ Information about release notes of Coco App is provided here.
|
|||||||
- chore: ignore tauri::AppHandle's generic argument R #845
|
- chore: ignore tauri::AppHandle's generic argument R #845
|
||||||
- refactor: check Extension/plugin.json from all sources #846
|
- refactor: check Extension/plugin.json from all sources #846
|
||||||
- refactor: pinning window won't set CanJoinAllSpaces on macOS #854
|
- refactor: pinning window won't set CanJoinAllSpaces on macOS #854
|
||||||
|
- build: web component build error #858
|
||||||
|
|
||||||
## 0.7.1 (2025-07-27)
|
## 0.7.1 (2025-07-27)
|
||||||
|
|
||||||
|
|||||||
@@ -16,49 +16,10 @@ import {
|
|||||||
} from "@/types/commands";
|
} from "@/types/commands";
|
||||||
import { useAppStore } from "@/stores/appStore";
|
import { useAppStore } from "@/stores/appStore";
|
||||||
import { useAuthStore } from "@/stores/authStore";
|
import { useAuthStore } from "@/stores/authStore";
|
||||||
import { useConnectStore } from "@/stores/connectStore";
|
import {
|
||||||
import { SETTINGS_WINDOW_LABEL } from "@/constants";
|
getCurrentWindowService,
|
||||||
import platformAdapter from "@/utils/platformAdapter";
|
handleLogout,
|
||||||
|
} from "@/commands/windowService";
|
||||||
export async function getCurrentWindowService() {
|
|
||||||
const currentService = useConnectStore.getState().currentService;
|
|
||||||
const cloudSelectService = useConnectStore.getState().cloudSelectService;
|
|
||||||
const windowLabel = await platformAdapter.getCurrentWindowLabel();
|
|
||||||
|
|
||||||
return windowLabel === SETTINGS_WINDOW_LABEL
|
|
||||||
? cloudSelectService
|
|
||||||
: currentService;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function setCurrentWindowService(service: any) {
|
|
||||||
const windowLabel = await platformAdapter.getCurrentWindowLabel();
|
|
||||||
const { setCurrentService, setCloudSelectService } =
|
|
||||||
useConnectStore.getState();
|
|
||||||
|
|
||||||
return windowLabel === SETTINGS_WINDOW_LABEL
|
|
||||||
? setCloudSelectService(service)
|
|
||||||
: setCurrentService(service);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function handleLogout(serverId?: string) {
|
|
||||||
const setIsCurrentLogin = useAuthStore.getState().setIsCurrentLogin;
|
|
||||||
const { serverList, setServerList } = useConnectStore.getState();
|
|
||||||
|
|
||||||
const service = await getCurrentWindowService();
|
|
||||||
|
|
||||||
const id = serverId || service?.id;
|
|
||||||
if (!id) return;
|
|
||||||
|
|
||||||
// Update the status first
|
|
||||||
setIsCurrentLogin(false);
|
|
||||||
if (service?.id === id) {
|
|
||||||
await setCurrentWindowService({ ...service, profile: null });
|
|
||||||
}
|
|
||||||
const updatedServerList = serverList.map((server) =>
|
|
||||||
server.id === id ? { ...server, profile: null } : server
|
|
||||||
);
|
|
||||||
setServerList(updatedServerList);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Endpoints that don't require authentication
|
// Endpoints that don't require authentication
|
||||||
const WHITELIST_SERVERS = [
|
const WHITELIST_SERVERS = [
|
||||||
|
|||||||
44
src/commands/windowService.ts
Normal file
44
src/commands/windowService.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import { useConnectStore } from "@/stores/connectStore";
|
||||||
|
import { SETTINGS_WINDOW_LABEL } from "@/constants";
|
||||||
|
import platformAdapter from "@/utils/platformAdapter";
|
||||||
|
import { useAuthStore } from "@/stores/authStore";
|
||||||
|
|
||||||
|
export async function getCurrentWindowService() {
|
||||||
|
const currentService = useConnectStore.getState().currentService;
|
||||||
|
const cloudSelectService = useConnectStore.getState().cloudSelectService;
|
||||||
|
const windowLabel = await platformAdapter.getCurrentWindowLabel();
|
||||||
|
|
||||||
|
return windowLabel === SETTINGS_WINDOW_LABEL
|
||||||
|
? cloudSelectService
|
||||||
|
: currentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function setCurrentWindowService(service: any) {
|
||||||
|
const windowLabel = await platformAdapter.getCurrentWindowLabel();
|
||||||
|
const { setCurrentService, setCloudSelectService } =
|
||||||
|
useConnectStore.getState();
|
||||||
|
|
||||||
|
return windowLabel === SETTINGS_WINDOW_LABEL
|
||||||
|
? setCloudSelectService(service)
|
||||||
|
: setCurrentService(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function handleLogout(serverId?: string) {
|
||||||
|
const setIsCurrentLogin = useAuthStore.getState().setIsCurrentLogin;
|
||||||
|
const { serverList, setServerList } = useConnectStore.getState();
|
||||||
|
|
||||||
|
const service = await getCurrentWindowService();
|
||||||
|
|
||||||
|
const id = serverId || service?.id;
|
||||||
|
if (!id) return;
|
||||||
|
|
||||||
|
// Update the status first
|
||||||
|
setIsCurrentLogin(false);
|
||||||
|
if (service?.id === id) {
|
||||||
|
await setCurrentWindowService({ ...service, profile: null });
|
||||||
|
}
|
||||||
|
const updatedServerList = serverList.map((server) =>
|
||||||
|
server.id === id ? { ...server, profile: null } : server
|
||||||
|
);
|
||||||
|
setServerList(updatedServerList);
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ import StatusIndicator from "@/components/Cloud/StatusIndicator";
|
|||||||
import { useAuthStore } from "@/stores/authStore";
|
import { useAuthStore } from "@/stores/authStore";
|
||||||
import { useSearchStore } from "@/stores/searchStore";
|
import { useSearchStore } from "@/stores/searchStore";
|
||||||
import { useServers } from "@/hooks/useServers";
|
import { useServers } from "@/hooks/useServers";
|
||||||
import { getCurrentWindowService, setCurrentWindowService } from "@/commands";
|
import { getCurrentWindowService, setCurrentWindowService } from "@/commands/windowService";
|
||||||
|
|
||||||
interface ServerListProps {
|
interface ServerListProps {
|
||||||
clearChat: () => void;
|
clearChat: () => void;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
getCurrentWindowService,
|
getCurrentWindowService,
|
||||||
setCurrentWindowService,
|
setCurrentWindowService,
|
||||||
handleLogout,
|
handleLogout,
|
||||||
} from "@/commands/servers";
|
} from "@/commands/windowService";
|
||||||
|
|
||||||
export const useServers = () => {
|
export const useServers = () => {
|
||||||
const setServerList = useConnectStore((state) => state.setServerList);
|
const setServerList = useConnectStore((state) => state.setServerList);
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export interface WindowOperations {
|
|||||||
event: string,
|
event: string,
|
||||||
callback: (event: any) => void
|
callback: (event: any) => void
|
||||||
) => Promise<() => void>;
|
) => Promise<() => void>;
|
||||||
|
getCurrentWindowLabel: () => Promise<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Theme and event related interface
|
// Theme and event related interface
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export interface TauriPlatformAdapter extends BasePlatformAdapter {
|
|||||||
) => Promise<string | string[] | null>;
|
) => Promise<string | string[] | null>;
|
||||||
metadata: typeof metadata;
|
metadata: typeof metadata;
|
||||||
error: typeof error;
|
error: typeof error;
|
||||||
getCurrentWindowLabel: () => Promise<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Tauri adapter functions
|
// Create Tauri adapter functions
|
||||||
|
|||||||
@@ -269,5 +269,9 @@ export const createWebAdapter = (): WebPlatformAdapter => {
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getCurrentWindowLabel() {
|
||||||
|
return "web";
|
||||||
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user