-
Notifications
You must be signed in to change notification settings - Fork 16
Sets of edits
The WWW has undergone many technological changes in recent years. Initially, browsers older than 5 years stopped opening web sites due to changes in image formats, HTML tags, JavaScript and CSS changes. Then traffic encryption (HTTPS) became a new trouble to old browsers. Also some interactive services in software, that using HTTP for network tasks, are stopped working after disable or change of servers.
WebOne can make all corrections to make particular websites (services) usable in particular old browsers (applications). It only needs specific instructions. These instructions are called Sets of edits, and commands from instructions are the Edits. They are stored in WebOne configuration file(s).
The Set of edits can contain detection rules (determining when the Set should be used) and edition rules (what should be edited to make the web site usable in particular browser).
Most of rules are using Regular Expressions (RegExp/RegEx). See WWW, books and magazines for more details about RegEx match masks, capture groups and replacement masks.
Some rules are using 1/0, y/n, yes/no, on/off, enable/disable or true/false as value.
The section title contains first (or single) URL regular expression mask determining on which URLs the Set should be used.
Some rules can be checked for both HTTP client requests and HTTP server responses (like URL), some can be only for HTTP responses (like status code or content type). So if the set is containing detection rules which cannot be checked on request time, WebOne will check and probably use the Set at the time of processing of remote server response.
If the URL in the title is not single, additional URL masks can be added as OnUrl rules. Example:
[Edit:jquery.min.js]
OnUrl=jquery2.js
;Will fire on:
; https://example.com/0458/jquery2.js
; https://example.com/assets/javascript/jquery.min.js?assets_version=102
; https://example.com/libs/jquery/jquery.min.js
Added in v0.10.0.
Hint: when the Set should apply on all URLs, use [Edit:.*]
title or its shortcut (added in v0.10.2): [Edit]
.
If the OnUrl masks (or the mask in the title) is not so quite detailed, you may add similar masks that will determine URL black list. Example:
[Edit:bootstrap.min.js]
IgnoreUrl=2.3.1
;Will fire on:
; http://maxcdn.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js
; http://maxcdn.bootstrapcdn.com/bootstrap/4.5.6/js/bootstrap.min.js
; http://maxcdn.bootstrapcdn.com/bootstrap/1.0.0/js/bootstrap.min.js
;But not on:
; http://maxcdn.bootstrapcdn.com/bootstrap/2.3.1/js/bootstrap.min.js
Hint: Add IgnoreUrl=webdav
rule in every set to disable them on WebDAV servers. Most of them are running on webdav.company.org domains, so the rule will work fine.
Added in v0.10.0.
It is possible to run the Set only on replies with particular MIME content types.
Added in v0.10.0.
It is possible to run the Set only on replies with particular response code. It may be a real code (e.g. 200 or 403) or a "abbreviation":
- 0 = less than 300
- 2 = 2XX
- 3 = 3XX
- 4 = 4XX
Added in v0.10.0.
Sometimes it is need to run the Set only when the client sends particular request header. E.g. only for browsers which sending concrete User-Agent string. For those cases there is OnHeader rule. Example:
OnHeader=User-Agent: Mozilla/0
OnHeader=User-Agent: Mozilla/1
OnHeader=User-Agent: Mozilla/2
OnHeader=User-Agent: Mozilla/3
; set with these rules will apply only to traffic with old web browsers like Netscape 3.0
; because it sends "User-Agent: Mozilla/3.04Gold (WinNT; U)" header to every request.
Added in v0.10.1.
If the Set is applicable for current HTTP request/response, all of Set's editing rules will be applied to the operation.
Every editing rule can contain masks (e.g. %UrlNoQuery%
), which will be replaced by actual content when processed by WebOne.
- %URL% - original URL (non encoded). Added in v0.4.0.
- %Url% - URL-encoded original URL (https://example.com -> https%3A%2F%2Fexample.com), don't confuse with %URL% which is not encoded. Added in v0.9.2.
- %UrlNoQuery% - original URL without ?arguments=. Added in v0.9.2.
- %UrlNoPort% - original URL without port number (if any). Added in v0.8.1.
- %UrlNoDomain% - part of original URL without domain name. Added in v0.6.1.
- %UrlDomain% - domain name of the original URL. Added in v0.10.5.
- %UrlHttps% - original URL with forced HTTPS protocol. Added in v0.9.2.
- %UrlHttp% - original URL with forced insecure HTTP protocol. Added in v0.9.2.
- %ProxyHost% - proxy host name. May be useful for using of in-proxy converters. Added in v0.9.0.
- %ProxyPort% - proxy working port. Added in v0.9.0.
- %Proxy% - shortcode for %ProxyHost%:%ProxyPort% which also may be equal to DefaultHostName setting. Added in v0.9.2.
Return a HTTP-302 redirect to a particular URL.
Since v0.10.3 it can utilize RegEx capture groups from Edit title. E.g. if there are single URL group in the section title (no OnUrl
rules), it may look like [Edit:(^http://.*/styles/prosilver/theme/)(.*)]
. This will hit on all phpBB forums with ProSilver theme. Then add a redirect to patched theme file: AddRedirect=http://atauenis.github.io/webone-webfixes/prosilver/theme/$2
. So $2 will be replaced with file name.
Added in v0.10.0, enhanced in v0.10.3.
Same as AddRedirect, but return a page from that URL without saying to the browser that the requested page is really a one from the redirect destination. Ignored on response processing. Added in v0.10.0.
Add a header(s) to HTTP/HTTPS request. Ignored on response processing. Added in v0.10.0.
Add a header(s) to HTTP response. May be useful for manual adding of cookies, plugin overriding, etc. Added in v0.10.0.
Convert the content using a external format converting utility. For example, convert a WebP image to GIF, compress a JPEG picture for slow modem line or trans-code a 8K h264 video to Intel Indeo with low bit rate and resolution.
The argument is name of converter utility.
This rule should be used together with additional parameter-setting rules: AddConvertDest, AddConvertArg1, AddConvertArg2, etc.
;Example: convert all PNGs and WEBPs to GIF.
[Edit:.*]
OnContentType=image/png
OnContentType=image/webp
AddConvert=convert
AddConvertDest=gif
AddResponseHeader=Content-Type: image/gif
Added in v0.10.0.
See above. All were added in v0.10.0.
Add these rules to apply edits to text part of responses. E.g. replace too modern JavaScript functions to their older equivalents, hide inline scripts, edit CSS on fly.
One set can contain multiple AddFind/AddReplace edits, but count of both them must be similar.
;Example: JS patch for Old-DOS.ru
[Edit:^http://old-dos.ru]
AddFind=eval\(('|")(.*?)\1\)
AddReplace=$2
AddFind=var _tmr = _tmr .* \[\];
AddReplace=var _tmr = _tmr;
Added in v0.10.0.
Similar to above, but for HTTP response headers (their content only). Added in v0.11.0.
Similar to AddFind, AddReplace, but for HTTP request headers (their content only). Added in v0.11.0.
Set output encoding (code page) for this request. See OutputEncoding
in configuration file for syntax. Added in v0.11.0.
Enable (AddTranslit=yes
) or force disable (AddTranslit=no
) replacing of non-English letters in response body to their equivalents in Latin alphabet (text transliteration, e.g. Cyrillic "У" to Latin "U" or Greek "Σ" to Latin "S".). The configuration file(s) must have [Translit]
section with transliteration table. Added in v0.11.0.
While debugging web sites in modern browsers, web developers are using internal DevTools in browser. Older web browsers have no such functionality (the first was Firefox 1.x where Firebug was the first developer console), so there is no ways to see HTTP Headers.
To enable HTTP request and response header saving (dumping) into particular file, use this edit rule:
AddHeaderDumping=dump-%Url%.log
%Url%
will be replaced with address of the request's page. Do not use %URL%
mask here as it will add characters disallowed in local paths.
Added in v0.10.2.
Similar to AddHeaderDumping but also saves POST/PUT/etc requests body.
Warning: dumps may contain private data, and enabling of AddHeaderDumping
/AddRequestDumping
will significantly slow down performance. Use only for debugging or development purposes.
Added in v0.10.2.
- Release Archive
- Websites edits / Syntax of traffic edits
- Known bugs / Report a new bug
- Windows installation
- Linux installation
- macOS installation
- Android installation
- Configuration file
- Command line arguments
Usage:
- Installing the Root Certificate
- YouTube playback
- Using with ViewTube
- Using with virtual machines
- Using with FTP servers
- Using with MSN Messenger
Web standards timeline:
Troubleshooting guides:
Developer corner: