@ysgroup/core 0.1.13 → 0.1.15
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 +1 -1
- package/src/rest.ts +26 -1
- package/src/store.ts +1 -6
package/package.json
CHANGED
package/src/rest.ts
CHANGED
|
@@ -229,6 +229,29 @@ export class YsRest {
|
|
|
229
229
|
portalApps() {
|
|
230
230
|
return this.request<Record<string, unknown>[]>("GET", "/api/portal/apps");
|
|
231
231
|
}
|
|
232
|
+
uploadAppLogo(appId: string, file: File) {
|
|
233
|
+
return this.upload<{
|
|
234
|
+
file_id: string;
|
|
235
|
+
usage: string;
|
|
236
|
+
size: number;
|
|
237
|
+
has_logo: boolean;
|
|
238
|
+
}>(`/api/apps/${appId}/logo`, file);
|
|
239
|
+
}
|
|
240
|
+
async downloadAppLogo(appId: string) {
|
|
241
|
+
if (this.rpcCall) {
|
|
242
|
+
const result = await this.request<{
|
|
243
|
+
base64: string;
|
|
244
|
+
content_type: string;
|
|
245
|
+
}>("GET", `/api/apps/${appId}/logo`);
|
|
246
|
+
return base64ToBlob(result.base64, result.content_type);
|
|
247
|
+
}
|
|
248
|
+
return fetch(`${this.baseUrl}/api/apps/${appId}/logo`, {
|
|
249
|
+
headers: { Authorization: `Bearer ${this.getToken()}` },
|
|
250
|
+
}).then(async (resp) => {
|
|
251
|
+
if (!resp.ok) throw new YsRestError(resp.status, await resp.text());
|
|
252
|
+
return resp.blob();
|
|
253
|
+
});
|
|
254
|
+
}
|
|
232
255
|
async createUser(body: Record<string, unknown>) {
|
|
233
256
|
const password =
|
|
234
257
|
typeof body.password === "string"
|
|
@@ -402,11 +425,13 @@ function base64ToBlob(value: string, contentType: string): Blob {
|
|
|
402
425
|
}
|
|
403
426
|
|
|
404
427
|
export interface TopologyNode {
|
|
428
|
+
_id?: string;
|
|
405
429
|
name: string;
|
|
406
430
|
title: string;
|
|
407
431
|
kind: "service" | "link";
|
|
408
432
|
status: string;
|
|
409
|
-
|
|
433
|
+
has_logo?: boolean;
|
|
434
|
+
logo?: string;
|
|
410
435
|
online: boolean;
|
|
411
436
|
last_heartbeat_at: number;
|
|
412
437
|
authorization_version: number;
|
package/src/store.ts
CHANGED
|
@@ -101,17 +101,12 @@ export const useYsStore = defineStore("ys", () => {
|
|
|
101
101
|
return "登录状态已失效,请重新登录。";
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
async function login(
|
|
105
|
-
username: string,
|
|
106
|
-
password: string,
|
|
107
|
-
otp = "",
|
|
108
|
-
): Promise<void> {
|
|
104
|
+
async function login(username: string, password: string): Promise<void> {
|
|
109
105
|
if (!ws) throw new Error("未连接");
|
|
110
106
|
sessionMessage.value = "";
|
|
111
107
|
const result = (await ws.call("login", {
|
|
112
108
|
username,
|
|
113
109
|
password: await sealLoginPassword(password),
|
|
114
|
-
otp,
|
|
115
110
|
app_name: appName.value,
|
|
116
111
|
user_agent: navigator.userAgent,
|
|
117
112
|
})) as LoginResult;
|