CN113190228A - Method and device for generating script file and computer storage medium - Google Patents

Method and device for generating script file and computer storage medium Download PDF

Info

Publication number
CN113190228A
CN113190228A CN202110528353.9A CN202110528353A CN113190228A CN 113190228 A CN113190228 A CN 113190228A CN 202110528353 A CN202110528353 A CN 202110528353A CN 113190228 A CN113190228 A CN 113190228A
Authority
CN
China
Prior art keywords
configuration information
target site
script file
service agent
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110528353.9A
Other languages
Chinese (zh)
Other versions
CN113190228B (en
Inventor
戴馨乐
王向众
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202110528353.9A priority Critical patent/CN113190228B/en
Publication of CN113190228A publication Critical patent/CN113190228A/en
Application granted granted Critical
Publication of CN113190228B publication Critical patent/CN113190228B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present disclosure provides a method, an apparatus, and a computer storage medium for generating a script file, wherein the method includes: acquiring custom configuration information of a target site aiming at a service agent and general configuration information of the service agents of different sites; generating a script file of a service agent of the target site based on the general configuration information and the custom configuration information; and configuring or updating the service agent corresponding to the target site according to the script file. The embodiment of the disclosure can provide common general configuration information for different sites through the unified management configuration platform, and can generate the script file of the service agent of the target site by combining the user-defined configuration information of the target site and the general configuration information of each site when generating the script file of the target site, thereby reducing the development cost and improving the development efficiency.

Description

Method and device for generating script file and computer storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a script file, and a computer storage medium.
Background
With the development of internet technology, obtaining information by browsing pages has become a main way for users to obtain information.
The Service broker (Service Worker) is a script running in a background process of the browser and independent of the current web page, and after the web site registers the Service Worker, all requests of the current web site can be intercepted, and the intercepted requests are processed according to requirements, so that processing such as offline caching of a web resource file corresponding to the current web site is realized.
Generally, in order to avoid the situation that a user cannot acquire a webpage in time due to unstable network, a Service Worker script file is registered for a site corresponding to the webpage, so that the page resource file of the webpage is cached offline through the Service Worker script file; therefore, for a plurality of sites, corresponding Service Worker script files need to be developed respectively, but the development cost is high due to the mode that the corresponding Service Worker script files are developed for each site; codes with the same function can be contained in the script file corresponding to each site, so that the development process is repeated, and the development time is wasted; when there is a need to modify codes with the same function in script files corresponding to each site, developers need to modify the script files corresponding to each site, so that the modification task amount is large, and the modification efficiency is low.
Disclosure of Invention
The embodiment of the disclosure at least provides a method and a device for generating a script file and a computer storage medium.
In a first aspect, an embodiment of the present disclosure provides a method for generating a script file, including:
acquiring custom configuration information of a target site aiming at a service agent and general configuration information of the service agents of different sites;
generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information;
and configuring or updating the service agent corresponding to the target site according to the script file.
In an optional implementation manner, before obtaining the customized configuration information of the target site for the service agent, the method further includes:
and responding to the registration request of the target site, and distributing a service agent access address for the target site.
In an optional implementation manner, the allocating a service agent access address to the destination station in response to the registration request of the destination station includes:
responding a registration request of a target site, and distributing an application identifier and a service agent access address corresponding to the application identifier for the target site;
the obtaining of the user-defined configuration information of the target site for the service agent includes:
receiving user-defined configuration information which is sent by the registered target station and carries an application identifier;
generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information, wherein the script file comprises:
and after the application identifier is determined to be legal, generating a script file of the service agent of the target site based on the general configuration information and the user-defined configuration information.
In an optional implementation manner, receiving the user-defined configuration information carrying the application identifier and sent by the registered target station includes:
after the application identifier is determined to be legal, feeding back configuration page information to the target site;
and acquiring the user-defined configuration information input by the target site based on the configuration page.
In an optional embodiment, the method further comprises:
receiving a script file updating request of the target site; the script file updating request carries an application identifier and updating information of user-defined configuration information aiming at the service agent;
determining updated custom configuration information corresponding to the application identifier according to the update information;
and updating the script file of the service agent of the target site according to the updated custom configuration information.
In an optional embodiment, the method further comprises:
responding to an updating request aiming at the general configuration information, and determining the updated general configuration information;
and updating the script files of the service agents of the different sites according to the updated general configuration information.
In an optional implementation manner, configuring or updating the service agent corresponding to the target site according to the script file includes:
and storing the script file into a service agent access address corresponding to the target site.
In an optional embodiment, after storing the script file in the service agent access address corresponding to the target site, the method further includes:
and responding to a first access request of the user side for the target site, feeding back the service agent access address to the user side so that the user side can obtain a script file of the service agent of the target site based on the service agent access address, and after installing the service agent based on the script file, accessing the target site through the service agent.
In an optional embodiment, the general configuration information at least includes content delivery network CDN configuration information; the custom configuration information at least comprises page cache configuration information.
In a second aspect, an embodiment of the present disclosure provides an apparatus for generating a script file, including:
the acquisition module is used for acquiring the user-defined configuration information of the target site aiming at the service agents and the general configuration information of the service agents of different sites;
the generating module is used for generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information;
and the processing module is used for configuring or updating the service agent corresponding to the target site according to the script file.
In an alternative embodiment, the apparatus further comprises: and the first response module is used for responding the registration request of the target site and distributing the service agent access address to the target site.
In an optional implementation manner, the first response module is specifically configured to respond to a registration request of a target site, and allocate an application identifier and a service agent access address corresponding to the application identifier to the target site;
the acquisition module is specifically configured to receive custom configuration information carrying an application identifier sent by the registered target station;
the generating module is specifically configured to generate a script file of the service agent of the target site based on the general configuration information and the custom configuration information after determining that the application identifier is legal.
In an optional implementation manner, the obtaining module is specifically configured to feed back configuration page information to the target site after determining that the application identifier is legal; and acquiring the user-defined configuration information input by the target site based on the configuration page.
In an alternative embodiment, the apparatus further comprises: the updating module is used for receiving a script file updating request of the target site; the script file updating request carries an application identifier and updating information of user-defined configuration information aiming at the service agent; determining updated custom configuration information corresponding to the application identifier according to the update information; and updating the script file of the service agent of the target site according to the updated custom configuration information.
In an optional implementation manner, the update module is further configured to determine updated general configuration information in response to an update request for the general configuration information; and updating the script files of the service agents of the different sites according to the updated general configuration information.
In an optional implementation manner, the processing module is specifically configured to store the script file in a service agent access address corresponding to the target site.
In an alternative embodiment, the apparatus further comprises: and the second response module is used for responding to a first access request of the user terminal for the target site, feeding back the service agent access address to the user terminal so that the user terminal can obtain the script file of the service agent of the target site based on the service agent access address, and after installing the service agent based on the script file, accessing the target site through the service agent.
In an optional embodiment, the general configuration information at least includes content delivery network CDN configuration information; the custom configuration information at least comprises page cache configuration information.
In a third aspect, this disclosure also provides a computer device, a processor, and a memory, where the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory, and when the machine-readable instructions are executed by the processor, the machine-readable instructions are executed by the processor to perform the steps in the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, this disclosure also provides a computer-readable storage medium having a computer program stored thereon, where the computer program is executed to perform the steps in the first aspect or any one of the possible implementation manners of the first aspect.
The method, the device and the computer storage medium for generating the script file provided by the embodiment of the disclosure acquire the user-defined configuration information of the target site for the service agent and the general configuration information of the service agents of different sites; generating a script file of a service agent of the target site based on the general configuration information and the custom configuration information; configuring or updating a service agent corresponding to the target site according to the script file; in the embodiment of the disclosure, the unified management configuration platform can provide common general configuration information for different sites, and when the script file of the target site is generated, the script file of the service agent of the target site can be generated by combining the user-defined configuration information of the target site and the general configuration information of each site, so that the development cost is reduced, and the development efficiency is improved.
In the embodiment of the disclosure, codes with the same function in the script file of the service agent of each site are configured into the general configuration information, so that when the script file of the service agent of each site is generated, the development process of repeated content is reduced, the development time is saved, and if the requirement for modifying the codes with the same function in the script file of the service agent of each site exists, developers only need to adjust the general configuration information, and do not need to modify the script files corresponding to each site, thereby reducing the modification task amount and improving the modification efficiency.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly described below, and the drawings herein incorporated in and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the technical solutions of the present disclosure. It is appreciated that the following drawings depict only certain embodiments of the disclosure and are therefore not to be considered limiting of its scope, for those skilled in the art will be able to derive additional related drawings therefrom without the benefit of the inventive faculty.
FIG. 1 is a flow chart illustrating a method for script file generation provided by an embodiment of the present disclosure;
fig. 2 is a schematic flowchart illustrating a process of determining a service agent access address corresponding to a target site in a method for generating a script file according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a configuration page of custom configuration information in a method for generating a script file according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating an apparatus for generating a script file provided by an embodiment of the present disclosure;
fig. 5 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, not all of the embodiments. The components of embodiments of the present disclosure, as generally described and illustrated herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the disclosure without making creative efforts, shall fall within the protection scope of the disclosure.
The Service agent Service Worker is a script which is independent of the current page and runs in the background process of the browser, and after the Service Worker is registered in the website, all requests of the current website can be intercepted, and the intercepted requests are processed according to requirements.
Generally, in order to avoid the situation that a user cannot acquire a webpage in time due to unstable network, a Service Worker script file is registered for a site corresponding to the webpage, so that the page resource file of the webpage is cached offline through the Service Worker script file; therefore, the staff can respectively develop the corresponding Service Worker script files for a plurality of sites existing in the company, but the development cost is higher due to the mode of developing the corresponding Service Worker script files for each site; codes with the same function can be contained in the script file corresponding to each site, so that the development process is repeated, and the development time is wasted; when there is a need to modify codes with the same function in script files corresponding to each site, developers need to modify the script files corresponding to each site, so that the modification task amount is large, and the modification efficiency is low.
Therefore, the present disclosure provides a method and an apparatus for generating a script file, and a computer storage medium, which can provide common general configuration information for different sites through a unified management configuration platform, and when generating a script file of a target site, can generate a script file of a service agent of the target site by combining the customized configuration information of the target site and the general configuration information of each site, thereby reducing development cost and improving development efficiency; in addition, in the embodiment of the present disclosure, the codes with the same function in the script file of the service agent of each site are configured to be the general configuration information, so that when the script file of the service agent of each site is generated, a development process of repeated content is reduced, development time is saved, and if there is a need to modify the codes with the same function in the script file of the service agent of each site, a developer only needs to adjust the general configuration information, and does not need to modify the script files corresponding to each site, thereby reducing modification task load and improving modification efficiency.
The discovery process and the solution process of the above problems are the results of the inventor after practice and careful study, therefore, the discovery process of the above problems and the solution proposed by the present disclosure to the above problems in the following should be the contribution of the inventor to the present disclosure in the process of the present disclosure.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
To facilitate understanding of the present embodiment, first, a method for generating a script file disclosed in the embodiments of the present disclosure is described in detail, where an execution subject of the method for generating a script file provided in the embodiments of the present disclosure is generally a computer device with certain computing capability, and the computer device includes, for example: a server or other processing device. In some possible implementations, the method of script file generation may be implemented by a processor calling computer readable instructions stored in a memory.
In the following, a description will be first given of several technical terms involved in the embodiments of the present disclosure.
The service agent refers to a task which runs at the browser end and is processed under the condition that the page display of the browser end is not influenced, and for example, the service agent can comprise a timed update task, a message notification push task and a page cache task; in the embodiment of the present disclosure, the Service agent may include a Service Worker, that is, the Service Worker is a task that can be executed in the background without performing page interaction with the browser; the browser end may be an independent web browser or a browser module embedded in an application program.
The script file of the Service agent (i.e. the script file of the Service Worker) is a browser-side proxy script written by Javascript, and is a script running in a background process of a browser. The script file of the service agent may be characterized in sw.
The following describes a method for generating a script file according to an embodiment of the present disclosure, taking an execution subject as a server as an example.
Referring to fig. 1, a flowchart of a method for generating a script file provided by an embodiment of the present disclosure is shown, where the method includes steps S101 to S103, where:
s101, obtaining the user-defined configuration information of the target site aiming at the service agent and the general configuration information of the service agents of different sites.
The target site may be any one of a plurality of websites, such as www.a.com, developed by company content.
Here, the custom configuration information is determined according to the development requirements of each site, and is used to configure a domain name that needs to be intercepted and a processing operation performed on the intercepted domain name.
The general configuration information at least includes Content Delivery Network (CND) configuration information, where the CND is a server system, and the server system includes a plurality of servers located in different geographic regions, and is used for caching hypertext markup Language (HTML), script (JavaScript, JS), Cascading Style Sheets (CSSs), images, and other static resources of a website; the CDN configuration information is used to configure the storage location information for the HTML, JS, CSS, images and other static resources of the web page. Here, the general configuration information may be determined according to development requirements of different sites, and the general server may pre-configure the general configuration information of the service agents of the different sites.
Here, a service agent access address is first assigned to the destination site in response to a registration request from the destination site.
Specifically, the server firstly responds to a registration request of a target site, and allocates an application identifier and a service agent access address corresponding to the application identifier for the target site; and after the target station is successfully registered, receiving the user-defined configuration information which is sent by the registered target station and carries the application identifier.
In the embodiment of the present disclosure, the Application identifier may be represented by an Application Identity document (app id); the service agent access address is used to characterize the storage location of the script file for the service agent at the target site.
Specifically, after receiving a registration request of a target site, a server responds to the registration request of the target site, allocates an AppId to the target site, creates a storage folder for storing a script file of a Service Worker of the target site, and determines a Service agent access address corresponding to the target site according to the address of the storage folder.
Illustratively, the server assigns an AppId to site 1 after receiving registration requests of site 1 and site 2: 12345, and creating a storage folder 12345 for storing the script file of the Service Worker of the site 1 for the site 1, if the address of the storage folder 12345 is 12345/sw.js; determining the access address of the service agent corresponding to the target site as https:// cdn.xxx.com/12345/sw.js according to 12345/sw.js; similarly, site 2 is assigned an AppId: creating a storage folder abcd for the site 2, wherein the storage folder abcd stores the script file of the Service Worker of the site 2, and if the address of the storage folder abcd is abcd/sw.js; then, according to abcd/sw.js, the service agent access address corresponding to the target site is determined to be https:// cdn.xxx.com/abcd/sw.js, and a specific flow diagram for determining the service agent access address corresponding to the target site may be as shown in fig. 2.
Here, after determining that the application identifier of the target site is legal, feeding back configuration page information to the target site, and presenting a configuration page for inputting custom configuration information at a server of the target site; and acquiring the user-defined configuration information input by the target site based on the configuration page.
In specific implementation, the server detects the legality of the application identifier allocated to the target site, after the application identifier of the target site is determined to be legal, the configuration page information can be sent to the target site, so that the server side of the target site can display the configuration page for inputting the custom configuration information to developers after receiving the configuration page information, the developers can send the custom configuration information to the server after inputting the custom configuration information into the configuration page for inputting the custom configuration information, and the server can obtain the custom configuration information input by the target site based on the configuration page.
For example, a configuration page for inputting the custom configuration information may be as shown in fig. 3, and the configuration page may include a domain name input area that needs to be intercepted and a processing operation input area that needs to be performed for each domain name that needs to be intercepted.
In a specific implementation, after the user-defined configuration information of the target site and the pre-configured general configuration information of the service agents of different sites are obtained based on step S101, sw.js of the target site may be generated based on the user-defined configuration information and the general configuration information, and the specific description refers to step S102 described below.
S102, generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information.
In a specific implementation, after determining that the application identifier of the target station is legal, the sw.js of the target station is generated according to the general configuration information acquired in step S101 and the custom configuration information of the target station.
S103, configuring or updating the service agent corresponding to the target site according to the script file.
Here, when the service agent corresponding to the target site is configured or updated according to the sw.js of the target site generated in step S102, the sw.js of the target site may be stored in the service agent access address corresponding to the target site, so that the server may feed back the service agent access address corresponding to the target site to the user side when receiving the first access request sent by the user side, so that the user side may obtain the sw.js of the target site according to the obtained service agent access address; in an alternative embodiment, the server may actively distribute the sw.js of the target site generated according to step S102 to the user terminal accessing the target site.
After the target site sw.js is generated based on step S102, the target site sw.js may be stored in a storage folder corresponding to the target site, and the access address of the target site sw.js may be determined based on the storage location of the target site sw.js.
Illustratively, if the storage folder 12345 is created for the target site to store the sw.js of the target site, the sw.js of the target site generated in step S102 is stored in the storage folder 12345, and the service agent access address corresponding to the target site is determined to be https:// cdn.xxx.com/12345/sw.js according to the storage location of the sw.js of the target site.
In specific implementation, after determining the access address of the target site sw.js, the server can receive a first access request of the user terminal for the target site, respond to the first access request of the user terminal for the target site, and feed back the Service agent access address of the target site to the user terminal, so that the user terminal can obtain the sw.js of the target site based on the Service agent access address, the user terminal can install a Service Worker based on the obtained sw.js of the target site, and after the installation is successful, the target site can be accessed through the Service Worker.
After a user side installs a Service Worker, timely obtaining the sw.js of a target site from a server based on a Service agent access address of the target site, and detecting whether the installed Service Worker needs to be updated or not by comparing whether the obtained sw.js of the target site is consistent with the obtained sw.js of the target site when the Service Worker is installed or not; when the obtained sws.js of the target site at fixed time is consistent with the obtained sws.js of the target site when the Service Worker is installed, the Service Worker does not need to be installed again; when the obtained sw.js of the target station at fixed time is not consistent with the obtained sw.js of the target station when the Service Worker is installed, the installed Service Worker needs to be updated according to the obtained sw.js of the target station at fixed time.
In an alternative embodiment, when there is a need to update the script file of the service agent of the target site, the server may update the script file of the service agent of the target site according to the updated general configuration information and/or the updated custom configuration information.
In specific implementation, after adding/modifying/deleting custom configuration information in a configuration page for inputting the custom configuration information for a developer, a server of a target site may send a script file update request (where the script file update request carries an application identifier and update information of the custom configuration information for a service agent) of the target site to a server, and the server receives the application identifier of the target site and the update information of the custom configuration information of the service agent; the server determines updated custom configuration information corresponding to the application identifier according to the updating information of the custom configuration information of the service agent; and then, updating the sw.js of the target site stored in the service agent access address corresponding to the application identifier according to the updated custom configuration information.
In specific implementation, if a manager adds/modifies/deletes the general configuration information in a general information configuration page of a Service Worker configuration platform, an update request for the general configuration information is generated and sent to a Service Worker configuration platform server, the Service Worker configuration platform server responds to the update request for the general configuration information, determines the updated general configuration information, and updates sw.js respectively corresponding to Service agents of different sites according to the updated general configuration information.
For example, if the general configuration information of the service proxies for different sites configured in the server includes the CDN domain name: cd.a.com, cd.b.com, cd.c.com; if the script files of the service agents corresponding to the site 1 and the site 2 are generated based on the general configuration information of the service agents of different sites and the custom configuration information corresponding to the site 1 and the site 2, respectively, and the script files of the service agents of the site 1 are stored in the service agent access address corresponding to the site 1: and under https:// cdn.xxx.com/12345/sw.js, storing the script file of the service agent of the site 2 at the service agent access address corresponding to the site 2: https:// cdn.xxx.com/abcd/sw.js; com, when the cdn.c.com is sealed, the server determines that the updated general configuration information is: cd.a.com, cd.b.com; then, the corresponding service agent access address at site 1: finding the script file of the service agent of the site 1 under https:// cdn.xxx.com/12345/sw.js, and updating the script file of the service agent of the site 1 based on the updated general configuration information; similarly, the access address of the service agent corresponding to the site 2: finding the script file of the service agent of the site 2 under https:// cdn.xxx.com/abcd/sw.js, and updating the script file of the service agent of the site 2 based on the updated general configuration information; the CDN domain name in the script file of the service agent of each site is configured to be the general configuration information, and when the CDN domain name is converted, the server can automatically update the script file of the service agent of each site according to the update result of the CDN domain name, so that developers do not need to respectively modify the script file corresponding to each site, the modification task amount of the developers is reduced, and the modification efficiency is improved.
In the embodiment of the disclosure, user-defined configuration information of a target site for a service agent and general configuration information of the service agents of different sites are obtained; generating a script file of a service agent of the target site based on the general configuration information and the custom configuration information; configuring or updating a service agent corresponding to the target site according to the script file; in the embodiment of the disclosure, the unified management configuration platform can provide common general configuration information for different sites, and when the script file of the target site is generated, the script file of the service agent of the target site can be generated by combining the user-defined configuration information of the target site and the general configuration information of each site, so that the development cost is reduced, and the development efficiency is improved.
In addition, in the embodiment of the present disclosure, the codes with the same function in the script file of the service agent of each site are configured to be the general configuration information, so that when the script file of the service agent of each site is generated, a development process of repeated content is reduced, development time is saved, and if there is a need to modify the codes with the same function in the script file of the service agent of each site, a developer only needs to adjust the general configuration information, and does not need to modify the script files corresponding to each site, thereby reducing modification task load and improving modification efficiency.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same inventive concept, the embodiment of the present disclosure further provides a device for generating a script file corresponding to the method for generating a script file, and since the principle of solving the problem of the device in the embodiment of the present disclosure is similar to the method for generating a script file in the embodiment of the present disclosure, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 4, a schematic diagram of an apparatus 400 for generating a script file according to an embodiment of the present disclosure is shown, where the apparatus includes: an acquisition module 401, a generation module 402, and a processing module 403; wherein the content of the first and second substances,
the obtaining module 401 is configured to obtain the customized configuration information of the target site for the service agent and the general configuration information of the service agents of different sites.
A generating module 402, configured to generate a script file of the service agent of the target site based on the general configuration information and the custom configuration information.
And the processing module 403 is configured to configure or update the service agent corresponding to the target site according to the script file.
In an alternative embodiment, the apparatus further comprises: and the first response module is used for responding the registration request of the target site and distributing the service agent access address to the target site.
In an optional implementation manner, the first response module is specifically configured to respond to a registration request of a target site, and allocate an application identifier and a service agent access address corresponding to the application identifier to the target site.
The obtaining module 401 is specifically configured to receive the user-defined configuration information carrying the application identifier and sent by the registered target station.
The generating module 402 is specifically configured to generate a script file of the service agent of the target site based on the general configuration information and the custom configuration information after determining that the application identifier is legal.
In an optional implementation manner, the obtaining module 401 is specifically configured to feed back configuration page information to the target site after determining that the application identifier is legal; and acquiring the user-defined configuration information input by the target site based on the configuration page.
In an alternative embodiment, the apparatus further comprises: the updating module is used for receiving a script file updating request of the target site; the script file updating request carries an application identifier and updating information of user-defined configuration information aiming at the service agent; determining updated custom configuration information corresponding to the application identifier according to the update information; and updating the script file of the service agent of the target site according to the updated custom configuration information.
In an optional implementation manner, the update module is further configured to determine updated general configuration information in response to an update request for the general configuration information; and updating the script files of the service agents of the different sites according to the updated general configuration information.
In an optional implementation manner, the processing module 403 is specifically configured to store the script file in a service agent access address corresponding to the target site.
In an alternative embodiment, the apparatus further comprises: and the second response module is used for responding to a first access request of the user terminal for the target site, feeding back the service agent access address to the user terminal so that the user terminal can obtain the script file of the service agent of the target site based on the service agent access address, and after installing the service agent based on the script file, accessing the target site through the service agent.
In an optional embodiment, the general configuration information at least includes content delivery network CDN configuration information; the custom configuration information at least comprises page cache configuration information.
In the embodiment of the disclosure, the unified management configuration platform can provide common general configuration information for different sites, and when the script file of the target site is generated, the script file of the service agent of the target site can be generated by combining the user-defined configuration information of the target site and the general configuration information of each site, so that the development cost is reduced, and the development efficiency is improved. In addition, in the embodiment of the present disclosure, the codes with the same function in the script file of the service agent of each site are configured to be the general configuration information, so that when the script file of the service agent of each site is generated, a development process of repeated content is reduced, development time is saved, and if there is a need to modify the codes with the same function in the script file of the service agent of each site, a developer only needs to adjust the general configuration information, and does not need to modify the script files corresponding to each site, thereby reducing modification task load and improving modification efficiency.
The description of the processing flow of each module in the device and the interaction flow between the modules may refer to the related description in the above method embodiments, and will not be described in detail here.
Based on the same technical concept, the embodiment of the application also provides computer equipment. Referring to fig. 5, a schematic structural diagram of a computer device 500 provided in the embodiment of the present application includes a processor 501, a memory 502, and a bus 503. The memory 502 is used for storing execution instructions and includes a memory 5021 and an external memory 5022; the memory 5021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 501 and data exchanged with an external storage 5022 such as a hard disk, the processor 501 exchanges data with the external storage 5022 through the memory 5021, and when the computer 500 operates, the processor 501 communicates with the storage 502 through the bus 503, so that the processor 501 executes the following instructions:
acquiring custom configuration information of a target site aiming at a service agent and general configuration information of the service agents of different sites;
generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information;
and configuring or updating the service agent corresponding to the target site according to the script file.
The specific processing flow of the processor 501 may refer to the description of the above method embodiment, and is not described herein again.
The embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, executes the steps of the method for generating a script file described in the above method embodiments. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute steps of the method for generating a script file in the foregoing method embodiments, which may be referred to specifically for the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present disclosure, which are used for illustrating the technical solutions of the present disclosure and not for limiting the same, and the scope of the present disclosure is not limited thereto, and although the present disclosure is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive of the technical solutions described in the foregoing embodiments or equivalent technical features thereof within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present disclosure, and should be construed as being included therein. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (12)

1. A method for generating a script file, comprising:
acquiring custom configuration information of a target site aiming at a service agent and general configuration information of the service agents of different sites;
generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information;
and configuring or updating the service agent corresponding to the target site according to the script file.
2. The method of claim 1, wherein before obtaining the customized configuration information of the target site for the service agent, further comprising:
and responding to the registration request of the target site, and distributing a service agent access address for the target site.
3. The method of claim 2, wherein assigning a service agent access address to the destination site in response to the destination site's registration request comprises:
responding a registration request of a target site, and distributing an application identifier and a service agent access address corresponding to the application identifier for the target site;
the obtaining of the user-defined configuration information of the target site for the service agent includes:
receiving user-defined configuration information which is sent by the registered target station and carries an application identifier;
generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information, wherein the script file comprises:
and after the application identifier is determined to be legal, generating a script file of the service agent of the target site based on the general configuration information and the user-defined configuration information.
4. The method according to claim 3, wherein receiving the user-defined configuration information carrying the application identifier sent by the registered target station comprises:
after the application identifier is determined to be legal, feeding back configuration page information to the target site;
and acquiring the user-defined configuration information input by the target site based on the configuration page.
5. The method according to claim 3 or 4, characterized in that the method further comprises:
receiving a script file updating request of the target site; the script file updating request carries an application identifier and updating information of user-defined configuration information aiming at the service agent;
determining updated custom configuration information corresponding to the application identifier according to the update information;
and updating the script file of the service agent of the target site according to the updated custom configuration information.
6. The method according to claim 3 or 4, characterized in that the method further comprises:
responding to an updating request aiming at the general configuration information, and determining the updated general configuration information;
and updating the script files of the service agents of the different sites according to the updated general configuration information.
7. The method of claim 1, wherein configuring or updating the service agent corresponding to the target site according to the script file comprises:
and storing the script file into a service agent access address corresponding to the target site.
8. The method of claim 7, wherein after storing the script file in the service agent access address corresponding to the target site, further comprising:
and responding to a first access request of the user side for the target site, feeding back the service agent access address to the user side so that the user side can obtain a script file of the service agent of the target site based on the service agent access address, and after installing the service agent based on the script file, accessing the target site through the service agent.
9. The method of claim 1, wherein the generic configuration information comprises at least Content Delivery Network (CDN) configuration information; the custom configuration information at least comprises page cache configuration information.
10. An apparatus for script file generation, comprising:
the acquisition module is used for acquiring the user-defined configuration information of the target site aiming at the service agents and the general configuration information of the service agents of different sites;
the generating module is used for generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information;
and the processing module is used for configuring or updating the service agent corresponding to the target site according to the script file.
11. A computer device, comprising: a processor, a memory storing machine readable instructions executable by the processor, the processor for executing the machine readable instructions stored in the memory, the processor performing the steps of the method of script file generation as claimed in any one of claims 1 to 9 when the machine readable instructions are executed by the processor.
12. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when executed by a computer device, performs the steps of the method of script file generation as claimed in any one of claims 1 to 9.
CN202110528353.9A 2021-05-14 2021-05-14 Script file generation method and device and computer storage medium Active CN113190228B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110528353.9A CN113190228B (en) 2021-05-14 2021-05-14 Script file generation method and device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110528353.9A CN113190228B (en) 2021-05-14 2021-05-14 Script file generation method and device and computer storage medium

Publications (2)

Publication Number Publication Date
CN113190228A true CN113190228A (en) 2021-07-30
CN113190228B CN113190228B (en) 2024-01-26

Family

ID=76981869

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110528353.9A Active CN113190228B (en) 2021-05-14 2021-05-14 Script file generation method and device and computer storage medium

Country Status (1)

Country Link
CN (1) CN113190228B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580540A (en) * 2013-10-09 2015-04-29 腾讯科技(深圳)有限公司 Method and device for achieving website access
CN105447198A (en) * 2015-12-30 2016-03-30 深圳市瑞铭无限科技有限公司 Convenient page script importing method and device
CN105635338A (en) * 2015-12-31 2016-06-01 迈普通信技术股份有限公司 Data transmission method and device
CN108153533A (en) * 2016-12-02 2018-06-12 腾讯科技(深圳)有限公司 The method and apparatus of fabrication and installation program, the installation method of program and device
CN108228282A (en) * 2018-04-04 2018-06-29 北京三快在线科技有限公司 For the method and device of Website page loading
CN108958729A (en) * 2017-05-19 2018-12-07 腾讯科技(深圳)有限公司 A kind of data processing method, device and storage medium
CN111953811A (en) * 2020-08-07 2020-11-17 腾讯科技(深圳)有限公司 Site access method, site registration method, device, equipment and storage medium
US10936662B1 (en) * 2017-05-02 2021-03-02 Amazon Technologies, Inc. Detection of automated agents through interaction element presentation
CN112637346A (en) * 2020-12-24 2021-04-09 北京知道创宇信息技术股份有限公司 Proxy method, device, proxy server and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580540A (en) * 2013-10-09 2015-04-29 腾讯科技(深圳)有限公司 Method and device for achieving website access
CN105447198A (en) * 2015-12-30 2016-03-30 深圳市瑞铭无限科技有限公司 Convenient page script importing method and device
CN105635338A (en) * 2015-12-31 2016-06-01 迈普通信技术股份有限公司 Data transmission method and device
CN108153533A (en) * 2016-12-02 2018-06-12 腾讯科技(深圳)有限公司 The method and apparatus of fabrication and installation program, the installation method of program and device
US10936662B1 (en) * 2017-05-02 2021-03-02 Amazon Technologies, Inc. Detection of automated agents through interaction element presentation
CN108958729A (en) * 2017-05-19 2018-12-07 腾讯科技(深圳)有限公司 A kind of data processing method, device and storage medium
CN108228282A (en) * 2018-04-04 2018-06-29 北京三快在线科技有限公司 For the method and device of Website page loading
CN111953811A (en) * 2020-08-07 2020-11-17 腾讯科技(深圳)有限公司 Site access method, site registration method, device, equipment and storage medium
CN112637346A (en) * 2020-12-24 2021-04-09 北京知道创宇信息技术股份有限公司 Proxy method, device, proxy server and storage medium

Also Published As

Publication number Publication date
CN113190228B (en) 2024-01-26

Similar Documents

Publication Publication Date Title
RU2673403C2 (en) Website access method, device and website system
US10419289B2 (en) System and method for configuration management service
WO2017113963A1 (en) Static webpage processing method and device
JP6081472B2 (en) System and method for managing a dedicated cache
CA2839006C (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
JP6404816B2 (en) Method and apparatus for responding to web page access request
CN106528578B (en) Information display method and device
CN110365724B (en) Task processing method and device and electronic equipment
CN109144619B (en) Icon font information processing method, device and system
CN111092921B (en) Data acquisition method, device and storage medium
EP3528474B1 (en) Webpage advertisement anti-shielding methods and content distribution network
CN111510330A (en) Interface management apparatus, method and storage medium
CN103338233A (en) Load balancing device, Web server, request information processing method and system
JP2010272090A (en) Device, program and method for managing processing request destination
US20160352858A1 (en) Plug-in cache
CN110874445A (en) Webpage loading method, client and business service center
CN113114515A (en) Resource file configuration method and device
CN113190228B (en) Script file generation method and device and computer storage medium
CN111753226A (en) Page loading method and device
CN107918552B (en) Light application calling method and device, client device and electronic equipment
CN113536168B (en) Component processing method and device
US20140143646A1 (en) Systems and methods for dynamic external document content
CN111368237B (en) Distributed website cache staticizing method, server and system
CN114579167A (en) Method, device and storage medium for downloading application upgrade file
CN111124482B (en) Configuration method and device for document information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: Tiktok vision (Beijing) Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Applicant before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant