Terminal control method and device, electronic equipment and storage medium

By generating terminal graphics windows in the browser page and receiving control commands, the problem of complex console operations is solved, the function of the browser to directly control the terminal is realized, and the R&D efficiency and user experience are improved.

CN119598046APending Publication Date: 2025-03-11BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311167652.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-11
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The console operating system commands are complex, making it difficult to debug and troubleshoot errors, making it difficult for novice R&D personnel to operate the terminal efficiently.

Method used

By initializing the pre-configured terminal emulation program Xterm, a terminal graphics window is generated in the browser page, and the control command is received and sent to the server for execution.

Benefits of technology

It realizes direct control of the terminal through the browser, improves the developer's R&D efficiency and user experience, and facilitates and quickly access the terminal.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119598046A_ABST
    Figure CN119598046A_ABST
Patent Text Reader

Abstract

The invention provides a terminal control method and device, electronic equipment and a storage medium, and relates to the technical field of computers. Comprising the following steps: initializing a pre-configured terminal simulation program Xterm to generate a terminal graphic window in a browser page; based on the terminal graphic window, receiving a control command for the terminal; and sending the control command to a server side to enable the server side to execute an operation. Therefore, the terminal can be directly controlled through the browser, the terminal can be conveniently and quickly accessed through the terminal graphic window generated in the browser page, and the research and development efficiency and the use experience of developers are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a terminal control method, device, electronic device and storage medium. Background Art

[0002] When developers operate the terminal, they usually use the console to operate directly. However, the console operation has complex command syntax and options, and it is difficult to debug and troubleshoot errors. It is difficult for novice developers to get started, and therefore it is difficult to efficiently operate system commands through the console. At the same time, for ordinary developers, operating the terminal through the console is not convenient enough, and the development efficiency is relatively low. Summary of the invention

[0003] The present disclosure aims to solve one of the technical problems in the related art at least to some extent.

[0004] The first aspect of the present disclosure provides a terminal control method, including:

[0005] Initialize the pre-configured terminal emulation program Xterm to generate a terminal graphics window in the browser page;

[0006] Based on the terminal graphic window, receiving a control command for the terminal;

[0007] The control command is sent to the server to enable the server to perform an operation.

[0008] Optionally, the initializing a preconfigured terminal emulation program Xterm to generate a terminal graphics window in the browser page includes:

[0009] Initializing a preconfigured terminal emulation program Xterm to draw the terminal graphics window in the browser page according to preconfigured terminal description parameters,

[0010] The terminal description parameter includes at least one of the following:

[0011] Font size, font color, font style, mouse pointer style, window size.

[0012] Optionally, before receiving a control command for a terminal based on the terminal graphic window, the method further includes:

[0013] Based on the WebSocket protocol, a link is established between the browser and the server.

[0014] The server adopts a service architecture created based on Node.js, and the service architecture uses at least one of the following modules:

[0015] node-pty, WebSocket library, Portfinder, os, fs, net, https, path, tty, vm, stream.

[0016] Optionally, the browser page is client software that is pre-packaged and encapsulated by electron;

[0017] The client software includes a first plug-in for adjusting terminal attribute information and a second plug-in for realizing terminal interaction.

[0018] Optionally, the initializing a preconfigured terminal emulation program Xterm includes:

[0019] In response to the browser page being opened, initializing the pre-configured terminal emulation program Xterm;

[0020] or,

[0021] In response to the designated control in the browser page being triggered, the pre-configured terminal emulation program Xterm is initialized.

[0022] Optionally, the initializing of a preconfigured terminal emulation program Xterm to generate a terminal graphics window in a browser page includes:

[0023] In response to a designated control in the browser page being triggered, determining a triggering mode of the designated control;

[0024] Acquire a target terminal description parameter associated with the triggering mode of the specified control;

[0025] The pre-configured terminal emulation program Xterm is initialized to draw the terminal graphic window in the browser page according to the target terminal description parameter.

[0026] Optionally, after sending the control command to the server so that the server performs an operation, the method further includes:

[0027] Receive execution information returned by the server, wherein the execution information includes execution process data and execution results;

[0028] The execution information is displayed based on the terminal graphic window.

[0029] A second aspect of the present disclosure provides a control device for a terminal, including:

[0030] A generation module is used to initialize a pre-configured terminal emulation program Xterm to generate a terminal graphic window in a browser page;

[0031] A receiving module, used for receiving a control command for a terminal based on the terminal graphic window;

[0032] The sending module is used to send the control command to the server so that the server performs an operation.

[0033] Optionally, the generating module is specifically used for:

[0034] Initializing a preconfigured terminal emulation program Xterm to draw the terminal graphics window in the browser page according to preconfigured terminal description parameters,

[0035] The terminal description parameter includes at least one of the following:

[0036] Font size, font color, font style, mouse pointer style, window size.

[0037] Optionally, the receiving module is further used for:

[0038] Based on the WebSocket protocol, a link is established between the browser and the server.

[0039] The server adopts a service architecture created based on Node.js, and the service architecture uses at least one of the following modules:

[0040] node-pty, WebSocket library, Portfinder, os, fs, net, https, path, tty, vm, stream.

[0041] Optionally, the browser page is client software that is pre-packaged and encapsulated by electron;

[0042] The client software includes a first plug-in for adjusting terminal attribute information and a second plug-in for realizing terminal interaction.

[0043] Optionally, the generating module is specifically used for:

[0044] In response to the browser page being opened, initializing the pre-configured terminal emulation program Xterm;

[0045] or,

[0046] In response to the designated control in the browser page being triggered, the pre-configured terminal emulation program Xterm is initialized.

[0047] Optionally, the generating module is specifically used for:

[0048] In response to a designated control in the browser page being triggered, determining a triggering mode of the designated control;

[0049] Acquire a target terminal description parameter associated with the triggering mode of the specified control;

[0050] The pre-configured terminal emulation program Xterm is initialized to draw the terminal graphic window in the browser page according to the target terminal description parameter.

[0051] Optionally, the sending module is further used to:

[0052] Receive execution information returned by the server, wherein the execution information includes execution process data and execution results;

[0053] The execution information is displayed based on the terminal graphic window.

[0054] The third aspect of the present disclosure proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the terminal control method proposed in the embodiment of the first aspect of the present disclosure is implemented.

[0055] The fourth aspect of the present disclosure proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the terminal control method proposed in the embodiment of the first aspect of the present disclosure is implemented.

[0056] A fifth aspect of the present disclosure proposes a computer program product, including a computer program, which, when executed by a processor, implements the terminal control method proposed in the embodiment of the first aspect of the present disclosure.

[0057] The terminal control method, device, electronic device and storage medium provided by the present disclosure have the following beneficial effects:

[0058] In the present disclosure, the pre-configured terminal emulation program Xterm is first initialized to generate a terminal graphic window in a browser page, and then based on the terminal graphic window, a control command for the terminal is received, and then the control command is sent to a server to enable the server to perform an operation. Thus, the terminal can be directly controlled through the browser, and the terminal can be accessed conveniently and quickly through the terminal graphic window generated in the browser page, thereby improving the developer's R&D efficiency and usage experience.

[0059] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0061] Figure 1 A schematic diagram of a flow chart of a terminal control method provided by an embodiment of the present disclosure;

[0062] Figure 2 A flowchart of another terminal control method provided by an embodiment of the present disclosure;

[0063] Figure 3 A schematic diagram of interaction between a server and a browser provided in an embodiment of the present disclosure;

[0064] Figure 4 A schematic diagram of a Node.js-based service architecture provided by an embodiment of the present disclosure;

[0065] Figure 5 A schematic diagram of the structure of a control device of a terminal provided by an embodiment of the present disclosure;

[0066] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0067] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.

[0068] The disclosed embodiment takes the control method of the terminal as an example in which the control device of the terminal is configured. The control device of the terminal can be applied to any electronic device so that the electronic device can execute the control method of the terminal, which is not limited here. It should be noted that the execution subject of the control method of the terminal proposed in the disclosed embodiment can be a browser backend.

[0069] The following describes a terminal control method, an apparatus, an electronic device, and a storage medium according to an embodiment of the present disclosure with reference to the accompanying drawings.

[0070] Figure 1 A flowchart of a terminal control method provided by an embodiment of the present disclosure.

[0071] like Figure 1 As shown, the control method of the terminal may include the following steps:

[0072] Step 101, initializing a pre-configured terminal emulation program Xterm to generate a terminal graphic window in a browser page.

[0073] Among them, Xterm is a terminal emulation program that can provide terminal functions, including command line input, output, screen scrolling, etc., and supports various terminal control sequences and function keys. In the disclosed embodiment, the browser can be pre-configured with an npm (Node Package Manager) package of Xterm.

[0074] The browser page may be client software that is pre-packaged and encapsulated by electron.

[0075] It should be noted that the client software can run on different platforms, such as Windows and Mac, which are not limited here. Among them, the browser page on Windows can be an .exe executable file, and the browser page on Mac can be a .dmg executable file, which are not limited here. By packaging the browser page with electron into a cross-platform executable program, the browser page can be run on different platforms, which improves the scalability of the terminal control method proposed in the present disclosure.

[0076] In the present disclosure, the client software packaged by electron includes a terminal emulation program Xterm.

[0077] The client software also includes a first plug-in for adjusting terminal attribute information and a second plug-in for implementing terminal interaction. In the disclosed embodiment, the first plug-in may be xterm-addon-fit, and the second plug-in may be xterm-addon-attach.

[0078] The terminal attribute information may include the size, position, font color, background color, etc. of the terminal, which is not limited here.

[0079] Among them, xterm-addon-fit can be used to adjust the size of the xterm terminal to adapt to the container size, thereby ensuring that the xterm terminal automatically resizes when the container size changes to maintain the best display.

[0080] Among them, xterm-addon-attach can allow you to create an emulated terminal in a web browser and connect to an existing local or remote terminal session. You can integrate xterm.js into your application and make terminal connections via WebSocket or other transport protocols.

[0081] Optionally, the first plug-in, the second plug-in and Xterm may be introduced into the browser page together, that is, they may be encapsulated in one client software.

[0082] The terminal graphic window may be a graphical interface for a user to conduct a terminal session in a browser page, and may be a terminal interface generated based on a canvas.

[0083] It should be noted that, by initializing the pre-configured terminal emulation program Xterm, a simulated terminal can be established in the browser, and a terminal interaction page of the simulated terminal, ie, a terminal graphical interface, can be generated.

[0084] Step 102: receiving a control command for the terminal based on the terminal graphic window.

[0085] Among them, the control command can be used to control the terminal.

[0086] The control command may be an instruction input by a user in a terminal graphic window.

[0087] Optionally, the terminal graphic window may include a textarea text input box, wherein the user may input a control command to be executed in the textarea text input box, so that the browser may receive the control command for the terminal in the terminal graphic window.

[0088] Step 103: Send the control command to the server to enable the server to perform the operation.

[0089] The server may be a server that can use the terminal system capabilities. In the embodiment of the present disclosure, the server may be a local server.

[0090] As a possible implementation method, the server can adopt a service architecture created based on Node.js.

[0091] Node.js is a JavaScript runtime environment based on the Chrome V8 engine, which allows developers to use the JavaScript language to run code on the server side. It should be noted that after sending the control command to the server, the Node.js-based server can use the built-in os module to access and operate the operating system's capabilities, so that the server can perform operations.

[0092] In addition, because Node.js uses an event-driven and asynchronous I / O model, it can handle a large number of concurrent requests without blocking other operations, improving the throughput and performance of the server. Node.js can run on multiple operating systems, including Windows, Linux, and macOS, allowing developers to easily deploy and migrate server applications. Node.js has a package manager npm, which provides a large number of third-party libraries and modules that can quickly integrate various functions and expand server capabilities.

[0093] It should be noted that a browser-based server can be created through Node.js as an online terminal platform, thereby allowing users to enter commands in the terminal graphics window in the browser page to achieve control of the terminal and use of system capabilities.

[0094] In the present disclosure, the pre-configured terminal emulation program Xterm is first initialized to generate a terminal graphic window in a browser page, and then based on the terminal graphic window, a control command for the terminal is received, and then the control command is sent to a server to enable the server to perform an operation. Thus, the terminal can be directly controlled through the browser, and the terminal can be accessed conveniently and quickly through the terminal graphic window generated in the browser page, thereby improving the developer's R&D efficiency and usage experience.

[0095] Figure 2 A flowchart of a terminal control method provided by an embodiment of the present disclosure.

[0096] like Figure 2 As shown, the control method of the terminal may include the following steps:

[0097] Step 201, initializing the pre-configured terminal emulation program Xterm to draw a terminal graphic window in the browser page according to the pre-configured terminal description parameters.

[0098] The terminal description parameter includes at least one of the following: font size, font color, font style, mouse pointer style, and window size.

[0099] The terminal description parameter is used to describe the styles of the terminal graphic window and the terminal dialogue.

[0100] Specifically, after initializing Xterm, the browser can use HTML5 <canvas>Elements and JavaScript are used to implement graphics drawing of the terminal graphics window, thereby constructing a terminal.

[0101] As a possible implementation manner, when the browser page is opened, a pre-configured terminal emulation program Xterm is initialized.

[0102] It should be noted that the preconfigured terminal emulation program Xterm may be initialized when the user starts the browser and opens the browser page, that is, the preconfigured terminal emulation program Xterm may be initialized when the browser page is opened.

[0103] As another possible implementation manner, the pre-configured terminal emulation program Xterm may also be initialized when a designated control in the browser page is triggered.

[0104] The designated control may be any control in the browser page that is pre-associated with the initialization operation, such as any button, link, character or picture, which is not limited here.

[0105] It should be noted that after the user opens the browser page, the terminal graphic window may not be generated in the browser page, and then after the user triggers the specified control in the browser page, the terminal graphic window is generated.

[0106] As a possible implementation method, if a specified control in a browser page is triggered, the triggering method of the specified control can be determined, and then the target terminal description parameters associated with the triggering method of the specified control can be obtained, and then the pre-configured terminal emulation program Xterm is initialized to draw a terminal graphics window in the browser page according to the target terminal description parameters.

[0107] The specified control may be one or more, which is not limited here.

[0108] Specifically, one or more designated controls that can trigger the Xterm initialization operation can be pre-set in the browser page.

[0109] Among them, the triggering method can be single click, double click, left swipe, right swipe, pull down, etc., which is not limited here.

[0110] It is understandable that if there are multiple designated controls, the user can select different terminal description parameters to draw the terminal graphics window by triggering different designated controls. If there is only one designated control, the user can select different terminal description parameters to draw the terminal graphics window by triggering the designated control in different ways.

[0111] Specifically, the triggering mode of the designated control by the user can be identified, and then based on the pre-stored mapping relationship table, the terminal description parameter associated with the triggering mode of the designated control can be obtained, and then used as the target terminal description parameter.

[0112] It should be noted that multiple sets of terminal description parameters can be pre-configured to adapt to users with different usage habits. Users can select the terminal drawing parameters they need, that is, the target terminal drawing parameters, by selecting specified controls and the triggering method of the specified controls. The browser backend can then draw the terminal graphics window in the browser page based on the target terminal description parameters, so that users can make choices based on their own usage characteristics, thereby improving the R&D personnel's usage experience of the terminal graphics window and improving R&D efficiency.

[0113] Step 202: Establish a link between the browser and the server based on the WebSocket protocol.

[0114] Among them, the WebSocket protocol is a protocol for full-duplex communication on a single TCP connection, which allows real-time two-way communication between the browser and the server.

[0115] Among them, the server adopts a service architecture created based on Node.js, and the service architecture uses at least one of the following modules: node-pty, WebSocket library, Portfinder, os, fs, net, https, path, tty, vm, and stream.

[0116] Among them, node-pty can be used to provide a cross-platform pseudo-terminal interface, allowing pseudo-terminal instances to be created and operated in Node, and commands can be executed and interacted with.

[0117] The WebSocket library may be a software library or module for implementing the WebSocket protocol on the client and server.

[0118] Among them, Portfinder can be used to find available ports on the operating system.

[0119] Among them, os can be used to provide utility functions and information related to the operating system, so as to implement operating system related functions, such as operating system platform, CPU architecture, which are not limited here.

[0120] Among them, fs can be used to provide operations related to the file system, such as reading, writing and operating files, and creating directories, which are not limited here.

[0121] Among them, net is used to provide network communication related functions, such as creating servers, creating clients, and sending data.

[0122] Among them, https is used to provide functions related to the HTTP protocol and is used to create and process HTTPS servers.

[0123] Among them, path is used to provide utilities for working with file paths and directories.

[0124] Among them, tty is used to provide utilities related to terminal input and output.

[0125] Among them, vm is used to provide virtual machine related functions and is used to dynamically compile and run JavaScript code in the context of the virtual machine.

[0126] Stream is used to provide methods for processing streaming data, allowing data to be read or written in blocks.

[0127] As a possible implementation method, the above modules can be introduced through the require() function, which is not limited here.

[0128] Figure 3 A schematic diagram of the interaction between a server and a browser proposed in the present disclosure is shown in FIG. Figure 3 As shown in the figure, the Node.js server and the browser establish a link through the WebSocket protocol.

[0129] Figure 4 A schematic diagram of a Node.js-based service architecture provided by the present disclosure is shown in FIG. Figure 4 As shown, nodexterm service (xterm terminal service based on Node.js) can use terminal capabilities by using Native modules, such as os, fs, net, https, path, tty, vm, and stream.

[0130] Among them, V8 engine is an open source JavaScript engine used to interpret and run JavaScript code in browsers and other environments. C++addon is an extension module written in C++ language, which can be integrated with V8 engine to call and use C++ code and functions in JavaScript. Libuv is a cross-platform asynchronous I / O library that provides an event-driven programming interface and is suitable for building high-performance network applications. It is used as the core part of Node.js to handle asynchronous tasks such as file system operations and network requests, and can be used with V8 engine to build efficient network servers and applications.

[0131] Among them, CPU / RAM / DISK are Central Processing Unit, Random Access Memory and Disk respectively.

[0132] Step 203: receiving a control command for the terminal based on the terminal graphic window

[0133] Step 204: Send the control command to the server to enable the server to perform the operation.

[0134] It should be noted that the specific implementation of steps 203 and 204 can refer to the above embodiment and will not be described in detail here.

[0135] Step 205: Receive execution information returned by the server, where the execution information includes execution process data and execution results.

[0136] The execution information is information about the terminal executing the control command. The execution process data may include an execution timestamp, input parameters, and error information that may occur during the execution process, which are not limited here.

[0137] The execution result may include the return status code of the control command execution (e.g., 0 for success, non-zero value for failure), and output data or modified system status or files that may be included according to the specific function of the control command. Alternatively, the execution result may also include some metadata, such as the resources consumed by the command execution (e.g., CPU time, memory usage, etc.), which are not limited here.

[0138] Step 206: Display the execution information based on the terminal graphic window.

[0139] Specifically, the execution information may be displayed at a designated location in the terminal graphic window, so that the user can pay attention to the execution status of the control command by the terminal.

[0140] In the disclosed embodiment, the pre-configured terminal emulation program Xterm is first initialized to draw a terminal graphics window in the browser page according to the pre-configured terminal description parameters, and then a link is established between the browser and the server based on the WebSocket protocol, and then a control command for the terminal is received based on the terminal graphics window, and then the control command is sent to the server to make the server perform the operation, and then the execution information returned by the server is received, the execution information includes the execution process data and the execution result, and finally the execution information is displayed based on the terminal graphics window. Thus, real-time communication between the browser and the server can be established based on the WebSocket protocol, so that R&D personnel can obtain the execution information of the control command in real time, and the terminal capabilities of the local device are used to reduce losses and consumption, greatly improve the user experience and R&D efficiency, and the terminal capabilities of the local operating system can be used through the browser.

[0141] In order to implement the above embodiments, the present disclosure also proposes a control device for a terminal.

[0142] Figure 5 A schematic diagram of the structure of a terminal control device provided in an embodiment of the present disclosure.

[0143] like Figure 5 As shown, the control device 500 of the terminal may include:

[0144] A generating module 510 is used to initialize a pre-configured terminal emulation program Xterm to generate a terminal graphic window in a browser page;

[0145] A receiving module 520, configured to receive a control command for a terminal based on the terminal graphic window;

[0146] The sending module 530 is used to send the control command to the server so that the server performs an operation.

[0147] Optionally, the generating module is specifically used for:

[0148] Initializing a preconfigured terminal emulation program Xterm to draw the terminal graphics window in the browser page according to preconfigured terminal description parameters,

[0149] The terminal description parameter includes at least one of the following:

[0150] Font size, font color, font style, mouse pointer style, window size.

[0151] Optionally, the receiving module is further used for:

[0152] Based on the WebSocket protocol, a link is established between the browser and the server.

[0153] The server adopts a service architecture created based on Node.js, and the service architecture uses at least one of the following modules:

[0154] node-pty, WebSocket library, Portfinder, os, fs, net, https, path, tty, vm, stream.

[0155] Optionally, the browser page is client software that is pre-packaged and encapsulated by electron;

[0156] The client software includes a first plug-in for adjusting terminal attribute information and a second plug-in for realizing terminal interaction.

[0157] Optionally, the generating module is specifically used for:

[0158] In response to the browser page being opened, initializing the pre-configured terminal emulation program Xterm;

[0159] or,

[0160] In response to the designated control in the browser page being triggered, the pre-configured terminal emulation program Xterm is initialized.

[0161] Optionally, the generating module is specifically used for:

[0162] In response to a designated control in the browser page being triggered, determining a triggering mode of the designated control;

[0163] Acquire a target terminal description parameter associated with the triggering mode of the specified control;

[0164] The pre-configured terminal emulation program Xterm is initialized to draw the terminal graphic window in the browser page according to the target terminal description parameter.

[0165] Optionally, the sending module is further used to:

[0166] Receive execution information returned by the server, wherein the execution information includes execution process data and execution results;

[0167] The execution information is displayed based on the terminal graphic window.

[0168] In the present disclosure, the pre-configured terminal emulation program Xterm is first initialized to generate a terminal graphic window in a browser page, and then based on the terminal graphic window, a control command for the terminal is received, and then the control command is sent to a server to enable the server to perform an operation. Thus, the terminal can be directly controlled through the browser, and the terminal can be accessed conveniently and quickly through the terminal graphic window generated in the browser page, thereby improving the developer's R&D efficiency and usage experience.

[0169] In order to implement the above embodiments, the present disclosure also proposes an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the terminal control method proposed in the above embodiments of the present disclosure is implemented.

[0170] In order to implement the above embodiments, the present disclosure further proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the terminal control method proposed in the above embodiments of the present disclosure is implemented.

[0171] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 6 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0172] like Figure 6 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0173] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.

[0174] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0175] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.

[0176] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0177] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0178] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the methods mentioned in the above embodiments.

[0179] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0180] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0181] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present disclosure includes additional implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present disclosure belong.

[0182] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0183] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0184] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0185] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0186] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present disclosure have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations of the present disclosure. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present disclosure.< / canvas>

Claims

1. A terminal control method, characterized in that: include: Initialize the pre-configured terminal emulation program Xterm to generate a terminal graphics window in the browser page; Based on the terminal graphic window, receiving a control command for the terminal; The control command is sent to the server to enable the server to perform an operation.

2. The method according to claim 1, characterized in that Initializing the pre-configured terminal emulation program Xterm to generate a terminal graphics window in the browser page includes: Initializing a preconfigured terminal emulation program Xterm to draw the terminal graphics window in the browser page according to preconfigured terminal description parameters, The terminal description parameter includes at least one of the following: Font size, font color, font style, mouse pointer style, window size.

3. The method according to claim 1, characterized in that Before receiving a control command for a terminal based on the terminal graphic window, the method further includes: Based on the WebSocket protocol, a link is established between the browser and the server. The server adopts a service architecture created based on Node.js, and the service architecture uses at least one of the following modules: node-pty, WebSocket library, Portfinder, os, fs, net, https, path, tty, vm, stream.

4. The method according to claim 1, characterized in that: in, The browser page is client software that is pre-packaged and encapsulated by electron; The client software includes a first plug-in for adjusting terminal attribute information and a second plug-in for realizing terminal interaction.

5. The method according to claim 1, characterized in that Initializing the pre-configured terminal emulation program Xterm includes: In response to the browser page being opened, initializing the pre-configured terminal emulation program Xterm; or, In response to the designated control in the browser page being triggered, the pre-configured terminal emulation program Xterm is initialized.

6. The method according to claim 1, characterized in that Initializing the pre-configured terminal emulation program Xterm to generate a terminal graphics window in the browser page includes: In response to a designated control in the browser page being triggered, determining a triggering mode of the designated control; Acquire a target terminal description parameter associated with the triggering mode of the specified control; The pre-configured terminal emulation program Xterm is initialized to draw the terminal graphic window in the browser page according to the target terminal description parameter.

7. The method according to claim 1, characterized in that After sending the control command to the server so that the server performs the operation, the method further includes: Receive execution information returned by the server, wherein the execution information includes execution process data and execution results; The execution information is displayed based on the terminal graphic window.

8. A terminal control device, characterized in that: include: A generation module is used to initialize a pre-configured terminal emulation program Xterm to generate a terminal graphic window in a browser page; A receiving module, used for receiving a control command for a terminal based on the terminal graphic window; The sending module is used to send the control command to the server so that the server performs an operation.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the terminal control method as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the terminal control method as described in any one of claims 1 to 7 is implemented.