@niyamulahsan/create-deskapp 1.2.4 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +16 -16
- package/template/.env.example +20 -13
- package/template/AGENTS.md +699 -0
- package/template/package.json +3 -0
- package/template/src/config/app.ts +26 -24
- package/template/src/config/winsetup.ts +93 -91
- package/template/src/core/api/binding-error.ts +57 -0
- package/template/src/core/api/bindings.generated.ts +2 -0
- package/template/src/core/api/generate.manifest.ts +84 -80
- package/template/src/core/api/registry.ts +58 -48
- package/template/src/core/config.ts +101 -99
- package/template/src/core/database/aggregate.ts +89 -85
- package/template/src/core/database/config.ts +50 -48
- package/template/src/core/database/connection.ts +116 -114
- package/template/src/core/database/migrate-hooks.ts +86 -84
- package/template/src/core/database/paginate.ts +226 -224
- package/template/src/core/database/reset.ts +21 -19
- package/template/src/core/database/seed.ts +169 -167
- package/template/src/core/database/status.ts +37 -35
- package/template/src/core/env.ts +108 -106
- package/template/src/core/facade.ts +63 -61
- package/template/src/core/maker/db/fresh.ts +10 -8
- package/template/src/core/maker/db/generate.ts +13 -11
- package/template/src/core/maker/db/helpers.ts +92 -96
- package/template/src/core/maker/db/migrate.ts +37 -35
- package/template/src/core/maker/db/mod.ts +93 -91
- package/template/src/core/maker/db/module-migrate.ts +56 -54
- package/template/src/core/maker/db/push.ts +23 -21
- package/template/src/core/maker/db/reset.ts +8 -6
- package/template/src/core/maker/db/seed.ts +9 -7
- package/template/src/core/maker/db/status.ts +8 -6
- package/template/src/core/maker/help.ts +59 -57
- package/template/src/core/maker/make/controller.ts +25 -22
- package/template/src/core/maker/make/helpers.ts +97 -91
- package/template/src/core/maker/make/mod.ts +69 -67
- package/template/src/core/maker/make/model.ts +16 -14
- package/template/src/core/maker/make/module.ts +53 -39
- package/template/src/core/maker/make/seeder.ts +23 -21
- package/template/src/core/maker/make/test.ts +33 -30
- package/template/src/core/maker/mod.ts +85 -83
- package/template/src/core/maker/run/mod.ts +134 -132
- package/template/src/core/maker/stub.ts +26 -24
- package/template/src/core/maker/stubs/controller/controller.controller.stub +57 -55
- package/template/src/core/maker/stubs/controller/controller.schema.stub +18 -13
- package/template/src/core/maker/stubs/facade/facade.stub +21 -0
- package/template/src/core/maker/stubs/model/model.stub +10 -8
- package/template/src/core/maker/stubs/seeder/seeder.stub +18 -16
- package/template/src/core/maker/stubs/test/test.stub +9 -7
- package/template/src/core/maker/sync-config.ts +93 -94
- package/template/src/core/utils/password.ts +29 -27
- package/template/src/core/utils/playwright.ts +123 -121
- package/template/src/core/utils/queue.ts +68 -66
- package/template/src/core/utils/scheduler.ts +62 -60
- package/template/src/core/utils/storage.ts +3 -1
- package/template/src/core/utils/validation.ts +37 -35
- package/template/src/database/schema.ts +2 -0
- package/template/src/main.ts +120 -118
- package/template/src/modules/app/__tests__/demo.controller.test.ts +75 -0
- package/template/src/modules/app/__tests__/net.controller.test.ts +65 -0
- package/template/src/modules/app/__tests__/playwright.controller.test.ts +50 -0
- package/template/src/modules/app/__tests__/storage.controller.test.ts +114 -0
- package/template/src/modules/app/__tests__/window.controller.test.ts +98 -0
- package/template/src/modules/app/controllers/demo.controller.ts +120 -118
- package/template/src/modules/app/controllers/net.controller.ts +50 -48
- package/template/src/modules/app/controllers/playwright.controller.ts +142 -140
- package/template/src/modules/app/controllers/storage.controller.ts +231 -229
- package/template/src/modules/app/controllers/window.controller.ts +2 -0
- package/template/src/modules/app/facade.ts +21 -0
- package/template/src/preload.ts +25 -2
- package/template/src/ui/src/App.vue +4 -2
- package/template/src/ui/src/app.ts +38 -23
- package/template/src/ui/src/bindings.d.ts +18 -16
- package/template/src/ui/src/components/Button.vue +34 -32
- package/template/src/ui/src/components/Checkbox.vue +26 -29
- package/template/src/ui/src/components/Input.vue +221 -227
- package/template/src/ui/src/components/InputGroup.vue +141 -0
- package/template/src/ui/src/components/InputPasswordToggle.vue +204 -0
- package/template/src/ui/src/components/Modal.vue +65 -55
- package/template/src/ui/src/components/Spinner.vue +44 -42
- package/template/src/ui/src/components/Switch.vue +62 -65
- package/template/src/ui/src/components/TextArea.vue +108 -121
- package/template/src/ui/src/components/Toast.vue +55 -56
- package/template/src/ui/src/components/datatable/DataTableSkeleton.vue +100 -98
- package/template/src/ui/src/components/datatable/Pagination.vue +153 -125
- package/template/src/ui/src/components/datatable/SelectOpption.vue +36 -35
- package/template/src/ui/src/components/datatable/index.vue +336 -258
- package/template/src/ui/src/env.d.ts +16 -13
- package/template/src/ui/src/global.d.ts +21 -2
- package/template/src/ui/src/helpers/nformatter.ts +12 -10
- package/template/src/ui/src/pages/dashboard/index.vue +690 -687
- package/template/src/ui/src/plugins/browserDetect.ts +57 -0
- package/template/src/ui/src/plugins/gum.ts +576 -549
- package/template/src/ui/src/plugins/pulse.ts +181 -147
- package/template/src/ui/src/plugins/routeProgress.ts +89 -0
- package/template/src/ui/src/router/index.ts +44 -25
- package/template/src/ui/src/stores/example.ts +2 -0
- package/template/src/ui/vite.config.ts +40 -38
- package/template/src/window/app-menu.ts +89 -87
- package/template/src/window/config.ts +14 -12
- package/template/src/window/context-menu.ts +23 -21
- package/template/src/window/dialogs.ts +92 -90
- package/template/src/window/manager.ts +2 -0
- package/template/src/window/native.ts +47 -45
- package/template/src/window/tray.ts +132 -130
|
@@ -1,148 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return api;
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1
|
+
// ./src/ui/src/plugins/pulse.ts
|
|
2
|
+
|
|
3
|
+
import { io, type Socket } from "socket.io-client";
|
|
4
|
+
import type { App } from "vue";
|
|
5
|
+
|
|
6
|
+
declare const __SOCKET_ENABLED__: boolean;
|
|
7
|
+
|
|
8
|
+
type EventCallback<T = unknown> = (payload: T) => void;
|
|
9
|
+
|
|
10
|
+
// Access token (or a getter returning one) sent with the Socket.IO handshake.
|
|
11
|
+
// The desktop client cannot send the httpOnly auth cookie, so the server reads
|
|
12
|
+
// this bare JWT from `handshake.auth.token`. A getter is preferred because it
|
|
13
|
+
// is resolved on every (re)connect.
|
|
14
|
+
export type PulseToken = string | null | (() => string | null);
|
|
15
|
+
|
|
16
|
+
type ChannelBinding = {
|
|
17
|
+
event: string;
|
|
18
|
+
callback: EventCallback;
|
|
19
|
+
wrapped: EventCallback;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type PulseChannel = {
|
|
23
|
+
listen: <T = unknown>(event: string, callback: EventCallback<T>) => PulseChannel;
|
|
24
|
+
stopListening: (event: string, callback?: EventCallback) => PulseChannel;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type PulseClient = {
|
|
28
|
+
connect: () => PulseClient;
|
|
29
|
+
disconnect: () => PulseClient;
|
|
30
|
+
setToken: (token: PulseToken) => PulseClient;
|
|
31
|
+
channel: (name: string) => PulseChannel;
|
|
32
|
+
private: (room: string) => PulseChannel;
|
|
33
|
+
leave: (room: string) => PulseClient;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function createPulse(): PulseClient {
|
|
37
|
+
if (!__SOCKET_ENABLED__) {
|
|
38
|
+
const n = (): PulseChannel => ({ listen: () => n(), stopListening: () => n() });
|
|
39
|
+
const c: PulseClient = {
|
|
40
|
+
connect: () => c,
|
|
41
|
+
disconnect: () => c,
|
|
42
|
+
setToken: () => c,
|
|
43
|
+
channel: n,
|
|
44
|
+
private: n,
|
|
45
|
+
leave: () => c,
|
|
46
|
+
};
|
|
47
|
+
return c;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let socket: Socket | null = null;
|
|
51
|
+
let tokenSource: PulseToken = null;
|
|
52
|
+
const channels = new Map<string, ChannelBinding[]>();
|
|
53
|
+
const joinedRooms = new Set<string>();
|
|
54
|
+
|
|
55
|
+
// Resolve lazily so every reconnect picks up the current token.
|
|
56
|
+
const resolveToken = () => (typeof tokenSource === "function" ? tokenSource() : tokenSource);
|
|
57
|
+
|
|
58
|
+
const socketUrl = () => {
|
|
59
|
+
const explicit = import.meta.env.VITE_SOCKET_URL || import.meta.env.VITE_API_URL;
|
|
60
|
+
if (explicit) return explicit;
|
|
61
|
+
return window.location.origin;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const ensureConnected = () => {
|
|
65
|
+
if (socket) return socket;
|
|
66
|
+
|
|
67
|
+
socket = io(socketUrl(), {
|
|
68
|
+
withCredentials: true,
|
|
69
|
+
transports: ["websocket", "polling"],
|
|
70
|
+
auth: (callback) => {
|
|
71
|
+
const token = resolveToken();
|
|
72
|
+
callback(token ? { token } : {});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
socket.on("connect", () => {
|
|
77
|
+
for (const room of joinedRooms) {
|
|
78
|
+
socket?.emit("join", room);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return socket;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const channel = (name: string): PulseChannel => {
|
|
86
|
+
const room = String(name).trim();
|
|
87
|
+
if (!room) throw new Error("Channel name is required");
|
|
88
|
+
|
|
89
|
+
const currentSocket = ensureConnected();
|
|
90
|
+
joinedRooms.add(room);
|
|
91
|
+
currentSocket.emit("join", room);
|
|
92
|
+
|
|
93
|
+
const api: PulseChannel = {
|
|
94
|
+
listen: <T = unknown>(event: string, callback: EventCallback<T>) => {
|
|
95
|
+
const wrapped = (payload: unknown) => callback(payload as T);
|
|
96
|
+
const bindings = channels.get(room) || [];
|
|
97
|
+
bindings.push({ event, callback: callback as EventCallback, wrapped });
|
|
98
|
+
channels.set(room, bindings);
|
|
99
|
+
currentSocket.on(event, wrapped);
|
|
100
|
+
return api;
|
|
101
|
+
},
|
|
102
|
+
stopListening: (event: string, callback?: EventCallback) => {
|
|
103
|
+
const bindings = channels.get(room) || [];
|
|
104
|
+
const kept: ChannelBinding[] = [];
|
|
105
|
+
|
|
106
|
+
for (const binding of bindings) {
|
|
107
|
+
const matchesEvent = binding.event === event;
|
|
108
|
+
const matchesCallback = !callback || binding.callback === callback;
|
|
109
|
+
if (matchesEvent && matchesCallback) {
|
|
110
|
+
currentSocket.off(binding.event, binding.wrapped);
|
|
111
|
+
} else {
|
|
112
|
+
kept.push(binding);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (kept.length > 0) channels.set(room, kept);
|
|
117
|
+
else channels.delete(room);
|
|
118
|
+
return api;
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return api;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const pulse: PulseClient = {
|
|
126
|
+
connect: () => {
|
|
127
|
+
ensureConnected();
|
|
128
|
+
return pulse;
|
|
129
|
+
},
|
|
130
|
+
disconnect: () => {
|
|
131
|
+
socket?.disconnect();
|
|
132
|
+
socket = null;
|
|
133
|
+
return pulse;
|
|
134
|
+
},
|
|
135
|
+
setToken: (token: PulseToken) => {
|
|
136
|
+
tokenSource = token;
|
|
137
|
+
if (socket) {
|
|
138
|
+
// Force a new handshake with the updated credentials. The connect
|
|
139
|
+
// handler re-joins every room in joinedRooms.
|
|
140
|
+
socket.disconnect().connect();
|
|
141
|
+
}
|
|
142
|
+
return pulse;
|
|
143
|
+
},
|
|
144
|
+
channel,
|
|
145
|
+
private: (room: string) => channel(`private:${room}`),
|
|
146
|
+
leave: (room: string) => {
|
|
147
|
+
const name = String(room).trim();
|
|
148
|
+
if (!name) return pulse;
|
|
149
|
+
|
|
150
|
+
joinedRooms.delete(name);
|
|
151
|
+
const bindings = channels.get(name) || [];
|
|
152
|
+
channels.delete(name);
|
|
153
|
+
|
|
154
|
+
if (socket) {
|
|
155
|
+
// Tell the server too: dropping listeners alone leaves the socket
|
|
156
|
+
// subscribed and still receiving that room's events.
|
|
157
|
+
socket.emit("leave", name);
|
|
158
|
+
for (const binding of bindings) {
|
|
159
|
+
socket.off(binding.event, binding.wrapped);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return pulse;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return pulse;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const pulse = createPulse();
|
|
171
|
+
|
|
172
|
+
export const PulsePlugin = {
|
|
173
|
+
install(app: App) {
|
|
174
|
+
app.config.globalProperties.$pulse = pulse;
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
declare module "vue" {
|
|
179
|
+
interface ComponentCustomProperties {
|
|
180
|
+
$pulse: PulseClient;
|
|
181
|
+
}
|
|
148
182
|
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// ./src/ui/src/plugins/routeProgress.ts
|
|
2
|
+
|
|
3
|
+
import type { Router } from "vue-router";
|
|
4
|
+
|
|
5
|
+
const BAR_ID = "app-route-progress";
|
|
6
|
+
|
|
7
|
+
function ensureBar(): HTMLElement {
|
|
8
|
+
const existing = document.getElementById(BAR_ID);
|
|
9
|
+
if (existing) return existing;
|
|
10
|
+
|
|
11
|
+
const bar = document.createElement("div");
|
|
12
|
+
bar.id = BAR_ID;
|
|
13
|
+
bar.style.position = "fixed";
|
|
14
|
+
bar.style.top = "0";
|
|
15
|
+
bar.style.left = "0";
|
|
16
|
+
bar.style.right = "0";
|
|
17
|
+
bar.style.height = "2px";
|
|
18
|
+
bar.style.width = "100vw";
|
|
19
|
+
bar.style.opacity = "0";
|
|
20
|
+
bar.style.zIndex = "99999";
|
|
21
|
+
bar.style.pointerEvents = "none";
|
|
22
|
+
bar.style.background = "linear-gradient(90deg, #2563eb, #06b6d4)";
|
|
23
|
+
bar.style.boxShadow = "0 0 8px rgba(37, 99, 235, 0.5)";
|
|
24
|
+
bar.style.transformOrigin = "left center";
|
|
25
|
+
bar.style.transform = "scaleX(0)";
|
|
26
|
+
bar.style.transition = "transform 0.25s ease, opacity 0.2s ease";
|
|
27
|
+
document.body.appendChild(bar);
|
|
28
|
+
return bar;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function setupRouteProgress(router: Router) {
|
|
32
|
+
if (typeof window === "undefined") return;
|
|
33
|
+
|
|
34
|
+
const bar = ensureBar();
|
|
35
|
+
let trickleTimer: number | null = null;
|
|
36
|
+
let finishTimer: number | null = null;
|
|
37
|
+
|
|
38
|
+
const clearTimers = () => {
|
|
39
|
+
if (trickleTimer !== null) {
|
|
40
|
+
window.clearInterval(trickleTimer);
|
|
41
|
+
trickleTimer = null;
|
|
42
|
+
}
|
|
43
|
+
if (finishTimer !== null) {
|
|
44
|
+
window.clearTimeout(finishTimer);
|
|
45
|
+
finishTimer = null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const start = () => {
|
|
50
|
+
clearTimers();
|
|
51
|
+
bar.style.opacity = "1";
|
|
52
|
+
bar.dataset.progress = "0.18";
|
|
53
|
+
bar.style.transform = "scaleX(0.18)";
|
|
54
|
+
|
|
55
|
+
trickleTimer = window.setInterval(() => {
|
|
56
|
+
const current = Number.parseFloat(bar.dataset.progress || "0.18");
|
|
57
|
+
if (current >= 0.85) return;
|
|
58
|
+
const next = Math.min(current + Math.random() * 0.09, 0.85);
|
|
59
|
+
bar.dataset.progress = String(next);
|
|
60
|
+
bar.style.transform = `scaleX(${next})`;
|
|
61
|
+
}, 180);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const done = () => {
|
|
65
|
+
clearTimers();
|
|
66
|
+
bar.dataset.progress = "1";
|
|
67
|
+
bar.style.transform = "scaleX(1)";
|
|
68
|
+
finishTimer = window.setTimeout(() => {
|
|
69
|
+
bar.style.opacity = "0";
|
|
70
|
+
bar.style.transform = "scaleX(0)";
|
|
71
|
+
bar.dataset.progress = "0";
|
|
72
|
+
}, 220);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
router.beforeEach((to, from) => {
|
|
76
|
+
if (to.path !== from.path) {
|
|
77
|
+
start();
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
router.afterEach(() => {
|
|
83
|
+
done();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
router.onError(() => {
|
|
87
|
+
done();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
// ./src/ui/src/router/index.ts
|
|
2
|
+
|
|
3
|
+
import { createRouter, createWebHashHistory } from "vue-router";
|
|
4
|
+
import { setupRouteProgress } from "@/ui/plugins/routeProgress";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Router - one route for now, the dashboard at `/`. Route components are
|
|
8
|
+
* lazy-imported from the pages folder; add routes here as your app grows:
|
|
9
|
+
*
|
|
10
|
+
* { path: "/posts", name: "posts", component: () => import("@/ui/pages/posts/index.vue") }
|
|
11
|
+
*
|
|
12
|
+
* The backend serves the built SPA (`src/ui/dist`) for every path, so SPA
|
|
13
|
+
* routes work directly inside the desktop window.
|
|
14
|
+
*/
|
|
15
|
+
export const routes = [
|
|
16
|
+
{
|
|
17
|
+
path: "/",
|
|
18
|
+
name: "dashboard",
|
|
19
|
+
component: () => import("@/ui/pages/dashboard/index.vue")
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const router = createRouter({
|
|
24
|
+
history: createWebHashHistory(),
|
|
25
|
+
routes
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// setupRouteProgress(router);
|
|
29
|
+
|
|
30
|
+
// router.beforeEach(async (to) => {
|
|
31
|
+
// const auth = useAuthStore(); // first make it into pinia store and import from there
|
|
32
|
+
|
|
33
|
+
// if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
|
34
|
+
// return { path: "/login", query: { redirect: to.fullPath } };
|
|
35
|
+
// }
|
|
36
|
+
|
|
37
|
+
// if (to.meta.guestOnly && auth.isAuthenticated) {
|
|
38
|
+
// return { path: "/" };
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
// return true;
|
|
42
|
+
// });
|
|
43
|
+
|
|
44
|
+
export default router;
|
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
// ./src/ui/vite.config.ts
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import vue from "@vitejs/plugin-vue";
|
|
6
|
+
import { defineConfig } from "vite";
|
|
7
|
+
|
|
8
|
+
const rootDir = typeof import.meta.dirname === "string"
|
|
9
|
+
? import.meta.dirname
|
|
10
|
+
: path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
// Use path.resolve for bulletproof Windows support
|
|
14
|
+
root: path.resolve(rootDir, "."),
|
|
15
|
+
plugins: [vue()],
|
|
16
|
+
base: "./",
|
|
17
|
+
define: {
|
|
18
|
+
__SOCKET_ENABLED__: JSON.stringify(!!process.env.VITE_SOCKET_URL || !!process.env.VITE_API_URL),
|
|
19
|
+
},
|
|
20
|
+
resolve: {
|
|
21
|
+
alias: {
|
|
22
|
+
"@/ui": path.resolve(rootDir, "./src"),
|
|
23
|
+
"@": path.resolve(rootDir, "../../src"),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
server: {
|
|
27
|
+
port: 5173,
|
|
28
|
+
strictPort: true,
|
|
29
|
+
fs: {
|
|
30
|
+
allow: [path.resolve(rootDir, "../..")],
|
|
31
|
+
},
|
|
32
|
+
proxy: {
|
|
33
|
+
"/__invoke": "http://localhost:8000",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
build: {
|
|
37
|
+
outDir: "dist",
|
|
38
|
+
emptyOutDir: true,
|
|
39
|
+
},
|
|
40
|
+
});
|