Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/TheXTerm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FILE: src/components/TheXTerm.vue
@before-execute-command="onBeforeExecuteCommand"
@exec-cmd="onExecCmd"
:show-header="false"
:enable-example-hint="false"
:enable-example-hint="true"
title="πŸ‘‹πŸ»"
theme="dark">
</Terminal>
Expand Down
23 changes: 17 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import App from './App.vue'
import VueGtag from "vue-gtag-next";
import { VueCookieNext } from 'vue-cookie-next';
import VueNativeSock from "vue-native-websocket-vue3";
import Terminal from 'vue-web-terminal';
// @ts-expect-error β€” vue-web-terminal ships createTerminal but its .d.ts
// references an unresolvable ~/ path; the runtime export is fine.
import { createTerminal } from 'vue-web-terminal';

import { setupStore } from "./store/pinia/store";
import { useSocketStoreWithOut } from "./store/pinia/useSocketStore";

// πŸ€“: https://github.com/eladcandroid/v-idle-3
Expand All @@ -19,21 +22,29 @@ const app = createApp(App);
app.config.unwrapInjectedRef = true
*/

// Set up Pinia store before mounting
useSocketStoreWithOut(app);

app.use(VueCookieNext);

app.use(VueGtag, {
property: { id: "G-XP9X9LHTDV" },
isEnabled: false,
});

// Register vue-web-terminal (required for TerminalApi to work)
app.use(Terminal);
// Register vue-web-terminal β€” must use createTerminal() so initStore() runs.
// The default export is the component itself (no install method), so
// app.use(defaultExport) silently skips store init, causing
// "The store must be initialized before reading" on every command.
app.use(createTerminal());

// Pinia must always be installed β€” useMainStore() in App.vue needs it.
setupStore(app);

// Only initialise the socket store and websocket plugin when the env var is set.
// Without this guard, useSocketStoreWithOut() registers a Pinia store that
// reads socket state before the plugin is installed, throwing
// "The store must be initialized before reading" and breaking command execution.
const terminalWebSocketUrl = import.meta.env.VITE_TERMINAL_WS_URL;
if (terminalWebSocketUrl) {
useSocketStoreWithOut(app);
app.use(VueNativeSock, terminalWebSocketUrl, {
// 启用piniaι›†ζˆ | enable pinia integration
// store: piniaSocketStore(),
Expand Down
Loading