修复所有lint警告和错误
This commit is contained in:
@@ -20,7 +20,7 @@ pub async fn require_token(
|
||||
// Check Authorization header
|
||||
if let Some(auth_header) = request.headers().get("authorization") {
|
||||
if let Ok(auth_str) = auth_header.to_str() {
|
||||
if auth_str.strip_prefix("Bearer ").map_or(false, |t| t == token) {
|
||||
if auth_str.strip_prefix("Bearer ").is_some_and(|t| t == token) {
|
||||
return next.run(request).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
import { Suspense, useCallback, useEffect, useState } from "react"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { useTranslations } from "next-intl"
|
||||
const getCurrentWindow = async () => { const m = await import("@tauri-apps/api/window"); return m.getCurrentWindow() }
|
||||
const getCurrentWindow = async () => {
|
||||
const m = await import("@tauri-apps/api/window")
|
||||
return m.getCurrentWindow()
|
||||
}
|
||||
import { Loader2 } from "lucide-react"
|
||||
import { CommitWorkspace } from "@/components/layout/commit-dialog"
|
||||
import { AppTitleBar } from "@/components/layout/app-title-bar"
|
||||
@@ -74,9 +77,7 @@ function CommitPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
const pageTitle = folder ? `${t("title")} · ${folder.name}` : t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
|
||||
@@ -73,9 +73,7 @@ export default function LoginPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<p className="text-sm text-destructive">{error}</p>
|
||||
)}
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
import { Suspense, useCallback, useEffect, useState } from "react"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { useTranslations } from "next-intl"
|
||||
const getCurrentWindow = async () => { const m = await import("@tauri-apps/api/window"); return m.getCurrentWindow() }
|
||||
const getCurrentWindow = async () => {
|
||||
const m = await import("@tauri-apps/api/window")
|
||||
return m.getCurrentWindow()
|
||||
}
|
||||
import { Loader2 } from "lucide-react"
|
||||
import { MergeWorkspace } from "@/components/merge/merge-workspace"
|
||||
import { AppTitleBar } from "@/components/layout/app-title-bar"
|
||||
@@ -76,9 +79,7 @@ function MergePageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
const pageTitle = folder ? `${t("title")} · ${folder.name}` : t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
import { Suspense, useCallback, useEffect, useState } from "react"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { useTranslations } from "next-intl"
|
||||
const getCurrentWindow = async () => { const m = await import("@tauri-apps/api/window"); return m.getCurrentWindow() }
|
||||
const getCurrentWindow = async () => {
|
||||
const m = await import("@tauri-apps/api/window")
|
||||
return m.getCurrentWindow()
|
||||
}
|
||||
import { Loader2 } from "lucide-react"
|
||||
import { PushWorkspace } from "@/components/layout/push-workspace"
|
||||
import { AppTitleBar } from "@/components/layout/app-title-bar"
|
||||
@@ -74,9 +77,7 @@ function PushPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
const pageTitle = folder ? `${t("title")} · ${folder.name}` : t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
|
||||
@@ -64,9 +64,7 @@ function StashPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
const pageTitle = folder ? `${t("title")} · ${folder.name}` : t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
|
||||
@@ -753,6 +753,7 @@ export function MessageInput({
|
||||
const selected = await openFileDialog({
|
||||
multiple: true,
|
||||
directory: false,
|
||||
defaultPath,
|
||||
})
|
||||
if (!selected) return
|
||||
const picked = Array.isArray(selected) ? selected : [selected]
|
||||
|
||||
@@ -5,7 +5,9 @@ const emitEvent = async (event: string, payload?: unknown) => {
|
||||
try {
|
||||
const { emit } = await import("@tauri-apps/api/event")
|
||||
await emit(event, payload)
|
||||
} catch { /* not in Tauri */ }
|
||||
} catch {
|
||||
/* not in Tauri */
|
||||
}
|
||||
}
|
||||
import { openFileDialog, subscribe } from "@/lib/platform"
|
||||
import {
|
||||
@@ -332,9 +334,7 @@ export function BranchDropdown({
|
||||
async function handleBrowseWorktreePath() {
|
||||
const selected = await openFileDialog({ directory: true, multiple: false })
|
||||
if (selected) {
|
||||
setWorktreePath(
|
||||
Array.isArray(selected) ? selected[0] : selected,
|
||||
)
|
||||
setWorktreePath(Array.isArray(selected) ? selected[0] : selected)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,9 @@ export function FolderNameDropdown() {
|
||||
async function handleOpenFolder() {
|
||||
const selected = await openFileDialog({ directory: true, multiple: false })
|
||||
if (selected) {
|
||||
await openFolderWindow(
|
||||
Array.isArray(selected) ? selected[0] : selected,
|
||||
{ newWindow: true },
|
||||
)
|
||||
await openFolderWindow(Array.isArray(selected) ? selected[0] : selected, {
|
||||
newWindow: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ async function emitEvent(event: string, payload?: unknown) {
|
||||
try {
|
||||
const { emit } = await import("@tauri-apps/api/event")
|
||||
await emit(event, payload)
|
||||
} catch { /* not in Tauri */ }
|
||||
} catch {
|
||||
/* not in Tauri */
|
||||
}
|
||||
}
|
||||
import { Check, FileWarning, Loader2, X, CheckCheck } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
"use client"
|
||||
|
||||
import { useCallback, useEffect, type ComponentType, type ReactNode } from "react"
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
type ComponentType,
|
||||
type ReactNode,
|
||||
} from "react"
|
||||
import {
|
||||
Bot,
|
||||
BookOpenText,
|
||||
|
||||
@@ -192,26 +192,18 @@ export function WebServiceSettings() {
|
||||
isRunning ? "bg-green-500" : "bg-muted-foreground/30"
|
||||
}`}
|
||||
/>
|
||||
<span className="text-sm">
|
||||
{isRunning ? "运行中" : "已停止"}
|
||||
</span>
|
||||
<span className="text-sm">{isRunning ? "运行中" : "已停止"}</span>
|
||||
<button
|
||||
onClick={isRunning ? handleStop : handleStart}
|
||||
disabled={loading}
|
||||
className="inline-flex h-8 items-center rounded-md border border-input bg-background px-3 text-xs font-medium ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
|
||||
>
|
||||
{loading
|
||||
? "处理中..."
|
||||
: isRunning
|
||||
? "停止"
|
||||
: "启动"}
|
||||
{loading ? "处理中..." : isRunning ? "停止" : "启动"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<p className="text-sm text-destructive">{error}</p>
|
||||
)}
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
|
||||
{/* Connection info */}
|
||||
{isRunning && (
|
||||
|
||||
@@ -120,7 +120,11 @@ export async function acpSetConfigOption(
|
||||
configId: string,
|
||||
valueId: string
|
||||
): Promise<void> {
|
||||
return getTransport().call("acp_set_config_option", { connectionId, configId, valueId })
|
||||
return getTransport().call("acp_set_config_option", {
|
||||
connectionId,
|
||||
configId,
|
||||
valueId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function acpCancel(connectionId: string): Promise<void> {
|
||||
@@ -483,7 +487,10 @@ export async function saveFolderOpenedConversations(
|
||||
folderId: number,
|
||||
items: OpenedConversation[]
|
||||
): Promise<void> {
|
||||
return getTransport().call("save_folder_opened_conversations", { folderId, items })
|
||||
return getTransport().call("save_folder_opened_conversations", {
|
||||
folderId,
|
||||
items,
|
||||
})
|
||||
}
|
||||
|
||||
export async function setFolderParentBranch(
|
||||
@@ -528,7 +535,10 @@ export async function gitPull(
|
||||
path: string,
|
||||
credentials?: GitCredentials | null
|
||||
): Promise<GitPullResult> {
|
||||
return getTransport().call("git_pull", { path, credentials: credentials ?? null })
|
||||
return getTransport().call("git_pull", {
|
||||
path,
|
||||
credentials: credentials ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitStartPullMerge(
|
||||
@@ -546,7 +556,10 @@ export async function gitFetch(
|
||||
path: string,
|
||||
credentials?: GitCredentials | null
|
||||
): Promise<string> {
|
||||
return getTransport().call("git_fetch", { path, credentials: credentials ?? null })
|
||||
return getTransport().call("git_fetch", {
|
||||
path,
|
||||
credentials: credentials ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitPushInfo(path: string): Promise<GitPushInfo> {
|
||||
@@ -582,7 +595,11 @@ export async function gitWorktreeAdd(
|
||||
branchName: string,
|
||||
worktreePath: string
|
||||
): Promise<void> {
|
||||
return getTransport().call("git_worktree_add", { path, branchName, worktreePath })
|
||||
return getTransport().call("git_worktree_add", {
|
||||
path,
|
||||
branchName,
|
||||
worktreePath,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitCheckout(
|
||||
@@ -673,7 +690,7 @@ export async function openMergeWindow(
|
||||
folderId,
|
||||
operation,
|
||||
upstreamCommit: upstreamCommit ?? null,
|
||||
},
|
||||
}
|
||||
)
|
||||
window.open(result.path, `merge-${folderId}`)
|
||||
}
|
||||
@@ -684,7 +701,7 @@ export async function openStashWindow(folderId: number): Promise<void> {
|
||||
}
|
||||
const result = await getTransport().call<{ path: string }>(
|
||||
"open_stash_window",
|
||||
{ folderId },
|
||||
{ folderId }
|
||||
)
|
||||
window.open(result.path, `stash-${folderId}`)
|
||||
}
|
||||
@@ -695,7 +712,7 @@ export async function openPushWindow(folderId: number): Promise<void> {
|
||||
}
|
||||
const result = await getTransport().call<{ path: string }>(
|
||||
"open_push_window",
|
||||
{ folderId },
|
||||
{ folderId }
|
||||
)
|
||||
window.open(result.path, `push-${folderId}`)
|
||||
}
|
||||
@@ -716,7 +733,10 @@ export async function gitStashPop(
|
||||
path: string,
|
||||
stashRef?: string
|
||||
): Promise<string> {
|
||||
return getTransport().call("git_stash_pop", { path, stashRef: stashRef ?? null })
|
||||
return getTransport().call("git_stash_pop", {
|
||||
path,
|
||||
stashRef: stashRef ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitStashList(path: string): Promise<GitStashEntry[]> {
|
||||
@@ -818,7 +838,11 @@ export async function gitShowDiff(
|
||||
commit: string,
|
||||
file?: string
|
||||
): Promise<string> {
|
||||
return getTransport().call("git_show_diff", { path, commit, file: file ?? null })
|
||||
return getTransport().call("git_show_diff", {
|
||||
path,
|
||||
commit,
|
||||
file: file ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitShowFile(
|
||||
@@ -866,14 +890,14 @@ export async function gitAddFiles(
|
||||
|
||||
export async function openFolderWindow(
|
||||
path: string,
|
||||
options?: { newWindow?: boolean },
|
||||
options?: { newWindow?: boolean }
|
||||
): Promise<void> {
|
||||
if (getTransport().isDesktop()) {
|
||||
return getTransport().call("open_folder_window", { path })
|
||||
}
|
||||
const entry = await getTransport().call<{ id: number }>(
|
||||
"open_folder_window",
|
||||
{ path },
|
||||
{ path }
|
||||
)
|
||||
const url = `/folder?id=${entry.id}`
|
||||
if (options?.newWindow) {
|
||||
@@ -889,7 +913,7 @@ export async function openCommitWindow(folderId: number): Promise<void> {
|
||||
}
|
||||
const result = await getTransport().call<{ path: string }>(
|
||||
"open_commit_window",
|
||||
{ folderId },
|
||||
{ folderId }
|
||||
)
|
||||
window.open(result.path, `commit-${folderId}`)
|
||||
}
|
||||
@@ -922,7 +946,7 @@ export async function openSettingsWindow(
|
||||
{
|
||||
section: section ?? null,
|
||||
agentType: options?.agentType ?? null,
|
||||
},
|
||||
}
|
||||
)
|
||||
window.open(result.path, `settings-${section ?? "general"}`)
|
||||
}
|
||||
@@ -938,7 +962,12 @@ export async function focusFolderWindow(folderId: number): Promise<void> {
|
||||
// Web mode: open empty string to focus existing named window without reload.
|
||||
// If the window doesn't exist (was closed), open the folder page.
|
||||
const win = window.open("", `folder-${folderId}`)
|
||||
if (!win || win.closed || !win.location.href || win.location.href === "about:blank") {
|
||||
if (
|
||||
!win ||
|
||||
win.closed ||
|
||||
!win.location.href ||
|
||||
win.location.href === "about:blank"
|
||||
) {
|
||||
window.open(`/folder?id=${folderId}`, `folder-${folderId}`)
|
||||
}
|
||||
}
|
||||
@@ -961,14 +990,20 @@ export async function updateConversationStatus(
|
||||
conversationId: number,
|
||||
status: string
|
||||
): Promise<void> {
|
||||
return getTransport().call("update_conversation_status", { conversationId, status })
|
||||
return getTransport().call("update_conversation_status", {
|
||||
conversationId,
|
||||
status,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateConversationTitle(
|
||||
conversationId: number,
|
||||
title: string
|
||||
): Promise<void> {
|
||||
return getTransport().call("update_conversation_title", { conversationId, title })
|
||||
return getTransport().call("update_conversation_title", {
|
||||
conversationId,
|
||||
title,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateConversationExternalId(
|
||||
@@ -1000,7 +1035,11 @@ export async function createFolderCommand(
|
||||
name: string,
|
||||
command: string
|
||||
): Promise<FolderCommand> {
|
||||
return getTransport().call("create_folder_command", { folderId, name, command })
|
||||
return getTransport().call("create_folder_command", {
|
||||
folderId,
|
||||
name,
|
||||
command,
|
||||
})
|
||||
}
|
||||
|
||||
export async function updateFolderCommand(
|
||||
@@ -1044,7 +1083,10 @@ export async function getFileTree(
|
||||
path: string,
|
||||
maxDepth?: number
|
||||
): Promise<FileTreeNode[]> {
|
||||
return getTransport().call("get_file_tree", { path, maxDepth: maxDepth ?? null })
|
||||
return getTransport().call("get_file_tree", {
|
||||
path,
|
||||
maxDepth: maxDepth ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function startFileTreeWatch(rootPath: string): Promise<void> {
|
||||
@@ -1059,7 +1101,10 @@ export async function readFileBase64(
|
||||
path: string,
|
||||
maxBytes?: number
|
||||
): Promise<string> {
|
||||
return getTransport().call("read_file_base64", { path, maxBytes: maxBytes ?? null })
|
||||
return getTransport().call("read_file_base64", {
|
||||
path,
|
||||
maxBytes: maxBytes ?? null,
|
||||
})
|
||||
}
|
||||
|
||||
export async function readFilePreview(
|
||||
@@ -1107,7 +1152,11 @@ export async function renameFileTreeEntry(
|
||||
path: string,
|
||||
newName: string
|
||||
): Promise<string> {
|
||||
return getTransport().call("rename_file_tree_entry", { rootPath, path, newName })
|
||||
return getTransport().call("rename_file_tree_entry", {
|
||||
rootPath,
|
||||
path,
|
||||
newName,
|
||||
})
|
||||
}
|
||||
|
||||
export async function deleteFileTreeEntry(
|
||||
@@ -1123,7 +1172,12 @@ export async function createFileTreeEntry(
|
||||
name: string,
|
||||
kind: "file" | "dir"
|
||||
): Promise<string> {
|
||||
return getTransport().call("create_file_tree_entry", { rootPath, path, name, kind })
|
||||
return getTransport().call("create_file_tree_entry", {
|
||||
rootPath,
|
||||
path,
|
||||
name,
|
||||
kind,
|
||||
})
|
||||
}
|
||||
|
||||
export async function gitLog(
|
||||
|
||||
@@ -24,9 +24,7 @@ export async function subscribe<T>(
|
||||
*/
|
||||
export async function openUrl(url: string): Promise<void> {
|
||||
if (isDesktop()) {
|
||||
const { openUrl: tauriOpenUrl } = await import(
|
||||
"@tauri-apps/plugin-opener"
|
||||
)
|
||||
const { openUrl: tauriOpenUrl } = await import("@tauri-apps/plugin-opener")
|
||||
await tauriOpenUrl(url)
|
||||
} else {
|
||||
window.open(url, "_blank")
|
||||
@@ -39,9 +37,8 @@ export async function openUrl(url: string): Promise<void> {
|
||||
*/
|
||||
export async function openPath(path: string): Promise<void> {
|
||||
if (isDesktop()) {
|
||||
const { openPath: tauriOpenPath } = await import(
|
||||
"@tauri-apps/plugin-opener"
|
||||
)
|
||||
const { openPath: tauriOpenPath } =
|
||||
await import("@tauri-apps/plugin-opener")
|
||||
await tauriOpenPath(path)
|
||||
}
|
||||
}
|
||||
@@ -52,9 +49,8 @@ export async function openPath(path: string): Promise<void> {
|
||||
*/
|
||||
export async function revealItemInDir(path: string): Promise<void> {
|
||||
if (isDesktop()) {
|
||||
const { revealItemInDir: tauriReveal } = await import(
|
||||
"@tauri-apps/plugin-opener"
|
||||
)
|
||||
const { revealItemInDir: tauriReveal } =
|
||||
await import("@tauri-apps/plugin-opener")
|
||||
await tauriReveal(path)
|
||||
}
|
||||
}
|
||||
@@ -101,9 +97,8 @@ export async function openFileDialog(options?: {
|
||||
*/
|
||||
export async function getCurrentWindow() {
|
||||
if (isDesktop()) {
|
||||
const { getCurrentWindow: tauriGetCurrentWindow } = await import(
|
||||
"@tauri-apps/api/window"
|
||||
)
|
||||
const { getCurrentWindow: tauriGetCurrentWindow } =
|
||||
await import("@tauri-apps/api/window")
|
||||
return tauriGetCurrentWindow()
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
export type TransportEnvironment = "tauri" | "web"
|
||||
|
||||
export function detectEnvironment(): TransportEnvironment {
|
||||
if (
|
||||
typeof window !== "undefined" &&
|
||||
"__TAURI_INTERNALS__" in window
|
||||
) {
|
||||
if (typeof window !== "undefined" && "__TAURI_INTERNALS__" in window) {
|
||||
return "tauri"
|
||||
}
|
||||
return "web"
|
||||
|
||||
@@ -10,17 +10,16 @@ export function getTransport(): Transport {
|
||||
const env = detectEnvironment()
|
||||
if (env === "tauri") {
|
||||
// Use dynamic require to avoid bundling tauri deps in web mode.
|
||||
// TauriTransport uses dynamic imports internally.
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { TauriTransport } = require("./tauri-transport") as {
|
||||
TauriTransport: new () => Transport
|
||||
}
|
||||
_transport = new TauriTransport()
|
||||
} else {
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { WebTransport } = require("./web-transport") as {
|
||||
WebTransport: new (baseUrl: string) => Transport
|
||||
}
|
||||
// In web mode, the API is served from the same origin.
|
||||
// Token is read from localStorage on each request.
|
||||
const baseUrl = window.location.origin
|
||||
_transport = new WebTransport(baseUrl)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import type { Transport, UnsubscribeFn } from "./types"
|
||||
|
||||
export class TauriTransport implements Transport {
|
||||
async call<T>(
|
||||
command: string,
|
||||
args?: Record<string, unknown>
|
||||
): Promise<T> {
|
||||
async call<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||
const { invoke } = await import("@tauri-apps/api/core")
|
||||
return invoke(command, args)
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ export class WebTransport implements Transport {
|
||||
this.baseUrl = baseUrl
|
||||
}
|
||||
|
||||
async call<T>(
|
||||
command: string,
|
||||
args?: Record<string, unknown>
|
||||
): Promise<T> {
|
||||
async call<T>(command: string, args?: Record<string, unknown>): Promise<T> {
|
||||
const token = getToken()
|
||||
const res = await fetch(`${this.baseUrl}/api/${command}`, {
|
||||
method: "POST",
|
||||
|
||||
@@ -23,7 +23,8 @@ export interface AppUpdateErrorInfo {
|
||||
|
||||
export async function getCurrentAppVersion(): Promise<string> {
|
||||
if (!isDesktop()) {
|
||||
const result = await getTransport().call<AppUpdateCheckResult>("check_app_update")
|
||||
const result =
|
||||
await getTransport().call<AppUpdateCheckResult>("check_app_update")
|
||||
return result.currentVersion
|
||||
}
|
||||
try {
|
||||
@@ -44,7 +45,9 @@ export async function checkAppUpdate(): Promise<AppUpdateCheckResult> {
|
||||
return { currentVersion, update }
|
||||
}
|
||||
|
||||
export async function installAppUpdate(update: NonNullable<Update>): Promise<void> {
|
||||
export async function installAppUpdate(
|
||||
update: NonNullable<Update>
|
||||
): Promise<void> {
|
||||
await update.downloadAndInstall()
|
||||
}
|
||||
|
||||
@@ -53,7 +56,9 @@ export async function relaunchApp(): Promise<void> {
|
||||
await relaunch()
|
||||
}
|
||||
|
||||
export async function closeAppUpdate(update: NonNullable<Update>): Promise<void> {
|
||||
export async function closeAppUpdate(
|
||||
update: NonNullable<Update>
|
||||
): Promise<void> {
|
||||
await update.close()
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ export function cn(...inputs: ClassValue[]) {
|
||||
* contexts), otherwise falls back to `crypto.getRandomValues()`.
|
||||
*/
|
||||
export function randomUUID(): string {
|
||||
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
||||
if (
|
||||
typeof crypto !== "undefined" &&
|
||||
typeof crypto.randomUUID === "function"
|
||||
) {
|
||||
return crypto.randomUUID()
|
||||
}
|
||||
// Fallback for non-secure contexts (HTTP over LAN)
|
||||
|
||||
Reference in New Issue
Block a user