diff --git a/.vscode/settings.json b/.vscode/settings.json index d1d29577..5b7e26c1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,7 +41,9 @@ ".rustup", ".crates" ], - "rust-analyzer.procMacro.enable": true, + "rust-analyzer.procMacro.enable": false, + "rust-analyzer.procMacro.attributes.enable": false, + "rust-analyzer.check.command": "check", "rust-analyzer.diagnostics.experimental.enable": false, "rust-analyzer.linkedProjects": [], "rust-analyzer.cargo.extraEnv": {}, diff --git a/apps/frontend/src/ui/pages/cluster/ClusterGame.tsx b/apps/frontend/src/ui/pages/cluster/ClusterGame.tsx index 7bc9d9f9..4f7dc308 100644 --- a/apps/frontend/src/ui/pages/cluster/ClusterGame.tsx +++ b/apps/frontend/src/ui/pages/cluster/ClusterGame.tsx @@ -10,9 +10,9 @@ import { TimeAgo } from '~ui/components/DynamicTime'; import Modal, { createModal } from '~ui/components/overlay/Modal'; import Sidebar from '~ui/components/Sidebar'; import useClusterContext from '~ui/hooks/useCluster'; -import useCommand from '~ui/hooks/useCommand'; +import { tryResult } from '~ui/hooks/useCommand'; import useNotifications from '~ui/hooks/useNotifications'; -import { createSignal, onCleanup, onMount } from 'solid-js'; +import { createResource, createSignal, onCleanup, onMount } from 'solid-js'; import { render } from 'solid-js/web'; interface ClusterGameParams extends Params { @@ -25,7 +25,14 @@ interface ClusterGameParams extends Params { function ClusterGame() { const [cluster] = useClusterContext(); const [params] = useSearchParams(); - const [log] = useCommand(() => bridge.commands.getClusterLog(cluster()!.uuid, 'latest.log')); + const [log] = createResource(() => { + return tryResult(() => bridge.commands.getClusterLog(cluster()!.uuid, 'latest.log')) + .then(res => res) + .catch((err) => { + console.error(err); + return ''; + }); + }); const [isRunning, setIsRunning] = createSignal(true); const notifications = useNotifications(); diff --git a/apps/frontend/src/ui/pages/cluster/ClusterLogs.tsx b/apps/frontend/src/ui/pages/cluster/ClusterLogs.tsx index e34b9043..89ac5263 100644 --- a/apps/frontend/src/ui/pages/cluster/ClusterLogs.tsx +++ b/apps/frontend/src/ui/pages/cluster/ClusterLogs.tsx @@ -6,10 +6,10 @@ import Dropdown from '~ui/components/base/Dropdown'; import FormattedLog from '~ui/components/content/FormattedLog'; import useClusterContext from '~ui/hooks/useCluster'; import useCommand, { tryResult } from '~ui/hooks/useCommand'; +import useNotifications from '~ui/hooks/useNotifications.tsx'; import useSettings from '~ui/hooks/useSettings'; import { join } from 'pathe'; import { createEffect, createSignal, For, Show, untrack } from 'solid-js'; -import useNotifications from "~ui/hooks/useNotifications.tsx"; function ClusterLogs() { const [cluster] = useClusterContext(); @@ -49,9 +49,9 @@ function ClusterLogs() { const id = await tryResult(() => bridge.commands.uploadLog(cluster()!.uuid, log)); - open(`https://mclo.gs/${id}`).then(() => notifications.set("logs", { - title: "Log Uploaded", - message: "Opening in your browser." + open(`https://mclo.gs/${id}`).then(() => notifications.set('logs', { + title: 'Log Uploaded', + message: 'Opening in your browser.', })); } diff --git a/packages/core/src/api/cluster/content/logger.rs b/packages/core/src/api/cluster/content/logger.rs index 20056f0c..1f05a719 100644 --- a/packages/core/src/api/cluster/content/logger.rs +++ b/packages/core/src/api/cluster/content/logger.rs @@ -247,7 +247,13 @@ pub async fn read_log_to_string(path: &std::path::PathBuf) -> crate::Result