@fefeding/aicmd 0.1.16 → 1.0.4
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/dist/public/index.css +139 -37
- package/dist/public/index.js +464 -34
- package/dist/public/views.css +156 -156
- package/dist/public/views.js +69 -41
- package/dist/public/vue.js +1 -1
- package/dist/server/service/ai.service.d.ts +20 -128
- package/dist/server/service/ai.service.d.ts.map +1 -1
- package/dist/server/service/ai.service.js +359 -649
- package/dist/server/service/ai.service.js.map +1 -1
- package/dist/server/service/ai.service.ts +404 -833
- package/electron/main.js +21 -2
- package/electron/preload.js +9 -0
- package/electron/updater.js +6 -6
- package/package.json +5 -2
package/dist/public/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./views.js","./rolldown-runtime.js","./vue.js","./xterm.js","./xterm.css","./views.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import { n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime.js";
|
|
3
|
-
import { $ as
|
|
2
|
+
import { i as __toESM, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime.js";
|
|
3
|
+
import { $ as ref, A as getCurrentInstance, B as renderSlot, C as createBaseVNode, D as createTextVNode, E as createElementBlock, F as onBeforeUnmount, G as effectScope, H as watch, I as onMounted, J as isReactive, K as getCurrentScope, L as onUnmounted, N as inject, O as createVNode, P as nextTick, Q as reactive, R as openBlock, S as computed, T as createCommentVNode, U as withCtx, V as resolveComponent, X as markRaw, Y as isRef, Z as onScopeDispose, a as init_vue_router, at as normalizeStyle, c as useI18n, d as createApp, et as toRaw, i as createWebHistory, it as normalizeClass, j as hasInjectionContext, k as defineComponent, l as init_vue_runtime_esm_bundler, n as useTitle, nt as unref, o as createI18n, ot as toDisplayString, r as createRouter, s as init_vue_i18n, t as init_core, tt as toRefs, u as Transition, x as Fragment, z as renderList } from "./vue.js";
|
|
4
4
|
import { i as init_bootstrap, n as init_bootstrap_esm, r as init_bootstrap_icons, t as Modal } from "./bootstrap.js";
|
|
5
5
|
//#region \0vite/modulepreload-polyfill.js
|
|
6
6
|
(function polyfill() {
|
|
@@ -33,13 +33,375 @@ import { i as init_bootstrap, n as init_bootstrap_esm, r as init_bootstrap_icons
|
|
|
33
33
|
}
|
|
34
34
|
})();
|
|
35
35
|
//#endregion
|
|
36
|
+
//#region node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
|
|
37
|
+
var require_eventemitter3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
38
|
+
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
39
|
+
/**
|
|
40
|
+
* Constructor to create a storage for our `EE` objects.
|
|
41
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
42
|
+
*
|
|
43
|
+
* @constructor
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
function Events() {}
|
|
47
|
+
if (Object.create) {
|
|
48
|
+
Events.prototype = Object.create(null);
|
|
49
|
+
if (!new Events().__proto__) prefix = false;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Representation of a single event listener.
|
|
53
|
+
*
|
|
54
|
+
* @param {Function} fn The listener function.
|
|
55
|
+
* @param {*} context The context to invoke the listener with.
|
|
56
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
57
|
+
* @constructor
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
function EE(fn, context, once) {
|
|
61
|
+
this.fn = fn;
|
|
62
|
+
this.context = context;
|
|
63
|
+
this.once = once || false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Add a listener for a given event.
|
|
67
|
+
*
|
|
68
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
69
|
+
* @param {(String|Symbol)} event The event name.
|
|
70
|
+
* @param {Function} fn The listener function.
|
|
71
|
+
* @param {*} context The context to invoke the listener with.
|
|
72
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
73
|
+
* @returns {EventEmitter}
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
function addListener(emitter, event, fn, context, once) {
|
|
77
|
+
if (typeof fn !== "function") throw new TypeError("The listener must be a function");
|
|
78
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
79
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
80
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
81
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
82
|
+
return emitter;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Clear event by name.
|
|
86
|
+
*
|
|
87
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
88
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
function clearEvent(emitter, evt) {
|
|
92
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
93
|
+
else delete emitter._events[evt];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
97
|
+
* `EventEmitter` interface.
|
|
98
|
+
*
|
|
99
|
+
* @constructor
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
function EventEmitter() {
|
|
103
|
+
this._events = new Events();
|
|
104
|
+
this._eventsCount = 0;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Return an array listing the events for which the emitter has registered
|
|
108
|
+
* listeners.
|
|
109
|
+
*
|
|
110
|
+
* @returns {Array}
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
114
|
+
var names = [], events, name;
|
|
115
|
+
if (this._eventsCount === 0) return names;
|
|
116
|
+
for (name in events = this._events) if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
117
|
+
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
118
|
+
return names;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Return the listeners registered for a given event.
|
|
122
|
+
*
|
|
123
|
+
* @param {(String|Symbol)} event The event name.
|
|
124
|
+
* @returns {Array} The registered listeners.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
128
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
129
|
+
if (!handlers) return [];
|
|
130
|
+
if (handlers.fn) return [handlers.fn];
|
|
131
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) ee[i] = handlers[i].fn;
|
|
132
|
+
return ee;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Return the number of listeners listening to a given event.
|
|
136
|
+
*
|
|
137
|
+
* @param {(String|Symbol)} event The event name.
|
|
138
|
+
* @returns {Number} The number of listeners.
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
142
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
143
|
+
if (!listeners) return 0;
|
|
144
|
+
if (listeners.fn) return 1;
|
|
145
|
+
return listeners.length;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Calls each of the listeners registered for a given event.
|
|
149
|
+
*
|
|
150
|
+
* @param {(String|Symbol)} event The event name.
|
|
151
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
152
|
+
* @public
|
|
153
|
+
*/
|
|
154
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
155
|
+
var evt = prefix ? prefix + event : event;
|
|
156
|
+
if (!this._events[evt]) return false;
|
|
157
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
158
|
+
if (listeners.fn) {
|
|
159
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
160
|
+
switch (len) {
|
|
161
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
162
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
163
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
164
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
165
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
166
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
167
|
+
}
|
|
168
|
+
for (i = 1, args = new Array(len - 1); i < len; i++) args[i - 1] = arguments[i];
|
|
169
|
+
listeners.fn.apply(listeners.context, args);
|
|
170
|
+
} else {
|
|
171
|
+
var length = listeners.length, j;
|
|
172
|
+
for (i = 0; i < length; i++) {
|
|
173
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
174
|
+
switch (len) {
|
|
175
|
+
case 1:
|
|
176
|
+
listeners[i].fn.call(listeners[i].context);
|
|
177
|
+
break;
|
|
178
|
+
case 2:
|
|
179
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
180
|
+
break;
|
|
181
|
+
case 3:
|
|
182
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
183
|
+
break;
|
|
184
|
+
case 4:
|
|
185
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) args[j - 1] = arguments[j];
|
|
189
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Add a listener for a given event.
|
|
197
|
+
*
|
|
198
|
+
* @param {(String|Symbol)} event The event name.
|
|
199
|
+
* @param {Function} fn The listener function.
|
|
200
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
201
|
+
* @returns {EventEmitter} `this`.
|
|
202
|
+
* @public
|
|
203
|
+
*/
|
|
204
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
205
|
+
return addListener(this, event, fn, context, false);
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Add a one-time listener for a given event.
|
|
209
|
+
*
|
|
210
|
+
* @param {(String|Symbol)} event The event name.
|
|
211
|
+
* @param {Function} fn The listener function.
|
|
212
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
213
|
+
* @returns {EventEmitter} `this`.
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
217
|
+
return addListener(this, event, fn, context, true);
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Remove the listeners of a given event.
|
|
221
|
+
*
|
|
222
|
+
* @param {(String|Symbol)} event The event name.
|
|
223
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
224
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
225
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
226
|
+
* @returns {EventEmitter} `this`.
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
230
|
+
var evt = prefix ? prefix + event : event;
|
|
231
|
+
if (!this._events[evt]) return this;
|
|
232
|
+
if (!fn) {
|
|
233
|
+
clearEvent(this, evt);
|
|
234
|
+
return this;
|
|
235
|
+
}
|
|
236
|
+
var listeners = this._events[evt];
|
|
237
|
+
if (listeners.fn) {
|
|
238
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
239
|
+
} else {
|
|
240
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
241
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
242
|
+
else clearEvent(this, evt);
|
|
243
|
+
}
|
|
244
|
+
return this;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Remove all listeners, or those of the specified event.
|
|
248
|
+
*
|
|
249
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
250
|
+
* @returns {EventEmitter} `this`.
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
254
|
+
var evt;
|
|
255
|
+
if (event) {
|
|
256
|
+
evt = prefix ? prefix + event : event;
|
|
257
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
258
|
+
} else {
|
|
259
|
+
this._events = new Events();
|
|
260
|
+
this._eventsCount = 0;
|
|
261
|
+
}
|
|
262
|
+
return this;
|
|
263
|
+
};
|
|
264
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
265
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
266
|
+
EventEmitter.prefixed = prefix;
|
|
267
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
268
|
+
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
269
|
+
}));
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs
|
|
272
|
+
var import_eventemitter3, eventemitter3_default;
|
|
273
|
+
var init_eventemitter3 = __esmMin((() => {
|
|
274
|
+
import_eventemitter3 = /* @__PURE__ */ __toESM(require_eventemitter3(), 1);
|
|
275
|
+
eventemitter3_default = import_eventemitter3.default;
|
|
276
|
+
}));
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region node_modules/.pnpm/@fefeding+eventemitter@1.0.5/node_modules/@fefeding/eventemitter/dist/index.js
|
|
279
|
+
var JEventEmitter;
|
|
280
|
+
var init_dist = __esmMin((() => {
|
|
281
|
+
init_eventemitter3();
|
|
282
|
+
JEventEmitter = class JEventEmitter extends eventemitter3_default {
|
|
283
|
+
/**
|
|
284
|
+
* 唯一标识
|
|
285
|
+
*/
|
|
286
|
+
key = "";
|
|
287
|
+
/**
|
|
288
|
+
* 私有方法,用于规范化事件名
|
|
289
|
+
* @param name - 可以是字符串、符号或字符串数组
|
|
290
|
+
* @returns 返回符号或字符串数组
|
|
291
|
+
*/
|
|
292
|
+
normalizeEventNames(name) {
|
|
293
|
+
if (!name) return [];
|
|
294
|
+
if (typeof name === "string") return name.split(" ");
|
|
295
|
+
return Array.isArray(name) ? name : [name];
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 为给定的事件添加一个监听器
|
|
299
|
+
* @param event - 事件名,可以是字符串、符号或字符串数组
|
|
300
|
+
* @param fn - 监听函数,参数列表为可变参数
|
|
301
|
+
* @param context - 可选,上下文对象
|
|
302
|
+
* @returns 返回 EventEmitter 实例
|
|
303
|
+
*/
|
|
304
|
+
on(event, fn, context) {
|
|
305
|
+
const events = this.normalizeEventNames(event);
|
|
306
|
+
for (const name of events) name && super.on(name, fn, context);
|
|
307
|
+
return this;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* 移除给定的事件的一个监听器
|
|
311
|
+
* @param event - 事件名,可以是字符串、符号或字符串数组
|
|
312
|
+
* @param fn - 可选,监听函数,参数列表为可变参数
|
|
313
|
+
* @param context - 可选,上下文对象
|
|
314
|
+
* @param once - 可选,是否只执行一次
|
|
315
|
+
* @returns 返回 EventEmitter 实例
|
|
316
|
+
*/
|
|
317
|
+
off(event, fn, context, once) {
|
|
318
|
+
const events = this.normalizeEventNames(event);
|
|
319
|
+
for (const name of events) name && super.off(name, fn, context);
|
|
320
|
+
return this;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* 消毁
|
|
324
|
+
*/
|
|
325
|
+
destory() {
|
|
326
|
+
this.removeAllListeners();
|
|
327
|
+
if (this.key) JEventEmitter.removeEmitter(this.key);
|
|
328
|
+
}
|
|
329
|
+
static emitters = /* @__PURE__ */ new Map();
|
|
330
|
+
static getEmitter(key) {
|
|
331
|
+
let emmiter = this.emitters.get(key);
|
|
332
|
+
if (!emmiter) {
|
|
333
|
+
emmiter = new JEventEmitter();
|
|
334
|
+
emmiter.key = key;
|
|
335
|
+
this.emitters.set(key, emmiter);
|
|
336
|
+
}
|
|
337
|
+
return emmiter;
|
|
338
|
+
}
|
|
339
|
+
static removeEmitter(key) {
|
|
340
|
+
if (this.emitters.has(key)) return this.emitters.delete(key);
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}));
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/base/eventBus.ts
|
|
347
|
+
function subscribe(name, callback) {
|
|
348
|
+
const id = typeof name === "symbol" ? name : Symbol(name);
|
|
349
|
+
GlobalEventBusCache.set(id, {
|
|
350
|
+
name,
|
|
351
|
+
callback
|
|
352
|
+
});
|
|
353
|
+
GlobalEventBus.on(name, callback);
|
|
354
|
+
return id;
|
|
355
|
+
}
|
|
356
|
+
function unsubscribe(eventId) {
|
|
357
|
+
const event = GlobalEventBusCache.get(eventId);
|
|
358
|
+
if (event) {
|
|
359
|
+
GlobalEventBus.off(event.name, event.callback);
|
|
360
|
+
GlobalEventBusCache.delete(eventId);
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
function publish(name, data) {
|
|
366
|
+
return GlobalEventBus.emit(name, data);
|
|
367
|
+
}
|
|
368
|
+
var GlobalEventBus, GlobalEventBusCache;
|
|
369
|
+
var init_eventBus = __esmMin((() => {
|
|
370
|
+
init_dist();
|
|
371
|
+
GlobalEventBus = new JEventEmitter();
|
|
372
|
+
GlobalEventBusCache = /* @__PURE__ */ new Map();
|
|
373
|
+
}));
|
|
374
|
+
//#endregion
|
|
36
375
|
//#region src/platform/App.vue?vue&type=script&setup=true&lang.ts
|
|
37
|
-
var _hoisted_1$3, _hoisted_2$3, App_vue_vue_type_script_setup_true_lang_default;
|
|
376
|
+
var _hoisted_1$3, _hoisted_2$3, _hoisted_3$2, _hoisted_4$2, _hoisted_5$2, _hoisted_6$1, _hoisted_7, _hoisted_8, _hoisted_9, _hoisted_10, _hoisted_11, _hoisted_12, _hoisted_13, _hoisted_14, _hoisted_15, _hoisted_16, _hoisted_17, _hoisted_18, _hoisted_19, _hoisted_20, _hoisted_21, App_vue_vue_type_script_setup_true_lang_default;
|
|
38
377
|
var init_App_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
39
378
|
init_vue_runtime_esm_bundler();
|
|
40
379
|
init_vue_i18n();
|
|
41
|
-
|
|
42
|
-
|
|
380
|
+
init_eventBus();
|
|
381
|
+
_hoisted_1$3 = { class: "update-card-header" };
|
|
382
|
+
_hoisted_2$3 = { class: "update-card-title" };
|
|
383
|
+
_hoisted_3$2 = ["title"];
|
|
384
|
+
_hoisted_4$2 = { class: "update-card-body" };
|
|
385
|
+
_hoisted_5$2 = { class: "update-version-info" };
|
|
386
|
+
_hoisted_6$1 = { class: "update-version-badge" };
|
|
387
|
+
_hoisted_7 = { class: "update-card-desc" };
|
|
388
|
+
_hoisted_8 = { class: "update-card-actions" };
|
|
389
|
+
_hoisted_9 = {
|
|
390
|
+
key: 1,
|
|
391
|
+
class: "update-progress-section"
|
|
392
|
+
};
|
|
393
|
+
_hoisted_10 = { class: "update-progress-header" };
|
|
394
|
+
_hoisted_11 = { class: "update-progress-label" };
|
|
395
|
+
_hoisted_12 = { class: "update-progress-percent" };
|
|
396
|
+
_hoisted_13 = { class: "update-progress-bar" };
|
|
397
|
+
_hoisted_14 = { class: "update-progress-detail" };
|
|
398
|
+
_hoisted_15 = { key: 0 };
|
|
399
|
+
_hoisted_16 = { class: "update-version-info" };
|
|
400
|
+
_hoisted_17 = { class: "update-version-badge" };
|
|
401
|
+
_hoisted_18 = { class: "update-card-desc" };
|
|
402
|
+
_hoisted_19 = { class: "update-card-actions" };
|
|
403
|
+
_hoisted_20 = { class: "update-card-desc update-error-text" };
|
|
404
|
+
_hoisted_21 = { class: "update-card-actions" };
|
|
43
405
|
App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
44
406
|
__name: "App",
|
|
45
407
|
setup(__props) {
|
|
@@ -48,34 +410,55 @@ var init_App_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
48
410
|
showBanner: false,
|
|
49
411
|
status: "",
|
|
50
412
|
version: "",
|
|
51
|
-
percent: 0
|
|
413
|
+
percent: 0,
|
|
414
|
+
transferred: 0,
|
|
415
|
+
total: 0,
|
|
416
|
+
speed: 0,
|
|
417
|
+
errorMessage: ""
|
|
52
418
|
});
|
|
53
419
|
let unsubscribeUpdate = null;
|
|
54
420
|
let unsubscribeMenu = null;
|
|
55
|
-
const
|
|
421
|
+
const updateCardIcon = computed(() => {
|
|
56
422
|
switch (updateState.status) {
|
|
57
423
|
case "available": return "bi-cloud-arrow-down";
|
|
58
424
|
case "progress": return "bi-arrow-repeat";
|
|
59
|
-
case "downloaded": return "bi-check-circle";
|
|
60
|
-
case "error": return "bi-exclamation-triangle";
|
|
425
|
+
case "downloaded": return "bi-check-circle-fill";
|
|
426
|
+
case "error": return "bi-exclamation-triangle-fill";
|
|
61
427
|
default: return "bi-info-circle";
|
|
62
428
|
}
|
|
63
429
|
});
|
|
64
|
-
const
|
|
430
|
+
const updateCardTitle = computed(() => {
|
|
65
431
|
switch (updateState.status) {
|
|
66
|
-
case "available": return t("update.
|
|
67
|
-
case "progress": return t("update.
|
|
68
|
-
case "downloaded": return t("update.
|
|
69
|
-
case "error": return t("update.
|
|
432
|
+
case "available": return t("update.newVersion");
|
|
433
|
+
case "progress": return t("update.downloadingTitle");
|
|
434
|
+
case "downloaded": return t("update.readyToInstall");
|
|
435
|
+
case "error": return t("update.updateFailed");
|
|
70
436
|
default: return "";
|
|
71
437
|
}
|
|
72
438
|
});
|
|
439
|
+
/** 格式化字节大小 */
|
|
440
|
+
function formatBytes(bytes) {
|
|
441
|
+
if (!bytes || bytes <= 0) return "0 B";
|
|
442
|
+
const units = [
|
|
443
|
+
"B",
|
|
444
|
+
"KB",
|
|
445
|
+
"MB",
|
|
446
|
+
"GB"
|
|
447
|
+
];
|
|
448
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
449
|
+
const val = bytes / Math.pow(1024, i);
|
|
450
|
+
return val >= 10 ? `${Math.round(val)} ${units[i]}` : `${val.toFixed(1)} ${units[i]}`;
|
|
451
|
+
}
|
|
73
452
|
function handleInstallUpdate() {
|
|
74
453
|
window.electronAPI?.updater?.install();
|
|
75
454
|
}
|
|
76
455
|
function handleDismiss() {
|
|
77
456
|
updateState.showBanner = false;
|
|
78
457
|
}
|
|
458
|
+
function handleRetryUpdate() {
|
|
459
|
+
updateState.showBanner = false;
|
|
460
|
+
window.electronAPI?.updater?.checkForUpdates();
|
|
461
|
+
}
|
|
79
462
|
onMounted(() => {
|
|
80
463
|
if (!window.electronAPI?.updater) return;
|
|
81
464
|
unsubscribeUpdate = window.electronAPI.updater.onEvent((msg) => {
|
|
@@ -89,6 +472,9 @@ var init_App_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
89
472
|
case "progress":
|
|
90
473
|
updateState.status = "progress";
|
|
91
474
|
updateState.percent = data?.percent || 0;
|
|
475
|
+
updateState.transferred = data?.transferred || 0;
|
|
476
|
+
updateState.total = data?.total || 0;
|
|
477
|
+
updateState.speed = data?.bytesPerSecond || 0;
|
|
92
478
|
updateState.showBanner = true;
|
|
93
479
|
break;
|
|
94
480
|
case "downloaded":
|
|
@@ -99,11 +485,15 @@ var init_App_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
99
485
|
case "not-available": break;
|
|
100
486
|
case "error":
|
|
101
487
|
console.error("[Update] Error:", data?.message);
|
|
488
|
+
updateState.status = "error";
|
|
489
|
+
updateState.errorMessage = data?.message || "";
|
|
490
|
+
updateState.showBanner = true;
|
|
102
491
|
break;
|
|
103
492
|
}
|
|
104
493
|
});
|
|
105
494
|
unsubscribeMenu = window.electronAPI.updater.onMenuAction((action) => {
|
|
106
495
|
if (action === "check-update") window.electronAPI?.updater?.checkForUpdates();
|
|
496
|
+
else if (action === "new-connection") publish("MENU_NEW_CONNECTION");
|
|
107
497
|
});
|
|
108
498
|
});
|
|
109
499
|
onBeforeUnmount(() => {
|
|
@@ -112,25 +502,51 @@ var init_App_vue_vue_type_script_setup_true_lang = __esmMin((() => {
|
|
|
112
502
|
});
|
|
113
503
|
return (_ctx, _cache) => {
|
|
114
504
|
const _component_router_view = resolveComponent("router-view");
|
|
115
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
116
|
-
|
|
117
|
-
class: normalizeClass(["update-banner", updateState.status])
|
|
118
|
-
}, [createBaseVNode("div", _hoisted_1$3, [
|
|
119
|
-
createBaseVNode("i", { class: normalizeClass(["bi", updateBannerIcon.value]) }, null, 2),
|
|
120
|
-
createBaseVNode("span", _hoisted_2$3, toDisplayString(updateBannerText.value), 1),
|
|
121
|
-
updateState.status === "downloaded" ? (openBlock(), createElementBlock("button", {
|
|
505
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(Transition, { name: "update-slide" }, {
|
|
506
|
+
default: withCtx(() => [updateState.showBanner ? (openBlock(), createElementBlock("div", {
|
|
122
507
|
key: 0,
|
|
123
|
-
class: "update-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
508
|
+
class: normalizeClass(["update-card", updateState.status])
|
|
509
|
+
}, [createBaseVNode("div", _hoisted_1$3, [createBaseVNode("div", _hoisted_2$3, [createBaseVNode("i", { class: normalizeClass(["bi", updateCardIcon.value]) }, null, 2), createBaseVNode("span", null, toDisplayString(updateCardTitle.value), 1)]), createBaseVNode("button", {
|
|
510
|
+
class: "update-card-close",
|
|
511
|
+
onClick: handleDismiss,
|
|
512
|
+
title: unref(t)("common.close")
|
|
513
|
+
}, [..._cache[0] || (_cache[0] = [createBaseVNode("i", { class: "bi bi-x" }, null, -1)])], 8, _hoisted_3$2)]), createBaseVNode("div", _hoisted_4$2, [updateState.status === "available" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
514
|
+
createBaseVNode("div", _hoisted_5$2, [createBaseVNode("span", _hoisted_6$1, "v" + toDisplayString(updateState.version), 1)]),
|
|
515
|
+
createBaseVNode("div", _hoisted_7, toDisplayString(unref(t)("update.availableDesc")), 1),
|
|
516
|
+
createBaseVNode("div", _hoisted_8, [createBaseVNode("button", {
|
|
517
|
+
class: "update-btn update-btn-secondary",
|
|
518
|
+
onClick: handleDismiss
|
|
519
|
+
}, toDisplayString(unref(t)("update.later")), 1)])
|
|
520
|
+
], 64)) : updateState.status === "progress" ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
521
|
+
createBaseVNode("div", _hoisted_10, [createBaseVNode("span", _hoisted_11, toDisplayString(unref(t)("update.downloading")), 1), createBaseVNode("span", _hoisted_12, toDisplayString(updateState.percent) + "%", 1)]),
|
|
522
|
+
createBaseVNode("div", _hoisted_13, [createBaseVNode("div", {
|
|
523
|
+
class: "update-progress-fill",
|
|
524
|
+
style: normalizeStyle({ width: updateState.percent + "%" })
|
|
525
|
+
}, null, 4)]),
|
|
526
|
+
createBaseVNode("div", _hoisted_14, [
|
|
527
|
+
createBaseVNode("span", null, toDisplayString(formatBytes(updateState.transferred)), 1),
|
|
528
|
+
createBaseVNode("span", null, "/ " + toDisplayString(formatBytes(updateState.total)), 1),
|
|
529
|
+
updateState.speed ? (openBlock(), createElementBlock("span", _hoisted_15, " · " + toDisplayString(formatBytes(updateState.speed)) + "/s", 1)) : createCommentVNode("", true)
|
|
530
|
+
])
|
|
531
|
+
])) : updateState.status === "downloaded" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
532
|
+
createBaseVNode("div", _hoisted_16, [createBaseVNode("span", _hoisted_17, "v" + toDisplayString(updateState.version), 1)]),
|
|
533
|
+
createBaseVNode("div", _hoisted_18, toDisplayString(unref(t)("update.downloadedDesc")), 1),
|
|
534
|
+
createBaseVNode("div", _hoisted_19, [createBaseVNode("button", {
|
|
535
|
+
class: "update-btn update-btn-secondary",
|
|
536
|
+
onClick: handleDismiss
|
|
537
|
+
}, toDisplayString(unref(t)("update.later")), 1), createBaseVNode("button", {
|
|
538
|
+
class: "update-btn",
|
|
539
|
+
onClick: handleInstallUpdate
|
|
540
|
+
}, [_cache[1] || (_cache[1] = createBaseVNode("i", { class: "bi bi-arrow-clockwise me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("update.restart")), 1)])])
|
|
541
|
+
], 64)) : updateState.status === "error" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createBaseVNode("div", _hoisted_20, toDisplayString(updateState.errorMessage || unref(t)("update.error")), 1), createBaseVNode("div", _hoisted_21, [createBaseVNode("button", {
|
|
127
542
|
class: "update-btn update-btn-secondary",
|
|
128
543
|
onClick: handleDismiss
|
|
129
|
-
}, toDisplayString(unref(t)("
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
544
|
+
}, toDisplayString(unref(t)("common.close")), 1), createBaseVNode("button", {
|
|
545
|
+
class: "update-btn",
|
|
546
|
+
onClick: handleRetryUpdate
|
|
547
|
+
}, [_cache[2] || (_cache[2] = createBaseVNode("i", { class: "bi bi-arrow-clockwise me-1" }, null, -1)), createTextVNode(toDisplayString(unref(t)("update.retry")), 1)])])], 64)) : createCommentVNode("", true)])], 2)) : createCommentVNode("", true)]),
|
|
548
|
+
_: 1
|
|
549
|
+
}), createVNode(_component_router_view)], 64);
|
|
134
550
|
};
|
|
135
551
|
}
|
|
136
552
|
});
|
|
@@ -3567,10 +3983,17 @@ var init_zh_CN = __esmMin((() => {
|
|
|
3567
3983
|
copyOutput: "复制输出"
|
|
3568
3984
|
},
|
|
3569
3985
|
update: {
|
|
3986
|
+
newVersion: "发现新版本",
|
|
3570
3987
|
available: "新版本 v{version} 可用,正在下载...",
|
|
3571
|
-
|
|
3988
|
+
availableDesc: "新版本正在后台自动下载,完成后将提示您安装。",
|
|
3989
|
+
downloadingTitle: "正在下载更新",
|
|
3990
|
+
downloading: "下载中",
|
|
3572
3991
|
downloaded: "v{version} 已下载完成,重启即可更新",
|
|
3992
|
+
downloadedDesc: "新版本已下载完成,重启应用即可完成更新。",
|
|
3993
|
+
readyToInstall: "准备安装",
|
|
3573
3994
|
error: "检查更新失败",
|
|
3995
|
+
updateFailed: "更新失败",
|
|
3996
|
+
retry: "重试",
|
|
3574
3997
|
restart: "立即重启",
|
|
3575
3998
|
later: "稍后"
|
|
3576
3999
|
}
|
|
@@ -3818,11 +4241,18 @@ var init_en_US = __esmMin((() => {
|
|
|
3818
4241
|
copyOutput: "Copy Output"
|
|
3819
4242
|
},
|
|
3820
4243
|
update: {
|
|
4244
|
+
newVersion: "New Version Available",
|
|
3821
4245
|
available: "New version v{version} available, downloading...",
|
|
3822
|
-
|
|
4246
|
+
availableDesc: "A new version is being downloaded in the background. You'll be notified when it's ready.",
|
|
4247
|
+
downloadingTitle: "Downloading Update",
|
|
4248
|
+
downloading: "Downloading",
|
|
3823
4249
|
downloaded: "v{version} downloaded, restart to apply",
|
|
4250
|
+
downloadedDesc: "The new version has been downloaded. Restart the app to apply the update.",
|
|
4251
|
+
readyToInstall: "Ready to Install",
|
|
3824
4252
|
error: "Update check failed",
|
|
3825
|
-
|
|
4253
|
+
updateFailed: "Update Failed",
|
|
4254
|
+
retry: "Retry",
|
|
4255
|
+
restart: "Restart Now",
|
|
3826
4256
|
later: "Later"
|
|
3827
4257
|
}
|
|
3828
4258
|
};
|
|
@@ -4933,4 +5363,4 @@ var init_modal = __esmMin((() => {
|
|
|
4933
5363
|
app.mount("#app");
|
|
4934
5364
|
})))();
|
|
4935
5365
|
//#endregion
|
|
4936
|
-
export { config_default as _, init_modal$1 as a, axios as b, toast as c, defineStore as d, init_pinia as f, setLocale as g, init_i18n as h, showConfirm as i, _plugin_vue_export_helper_default as l, i18n as m, init_modal as n, modal_default$1 as o, getLocale as p, showAlert as r, init_toast$1 as s, getModalInstance as t, init__plugin_vue_export_helper as u, init_config as v, init_axios$1 as x, init_axios as y };
|
|
5366
|
+
export { subscribe as C, init_eventBus as S, config_default as _, init_modal$1 as a, axios as b, toast as c, defineStore as d, init_pinia as f, setLocale as g, init_i18n as h, showConfirm as i, _plugin_vue_export_helper_default as l, i18n as m, init_modal as n, modal_default$1 as o, getLocale as p, showAlert as r, init_toast$1 as s, getModalInstance as t, init__plugin_vue_export_helper as u, init_config as v, unsubscribe as w, init_axios$1 as x, init_axios as y };
|