CN113190228B - Script file generation method and device and computer storage medium - Google Patents

Script file generation method and device and computer storage medium Download PDF

Info

Publication number
CN113190228B
CN113190228B CN202110528353.9A CN202110528353A CN113190228B CN 113190228 B CN113190228 B CN 113190228B CN 202110528353 A CN202110528353 A CN 202110528353A CN 113190228 B CN113190228 B CN 113190228B
Authority
CN
China
Prior art keywords
configuration information
target site
service agent
script file
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.)
Active
Application number
CN202110528353.9A
Other languages
Chinese (zh)
Other versions
CN113190228A (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.)
Douyin Vision Co Ltd
Original Assignee
Douyin Vision 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 Douyin Vision Co Ltd filed Critical Douyin Vision 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

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, apparatus, and computer storage medium for script file generation, wherein the method includes: acquiring custom configuration information of a target site aiming at a service agent and general configuration information of 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. According to the embodiment of the disclosure, the common general configuration information can be provided for different sites through the unified management configuration platform, 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 custom 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.

Description

Script file generation method and device and computer storage medium
Technical Field
The disclosure relates to the technical field of computers, and in particular relates to a method and a device for generating a script file and a computer storage medium.
Background
With the development of internet technology, information acquisition by browsing pages has become a major way for users to acquire information.
The Service agent (Service workbench) is a script which runs in a background process of the browser and is independent of the current page, after the Service workbench is registered in the website, all requests of the current website can be intercepted, and the intercepted requests are processed according to requirements, so that the processing such as offline caching and the like of page resource files corresponding to the current website is realized.
Generally, in order to avoid the situation that a user cannot acquire a webpage in time due to unstable network, a Service workbench script file is registered for a site corresponding to the webpage, so that an offline cache is performed on a webpage resource file of the webpage through the Service workbench script file; therefore, corresponding Service workbench script files need to be developed for a plurality of sites respectively, but the mode of developing the corresponding Service workbench script files for each site has high development cost; codes with the same function are arranged in script files corresponding to each site, so that repeatability exists in the development process, and development time is wasted; when the requirement of modifying codes with the same function in script files corresponding to all sites exists, developers need to modify the script files corresponding to all sites respectively, the modification task amount is large, and the modification efficiency is low.
Disclosure of Invention
The embodiment of the disclosure at least provides a script file generation method, a script file generation device 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 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.
In an optional implementation manner, before obtaining the custom 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 alternative embodiment, the allocating a service agent access address to the target station in response to the registration request of the target station includes:
responding to a registration request of a target site, and distributing an application identifier and a service agent access address corresponding to the application identifier to the target site;
The obtaining the custom configuration information of the target site for the service agent includes:
receiving user-defined configuration information carrying an application identifier and sent by the registered target site;
the generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information includes:
and after determining that the application identification is legal, generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information.
In an optional implementation manner, receiving the user-defined configuration information carrying the application identifier and sent by the target site after registration includes:
after the application identification is determined to be legal, feeding back configuration page information to the target site;
and acquiring the custom configuration information input by the target site based on the configuration page.
In an alternative embodiment, the method further comprises:
receiving a script file updating request of the target site; the script file update request carries an application identifier and update information of user-defined configuration information aiming at a service agent;
according to the update information, updated custom configuration information corresponding to the application identifier is determined;
And updating the script file of the service agent of the target site according to the updated custom configuration information.
In an alternative embodiment, the method further comprises:
responding to the update request aiming at the general configuration information, and determining updated general configuration information;
and updating script files of service agents of different sites according to the updated general configuration information.
In an alternative embodiment, 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 alternative 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 terminal for the target site, and feeding back the service agent access address to the user terminal, so that the user terminal obtains a script file of the service agent of the target site based on the service agent access address, installs the service agent based on the script file, and accesses the target site through the service agent.
In an alternative embodiment, the generic configuration information includes at least 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 custom configuration information of the target site aiming at the service agent and the general configuration information of the service agents of different sites;
the generation 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 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 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 user-defined configuration information carrying an application identifier sent by the registered target site;
the generation module is specifically configured to generate a script file of a 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 acquiring 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 custom 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 update request carries an application identifier and update information of user-defined configuration information aiming at a service agent; according to the update information, updated custom configuration information corresponding to the application identifier is determined; 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 updating module is further configured to determine updated general configuration information in response to an update request for the general configuration information; and updating script files of service agents of different sites according to the updated general configuration information.
In an alternative embodiment, the processing module is specifically configured to store the script file in a service proxy 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 the first access request of the user terminal aiming at the target site, feeding back the service agent access address to the user terminal so that the user terminal can acquire the script file of the service agent of the target site based on the service agent access address, and after the service agent is installed based on the script file, accessing the target site through the service agent.
In an alternative embodiment, the generic configuration information includes at least content delivery network CDN configuration information; the custom configuration information at least comprises page cache configuration information.
In a third aspect, an optional implementation manner of the disclosure further 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, where the machine-readable instructions, when executed by the processor, perform the steps in the first aspect, or any possible implementation manner of the first aspect, when executed by the processor.
In a fourth aspect, an alternative implementation of the present disclosure further provides a computer readable storage medium having stored thereon a computer program which when executed performs the steps of the first aspect, or any 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 custom configuration information of a target site aiming at 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 custom 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 files of the service agents of each site are configured into the universal configuration information, so that the development process of repeated content is reduced when the script files of the service agents of each site are generated, the development time is saved, and if the requirement of modifying the codes with the same function in the script files of the service agents of each site exists, a developer only needs to adjust the universal configuration information, does not need to modify the script files corresponding to each site respectively, thereby reducing the modification task amount and improving the modification efficiency.
The foregoing objects, features and advantages of the disclosure will be more readily apparent from the following detailed description of the preferred embodiments taken in conjunction with the accompanying drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the embodiments are briefly described below, which are incorporated in and constitute a part of the specification, these drawings showing embodiments consistent with the present disclosure and together with the description serve to illustrate the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of its scope, for the person of ordinary skill in the art may admit to other equally relevant drawings without inventive effort.
FIG. 1 illustrates a flow chart of a method of script file generation provided by embodiments of the present disclosure;
fig. 2 is a schematic flow chart 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 of 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 illustrates a schematic diagram of an apparatus for script file generation provided by embodiments of the present disclosure;
fig. 5 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the disclosed embodiments 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 made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
The Service agent Service workbench is a script which runs in a background process of the browser and is independent of the current page, after the Service workbench is registered in the website, all requests of the current website can be intercepted, and the intercepted requests can be 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 workbench script file is registered for a site corresponding to the webpage, so that an offline cache is performed on a webpage resource file of the webpage through the Service workbench script file; therefore, the staff can develop corresponding Service workbench script files for a plurality of sites existing in the company respectively, but the mode of developing the corresponding Service workbench script files for each site has higher development cost; codes with the same function are arranged in script files corresponding to each site, so that repeatability exists in the development process, and development time is wasted; when the requirement of modifying codes with the same function in script files corresponding to all sites exists, a developer needs to modify the script files corresponding to all sites, the modification task amount is large, and the modification efficiency is low.
Therefore, the present disclosure provides a method, an apparatus, and a computer storage medium for generating a script file, which can provide common general configuration information for different sites through a unified management configuration platform, and can combine custom configuration information of a target site and general configuration information of each site to generate a script file of a service agent of the target site when generating the script file of the target site, thereby reducing development cost and improving development efficiency; in addition, in the embodiment of the disclosure, codes with the same function in the script files of the service agents of each site are configured into the universal configuration information, so that when the script files of the service agents of each site are generated, the development process of repeated content is reduced, the development time is saved, and if the requirement of modifying the codes with the same function in the script files of the service agents of each site exists, a developer only needs to adjust the universal configuration information, does not need to modify the script files corresponding to each site respectively, the modification task amount is reduced, and the modification efficiency is improved.
The discovery process and the solution process of the above problems are the results obtained by the inventor after practice and careful study, and therefore, the discovery process of the above problems and the solutions proposed by the present disclosure hereinafter for the above problems should be all contributions of the inventor to the present disclosure in the process of the present disclosure.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
For the sake of understanding the present embodiment, first, a detailed description will be given of a method for generating a script file disclosed in the present embodiment, where an execution subject of the method for generating a script file provided in the present embodiment is generally a computer device having a 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 way of a processor invoking computer readable instructions stored in a memory.
In the following, several technical terms related to the embodiments of the present disclosure will be explained first.
The service agent is a task which is operated at the browser end and is processed under the condition of not influencing the page display at the browser end, and for example, the service agent can comprise a timing update task, a message notification pushing task and a page cache task; in the embodiment of the disclosure, the Service agent may include a Service workbench, that is, the Service workbench is a task that can be executed in the background without performing page interaction with the browser; the browser end can be an independent webpage browser or a browser module embedded into an application program.
The script file of the Service agent (namely, the script file of the Service workbench) is a browser-side agent script written by Javascript, and is a section of script running in a background process of the browser. The script file of the service agent may be characterized by sw.js.
The method for generating the script file provided in the embodiment of the present disclosure will be described below by taking the execution subject as a server as an example.
Referring to fig. 1, a flowchart of a method for generating a script file according to an embodiment of the present disclosure is shown, where the method includes steps S101 to S103, where:
s101, acquiring custom configuration information of a target site for a service agent and general configuration information of service agents of different sites.
The target site may be any one of a plurality of websites developed by company content, for example, www.a.com.
Here, the custom configuration information is determined according to development requirements of each site, and is used for configuring a domain name to be intercepted and performing a processing operation on the intercepted domain name.
Wherein the general configuration information includes at least content distribution network (Content Delivery Network, CND) configuration information, where CND is a server system including a plurality of servers located in different geographical areas for caching hypertext markup language (Hyper TextMarkup Language, HTML), scripts (JavaScript, JS), cascading style sheets (Cascading Style Sheets, CSS), images and other static resources of the web site; CDN configuration information is used to configure storage location information for the HTML, JS, CSS, image and other static resources of the web page. Here, the general configuration information may be general configuration information determined according to development requirements of different sites, and a general server may pre-configure service agents of the different sites.
Here, first, a service agent access address is assigned to a target station in response to a registration request of the target station.
Specifically, a server firstly responds to a registration request of a target site, and distributes an application identifier and a service agent access address corresponding to the application identifier for the target site; after the target site is successfully registered, receiving the user-defined configuration information carrying the application identifier and sent by the registered target site.
The application identifier is a unique identifier of each target site and is used for distinguishing each target site, and in the embodiment of the disclosure, the application identifier can be characterized by an application identity identifier number (Application Identity document, appId); the service agent access address is used to characterize the storage location of the script file of the service agent of the target site.
Specifically, after receiving a registration request of a target site, the server responds to the registration request of the target site, allocates an AppId for 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 an address where the storage folder is located.
Illustratively, the server, upon receiving registration requests for site 1 and site 2, assigns an AppId to site 1: 12345, and creating a storage folder 12345 for storing the script file of the Service workbench of the site 1 for the site 1, if the address of the storage folder 12345 is 12345/sw.js; determining that the service agent access address corresponding to the target site is https:// cdn.xxx.com/12345/sw.js according to 12345/sw.js; similarly, appId is allocated to site 2: abcd, creating a storage folder abcd for storing script files of Service workbench of the site 2 for the site 2, and if the address where the storage folder abcd is located is abcd/sw.js; the flow chart of determining the service proxy access address corresponding to the target site specifically may be shown in fig. 2, where the service proxy access address corresponding to the target site is https:// cdn.xxx.com/abcd/sw.js.
Here, after determining that the application identifier of the target site is legal, the configuration page information may be fed back to the target site, and a configuration page for inputting the custom configuration information may be presented at the server side of the target site; and acquiring the custom configuration information input by the target site based on the configuration page.
In a specific implementation, the server detects validity of an application identifier allocated to the target site, after determining that the application identifier of the target site is legal, the server can send configuration page information to the target site, so that after receiving the configuration page information, the server of the target site displays a configuration page for inputting custom configuration information to a developer, after the developer inputs the custom configuration information in the configuration page for inputting the custom configuration information, the server sends the custom configuration information to the server, and the server obtains the custom configuration information input by the target site based on the configuration page.
For example, as shown in fig. 3, a configuration page for inputting custom configuration information may include a domain name input area to be intercepted and a processing operation input area to be performed for each domain name to be intercepted.
In a specific implementation, after the custom configuration information of the target site and the general configuration information of the service agents of the different sites configured in advance are obtained based on step S101, sw.js of the target site may be generated based on the custom configuration information and the general configuration information, which is described in detail in step S102 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 site is legal, the sw.js of the target site is generated according to the general configuration information obtained in step S101 and the custom configuration information of the target site.
S103, configuring or updating the service agent corresponding to the target site according to the script file.
Here, when the serving proxy 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 serving proxy access address corresponding to the target site, so that when the server receives the first access request sent by the user terminal, the serving proxy access address corresponding to the target site may be fed back to the user terminal, so that the user terminal may obtain the sw.js of the target site according to the obtained serving proxy 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 generating the sw.js of the target site based on step S102, the sw.js of the target site may be stored in a storage folder corresponding to the target site, and an access address of the sw.js of the target site may be determined based on a storage location of the sw.js of the target site.
For example, if the storage folder 12345 created for the target site and used for storing the sw.js of the target site, the sw.js of the target site generated based on step S102 is stored in the storage folder 12345, and according to the storage location of the sw.js of the target site, the service agent access address corresponding to the target site is determined to be https:// cdn.xxx.com/12345/sw.js.
In a specific implementation, after determining the access address of the sw.js of the target site, the server may receive a first access request of the user terminal for the target site, and respond to the first access request of the user terminal for the target site, and feed back the Service proxy access address of the target site to the user terminal, so that the user terminal obtains the sw.js of the target site based on the Service proxy access address, and the user terminal installs the Service Worker based on the obtained sw.js of the target site, and may access the target site through the Service Worker after the installation is successful.
After the Service workbench is installed on the user side, based on the Service agent access address of the target site, the sw.js of the target site can be acquired from the server at regular time, whether the sw.js of the target site acquired at regular time is consistent with the sw.js of the target site acquired when the Service workbench is installed or not is compared, and whether the installed Service workbench needs to be updated or not is detected; when the sw.js of the target site obtained at regular time is consistent with the sw.js of the target site obtained when the Service workbench is installed, reinstallation of the Service workbench is not needed; when the sw.js of the target site acquired at the timing is inconsistent with the sw.js of the target site acquired when the Service Worker is installed, the installed Service Worker needs to be updated according to the sw.js of the target site acquired at the timing.
In an alternative embodiment, the server may update the script file of the service agent of the target site based on updated generic configuration information, and/or updated custom configuration information, when there is a need to update the script file of the service agent of the target site.
In a specific implementation, if the developer adds/modifies/deletes the custom configuration information in the configuration page of the custom configuration information, the server of the target site may send a script file update request of the target site (where the script file update request carries an application identifier and update information of the custom configuration information for the service agent) to the server, and the server receives the application identifier of the target site and 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 update 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 a specific implementation, if a manager adds/modifies/deletes general configuration information in a general information configuration page of a Service workbench, an update request for the general configuration information is generated and sent to a Service workbench server, and the Service workbench server responds to the update request for the general configuration information to determine updated general configuration information, and updates sw.js corresponding to Service agents of different sites respectively according to the updated general configuration information.
For example, if the general configuration information of the service agents configured in the server for different sites includes CDN domain names: cdn.a.com, cdn.b.com, cdn.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 the different sites and the custom configuration information corresponding to the site 1 and the site 2 respectively, the script files of the service agents of the site 1 are stored in the service agent access addresses corresponding to the site 1: under https:// cdn. Xxx. Com/12345/sw. Js, storing the script file of the service agent of site 2 at the service agent access address corresponding to site 2: https:// cdn. Xxx. Com/abcd/sw. Js; when cdn.c.com is sealed, the server determines that the updated general configuration information is: cdn.a.com, cdn.b.com; the corresponding service agent access address at site 1: finding out 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 service agent access address corresponding to site 2: finding out the script file of the service agent of the station 2 under the conditions of https,/(cdn. Xxx. Com/abcd/sw. Js, and updating the script file of the service agent of the station 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 into 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 a developer does not need to modify the script files corresponding to each site respectively, the modification task amount of the developer 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 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 custom 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 disclosure, codes with the same function in the script files of the service agents of each site are configured into the universal configuration information, so that when the script files of the service agents of each site are generated, the development process of repeated content is reduced, the development time is saved, and if the requirement of modifying the codes with the same function in the script files of the service agents of each site exists, a developer only needs to adjust the universal configuration information, does not need to modify the script files corresponding to each site respectively, the modification task amount is reduced, and the modification efficiency is improved.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiment of the disclosure further provides a script file generating device corresponding to the script file generating method, and since the principle of solving the problem of the device in the embodiment of the disclosure is similar to that of the script file generating method in the embodiment of the disclosure, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 4, a schematic diagram of an apparatus 400 for generating a script file according to an embodiment of the disclosure is shown, where the apparatus includes: an acquisition module 401, a generation module 402 and a processing module 403; wherein,
the acquiring module 401 is configured to acquire custom configuration information of a target site for a service agent, and general configuration information of service agents of different sites.
A generating module 402, configured to generate a script file of a service agent of the target site based on the generic 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 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 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 sent by the target site after registration.
The generating module 402 is specifically configured to generate, after determining that the application identifier is legal, a script file of a service agent of the target site based on the general configuration information and the custom configuration information.
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 custom 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 update request carries an application identifier and update information of user-defined configuration information aiming at a service agent; according to the update information, updated custom configuration information corresponding to the application identifier is determined; 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 updating module is further configured to determine updated general configuration information in response to an update request for the general configuration information; and updating script files of service agents of different sites according to the updated general configuration information.
In an alternative embodiment, the processing module 403 is specifically configured to store the script file in a service proxy 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 the first access request of the user terminal aiming at the target site, feeding back the service agent access address to the user terminal so that the user terminal can acquire the script file of the service agent of the target site based on the service agent access address, and after the service agent is installed based on the script file, accessing the target site through the service agent.
In an alternative embodiment, the generic configuration information includes at least 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 custom 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 disclosure, codes with the same function in the script files of the service agents of each site are configured into the universal configuration information, so that when the script files of the service agents of each site are generated, the development process of repeated content is reduced, the development time is saved, and if the requirement of modifying the codes with the same function in the script files of the service agents of each site exists, a developer only needs to adjust the universal configuration information, does not need to modify the script files corresponding to each site respectively, the modification task amount is reduced, and the modification efficiency is improved.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Based on the same technical conception, the embodiment of the application also provides computer equipment. Referring to fig. 5, a schematic structural diagram of a computer device 500 according to an embodiment of the present application includes a processor 501, a memory 502, and a bus 503. The memory 502 is configured to store execution instructions, including 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 memory 5022 such as a hard disk, the processor 501 exchanges data with the external memory 5022 through the memory 5021, and when the computer device 500 is running, the processor 501 and the memory 502 communicate 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 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 specific processing flow of the processor 501 may refer to the description of the above method embodiments, and will not be repeated here.
The disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of script file generation described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present disclosure further provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to perform the steps of the method for generating a script file described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in 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 essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (12)

1. A method for script file generation, comprising:
acquiring custom configuration information of a target site aiming at a service agent and general configuration information of service agents of different sites; the custom configuration information at least comprises page cache configuration information;
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.
2. The method of claim 1, further comprising, prior to obtaining the custom configuration information for the targeted site for the service agent:
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 the assigning a service agent access address to the target site in response to the registration request of the target site comprises:
responding to a registration request of a target site, and distributing an application identifier and a service agent access address corresponding to the application identifier to the target site;
the obtaining the custom configuration information of the target site for the service agent includes:
Receiving user-defined configuration information carrying an application identifier and sent by the registered target site;
the generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information includes:
and after determining that the application identification is legal, generating a script file of the service agent of the target site based on the general configuration information and the custom configuration information.
4. The method of claim 3, wherein receiving the registered custom configuration information carrying the application identifier sent by the target site includes:
after the application identification is determined to be legal, feeding back configuration page information to the target site;
and acquiring the custom 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 update request carries an application identifier and update information of user-defined configuration information aiming at a service agent;
according to the update information, updated custom configuration information corresponding to the application identifier is determined;
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 the update request aiming at the general configuration information, and determining updated general configuration information;
and updating script files of service agents of 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 terminal for the target site, and feeding back the service agent access address to the user terminal, so that the user terminal obtains a script file of the service agent of the target site based on the service agent access address, installs the service agent based on the script file, and accesses 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.
10. An apparatus for generating a script file, comprising:
the acquisition module is used for acquiring the custom configuration information of the target site aiming at the service agent and the general configuration information of the service agents of different sites; the custom configuration information at least comprises page cache configuration information;
the generation 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 for executing the machine-readable instructions stored in the memory, which when executed by the processor, perform the steps of the method of script file generation of any of claims 1 to 9.
12. A computer-readable storage medium, on which a computer program is stored which, when being run by a computer device, performs the steps of the method of script file generation according to any 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 CN113190228A (en) 2021-07-30
CN113190228B true 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
CN113190228A (en) 2021-07-30

Similar Documents

Publication Publication Date Title
CN110263275B (en) Method and device for accessing webpage, mobile terminal and storage medium
JP6410280B2 (en) Website access method, apparatus, and website system
CN109150978B (en) Method and device for debugging micro service
US8775577B1 (en) System and method for configuration management service
US10187445B2 (en) System, method and browser client for enabling browser data synchronization
US8527862B2 (en) Methods for making ajax web applications bookmarkable and crawlable and devices thereof
CN109388626B (en) Method and apparatus for assigning numbers to services
CN108200132B (en) Resource acquisition method, device, equipment and computer readable storage medium
JP2019512819A (en) Data caching method and apparatus
JP2019530089A (en) Method and apparatus for realizing communication between web page and native application, and electronic apparatus
EP3528474B1 (en) Webpage advertisement anti-shielding methods and content distribution network
CN108256014B (en) Page display method and device
CN109120614B (en) Service processing method and device based on distributed system
CN109819033A (en) A kind of resource file loading method and system
CN109040263B (en) Service processing method and device based on distributed system
CN103338233A (en) Load balancing device, Web server, request information processing method and system
CN107844310B (en) Configuration information updating method and system
CN111079048B (en) Page loading method and device
CN113190228B (en) Script file generation method and device and computer storage medium
CN110674426B (en) Webpage behavior reporting method and device
CN112527376A (en) Method for realizing DevOps automation based on reverse proxy service
US10674022B2 (en) Server, server system, non-transitory computer-readable recording medium storing computer-readable instructions for server, and method performed by server
CN104317819A (en) Method and system for webpage cross-domain communication based on browsers
CN112104703A (en) Cookie management method, intermediate node and webvpn system
CN109194742B (en) Virtual machine console connection method and device and storage medium

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

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.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant