增加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' vueRouterMode: "hash", // available values: 'hash', 'history'
// transpile: false, // transpile: false,
// Add dependencies for transpiling with Babel (Array of string/regex) // Add dependencies for transpiling with Babel (Array of string/regex)
// (from node_modules, which are by default not transpiled). // (from node_modules, which are by default not transpiled).
// Applies only if "transpile" is set to true. // 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 // rtl: true, // https://v2.quasar.dev/options/rtl-support
// preloadChunks: true, // preloadChunks: true,
// showProgress: false, // showProgress: false,
// gzip: true, gzip: true,
// analyze: true, // analyze: true,
// Options below are automatically set depending on the env, set them if you want to override // 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 { EProductNames } from "./entities/ProductNames";
import { api } from "./boot/axios"; import { api } from "./boot/axios";
import { WuJieInitializer } from "./common/WuJieInitializer"; import { WuJieInitializer } from "./common/WuJieInitializer";
import { isNumber } from "zrender/lib/core/util";
import ClientConnection from "./common/ClientConnection"; import ClientConnection from "./common/ClientConnection";
import { Common } from "./common/Common";
export default defineComponent({ export default defineComponent({
name: "App", name: "App",
@ -288,43 +288,35 @@ export default defineComponent({
EventBus.getInstance().on( EventBus.getInstance().on(
EventNamesDefine.CurrentConnectConnected, EventNamesDefine.CurrentConnectConnected,
(connection: ClientConnection) => { async (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 {}
}
const show_version_tip = () => const show_version_tip = () =>
$q.dialog({ $q.dialog({
persistent: true, persistent: true,
title: $t.t("Version Mismatch !"), title: $t.t("Version Mismatch !"),
message: $t.t( 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 { if (connection) {
version: number; let count = 0;
} while (
api connection &&
.get(final_url) !connection.is_login &&
.then((data) => { count < (1000 * 10) / 100 /* 10 S */
if (data) { ) {
const verson = data.data as _GetInterfaceVersionResponse; await Common.waitFor(100);
if (verson && verson.version == 2) {
return;
}
} }
if (count < (1000 * 10) / 100) {
try {
const response = await connection.getHttpInterfaceVersion();
if (!response || response.version != 2) {
show_version_tip(); show_version_tip();
}) }
.catch(() => { } catch (e) {
show_version_tip(); 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( public async setJointActionEquipment(
entity: JointActionEquipmentTableEntity entity: JointActionEquipmentTableEntity
) { ) {
@ -1551,19 +1557,13 @@ export default class ClientConnection {
); );
} }
public async SetProjectorResolution( public async SetProjectorResolution(width: number, height: number) {
width: number,
height: number
) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>( return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.SetProjectorResolutionRequestEntity(width, height) new Protocol.SetProjectorResolutionRequestEntity(width, height)
); );
} }
public async SetProjectorLayout( public async SetProjectorLayout(row: number, column: number) {
row: number,
column: number
) {
return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>( return await this.doRpc<Protocol.GetBlendingConfigResponseEntity>(
new Protocol.SetProjectorResolutionRequestEntity(row, column) new Protocol.SetProjectorResolutionRequestEntity(row, column)
); );

View File

@ -570,6 +570,9 @@ export namespace Protocol {
public static get kRpcCheckModeIndex() { public static get kRpcCheckModeIndex() {
return Commands.PROTOCOL_PREFIX + "RpcCheckModeIndex"; return Commands.PROTOCOL_PREFIX + "RpcCheckModeIndex";
} }
public static get kRpcGetHttpInterfaceVersion() {
return Commands.PROTOCOL_PREFIX + "RpcGetHttpInterfaceVersion";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
Commands.kSearchDevice, Commands.kSearchDevice,
@ -716,6 +719,7 @@ export namespace Protocol {
Commands.kRpcFileManagerDelete, Commands.kRpcFileManagerDelete,
Commands.kRpcFileManagerCreateDirectory, Commands.kRpcFileManagerCreateDirectory,
Commands.kRpcCheckModeIndex, Commands.kRpcCheckModeIndex,
Commands.kRpcGetHttpInterfaceVersion,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
@ -3682,11 +3686,7 @@ export namespace Protocol {
} }
export class SetProjectorResolutionRequestEntity extends PacketEntity { export class SetProjectorResolutionRequestEntity extends PacketEntity {
constructor( constructor(width: number, height: number, rpc_id = 0) {
width: number,
height: number,
rpc_id = 0
) {
super(); super();
super.command = Commands.kSetProjectorResolution; super.command = Commands.kSetProjectorResolution;
super.flag = PacketEntity.FLAG_REQUEST; super.flag = PacketEntity.FLAG_REQUEST;
@ -3701,11 +3701,7 @@ export namespace Protocol {
} }
export class SetProjectorLayoutRequestEntity extends PacketEntity { export class SetProjectorLayoutRequestEntity extends PacketEntity {
constructor( constructor(row: number, column: number, rpc_id = 0) {
row: number,
column: number,
rpc_id = 0
) {
super(); super();
super.command = Commands.kSetProjectorResolution; super.command = Commands.kSetProjectorResolution;
super.flag = PacketEntity.FLAG_REQUEST; super.flag = PacketEntity.FLAG_REQUEST;
@ -3827,4 +3823,20 @@ export namespace Protocol {
} }
success = false; 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": "请输入你所需要添加的点数", "Please enter the points you need to add": "请输入你所需要添加的点数",
"Whether to add control points": "是否添加控制点", "Whether to add control points": "是否添加控制点",
"Reset all program control points":"重置全部方案控制点", "Reset all program control points": "重置全部方案控制点",
"Reset the current program control point":"重置当前方案控制点", "Reset the current program control point": "重置当前方案控制点",
"device verify key": "设备校验码", "device verify key": "设备校验码",
"use wss": "使用Wss", "use wss": "使用Wss",
"server address": "服务器地址", "server address": "服务器地址",
@ -756,9 +756,9 @@ export default {
"export magic": "导出", "export magic": "导出",
"raster graph": "栅格图", "raster graph": "栅格图",
"the folder name cannot start with a '.'": "文件夹名称不能以“.” 开头", "the folder name cannot start with a '.'": "文件夹名称不能以“.” 开头",
"change resolution":"更改分辨率", "change resolution": "更改分辨率",
"Loading please wait":"加载中 请稍等" "Loading please wait": "加载中 请稍等",
"Version Mismatch !": "版本不匹配!", "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 !":
"版本不匹配!请重新升级软件!否则文件上传功能无法正常使用!", "版本不匹配!请重新升级软件!否则文件功能无法正常使用!",
}; };