mirror of
https://github.com/HugoAura/Seewo-HugoAura.git
synced 2026-06-23 09:14:28 +08:00
[Fix] Minor UX tweaks: freezeOverride components
This commit is contained in:
372
src/aura/init/main/ipcModules/fsIpcHandler.js
Normal file → Executable file
372
src/aura/init/main/ipcModules/fsIpcHandler.js
Normal file → Executable file
@@ -1,186 +1,186 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
const __SCOPE = "main";
|
const __SCOPE = "main";
|
||||||
|
|
||||||
const { exec } = require("child_process");
|
const { exec } = require("child_process");
|
||||||
const nodeHttp = require("http");
|
const nodeHttp = require("http");
|
||||||
const nodeHttps = require("https");
|
const nodeHttps = require("https");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const { genRandomHex } = require("../../../utils/crypto");
|
const { genRandomHex } = require("../../../utils/crypto");
|
||||||
|
|
||||||
const composableFunctions = {
|
const composableFunctions = {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
* @param {string} targetPath
|
* @param {string} targetPath
|
||||||
* @param {((arg: DownloadTask) => any)} progressCallback
|
* @param {((arg: DownloadTask) => any)} progressCallback
|
||||||
*/
|
*/
|
||||||
downloadFile: async (url, targetPath, progressCallback) => {
|
downloadFile: async (url, targetPath, progressCallback) => {
|
||||||
if (!progressCallback) return false;
|
if (!progressCallback) return false;
|
||||||
const taskId = genRandomHex();
|
const taskId = genRandomHex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {DownloadTask}
|
* @type {DownloadTask}
|
||||||
*/
|
*/
|
||||||
const failedTemplate = {
|
const failedTemplate = {
|
||||||
id: taskId,
|
id: taskId,
|
||||||
progress: 100,
|
progress: 100,
|
||||||
status: "failed",
|
status: "failed",
|
||||||
dlUrl: url,
|
dlUrl: url,
|
||||||
savePath: targetPath,
|
savePath: targetPath,
|
||||||
message: "",
|
message: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!url || !targetPath) {
|
if (!url || !targetPath) {
|
||||||
failedTemplate.message = "Invalid arg";
|
failedTemplate.message = "Invalid arg";
|
||||||
progressCallback(failedTemplate);
|
progressCallback(failedTemplate);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!fs.existsSync(path.dirname(targetPath))) {
|
if (!fs.existsSync(path.dirname(targetPath))) {
|
||||||
failedTemplate.message = "Path not exists";
|
failedTemplate.message = "Path not exists";
|
||||||
progressCallback(failedTemplate);
|
progressCallback(failedTemplate);
|
||||||
}
|
}
|
||||||
const httpModuleIns = url.startsWith("https") ? nodeHttps : nodeHttp;
|
const httpModuleIns = url.startsWith("https") ? nodeHttps : nodeHttp;
|
||||||
|
|
||||||
global.__HUGO_AURA__.fsTasks?.downloadTasks.set(taskId, {
|
global.__HUGO_AURA__.fsTasks?.downloadTasks.set(taskId, {
|
||||||
status: "waiting",
|
status: "waiting",
|
||||||
cancelReq: null,
|
cancelReq: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fsStream = fs.createWriteStream(targetPath);
|
const fsStream = fs.createWriteStream(targetPath);
|
||||||
|
|
||||||
const dlReq = httpModuleIns.get(url, (response) => {
|
const dlReq = httpModuleIns.get(url, (response) => {
|
||||||
if (response.statusCode !== 200) {
|
if (response.statusCode !== 200) {
|
||||||
fsStream.close();
|
fsStream.close();
|
||||||
failedTemplate.message = `Request error: HTTP ${response.statusCode}`;
|
failedTemplate.message = `Request error: HTTP ${response.statusCode}`;
|
||||||
progressCallback(failedTemplate);
|
progressCallback(failedTemplate);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentLength = response.headers["content-length"];
|
const contentLength = response.headers["content-length"];
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
const totalBytes = parseInt(contentLength, 10) || 0; // No error handling 😆
|
const totalBytes = parseInt(contentLength, 10) || 0; // No error handling 😆
|
||||||
let curRecvBytes = 0;
|
let curRecvBytes = 0;
|
||||||
|
|
||||||
global.__HUGO_AURA__.fsTasks?.downloadTasks.set(taskId, {
|
global.__HUGO_AURA__.fsTasks?.downloadTasks.set(taskId, {
|
||||||
status: "progressing",
|
status: "progressing",
|
||||||
cancelReq: () => {
|
cancelReq: () => {
|
||||||
dlReq.destroy();
|
dlReq.destroy();
|
||||||
fsStream.close();
|
fsStream.close();
|
||||||
fs.unlink(targetPath, () => {});
|
fs.unlink(targetPath, () => {});
|
||||||
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
||||||
progressCallback({
|
progressCallback({
|
||||||
id: taskId,
|
id: taskId,
|
||||||
progress: 100,
|
progress: 100,
|
||||||
curBytes: curRecvBytes,
|
curBytes: curRecvBytes,
|
||||||
totalBytes: totalBytes,
|
totalBytes: totalBytes,
|
||||||
status: "cancelled",
|
status: "cancelled",
|
||||||
dlUrl: url,
|
dlUrl: url,
|
||||||
savePath: targetPath,
|
savePath: targetPath,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
response.on("data", (chunk) => {
|
response.on("data", (chunk) => {
|
||||||
curRecvBytes += chunk.length;
|
curRecvBytes += chunk.length;
|
||||||
const curProgress =
|
const curProgress =
|
||||||
totalBytes > 0 ? (curRecvBytes / totalBytes) * 100 : 0;
|
totalBytes > 0 ? (curRecvBytes / totalBytes) * 100 : 0;
|
||||||
progressCallback({
|
progressCallback({
|
||||||
id: taskId,
|
id: taskId,
|
||||||
progress: curProgress.toFixed(2),
|
progress: curProgress.toFixed(2),
|
||||||
curBytes: curRecvBytes,
|
curBytes: curRecvBytes,
|
||||||
totalBytes: totalBytes,
|
totalBytes: totalBytes,
|
||||||
status: "progressing",
|
status: "progressing",
|
||||||
dlUrl: url,
|
dlUrl: url,
|
||||||
savePath: targetPath,
|
savePath: targetPath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
response.pipe(fsStream);
|
response.pipe(fsStream);
|
||||||
|
|
||||||
fsStream.on("finish", () => {
|
fsStream.on("finish", () => {
|
||||||
fsStream.close();
|
fsStream.close();
|
||||||
progressCallback({
|
progressCallback({
|
||||||
id: taskId,
|
id: taskId,
|
||||||
progress: (100).toFixed(2),
|
progress: (100).toFixed(2),
|
||||||
curBytes: curRecvBytes,
|
curBytes: curRecvBytes,
|
||||||
totalBytes: totalBytes,
|
totalBytes: totalBytes,
|
||||||
status: "done",
|
status: "done",
|
||||||
dlUrl: url,
|
dlUrl: url,
|
||||||
savePath: targetPath,
|
savePath: targetPath,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
dlReq.on("error", (e) => {
|
dlReq.on("error", (e) => {
|
||||||
fsStream.close();
|
fsStream.close();
|
||||||
fs.unlink(targetPath, () => {});
|
fs.unlink(targetPath, () => {});
|
||||||
failedTemplate.message =
|
failedTemplate.message =
|
||||||
"Request error: Unexpected error while downloading file";
|
"Request error: Unexpected error while downloading file";
|
||||||
failedTemplate.errorObj = e;
|
failedTemplate.errorObj = e;
|
||||||
progressCallback(failedTemplate);
|
progressCallback(failedTemplate);
|
||||||
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
global.__HUGO_AURA__.fsTasks?.downloadTasks.delete(taskId);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("electron").IpcMain} ipcMain
|
* @param {import("electron").IpcMain} ipcMain
|
||||||
*/
|
*/
|
||||||
const applyFsIpcHandler = (ipcMain) => {
|
const applyFsIpcHandler = (ipcMain) => {
|
||||||
const methodBase = "$aura.fs";
|
const methodBase = "$aura.fs";
|
||||||
|
|
||||||
global.__HUGO_AURA__.fsTasks = {
|
global.__HUGO_AURA__.fsTasks = {
|
||||||
downloadTasks: new Map(),
|
downloadTasks: new Map(),
|
||||||
};
|
};
|
||||||
|
|
||||||
ipcMain.handle(
|
ipcMain.handle(
|
||||||
`${methodBase}.dl.cancelDownloadTask`,
|
`${methodBase}.dl.cancelDownloadTask`,
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("electron").IpcMainInvokeEvent} _evt
|
* @param {import("electron").IpcMainInvokeEvent} _evt
|
||||||
* @param {{ targetTaskId: string }} arg
|
* @param {{ targetTaskId: string }} arg
|
||||||
* @returns {{ success: boolean, error: string | null }}
|
* @returns {{ success: boolean, error: string | null }}
|
||||||
*/
|
*/
|
||||||
(_evt, arg) => {
|
(_evt, arg) => {
|
||||||
if (!arg.targetTaskId) {
|
if (!arg.targetTaskId) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: "ARG_INVALID",
|
error: "ARG_INVALID",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!global.__HUGO_AURA__.fsTasks?.downloadTasks.has(arg.targetTaskId)) {
|
if (!global.__HUGO_AURA__.fsTasks?.downloadTasks.has(arg.targetTaskId)) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: "TASK_ID_NOT_FOUND",
|
error: "TASK_ID_NOT_FOUND",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskObj = global.__HUGO_AURA__.fsTasks.downloadTasks.get(
|
const taskObj = global.__HUGO_AURA__.fsTasks.downloadTasks.get(
|
||||||
arg.targetTaskId
|
arg.targetTaskId
|
||||||
);
|
);
|
||||||
if (!taskObj?.cancelReq) {
|
if (!taskObj?.cancelReq) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: "TASK_NOT_STARTED",
|
error: "TASK_NOT_STARTED",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
taskObj.cancelReq();
|
taskObj.cancelReq();
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
error: null,
|
error: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { fsComposables: composableFunctions, applyFsIpcHandler };
|
module.exports = { fsComposables: composableFunctions, applyFsIpcHandler };
|
||||||
|
|||||||
42
src/aura/types/main/ipc/fs.d.ts
vendored
Normal file → Executable file
42
src/aura/types/main/ipc/fs.d.ts
vendored
Normal file → Executable file
@@ -1,21 +1,21 @@
|
|||||||
type DownloadTaskID = string;
|
type DownloadTaskID = string;
|
||||||
type DownloadTaskStatus = "waiting" | "progressing" | "done" | "failed" | "cancelled";
|
type DownloadTaskStatus = "waiting" | "progressing" | "done" | "failed" | "cancelled";
|
||||||
|
|
||||||
interface DownloadTask {
|
interface DownloadTask {
|
||||||
id: DownloadTaskID;
|
id: DownloadTaskID;
|
||||||
progress: float;
|
progress: float;
|
||||||
curBytes?: number;
|
curBytes?: number;
|
||||||
totalBytes?: number;
|
totalBytes?: number;
|
||||||
status: DownloadTaskStatus;
|
status: DownloadTaskStatus;
|
||||||
dlUrl: string | null;
|
dlUrl: string | null;
|
||||||
savePath: string | null;
|
savePath: string | null;
|
||||||
message?: string;
|
message?: string;
|
||||||
errorObj?: Error;
|
errorObj?: Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FSTasks {
|
interface FSTasks {
|
||||||
downloadTasks: Map<
|
downloadTasks: Map<
|
||||||
DownloadTaskID,
|
DownloadTaskID,
|
||||||
{ status: DownloadTaskStatus; cancelReq: any }
|
{ status: DownloadTaskStatus; cancelReq: any }
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,13 @@ const showToast = (entry) => {
|
|||||||
showReloadToast();
|
showReloadToast();
|
||||||
} else if (entry.restart) {
|
} else if (entry.restart) {
|
||||||
showRelaunchToast();
|
showRelaunchToast();
|
||||||
} else if (entry.restartPLS) {
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
else if (entry.restartPLS) {
|
||||||
showRelaunchPLSToast();
|
showRelaunchPLSToast();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
const insertOrRemoveEl = (parent, child, isInsert = true) => {
|
const insertOrRemoveEl = (parent, child, isInsert = true) => {
|
||||||
|
|||||||
186
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/deviceSecurity.js
Normal file → Executable file
186
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/deviceSecurity.js
Normal file → Executable file
@@ -1,93 +1,93 @@
|
|||||||
const REQUIRE_BASE = ".";
|
const REQUIRE_BASE = ".";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
updatePlsConfigToRemote,
|
updatePlsConfigToRemote,
|
||||||
} = require(`${REQUIRE_BASE}/../../../../composables/plsConfigManager`);
|
} = require(`${REQUIRE_BASE}/../../../../composables/plsConfigManager`);
|
||||||
|
|
||||||
const composables = {};
|
const composables = {};
|
||||||
|
|
||||||
const deviceSecuritySettings = [
|
const deviceSecuritySettings = [
|
||||||
{
|
{
|
||||||
id: 0,
|
id: 0,
|
||||||
categoryName: "冰点管理",
|
categoryName: "冰点管理",
|
||||||
child: [
|
child: [
|
||||||
{
|
{
|
||||||
index: 0,
|
index: 0,
|
||||||
id: "enableFreezeInfoReportOverride",
|
id: "enableFreezeInfoReportOverride",
|
||||||
type: "switch",
|
type: "switch",
|
||||||
name: "启用冰冻状态篡改",
|
name: "启用冰冻状态篡改",
|
||||||
description: "篡改上报的冰冻数据, 可自定义集控端显示的状态",
|
description: "篡改上报的冰冻数据, 可自定义集控端显示的状态",
|
||||||
reactive: true,
|
reactive: true,
|
||||||
reactiveVal: ["root.ruleSettings"],
|
reactiveVal: ["root.ruleSettings"],
|
||||||
restart: false,
|
restart: false,
|
||||||
reload: false,
|
reload: false,
|
||||||
PLSRequired: true,
|
PLSRequired: true,
|
||||||
restartPLS: false,
|
restartPLS: false,
|
||||||
associateVal: null,
|
associateVal: null,
|
||||||
auraIf: () => true,
|
auraIf: () => true,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
valueGetter: () => {
|
valueGetter: () => {
|
||||||
if (!global.__HUGO_AURA__.plsRules) return "";
|
if (!global.__HUGO_AURA__.plsRules) return "";
|
||||||
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
||||||
.enable;
|
.enable;
|
||||||
},
|
},
|
||||||
callbackFn: (newVal) => {
|
callbackFn: (newVal) => {
|
||||||
if (typeof newVal !== "boolean") return;
|
if (typeof newVal !== "boolean") return;
|
||||||
|
|
||||||
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo.enable =
|
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo.enable =
|
||||||
newVal;
|
newVal;
|
||||||
updatePlsConfigToRemote(
|
updatePlsConfigToRemote(
|
||||||
"ruleSettings.client.security.uploadFreezeInfo.enable",
|
"ruleSettings.client.security.uploadFreezeInfo.enable",
|
||||||
newVal
|
newVal
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 1,
|
index: 1,
|
||||||
id: "freezeInfoReportOverrideType",
|
id: "freezeInfoReportOverrideType",
|
||||||
type: "radio",
|
type: "radio",
|
||||||
name: "篡改模式",
|
name: "篡改模式",
|
||||||
description: "选择一种篡改模式, 选中的磁盘范围会<b>被上报</b>为冻结 (不是实际行为)",
|
description: "选择一种篡改模式, 选中的磁盘范围会<b>被上报</b>为冻结 (不是实际行为)",
|
||||||
restart: false,
|
restart: false,
|
||||||
reload: false,
|
reload: false,
|
||||||
PLSRequired: true,
|
PLSRequired: true,
|
||||||
restartPLS: false,
|
restartPLS: false,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
reactiveVal: ["root.ruleSettings"],
|
reactiveVal: ["root.ruleSettings"],
|
||||||
associateVal: ["ruleSettings.client.security.uploadFreezeInfo.enable"],
|
associateVal: ["ruleSettings.client.security.uploadFreezeInfo.enable"],
|
||||||
auraIf: () => {
|
auraIf: () => {
|
||||||
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
||||||
.enable;
|
.enable;
|
||||||
},
|
},
|
||||||
defaultValue: "allFreeze",
|
defaultValue: "allFreeze",
|
||||||
templates: ["allFreeze", "systemOnly", "exceptSecondDisk"],
|
templates: ["allFreeze", "systemOnly", "exceptSecondDisk"],
|
||||||
templateLabels: ["全部冻结", "仅系统盘", "仅第二磁盘"],
|
templateLabels: ["全部冻结", "仅系统盘", "第二磁盘除外"],
|
||||||
valueGetter: () => {
|
valueGetter: () => {
|
||||||
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
return global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
||||||
.rewriteMode;
|
.rewriteMode;
|
||||||
},
|
},
|
||||||
callbackFn: (newVal) => {
|
callbackFn: (newVal) => {
|
||||||
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo.rewriteMode =
|
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo.rewriteMode =
|
||||||
newVal;
|
newVal;
|
||||||
updatePlsConfigToRemote(
|
updatePlsConfigToRemote(
|
||||||
"ruleSettings.client.security.uploadFreezeInfo.rewriteMode",
|
"ruleSettings.client.security.uploadFreezeInfo.rewriteMode",
|
||||||
newVal
|
newVal
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 2,
|
index: 2,
|
||||||
id: "freezeInfoReportOverridePreview",
|
id: "freezeInfoReportOverridePreview",
|
||||||
type: "preview",
|
type: "preview",
|
||||||
loaderTarget:
|
loaderTarget:
|
||||||
"Aura.UI.Assistant.Config.BehaviourCtrl.DeviceSecurity.FreezeOverridePreview",
|
"Aura.UI.Assistant.Config.BehaviourCtrl.DeviceSecurity.FreezeOverridePreview",
|
||||||
associateVal: ["ruleSettings.client.security.uploadFreezeInfo"],
|
associateVal: ["ruleSettings.client.security.uploadFreezeInfo"],
|
||||||
listenerType: "pls"
|
listenerType: "pls"
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = { deviceSecuritySettings };
|
module.exports = { deviceSecuritySettings };
|
||||||
|
|||||||
204
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.css
Normal file → Executable file
204
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.css
Normal file → Executable file
@@ -1,100 +1,104 @@
|
|||||||
.acs-bc-dsc-fop-container {
|
.acs-bc-dsc-fop-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-please-wait,
|
.acs-bc-dsc-fop-please-wait,
|
||||||
.acs-bc-dsc-fop-on-req-error,
|
.acs-bc-dsc-fop-on-req-error,
|
||||||
.acs-bc-dsc-fop-on-not-bind {
|
.acs-bc-dsc-fop-on-not-bind {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-please-wait svg,
|
.acs-bc-dsc-fop-please-wait svg,
|
||||||
.acs-bc-dsc-fop-on-req-error svg,
|
.acs-bc-dsc-fop-on-req-error svg,
|
||||||
.acs-bc-dsc-fop-on-not-bind svg {
|
.acs-bc-dsc-fop-on-not-bind svg {
|
||||||
width: 18px;
|
width: 18px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-please-wait p,
|
.acs-bc-dsc-fop-please-wait p,
|
||||||
.acs-bc-dsc-fop-on-req-error p,
|
.acs-bc-dsc-fop-on-req-error p,
|
||||||
.acs-bc-dsc-fop-on-not-bind p {
|
.acs-bc-dsc-fop-on-not-bind p {
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-please-wait[auraIf="false"],
|
.acs-bc-dsc-fop-please-wait[auraIf="false"],
|
||||||
.acs-bc-dsc-fop-on-req-error[auraIf="false"],
|
.acs-bc-dsc-fop-on-req-error[auraIf="false"],
|
||||||
.acs-bc-dsc-fop-on-not-bind[auraIf="false"],
|
.acs-bc-dsc-fop-on-not-bind[auraIf="false"],
|
||||||
.acs-bc-dsc-fop-main[auraIf="false"] {
|
.acs-bc-dsc-fop-main[auraIf="false"] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-main {
|
.acs-bc-dsc-fop-main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-main .disks-container {
|
.acs-bc-dsc-fop-main .disks-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-disk-el {
|
.acs-bc-dsc-fop-disk-el {
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
border: 0.5px solid rgba(0, 0, 0, 0.25);
|
border: 0.5px solid rgba(0, 0, 0, 0.25);
|
||||||
margin-left: 0.375rem;
|
margin-left: 0.375rem;
|
||||||
margin-right: 0.375rem;
|
margin-right: 0.375rem;
|
||||||
|
|
||||||
/* transition: all 0.5s; */
|
transition: all 0.5s;
|
||||||
/* 没有用, 因为元素全被重新创建了 */
|
/* 没有用, 因为元素全被重新创建了 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-disk-el.active {
|
.acs-bc-dsc-fop-disk-el.active {
|
||||||
background-color: #1d70f2;
|
background-color: #1d70f2;
|
||||||
color: white;
|
color: white;
|
||||||
border: 0.5px solid rgba(0, 0, 0, 0.125);
|
border: 0.5px solid rgba(0, 0, 0, 0.125);
|
||||||
}
|
}
|
||||||
|
|
||||||
.acs-bc-dsc-fop-main-hint-area {
|
.acs-bc-dsc-fop-disk-el.active:hover {
|
||||||
display: flex;
|
background-color: #4e8df2;
|
||||||
flex-direction: row;
|
}
|
||||||
margin-top: 1rem;
|
|
||||||
margin-bottom: -0.25rem;
|
.acs-bc-dsc-fop-main-hint-area {
|
||||||
}
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
.acs-bc-dsc-fop-main-hint-area svg {
|
margin-top: 1rem;
|
||||||
width: 18px;
|
margin-bottom: -0.25rem;
|
||||||
height: 18px;
|
}
|
||||||
}
|
|
||||||
|
.acs-bc-dsc-fop-main-hint-area svg {
|
||||||
.acs-bc-dsc-fop-main-hint-area div {
|
width: 18px;
|
||||||
display: flex;
|
height: 18px;
|
||||||
flex-direction: row;
|
}
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
.acs-bc-dsc-fop-main-hint-area div {
|
||||||
}
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
.acs-bc-dsc-fop-main-hint-area p {
|
justify-content: center;
|
||||||
margin-top: -1px;
|
align-items: center;
|
||||||
margin-left: 0.25rem;
|
}
|
||||||
}
|
|
||||||
|
.acs-bc-dsc-fop-main-hint-area p {
|
||||||
.acs-bc-dsc-fop-main-hint-area .acs-bc-dsc-fop-main-hint-freeze {
|
margin-top: -1px;
|
||||||
margin-right: 0.5rem;
|
margin-left: 0.25rem;
|
||||||
color: #1d70f2;
|
}
|
||||||
}
|
|
||||||
|
.acs-bc-dsc-fop-main-hint-area .acs-bc-dsc-fop-main-hint-freeze {
|
||||||
.acs-bc-dsc-fop-main-hint-area .acs-bc-dsc-fop-main-hint-unfreeze {
|
margin-right: 0.5rem;
|
||||||
margin-left: 0.5rem;
|
color: #1d70f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.acs-bc-dsc-fop-main-hint-area .acs-bc-dsc-fop-main-hint-unfreeze {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
|||||||
182
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.html
Normal file → Executable file
182
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.html
Normal file → Executable file
@@ -1,91 +1,91 @@
|
|||||||
<div class="acs-bc-dsc-fop-container">
|
<div class="acs-bc-dsc-fop-container">
|
||||||
<div class="acs-bc-dsc-fop-please-wait" auraIf="true">
|
<div class="acs-bc-dsc-fop-please-wait" auraIf="true">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
viewBox="0 0 32 32"
|
viewBox="0 0 32 32"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M16 30a14 14 0 1 1 14-14a14 14 0 0 1-14 14m0-26a12 12 0 1 0 12 12A12 12 0 0 0 16 4"
|
d="M16 30a14 14 0 1 1 14-14a14 14 0 0 1-14 14m0-26a12 12 0 1 0 12 12A12 12 0 0 0 16 4"
|
||||||
/>
|
/>
|
||||||
<path fill="currentColor" d="M20.59 22L15 16.41V7h2v8.58l5 5.01z" />
|
<path fill="currentColor" d="M20.59 22L15 16.41V7h2v8.58l5 5.01z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<p>请稍候...</p>
|
<p>请稍候...</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="acs-bc-dsc-fop-on-req-error" auraIf="false">
|
<div class="acs-bc-dsc-fop-on-req-error" auraIf="false">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
viewBox="0 0 32 32"
|
viewBox="0 0 32 32"
|
||||||
>
|
>
|
||||||
<path fill="currentColor" d="M9 10.555L10.555 9L23 21.444L21.444 23z" />
|
<path fill="currentColor" d="M9 10.555L10.555 9L23 21.444L21.444 23z" />
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M16 2A13.914 13.914 0 0 0 2 16a13.914 13.914 0 0 0 14 14a13.914 13.914 0 0 0 14-14A13.914 13.914 0 0 0 16 2m0 26a12 12 0 1 1 12-12a12.035 12.035 0 0 1-12 12"
|
d="M16 2A13.914 13.914 0 0 0 2 16a13.914 13.914 0 0 0 14 14a13.914 13.914 0 0 0 14-14A13.914 13.914 0 0 0 16 2m0 26a12 12 0 1 1 12-12a12.035 12.035 0 0 1-12 12"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<p>获取磁盘信息失败: <font id="acsBcDscFopOnReqErrorDetail"></font></p>
|
<p>获取磁盘信息失败: <font id="acsBcDscFopOnReqErrorDetail"></font></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="acs-bc-dsc-fop-on-not-bind" auraIf="false">
|
<div class="acs-bc-dsc-fop-on-not-bind" auraIf="false">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
viewBox="0 0 32 32"
|
viewBox="0 0 32 32"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M31.324 11.261A14.27 14.27 0 0 0 22.25 8H22v2h.25c2.608 0 5.155.837 7.246 2.372a12.18 12.18 0 0 1-7.548 7.036q.052-.605.052-1.22C22 10.366 15.635 4 7.812 4c-.929 0-1.856.09-2.757.268l-.657.13l-.13.657A14.3 14.3 0 0 0 4 7.812c0 4.124 1.78 7.831 4.598 10.426A14.2 14.2 0 0 0 8 22.254l.001.001a14.27 14.27 0 0 0 3.261 9.07l.439.53l.652-.22a14.18 14.18 0 0 0 9.237-10.046a14.18 14.18 0 0 0 10.045-9.237l.22-.652zM12.372 29.496A12.27 12.27 0 0 1 10 22.251c0-.912.113-1.796.303-2.652a14.1 14.1 0 0 0 9.105 2.349a12.18 12.18 0 0 1-7.036 7.548m7.51-9.613q-.833.116-1.694.117c-2.715 0-5.218-.904-7.247-2.412a12.4 12.4 0 0 1 4.048-5.204l-1.28-1.53A14.3 14.3 0 0 0 9.37 16.2A12.14 12.14 0 0 1 6.117 6.117A12 12 0 0 1 7.812 6C14.532 6 20 11.468 20 18.188q0 .862-.117 1.695Z"
|
d="M31.324 11.261A14.27 14.27 0 0 0 22.25 8H22v2h.25c2.608 0 5.155.837 7.246 2.372a12.18 12.18 0 0 1-7.548 7.036q.052-.605.052-1.22C22 10.366 15.635 4 7.812 4c-.929 0-1.856.09-2.757.268l-.657.13l-.13.657A14.3 14.3 0 0 0 4 7.812c0 4.124 1.78 7.831 4.598 10.426A14.2 14.2 0 0 0 8 22.254l.001.001a14.27 14.27 0 0 0 3.261 9.07l.439.53l.652-.22a14.18 14.18 0 0 0 9.237-10.046a14.18 14.18 0 0 0 10.045-9.237l.22-.652zM12.372 29.496A12.27 12.27 0 0 1 10 22.251c0-.912.113-1.796.303-2.652a14.1 14.1 0 0 0 9.105 2.349a12.18 12.18 0 0 1-7.036 7.548m7.51-9.613q-.833.116-1.694.117c-2.715 0-5.218-.904-7.247-2.412a12.4 12.4 0 0 1 4.048-5.204l-1.28-1.53A14.3 14.3 0 0 0 9.37 16.2A12.14 12.14 0 0 1 6.117 6.117A12 12 0 0 1 7.812 6C14.532 6 20 11.468 20 18.188q0 .862-.117 1.695Z"
|
||||||
/>
|
/>
|
||||||
<circle cx="20" cy="2" r="2" fill="currentColor" />
|
<circle cx="20" cy="2" r="2" fill="currentColor" />
|
||||||
<circle cx="27" cy="26" r="2" fill="currentColor" />
|
<circle cx="27" cy="26" r="2" fill="currentColor" />
|
||||||
<circle cx="2" cy="20" r="2" fill="currentColor" />
|
<circle cx="2" cy="20" r="2" fill="currentColor" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<p>当前设备暂未绑定学校, 无法查询冰点信息</p>
|
<p>当前设备暂未绑定学校, 无法查询冰点信息</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="acs-bc-dsc-fop-main" auraIf="false">
|
<div class="acs-bc-dsc-fop-main" auraIf="false">
|
||||||
<div class="disks-container">
|
<div class="disks-container">
|
||||||
<p class="acs-bc-dsc-fop-disk-el">C 盘</p>
|
<p class="acs-bc-dsc-fop-disk-el">C 盘</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="acs-bc-dsc-fop-main-hint-area">
|
<div class="acs-bc-dsc-fop-main-hint-area">
|
||||||
<div class="acs-bc-dsc-fop-main-hint-freeze">
|
<div class="acs-bc-dsc-fop-main-hint-freeze">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
viewBox="0 0 32 32"
|
viewBox="0 0 32 32"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M21.415 12H28v-2h-4.585L28 5.415L26.586 4L22 8.587V4h-2v6.587L18.587 12H17V8h-2v4h-1.587L12 10.587V4h-2v4.587L5.414 4L4 5.415L8.585 10H4v2h6.585L12 13.415V15H8v2h4v1.587L10.587 20H4v2h4.587L4 26.586l1.414 1.415L10 23.415V28h2v-6.585L13.415 20H15v4h2v-4h1.585L20 21.415V28h2v-4.585l4.585 4.586L28 26.586L23.413 22H28v-2h-6.587L20 18.587V17h4v-2h-4v-1.585ZM18 18h-4v-4h4Z"
|
d="M21.415 12H28v-2h-4.585L28 5.415L26.586 4L22 8.587V4h-2v6.587L18.587 12H17V8h-2v4h-1.587L12 10.587V4h-2v4.587L5.414 4L4 5.415L8.585 10H4v2h6.585L12 13.415V15H8v2h4v1.587L10.587 20H4v2h4.587L4 26.586l1.414 1.415L10 23.415V28h2v-6.585L13.415 20H15v4h2v-4h1.585L20 21.415V28h2v-4.585l4.585 4.586L28 26.586L23.413 22H28v-2h-6.587L20 18.587V17h4v-2h-4v-1.585ZM18 18h-4v-4h4Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<p>已冻结</p>
|
<p>已冻结</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="acs-bc-dsc-fop-main-hint-unfreeze">
|
<div class="acs-bc-dsc-fop-main-hint-unfreeze">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
viewBox="0 0 32 32"
|
viewBox="0 0 32 32"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6M5.394 6.813L6.81 5.399l3.505 3.506L8.9 10.319zM2 15.005h5v2H2zm3.394 10.193L8.9 21.692l1.414 1.414l-3.505 3.506zM15 25.005h2v5h-2zm6.687-1.9l1.414-1.414l3.506 3.506l-1.414 1.414zm3.313-8.1h5v2h-5zm-3.313-6.101l3.506-3.506l1.414 1.414l-3.506 3.506zM15 2.005h2v5h-2z"
|
d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6M5.394 6.813L6.81 5.399l3.505 3.506L8.9 10.319zM2 15.005h5v2H2zm3.394 10.193L8.9 21.692l1.414 1.414l-3.505 3.506zM15 25.005h2v5h-2zm6.687-1.9l1.414-1.414l3.506 3.506l-1.414 1.414zm3.313-8.1h5v2h-5zm-3.313-6.101l3.506-3.506l1.414 1.414l-3.506 3.506zM15 2.005h2v5h-2z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<p>未冻结</p>
|
<p>未冻结</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
312
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.js
Normal file → Executable file
312
src/aura/ui/pages/configSubPages/behaviourCtrl/settings/previews/freezeOverridePreview/freezeOverridePreview.js
Normal file → Executable file
@@ -1,156 +1,156 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
const REQUIRE_BASE = "../..";
|
const REQUIRE_BASE = "../..";
|
||||||
const { genRandomHex } = require(`${REQUIRE_BASE}/aura/utils/crypto`);
|
const { genRandomHex } = require(`${REQUIRE_BASE}/aura/utils/crypto`);
|
||||||
|
|
||||||
const composables = {
|
const composables = {
|
||||||
getAndUpdateDiskInfo: async (curConfig) => {
|
getAndUpdateDiskInfo: async (curConfig) => {
|
||||||
const progressingEl = document.getElementsByClassName(
|
const progressingEl = document.getElementsByClassName(
|
||||||
"acs-bc-dsc-fop-please-wait"
|
"acs-bc-dsc-fop-please-wait"
|
||||||
)[0];
|
)[0];
|
||||||
const onErrorEl = document.getElementsByClassName(
|
const onErrorEl = document.getElementsByClassName(
|
||||||
"acs-bc-dsc-fop-on-req-error"
|
"acs-bc-dsc-fop-on-req-error"
|
||||||
)[0];
|
)[0];
|
||||||
const onNotBindEl = document.getElementsByClassName(
|
const onNotBindEl = document.getElementsByClassName(
|
||||||
"acs-bc-dsc-fop-on-not-bind"
|
"acs-bc-dsc-fop-on-not-bind"
|
||||||
)[0];
|
)[0];
|
||||||
const mainEl = document.getElementsByClassName("acs-bc-dsc-fop-main")[0];
|
const mainEl = document.getElementsByClassName("acs-bc-dsc-fop-main")[0];
|
||||||
const diskContainerEl =
|
const diskContainerEl =
|
||||||
document.getElementsByClassName("disks-container")[0];
|
document.getElementsByClassName("disks-container")[0];
|
||||||
|
|
||||||
const seewoProxyPort = window._ACCEPT_DATA.data.ports.SeewoProxyHTTP;
|
const seewoProxyPort = window._ACCEPT_DATA.data.ports.SeewoProxyHTTP;
|
||||||
|
|
||||||
const reqPromise = new Promise((resolve) => {
|
const reqPromise = new Promise((resolve) => {
|
||||||
fetch(
|
fetch(
|
||||||
`https://127.0.0.1:${seewoProxyPort}/forward/freeze/api/v1/get_disk_data`,
|
`https://127.0.0.1:${seewoProxyPort}/forward/freeze/api/v1/get_disk_data`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
accept: "application/json, text/plain, */*",
|
accept: "application/json, text/plain, */*",
|
||||||
"X-Auth-Traceid": genRandomHex(),
|
"X-Auth-Traceid": genRandomHex(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
const parsedData = await response.json();
|
const parsedData = await response.json();
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
success: true,
|
success: true,
|
||||||
data: parsedData,
|
data: parsedData,
|
||||||
status: response.status,
|
status: response.status,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
resolve({ success: false, data: null, errorObj: e });
|
resolve({ success: false, data: null, errorObj: e });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const responseInfo = await reqPromise;
|
const responseInfo = await reqPromise;
|
||||||
|
|
||||||
progressingEl.setAttribute("auraIf", "false");
|
progressingEl.setAttribute("auraIf", "false");
|
||||||
|
|
||||||
if (!responseInfo.success) {
|
if (!responseInfo.success) {
|
||||||
onNotBindEl.setAttribute("auraIf", "false");
|
onNotBindEl.setAttribute("auraIf", "false");
|
||||||
mainEl.setAttribute("auraIf", "false");
|
mainEl.setAttribute("auraIf", "false");
|
||||||
onErrorEl.setAttribute("auraIf", "true");
|
onErrorEl.setAttribute("auraIf", "true");
|
||||||
const detailEl = document.getElementById("acsBcDscFopOnReqErrorDetail");
|
const detailEl = document.getElementById("acsBcDscFopOnReqErrorDetail");
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
detailEl.textContent = responseInfo.errorObj;
|
detailEl.textContent = responseInfo.errorObj;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseInfo.status !== 200) {
|
if (responseInfo.status !== 200) {
|
||||||
onErrorEl.setAttribute("auraIf", "false");
|
onErrorEl.setAttribute("auraIf", "false");
|
||||||
mainEl.setAttribute("auraIf", "false");
|
mainEl.setAttribute("auraIf", "false");
|
||||||
onNotBindEl.setAttribute("auraIf", "true");
|
onNotBindEl.setAttribute("auraIf", "true");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
diskContainerEl.innerHTML = ``;
|
diskContainerEl.innerHTML = ``;
|
||||||
|
|
||||||
const curDisks = [];
|
const curDisks = [];
|
||||||
for (const disk of responseInfo.data.data[0].disksData) {
|
for (const disk of responseInfo.data.data[0].disksData) {
|
||||||
curDisks.push({ name: disk.diskName, status: disk.protectedStatus });
|
curDisks.push({ name: disk.diskName, status: disk.protectedStatus });
|
||||||
}
|
}
|
||||||
|
|
||||||
const diskElTemplate = document.createElement("p");
|
const diskElTemplate = document.createElement("p");
|
||||||
diskElTemplate.classList.add("acs-bc-dsc-fop-disk-el");
|
diskElTemplate.classList.add("acs-bc-dsc-fop-disk-el");
|
||||||
if (!curConfig.enable) {
|
if (!curConfig.enable) {
|
||||||
for (const disk of curDisks) {
|
for (const disk of curDisks) {
|
||||||
const curDiskEl = diskElTemplate.cloneNode();
|
const curDiskEl = diskElTemplate.cloneNode();
|
||||||
if (disk.status !== 0) {
|
if (disk.status !== 0) {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
curDiskEl.classList.add("active");
|
curDiskEl.classList.add("active");
|
||||||
}
|
}
|
||||||
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
||||||
diskContainerEl.appendChild(curDiskEl);
|
diskContainerEl.appendChild(curDiskEl);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (curConfig.rewriteMode) {
|
switch (curConfig.rewriteMode) {
|
||||||
case "allFreeze":
|
case "allFreeze":
|
||||||
{
|
{
|
||||||
for (const disk of curDisks) {
|
for (const disk of curDisks) {
|
||||||
const curDiskEl = diskElTemplate.cloneNode();
|
const curDiskEl = diskElTemplate.cloneNode();
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
curDiskEl.classList.add("active");
|
curDiskEl.classList.add("active");
|
||||||
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
||||||
diskContainerEl.appendChild(curDiskEl);
|
diskContainerEl.appendChild(curDiskEl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "systemOnly":
|
case "systemOnly":
|
||||||
{
|
{
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
for (const disk of curDisks) {
|
for (const disk of curDisks) {
|
||||||
const curDiskEl = diskElTemplate.cloneNode();
|
const curDiskEl = diskElTemplate.cloneNode();
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (idx === 0) curDiskEl.classList.add("active");
|
if (idx === 0) curDiskEl.classList.add("active");
|
||||||
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
||||||
diskContainerEl.appendChild(curDiskEl);
|
diskContainerEl.appendChild(curDiskEl);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "exceptSecondDisk":
|
case "exceptSecondDisk":
|
||||||
{
|
{
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
for (const disk of curDisks) {
|
for (const disk of curDisks) {
|
||||||
const curDiskEl = diskElTemplate.cloneNode();
|
const curDiskEl = diskElTemplate.cloneNode();
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (idx === 0) curDiskEl.classList.add("active");
|
if (idx === 0) curDiskEl.classList.add("active");
|
||||||
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
curDiskEl.textContent = `${disk.name.toUpperCase()} 盘`;
|
||||||
diskContainerEl.appendChild(curDiskEl);
|
diskContainerEl.appendChild(curDiskEl);
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onErrorEl.setAttribute("auraIf", "false");
|
onErrorEl.setAttribute("auraIf", "false");
|
||||||
onNotBindEl.setAttribute("auraIf", "false");
|
onNotBindEl.setAttribute("auraIf", "false");
|
||||||
mainEl.setAttribute("auraIf", "true");
|
mainEl.setAttribute("auraIf", "true");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const onMounted = () => {
|
const onMounted = () => {
|
||||||
const rootEl = document.getElementsByClassName(
|
const rootEl = document.getElementsByClassName(
|
||||||
"acs-bc-dsc-fop-container"
|
"acs-bc-dsc-fop-container"
|
||||||
)[0];
|
)[0];
|
||||||
|
|
||||||
const eventListener = (_event) => {
|
const eventListener = (_event) => {
|
||||||
if (!global.__HUGO_AURA__.plsRules) return;
|
if (!global.__HUGO_AURA__.plsRules) return;
|
||||||
composables.getAndUpdateDiskInfo(
|
composables.getAndUpdateDiskInfo(
|
||||||
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
global.__HUGO_AURA__.plsRules.client.security.uploadFreezeInfo
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
rootEl.addEventListener("onAssociateValueUpdated", eventListener);
|
rootEl.addEventListener("onAssociateValueUpdated", eventListener);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
eventListener();
|
eventListener();
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted();
|
onMounted();
|
||||||
})();
|
})();
|
||||||
|
|||||||
28
src/aura/utils/crypto.js
Normal file → Executable file
28
src/aura/utils/crypto.js
Normal file → Executable file
@@ -1,14 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
const genRandomHex = () => {
|
const genRandomHex = () => {
|
||||||
let result = "";
|
let result = "";
|
||||||
for (let i = 0; i < 8; i++) {
|
for (let i = 0; i < 8; i++) {
|
||||||
const randomNum = Math.floor(Math.random() * 0x10000);
|
const randomNum = Math.floor(Math.random() * 0x10000);
|
||||||
result += randomNum.toString(16).padStart(4, "0");
|
result += randomNum.toString(16).padStart(4, "0");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { genRandomHex };
|
module.exports = { genRandomHex };
|
||||||
|
|||||||
Reference in New Issue
Block a user