增加GetHttpInterfaceVersion来校验兼容性

This commit is contained in:
fangxiang 2023-02-20 18:57:23 +08:00
parent 00c4056b5d
commit ee37d680b2
5 changed files with 58 additions and 55 deletions

View File

@ -43,7 +43,6 @@ module.exports = configure(function (ctx) {
vueRouterMode: "hash", // available values: 'hash', 'history'
// transpile: false,
// Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true.
@ -52,7 +51,7 @@ module.exports = configure(function (ctx) {
// rtl: true, // https://v2.quasar.dev/options/rtl-support
// preloadChunks: true,
// showProgress: false,
// gzip: true,
gzip: true,
// analyze: true,
// Options below are automatically set depending on the env, set them if you want to override

View File

@ -15,8 +15,8 @@ import GlobalData from "./common/GlobalData";
import { EProductNames } from "./entities/ProductNames";
import { api } from "./boot/axios";
import { WuJieInitializer } from "./common/WuJieInitializer";
import { isNumber } from "zrender/lib/core/util";
import ClientConnection from "./common/ClientConnection";
import { Common } from "./common/Common";
export default defineComponent({
name: "App",
@ -288,43 +288,35 @@ export default defineComponent({
EventBus.getInstance().on(
EventNamesDefine.CurrentConnectConnected,
(connection: ClientConnection) => {
let final_url = "/get_interface_version";
if (connection) {
try {
const current_http_url = new URL(window.location.toString());
const current_ws_url = new URL(connection.url);
current_http_url.hostname = current_ws_url.hostname;
current_http_url.pathname = "/get_interface_version";
current_http_url.port = "80";
final_url = current_http_url.toString();
} catch {}
}
async (connection: ClientConnection) => {
const show_version_tip = () =>
$q.dialog({
persistent: true,
title: $t.t("Version Mismatch !"),
message: $t.t(
"Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Upload Function Cannot Be Used !"
"Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Function Cannot Be Used !"
),
});
interface _GetInterfaceVersionResponse {
version: number;
}
api
.get(final_url)
.then((data) => {
if (data) {
const verson = data.data as _GetInterfaceVersionResponse;
if (verson && verson.version == 2) {
return;
if (connection) {
let count = 0;
while (
connection &&
!connection.is_login &&
count < (1000 * 10) / 100 /* 10 S */
) {
await Common.waitFor(100);
}
if (count < (1000 * 10) / 100) {
try {
const response = await connection.getHttpInterfaceVersion();
if (!response || response.version != 2) {
show_version_tip();
}
} catch (e) {
show_version_tip();
}
show_version_tip();
})
.catch(() => {
show_version_tip();
});
}
}
}
);

View File

@ -1343,6 +1343,12 @@ export default class ClientConnection {
);
}
public async getHttpInterfaceVersion() {
return await this.doRpc<Protocol.RpcGetHttpInterfaceVersionResponseEntity>(
new Protocol.RpcGetHttpInterfaceVersionRequestEntity()
);
}
public async setJointActionEquipment(
entity: JointActionEquipmentTableEntity
) {
@ -1551,19 +1557,13 @@ export default class ClientConnection {
);
}
public async SetProjectorResolution(
width: number,
height: number
) {
public async SetProjectorResolution(width: number, height: number) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.SetProjectorResolutionRequestEntity(width, height)
);
}
public async SetProjectorLayout(
row: number,
column: number
) {
public async SetProjectorLayout(row: number, column: number) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.SetProjectorResolutionRequestEntity(row, column)
);

View File

@ -570,6 +570,9 @@ export namespace Protocol {
public static get kRpcCheckModeIndex() {
return Commands.PROTOCOL_PREFIX + "RpcCheckModeIndex";
}
public static get kRpcGetHttpInterfaceVersion() {
return Commands.PROTOCOL_PREFIX + "RpcGetHttpInterfaceVersion";
}
static _all_commands = new Set([
Commands.kUnKnowCommand,
Commands.kSearchDevice,
@ -716,6 +719,7 @@ export namespace Protocol {
Commands.kRpcFileManagerDelete,
Commands.kRpcFileManagerCreateDirectory,
Commands.kRpcCheckModeIndex,
Commands.kRpcGetHttpInterfaceVersion,
]);
public static get AllCommands() {
return this._all_commands;
@ -3682,11 +3686,7 @@ export namespace Protocol {
}
export class SetProjectorResolutionRequestEntity extends PacketEntity {
constructor(
width: number,
height: number,
rpc_id = 0
) {
constructor(width: number, height: number, rpc_id = 0) {
super();
super.command = Commands.kSetProjectorResolution;
super.flag = PacketEntity.FLAG_REQUEST;
@ -3701,11 +3701,7 @@ export namespace Protocol {
}
export class SetProjectorLayoutRequestEntity extends PacketEntity {
constructor(
row: number,
column: number,
rpc_id = 0
) {
constructor(row: number, column: number, rpc_id = 0) {
super();
super.command = Commands.kSetProjectorResolution;
super.flag = PacketEntity.FLAG_REQUEST;
@ -3827,4 +3823,20 @@ export namespace Protocol {
}
success = false;
}
export class RpcGetHttpInterfaceVersionRequestEntity extends PacketEntity {
constructor(rpc_id = 0) {
super();
super.command = Commands.kRpcGetHttpInterfaceVersion;
super.flag = PacketEntity.FLAG_REQUEST;
}
timestamp = 0;
}
export class RpcGetHttpInterfaceVersionResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
version = 0;
}
}

View File

@ -736,8 +736,8 @@ export default {
"确定删除你将失去现在调整的数据",
"Please enter the points you need to add": "请输入你所需要添加的点数",
"Whether to add control points": "是否添加控制点",
"Reset all program control points":"重置全部方案控制点",
"Reset the current program control point":"重置当前方案控制点",
"Reset all program control points": "重置全部方案控制点",
"Reset the current program control point": "重置当前方案控制点",
"device verify key": "设备校验码",
"use wss": "使用Wss",
"server address": "服务器地址",
@ -756,9 +756,9 @@ export default {
"export magic": "导出",
"raster graph": "栅格图",
"the folder name cannot start with a '.'": "文件夹名称不能以“.” 开头",
"change resolution":"更改分辨率",
"Loading please wait":"加载中 请稍等"
"change resolution": "更改分辨率",
"Loading please wait": "加载中 请稍等",
"Version Mismatch !": "版本不匹配!",
"Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Upload Function Cannot Be Used !":
"版本不匹配!请重新升级软件!否则文件上传功能无法正常使用!",
"Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Function Cannot Be Used !":
"版本不匹配!请重新升级软件!否则文件功能无法正常使用!",
};