Web application plug-in development method, device, electronic device, medium and program
By injecting the obfuscated object code and plug-in development service transmission plug-in scripts in the web application, the SDK is stolen and the version is lagged, and safe and efficient plug-in development and debugging is achieved.
Patent Information
- Application Number
- CN202010797357.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2040-08-10
AI Technical Summary
In the prior art, web application plug-in development requires the installation of SDK locally on the development terminal, which can easily lead to the SDK core code being stolen and the freshness of the SDK version cannot be guaranteed.
The object code generated by the browser is injected according to the latest SDK source code of the Web application and renders the target plug-in script in the web page to avoid installing the SDK in the development terminal, and use the plug-in development service to transmit the target plug-in script.
It realizes debugging of plug-in development on the development terminal, ensures the security of the SDK and the freshness of the version, avoids the SDK core code being stolen, and reduces professional requirements for developers.
Smart Images

Figure CN114063985B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device, medium and program for developing a plug-in for a Web application. Background Art
[0002] Web applications are applications accessed through a browser. Most existing web applications that support extensions typically rely on the provided development kit (SDK) for development and debugging when developers develop plugins for them. Most development methods require the SDK to be installed locally on the development terminal in order to integrate with the local IDE. However, installing the SDK locally on the development terminal can lead to developers analyzing the technology or modifying the code for other purposes, potentially exposing their technical knowledge to theft.
[0003] It can be seen that the existing method of developing plug-ins requires installing the SDK locally on the development terminal, which easily causes the SDK core code to be stolen. Summary of the Invention
[0004] Embodiments of the present invention provide a method, apparatus, electronic device, medium, and program for developing a plug-in for a Web application, to address the problem that the existing method for developing a plug-in requires the installation of an SDK locally on a development terminal, which easily causes the SDK core code to be stolen and cannot ensure that the SDK on the development terminal is the latest version of the SDK.
[0005] In response to the above technical problems, in a first aspect, an embodiment of the present invention provides a method for developing a plug-in for a Web application, which is applied to a development terminal. The development terminal includes a browser and a plug-in development service provided by a plug-in development scaffold. The method for developing a plug-in for a Web application includes:
[0006] Opening a web page through the browser; wherein the web page is injected with target code, and the target code is generated by code obfuscation based on the latest SDK source code of the web application;
[0007] Obtaining a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in for the Web application or a plug-in script generated by modifying an existing plug-in script;
[0008] The target plug-in script is sent to the web page through the browser, and content is rendered and displayed in the web page according to the target code and the target plug-in script.
[0009] In a second aspect, an embodiment of the present invention provides a method for developing a plug-in for a Web application, which is applied to a server, wherein the server includes a Web application. The method for developing a plug-in for the Web application includes:
[0010] Receiving a web address of the web application accessed by a development terminal through a browser, and determining whether the web address in the access request carries tag information;
[0011] If the web address carries tag information, then generate target code; the target code is generated by code obfuscation based on the latest SDK source code of the web application;
[0012] The target code is injected into a page file for accessing the Web application, and the page file is sent to the browser so that the Web page injected with the target code is opened through the browser.
[0013] In a third aspect, an embodiment of the present invention provides a plug-in development device for a Web application, which is applied to a development terminal. The development terminal includes a browser and a plug-in development service provided by a plug-in development scaffold. The plug-in development device for the Web application includes:
[0014] A browser module, configured to open a web page through the browser; wherein the web page is injected with target code, and the target code is generated by code obfuscation based on the latest SDK source code of the web application;
[0015] A development service module, configured to obtain a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in for the Web application or a plug-in script generated by modifying an existing plug-in script;
[0016] A rendering module is used to send the target plug-in script to the Web page through the browser, and render and display content in the Web page according to the target code and the target plug-in script.
[0017] In a fourth aspect, an embodiment of the present invention provides a plug-in development device for a Web application, which is applied to a server, wherein the server includes a Web application, and the plug-in development device for the Web application includes:
[0018] A judgment module is used to receive a web address of the web application accessed by a development terminal through a browser, and to judge whether the web address in the access request carries tag information;
[0019] A generation module, configured to generate a target code if the web address carries tag information; the target code is generated by performing code obfuscation based on the latest SDK source code of the web application;
[0020] The injection module is used to inject the target code into the response information of accessing the Web application, and send the response information to the browser so that the browser can open the Web page injected with the target code.
[0021] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for developing a plug-in for a Web application when executing the program.
[0022] In a sixth aspect, an embodiment of the present invention provides a non-transitory readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned method for developing a plug-in for a Web application when executed by a processor.
[0023] In a seventh aspect, an embodiment of the present invention provides a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for developing a plug-in for a Web application.
[0024] An embodiment of the present invention provides a method, device, electronic device, medium and program for developing a plug-in for a Web application, wherein a development terminal opens a Web page into which a target code is injected through a browser. During the plug-in development process, the plug-in development service of the development terminal sends the newly developed target plug-in script to the Web page through the browser. The target code injected into the Web page is generated based on code obfuscation of the latest SDK source code of the Web application, and can support the optimized display of the Web page by the target plug-in script, thereby realizing debugging of the plug-in development. After code obfuscation, the SDK in the target code is unreadable, thereby preventing the theft of the SDK core code caused by the installation of the SDK by the development terminal.
[0025] Furthermore, each injected target code is obfuscated based on the latest SDK, ensuring that each web page opened is based on the latest SDK. Compared to the prior art, which often lags behind in SDK updates for development terminals, this application avoids version mismatches caused by untimely SDK updates. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0027] Figure 1This is a flow chart of a method for developing a plug-in for a Web application provided by an embodiment of the present invention;
[0028] Figure 2 is a flowchart of a method for developing a plug-in for a Web application provided by another embodiment of the present invention;
[0029] Figure 3 is a flowchart of a plug-in development process provided by another embodiment of the present invention;
[0030] Figure 4 This is a structural block diagram of a Web application plug-in development device provided by another embodiment of the present invention;
[0031] Figure 5 This is a structural block diagram of a Web application plug-in development device provided by another embodiment of the present invention;
[0032] Figure 6 It is a schematic diagram of the physical structure of an electronic device provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0033] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0034] Figure 1 This is a flow chart of a method for developing a plug-in for a Web application provided in this embodiment, which is applied to a development terminal including a browser and a plug-in development service provided by a plug-in development scaffold. Figure 1 , the plug-in development method of the Web application includes:
[0035] Step 101: Open a web page through the browser; wherein, target code is injected into the web page, and the target code is generated by code obfuscation based on the latest SDK source code of the web application.
[0036] A web page is generated based on the web address of the web application being accessed. This web address can be sent to the browser by the plugin development service or copied manually.
[0037] The target code can be a JavaScript script, i.e., a JS script that has been obfuscated based on the SDK source code. The obfuscated code in the target code is designed to support rendering of a newly developed target plug-in script on a web page. The target code provides the parameters required for the target plug-in script to run.
[0038] Obfuscated code, also known as junk code, is the act of converting the code of a computer program into a form that is functionally equivalent but difficult to read and understand. Code obfuscation can be used for program source code or for intermediate code compiled from a program. Code obfuscation can be performed using a code obfuscator. It can be seen that the target code generated by code obfuscation in this application can, on the one hand, support the operation of the target plug-in script, ensure the completeness and correctness of the SDK functions, and on the other hand, ensure the security of the SDK source code.
[0039] The target code is generated by code obfuscation based on the latest SDK source code of the Web application, which may include: directly generating the code obfuscation based on the latest SDK source code of the Web application, or first compiling the latest SDK source code and then generating the code obfuscation. The specific selection can be made according to actual needs.
[0040] In actual use, code obfuscation can be implemented by using obfuscation methods such as string encryption and program structure obfuscation encryption, or by using technical means such as code simplification, code compression, and code compilation that can achieve the obfuscation effect.
[0041] Step 102: Obtain a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in of the Web application or a plug-in script generated by modifying an existing plug-in script.
[0042] After running the plugin development scaffold, the plugin development scaffold automatically creates a plugin development service to retrieve the target plugin script edited by the developer. The plugin development service provides a code input box to retrieve the target plugin script written by the developer.
[0043] In the embodiments of the present application, the target plug-in script is used by a web application and can be used to extend and optimize the functionality of the web application, fix vulnerabilities and bugs in the web application, or optimize the front-end display of the web application. For ease of description, the following mainly uses the optimization of the front-end display of the web application as an example.
[0044] Step 103: Send the target plug-in script to the Web page through the browser, and render and display content in the Web page according to the target code and the target plug-in script.
[0045] The browser sends the target plug-in script to the web page. Since the target code is injected into the web page, the target plug-in script, after running, can render the optimized display effect after the target plug-in script is adapted to the web application development kit (SDK). Therefore, developers can debug the target plug-in script through the plug-in development terminal and use the browser to render the optimized display content on the web page, thus achieving plug-in debugging.
[0046] This embodiment provides a plug-in development method for a Web application, in which a development terminal opens a Web page into which a target code is injected through a browser. During the plug-in development process, the plug-in development service of the development terminal sends the newly developed target plug-in script to the Web page through the browser. The target code injected into the Web page is generated based on code obfuscation of the latest SDK source code of the Web application, and can support the optimized display of the Web page by the target plug-in script, thereby enabling debugging of the plug-in development. After code obfuscation, the SDK in the target code is unreadable, thereby preventing the theft of the SDK core code caused by the installation of the SDK by the development terminal.
[0047] At the same time, each injected target code is obfuscated based on the latest SDK, ensuring that each web page opened is based on the latest SDK. Compared to the prior art's lag in SDK updates for development terminals, this application, to a certain extent, avoids version mismatches caused by untimely SDK updates. Furthermore, there's no need to install the SDK on the development terminal, which avoids the tedious SDK dependency installation and startup process, reducing the professional expertise required of developers.
[0048] Furthermore, based on the above embodiment, opening a web page through the browser includes:
[0049] Obtaining a web address carrying tag information as an application access address; the web address is a web address for accessing the web application;
[0050] The web application is accessed through the browser according to the application access address, so that after the server detects the tag information, the target code is injected into the page opened according to the web address.
[0051] The tag information is used to identify that the page generated by accessing the web application is for plug-in development and that the target code needs to be injected into the page. The tag information can be the plug-in development address or a set string. If the web address carries the tag information, the server can inject the target code into the opened page. If the web address does not carry the tag information, it is considered that the access to the web application based on the web address is not for plug-in development, and therefore the target code is not injected into the page.
[0052] The tag information can usually be embedded in the Web address, for example, embedded in the Web address in a manner of being appended to the Web address, so the application access address can be a combination of the Web address and the tag information.
[0053] In this embodiment, by adding tag information to the web address for accessing the web application, the server can distinguish whether the page opened according to the web address is used for plug-in development, and if it is used for plug-in development, inject target code into the page so that the page supports the optimized display of the target plug-in code on the web page.
[0054] Furthermore, based on the above embodiments, before obtaining the web address carrying the tag information as the application access address, the method further includes:
[0055] The Web address is obtained through the plug-in development service, and the plug-in development address of the plug-in development service is accessed. The plug-in development address is embedded in the Web address as the tag information to generate the application access address.
[0056] After a web page is opened in a browser, a communication connection must be established with the plug-in development service to deliver the target plug-in script to the web page. Therefore, the web page must establish a communication connection with the plug-in development service using the plug-in development address. The plug-in development address can be used as tag information, serving as both identification information and injecting it into the web page via the server, facilitating subsequent communication between the web page and the plug-in development service.
[0057] In this embodiment, the plug-in development address is used as marking information, which can not only play an identification role but also provide the plug-in development address to the server so that the server can inject the plug-in development address into the web page to ensure that the subsequent web page establishes a communication connection with the plug-in development service.
[0058] Furthermore, based on the above embodiments, sending the target plug-in script to the web page through the browser includes:
[0059] Obtaining a plug-in development address injected into the Web page after the server receives the application access address; the application access address is a Web address carrying tag information; the plug-in development address is an address for accessing the plug-in development service;
[0060] A communication connection is established between the Web page and the plug-in development service according to the plug-in development address through the browser, and the target plug-in script is sent to the Web page through the communication connection.
[0061] The communication connection between the web page and the plug-in development service is established through the HTTP protocol.
[0062] The server can obtain the plug-in development address from the application access address and write the obtained plug-in development address into the target code. As a result, the web page can establish a communication connection with the plug-in development service through the plug-in development address, and then the plug-in development service can send the target plug-in script to the web page through the communication connection, so that the web page can render the optimized display content of the target plug-in script.
[0063] Specifically, sending the target plug-in script to the Web page through the communication connection includes:
[0064] After detecting the target plug-in script, the plug-in development service generates a script push message, and sends the script push message to the web page through the communication connection by the browser, so that the web page generates a script request message after receiving the script push message;
[0065] The browser sends the script request message to the plug-in development service through the communication connection, so that after the plug-in development service receives the script request message, it sends the target plug-in script to the Web page through the communication connection.
[0066] In this embodiment, a communication connection is established between the Web page in the browser and the plug-in development service through the plug-in development address. Through this communication connection, the plug-in development service in the development terminal can send the target plug-in script to the Web page, thereby realizing the plug-in development process.
[0067] Furthermore, based on the above embodiments, the present invention further includes:
[0068] After the plug-in development is completed, the plug-in script to be updated is sent to the server through the plug-in development service, so that the server upgrades the Web application according to the plug-in script to be updated;
[0069] The plug-in script to be updated is the target plug-in script most recently acquired by the plug-in development service.
[0070] Developers can use the optimized display content of the target plug-in script rendered on the web page to trigger a control indicating the completion of plug-in development. After plug-in development is complete, the plug-in development service uses the most recently acquired target plug-in script (i.e., the latest target plug-in script) as the plug-in script to be updated. This script is sent to the server, which then upgrades the web application plug-in and distributes the upgraded web application to all client terminals.
[0071] In this embodiment, after the debugging of the plug-in development is completed, the plug-in script to be updated is sent to the server, thereby achieving an upgrade of the Web application.
[0072] It should be noted that the scaffolding of the development terminal can be pre-installed in the development terminal, or it can be a scaffolding installation package downloaded from the server, and the scaffolding is installed through the scaffolding installation package before the plug-in development is carried out. For the "scaffolding pre-installed in the development terminal", after the plug-in development service generated by the scaffolding is started, the plug-in development service can obtain the Web address entered by the developer, and add tag information to the Web address to generate the application access address. For the "scaffolding installation package downloaded from the server", the server can add the Web address to the scaffolding installation package in advance, so that after the scaffolding installation is completed and the plug-in development service provided by the scaffold is started, the plug-in development service can add tag information to the Web address.
[0073] Figure 2 This is a flow chart of a method for developing a plug-in for a Web application provided in this embodiment, which is applied to a server including a Web application. Figure 2 , the plug-in development method of the Web application includes:
[0074] Step 201: Receive the web address of the web application accessed by the development terminal through the browser, and determine whether the web address in the access request carries tag information.
[0075] After receiving the web address of a web application, the server determines whether the page generated by the web application is for plug-in development by checking whether the web address carries tag information. If the page is for plug-in development, the server then injects target code into the generated page. The target code is generated by obfuscating the latest SDK source code for the web application. Because the target code does not contain the SDK source code, technical leaks caused by the SDK source code on the development terminal are avoided.
[0076] Step 202: If the Web address carries tag information, then generate a target code; the target code is generated by performing code obfuscation based on the latest SDK source code of the Web application.
[0077] If the web address carries the tag information, the latest SDK source code is obtained and the code generated after code obfuscation is performed on the latest SDK source code of the web application as the target code. By injecting the target code into the web page generated according to the web address, the web page can support the target plug-in script to optimize its display, thus realizing the plug-in development process even if the development terminal does not have the SDK source code installed.
[0078] Step 203: Inject the target code into a page file for accessing the Web application, and send the page file to the browser so that the browser opens the Web page injected with the target code.
[0079] The page file may be an HTML file that contains the target code, and when the browser opens the page file, it is a web page injected with the target code, which can support the optimized display of the web page by the target plug-in script.
[0080] This embodiment provides a plug-in development method for a Web application, in which a development terminal opens a Web page into which a target code is injected through a browser. During the plug-in development process, the plug-in development service of the development terminal sends the newly developed target plug-in script to the Web page through the browser. The target code injected into the Web page is generated based on code obfuscation of the latest SDK source code of the Web application, and can support the optimized display of the Web page by the target plug-in script, thereby enabling debugging of the plug-in development. After code obfuscation, the SDK in the target code is unreadable, thereby preventing the theft of the SDK core code caused by the installation of the SDK by the development terminal.
[0081] At the same time, each injected target code is obfuscated based on the latest SDK, ensuring that each web page opened is based on the latest SDK. Compared to the prior art's lag in SDK updates for development terminals, this application, to a certain extent, avoids version mismatches caused by untimely SDK updates. Furthermore, there's no need to install the SDK on the development terminal, which avoids the tedious SDK dependency installation and startup process, reducing the professional expertise required of developers.
[0082] Furthermore, based on the above embodiment, the present invention further includes:
[0083] If the web address carries tag information, obtaining a plug-in development address serving as the tag information, injecting the plug-in development address into the web page, and establishing a communication connection between the web page and a plug-in development service through the browser on the development terminal according to the plug-in development address;
[0084] The plug-in development address is an address for accessing the plug-in development service; the plug-in development service is provided by the plug-in development scaffold of the development terminal.
[0085] In this embodiment, the server also injects the plug-in development address into the Web page, so that the Web page can establish a communication connection with the plug-in development terminal through the browser according to the injected plug-in development address, thereby obtaining the target plug-in script from the plug-in development terminal, rendering the display content of the target plug-in script in the Web page, and realizing the debugging process of the plug-in.
[0086] Furthermore, based on the above embodiments, the present invention further includes:
[0087] Receiving a plug-in script to be updated sent by the development terminal, and upgrading the Web application according to the plug-in script to be updated;
[0088] The updated plug-in script is the target plug-in script most recently acquired by the plug-in development service of the development terminal after the plug-in development is completed; the target plug-in script is the plug-in script generated for the first time for the newly developed plug-in of the Web application or the plug-in script generated by modifying an existing plug-in script.
[0089] Furthermore, the server upgrades the plug-in of the Web application and promotes the upgraded Web application to each client terminal.
[0090] In this embodiment, after receiving the plug-in script to be updated, the server completes the upgrade of the Web application, thereby promoting the upgraded Web application to the client terminal, thereby achieving the promotion of the Web application supporting the new plug-in.
[0091] Figure 3 For a flow chart of the plug-in development process provided in this embodiment, see Figure 3 The plug-in development process provided in this embodiment includes the following:
[0092] (1) The developer downloads the plug-in development kit provided by the server, installs the plug-in development kit, decompresses the scaffolding and initializes it;
[0093] (2) The scaffold starts the plug-in development service and generates a web address with added tag information;
[0094] (3) The developer opens the web page through the browser according to the web address with the added tag information. Since the web address carries the tag information, the server will inject the target code and the plug-in development address into the web page;
[0095] (4) The web page establishes a communication connection with the plug-in development service through the plug-in development address, and based on the communication connection, the plug-in development service sends the plug-in script to the web page, thereby rendering and displaying content in the web page according to the plug-in development script and the target code;
[0096] (5) After the plug-in development is completed, the plug-in development service will upload the developed plug-in script to the server, and the server will implement the upgrade and promotion of the Web application.
[0097] Figure 4 This is a structural block diagram of a plug-in development device for a Web application provided in this embodiment. The plug-in development device for a Web application is applied to a development terminal. The development terminal includes a browser and a plug-in development service provided by a plug-in development scaffold. The plug-in development device for a Web application includes a browser module 401, a development service module 402, and a rendering module 403.
[0098] The browser module 401 is used to open a web page through the browser; wherein the web page is injected with target code, and the target code is generated by code obfuscation based on the latest SDK source code of the web application;
[0099] The development service module 402 is configured to obtain a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in for the Web application or a plug-in script generated by modifying an existing plug-in script;
[0100] The rendering module 403 is configured to send the target plug-in script to the Web page through the browser, and render and display content in the Web page according to the target code and the target plug-in script.
[0101] The plug-in development device for a Web application provided in this embodiment is applicable to the plug-in development method for a Web application applied to a development terminal provided in the above embodiments, and will not be described in detail here.
[0102] This embodiment provides a plug-in development device for a Web application.
[0103] The development terminal uses a browser to open the web page into which the target code has been injected. During plug-in development, the development terminal's plug-in development service sends the newly developed target plug-in script to this web page via the browser. The target code injected into this web page is generated by obfuscating the latest SDK source code for the web application. This supports the target plug-in script's optimized display of the web page, enabling debugging of the plug-in development. After code obfuscation, the SDK in the target code is unreadable, preventing the theft of the SDK's core code due to the development terminal installing the SDK.
[0104] Furthermore, each injected target code is obfuscated based on the latest SDK, ensuring that each web page opened is based on the latest SDK. Compared to the prior art, which often lags behind in SDK updates for development terminals, this application avoids version mismatches caused by untimely SDK updates.
[0105] Optionally, opening a web page through the browser includes:
[0106] Obtaining a web address carrying tag information as an application access address; the web address is a web address for accessing the web application;
[0107] The web application is accessed through the browser according to the application access address, so that after the server detects the tag information, the target code is injected into the page opened according to the web address.
[0108] Optionally, before obtaining the web address carrying the tag information as the application access address, the method further includes:
[0109] The Web address is obtained through the plug-in development service, and the plug-in development address of the plug-in development service is accessed. The plug-in development address is embedded in the Web address as the tag information to generate the application access address.
[0110] Optionally, sending the target plug-in script to the web page through the browser includes:
[0111] Obtaining a plug-in development address injected into the Web page after the server receives the application access address; the application access address is a Web address carrying tag information; the plug-in development address is an address for accessing the plug-in development service;
[0112] A communication connection is established between the Web page and the plug-in development service according to the plug-in development address through the browser, and the target plug-in script is sent to the Web page through the communication connection.
[0113] Optionally, it also includes:
[0114] After the plug-in development is completed, the plug-in script to be updated is sent to the server through the plug-in development service, so that the server upgrades the Web application according to the plug-in script to be updated;
[0115] The plug-in script to be updated is the target plug-in script most recently acquired by the plug-in development service.
[0116] Figure 5This is a structural block diagram of a plug-in development device for a Web application provided in this embodiment. The plug-in development device for a Web application is applied to a server, which includes a Web application. The plug-in development device for a Web application includes a determination module 501, a generation module 502, and an injection module 503, wherein:
[0117] The judgment module 501 is used to receive the web address of the web application accessed by the development terminal through the browser, and judge whether the web address in the access request carries the tag information;
[0118] A generating module 502 is configured to generate a target code if the web address carries tag information; the target code is generated by performing code obfuscation based on the latest SDK source code of the web application;
[0119] The injection module 503 is configured to inject the target code into the response information of accessing the Web application, and send the response information to the browser so that the browser opens the Web page injected with the target code.
[0120] The plug-in development device for a Web application provided in this embodiment is applicable to the plug-in development method for a Web application applied to a server provided in the above embodiments, and will not be described in detail here.
[0121] This embodiment provides a plug-in development device for a Web application.
[0122] The development terminal uses a browser to open the web page into which the target code has been injected. During plug-in development, the development terminal's plug-in development service sends the newly developed target plug-in script to this web page via the browser. The target code injected into this web page is generated by obfuscating the latest SDK source code for the web application. This supports the target plug-in script's optimized display of the web page, enabling debugging of the plug-in development. After code obfuscation, the SDK in the target code is unreadable, preventing the theft of the SDK's core code due to the development terminal installing the SDK.
[0123] Furthermore, each injected target code is obfuscated based on the latest SDK, ensuring that each web page opened is based on the latest SDK. Compared to the prior art, which often lags behind in SDK updates for development terminals, this application avoids version mismatches caused by untimely SDK updates.
[0124] Optionally, it also includes:
[0125] If the web address carries tag information, obtaining a plug-in development address serving as the tag information, injecting the plug-in development address into the web page, and establishing a communication connection between the web page and a plug-in development service through the browser on the development terminal according to the plug-in development address;
[0126] The plug-in development address is an address for accessing the plug-in development service of the development terminal; the plug-in development service is provided by the plug-in development scaffold of the development terminal.
[0127] Optionally, it also includes:
[0128] Receiving a plug-in script to be updated sent by the development terminal, and upgrading the Web application according to the plug-in script to be updated;
[0129] The updated plug-in script is the target plug-in script most recently acquired by the plug-in development service of the development terminal after the plug-in development is completed; the target plug-in script is the plug-in script generated for the first time for the newly developed plug-in of the Web application or the plug-in script generated by modifying an existing plug-in script.
[0130] Figure 6 An example of a physical structure diagram of an electronic device is shown below. Figure 6 As shown, the electronic device may include: a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein the processor 601, the communication interface 602, and the memory 603 communicate with each other via the communication bus 604. The processor 601 may call the logic instructions in the memory 603 to execute the following method:
[0131] A web page is opened through the browser; wherein a target code is injected into the web page, and the target code is generated by code obfuscation based on the latest SDK source code of the web application; a target plug-in script is obtained through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in of the web application or a plug-in script generated by modifying an existing plug-in script; the target plug-in script is sent to the web page through the browser, and content is rendered and displayed on the web page based on the target code and the target plug-in script.
[0132] Alternatively, a receiving development terminal accesses the web address of the web application through a browser, and determines whether the web address in the access request carries tag information; if the web address carries tag information, generates a target code; the target code is generated by code obfuscation based on the latest SDK source code of the web application; the target code is injected into a page file for accessing the web application, and the page file is sent to the browser, so that the web page injected with the target code is opened through the browser.
[0133] In addition, the logic instructions in the above-mentioned memory 603 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0134] Furthermore, an embodiment of the present invention discloses a computer program product, which includes a computer program stored on a non-transitory readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can perform the methods provided by the above method embodiments, for example, including:
[0135] A web page is opened through the browser; wherein a target code is injected into the web page, and the target code is generated by code obfuscation based on the latest SDK source code of the web application; a target plug-in script is obtained through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in of the web application or a plug-in script generated by modifying an existing plug-in script; the target plug-in script is sent to the web page through the browser, and content is rendered and displayed on the web page based on the target code and the target plug-in script.
[0136] Alternatively, a receiving development terminal accesses the web address of the web application through a browser, and determines whether the web address in the access request carries tag information; if the web address carries tag information, generates a target code; the target code is generated by code obfuscation based on the latest SDK source code of the web application; the target code is injected into a page file for accessing the web application, and the page file is sent to the browser, so that the web page injected with the target code is opened through the browser.
[0137] On the other hand, an embodiment of the present invention further provides a non-transitory readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the transmission method provided in each of the above embodiments is implemented, for example, including:
[0138] A web page is opened through the browser; wherein a target code is injected into the web page, and the target code is generated by code obfuscation based on the latest SDK source code of the web application; a target plug-in script is obtained through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in of the web application or a plug-in script generated by modifying an existing plug-in script; the target plug-in script is sent to the web page through the browser, and content is rendered and displayed on the web page based on the target code and the target plug-in script.
[0139] Alternatively, a receiving development terminal accesses the web address of the web application through a browser, and determines whether the web address in the access request carries tag information; if the web address carries tag information, generates a target code; the target code is generated by code obfuscation based on the latest SDK source code of the web application; the target code is injected into a page file for accessing the web application, and the page file is sent to the browser, so that the web page injected with the target code is opened through the browser.
[0140] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0141] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A method for developing a plug-in for a Web application, characterized in that: Applied to a development terminal, the development terminal includes a browser and a plug-in development service provided by a plug-in development scaffold, and the plug-in development method for a Web application includes: Opening a web page through the browser; wherein target code is injected into the web page, wherein the target code is generated by code obfuscation based on the latest SDK source code of the web application, wherein the target code is a JS script that is obfuscated based on the SDK source code; the code in the target code that is obfuscated based on the SDK source code is to support rendering of a newly developed target plug-in script in the web page; Obtaining a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in for the Web application or a plug-in script generated by modifying an existing plug-in script; The target plug-in script is sent to the web page through the browser, and content is rendered and displayed in the web page according to the target code and the target plug-in script.
2. The method for developing a plug-in for a Web application according to claim 1, wherein: Opening a web page through the browser includes: Obtaining a web address carrying tag information as an application access address; the web address is a web address for accessing the web application; The web application is accessed through the browser according to the application access address, so that after the server detects the tag information, the target code is injected into the page opened according to the web address.
3. The method for developing a plug-in for a Web application according to claim 2, wherein: Before obtaining the web address carrying the tag information as the application access address, the method further includes: The Web address is obtained through the plug-in development service, and the plug-in development address of the plug-in development service is accessed. The plug-in development address is embedded in the Web address as the tag information to generate the application access address.
4. The method for developing a plug-in for a Web application according to claim 1, wherein: The step of sending the target plug-in script to the web page through the browser includes: Obtaining a plug-in development address injected into the web page after the server receives the application access address; the application access address is a web address carrying tag information; the plug-in development address is an address for accessing the plug-in development service; A communication connection is established between the Web page and the plug-in development service according to the plug-in development address through the browser, and the target plug-in script is sent to the Web page through the communication connection.
5. The method for developing a plug-in for a Web application according to claim 1, wherein: Also includes: After the plug-in development is completed, the plug-in script to be updated is sent to the server through the plug-in development service, so that the server upgrades the Web application according to the plug-in script to be updated; The plug-in script to be updated is the target plug-in script most recently acquired by the plug-in development service.
6. A method for developing a plug-in for a Web application, characterized in that: Applied to a server, the server including a web application, the web application plug-in development method includes: Receiving a web address of the web application accessed by a development terminal through a browser, and determining whether the accessed web address carries tag information; If the web address carries tag information, a target code is generated; the target code is generated by code obfuscation based on the latest SDK source code of the web application, wherein the target code is a JS script that is obfuscated based on the SDK source code; the code in the target code that is obfuscated based on the SDK source code is to support rendering of the newly developed target plug-in script in the web page; The target code is injected into a page file for accessing the Web application, and the page file is sent to the browser so that the Web page injected with the target code is opened through the browser.
7. The method for developing a plug-in for a Web application according to claim 6, wherein: Also includes: If the web address carries tag information, obtaining a plug-in development address serving as the tag information, injecting the plug-in development address into the web page, and establishing a communication connection between the web page and a plug-in development service through the browser on the development terminal according to the plug-in development address; Wherein, the plug-in development address is the address for accessing the plug-in development service; The plug-in development service is provided by the plug-in development scaffold of the development terminal.
8. The method for developing a plug-in for a Web application according to claim 6, wherein: Also includes: Receiving a plug-in script to be updated sent by the development terminal, and upgrading the Web application according to the plug-in script to be updated; The updated plug-in script is the target plug-in script that the plug-in development service of the development terminal obtains most recently after the plug-in development is completed; The target plug-in script is a plug-in script generated for the first time for a newly developed plug-in of the Web application or a plug-in script generated by modifying an existing plug-in script.
9. A plug-in development device for a Web application, characterized in that: Applied to a development terminal, the development terminal includes a browser and a plug-in development service provided by a plug-in development scaffold, the device is used to implement the plug-in development method for a Web application according to any one of claims 1 to 5, and the plug-in development device for a Web application includes: A browser module, configured to open a web page through the browser; wherein the web page is injected with target code, and the target code is generated by code obfuscation based on the latest SDK source code of the web application; A development service module, configured to obtain a target plug-in script through the plug-in development service; wherein the target plug-in script is a plug-in script generated for the first time for a newly developed plug-in for the Web application or a plug-in script generated by modifying an existing plug-in script; A rendering module is used to send the target plug-in script to the Web page through the browser, and render and display content in the Web page according to the target code and the target plug-in script.
10. A plug-in development device for a Web application, characterized in that: Applied to a server, the server including a web application, the device being used to implement the web application plug-in development method according to any one of claims 6 to 8, the web application plug-in development device comprising: A judgment module is used to receive a web address of the web application accessed by a development terminal through a browser, and judge whether the accessed web address carries tag information; A generation module, configured to generate a target code if the web address carries tag information; the target code is generated by performing code obfuscation based on the latest SDK source code of the web application; The injection module is used to inject the target code into the response information of accessing the Web application, and send the response information to the browser so that the browser can open the Web page injected with the target code.
11. An electronic device comprising 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 steps of the method for developing a plug-in for a Web application according to any one of claims 1 to 8 are implemented.
12. A non-transitory readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for developing a plug-in for a Web application as claimed in any one of claims 1 to 8 are implemented.
13. A computer program, characterized in that When the computer program is executed by a processor, the steps of the method for developing a plug-in for a Web application as claimed in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Plug-in-based building method and system for Web application, and server
CN107291458A
Page display method and device
CN111459580A