源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
commit
04bac1f6e2
2200 files changed
+489415
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { desktopBootstrapFromConnectClaims } from "./connect-link.mjs";
|
||||
|
||||
/**
|
||||
* @param {Partial<import("@openwork/types/desktop-ipc").DesktopBootstrapConfig>} config
|
||||
* @param {(iconUrl: string) => Promise<unknown>} applyBrandIconUrl
|
||||
*/
|
||||
export async function applyDesktopBootstrapBrandIcon(config, applyBrandIconUrl) {
|
||||
const iconUrl = typeof config.brandIconUrl === "string" ? config.brandIconUrl.trim() : "";
|
||||
if (!iconUrl) return null;
|
||||
return applyBrandIconUrl(iconUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("@openwork/types/connect-link").ConnectLinkClaims} claims
|
||||
* @param {{
|
||||
* persistBootstrap: (
|
||||
* config: Partial<import("@openwork/types/desktop-ipc").DesktopBootstrapConfig>
|
||||
* ) => Promise<import("@openwork/types/desktop-ipc").DesktopBootstrapConfig>,
|
||||
* applyBrandIconUrl: (iconUrl: string) => Promise<unknown>,
|
||||
* enterpriseActivation?: { activatedAt: string, denBaseUrl: string } | null,
|
||||
* }} dependencies
|
||||
*/
|
||||
export async function persistConnectLinkBranding(claims, dependencies) {
|
||||
const config = await dependencies.persistBootstrap({
|
||||
...desktopBootstrapFromConnectClaims(claims),
|
||||
...(dependencies.enterpriseActivation
|
||||
? { enterpriseActivation: dependencies.enterpriseActivation }
|
||||
: {}),
|
||||
});
|
||||
await applyDesktopBootstrapBrandIcon(config, dependencies.applyBrandIconUrl);
|
||||
return config;
|
||||
}
|
||||
Reference in new issue
Block a user