AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] VGUI URL Cache Buster (3.1.4, 2018-05-19) (https://forums.alliedmods.net/showthread.php?t=302530)

nosoop 11-01-2017 16:12

[ANY] VGUI URL Cache Buster (3.1.4, 2018-05-19)
 
Version 3.1.4 has been released, with minor changes now that Steam opens same-domain pages again. See important notes here.

Other important note: There is a known issue with the Steam Client beta (with the new chat interface) where opening new popup windows does not work on any game. No known fix at the moment.

There is also currently no known solution for displaying MOTD panels on CS:GO post-Panorama.

Description:
Fixes various issues with plugins that create MOTD (web) panels.

Previously, the behavior of Steam's webview was problematic. Calling ShowMOTDPanel (or variants) will show a previously viewed page if the last page viewed was on the same first-level domain. Those changes have caused issues with plugins like backpack.tf Price Check.

This plugin hooks the VGUIMenu usermessage and manipulates it in one of two ways to attempt to force displaying the correct page:
  • The "delayed load": Another URL is opened, then the original URL is sent after a short delay.
  • The "proxy" page: The URL is rewritten so the user navigates to a static page; the desired page is then either loaded into an iframe element or opened in a new panel with window.open(). The information is communicated through the URL hash; no information is leaked to the web server and clients can cache the page.
This hook method means no plugins need to be recompiled with various natives / dedicated function stock workarounds, and uninstallation is quick.

As Steam currently does not have any issues with same-domain pages, those particular workarounds are currently unnecessary. The ability to hook these usermessages remain useful, however.

The plugin also handles CS:GO-specific quirks in opening web pages; plugin authors can now use SourceMod's ShowMOTDPanel function to make pages that are visible to the user as a popup window in CS:GO.

Other games can also attempt to use popups by sending a VGUI message with certain values configured while this plugin is present.

This plugin should work in games that support ShowVGUIPanel / ShowMOTDPanel and don't have other unique quirks. CS:GO (protobufs) are also supported.

ConVars:
  • vgui_workaround_delay_time: Amount of time that the "delayed load" takes. If you're having issues with loading pages, you may need to raise this value.
  • vgui_workaround_proxy_page: The URL to the static proxy page. You can host a copy yourself; it's available in the repository.
Other configuration:
You can configure which URL prefixes use which method. See the configs/vgui_cache_buster_urls.cfg file for more details.

Dependencies:
If the "proxy" method is used (whether by iframe or popup), this plugin is dependent on one static page made accessible via web hosting. The plugin ships with a default URL pointed to my personally hosted copy of the page (which you can modify as mentioned in the ConVars section above).

No other plugin / extension dependencies.

Things the plugin will clobber:
VGUIMenu usermessages, obviously. Any plugins that use ShowMOTDPanel or ShowVGUIPanel with the info panel with a URL will be caught by this plugin and "fixed". Any plugins that run their own fixes may conflict with this plugin.

Pages with restrictive X-Frame-Options headers will refuse to load with the "proxy" iframe method. This includes YouTube (non-embed), Google, and Steam Community pages. Any iframe-proxied pages that link to one of those pages will also fail.

Hosting the proxy page over HTTPS will prevent connections through HTTP, even if the HTTP connection redirects.

The default URL configuration is set up to use the delayed load for almost every page. However, if you have an internal site or pages that listen to hash changes (like a custom web audio setup), the iframe method will be faster and doesn't destroy and recreate a page.

In CS:GO, MOTDs will automatically be enabled. Use a plugin such as MOTD Disable to hide the panel that displays on join if you'd like.

There is a limitation of 255 bytes in a user message (for bitbuffers, at least).
Because the proxy method URL encodes parameters, you may reach this limit for long URLs that previously didn't.

Installation:
  1. Download the package.zip file from the releases page and copy the files into your SourceMod directory.
  2. Load the plugin. This will generate the configuration file located at cfg/sourcemod/plugin.vgui_cache_buster.cfg.
  3. Perform any desired configuration changes in the above file, as well as the URL configuration file.
    • Optionally: Upload the www/motd_proxy.html page to web hosting. You can set the vgui_workaround_proxy_page ConVar to your own hosted copy.
  4. You're done. Test any plugins that open up web panels to make sure that they work.
For plugin developers:
Just use ShowMOTDPanel as you would in every other game. If you use ShowVGUIPanel directly, there are additional KeyValues entries that you can pass in to modify the behavior of the MOTD display (see the stock file for details).

Releases / Source Code

hmmmmm 11-03-2017 04:42

Re: [TF2 (and others)] VGUI URL Cache Buster
 
1 Attachment(s)
Converted it to use protobuf so it works with games like CSGO

EDIT: nosoop added CSGO support to plugin, so don't use this

Powerlord 11-03-2017 11:36

Re: [TF2 (and others)] VGUI URL Cache Buster
 
Not sure about other games, but TF2 has the sv_motd_unload_on_dismissal server cvar already to deal with this problem.

nosoop 11-03-2017 18:55

Re: [TF2 (and others)] VGUI URL Cache Buster
 
Quote:

Originally Posted by Powerlord (Post 2558294)
Not sure about other games, but TF2 has the sv_motd_unload_on_dismissal server cvar already to deal with this problem.

Haven't seen it working by itself; I've had that cvar set on my server for a while now.

I also tried it with injecting unload in the message, and while that unloads the first web panel, I can't seem to get a second one to show up.

Stropy 11-04-2017 13:20

Re: [TF2 (and others)] VGUI URL Cache Buster
 
Oh my god, was waiting for this a long time, thank you! Will test it and report how it works asap.

EDIT: Works like a charm, thanks again.

LiMaaa 11-08-2017 02:28

Re: [TF2 (and others)] VGUI URL Cache Buster
 
Thanks nosnoop, will give it a test!

Quote:

Originally Posted by Powerlord (Post 2558294)
Not sure about other games, but TF2 has the sv_motd_unload_on_dismissal server cvar already to deal with this problem.

I do not believe this resolves the problem. I have had it set for as long as I can remember and still experience motd issues. If you do know how to utilize the cvar to solve these issues, please explain how?

nosoop 11-10-2017 08:18

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Glad to hear that it's working in TF2.
I've pushed out an initial merged protobuf/bitbuf branch of the code. Should still work the same for most games; mostly intended to see if CS:GO works as I think it does (though it might screw with plugins that are already using workarounds for stuff).

Beta release is available here. Make sure to check the CS:GO specific instructions if applicable.

Existing users don't need to update unless they'd like to ensure there aren't any regressions in the update to support both message types. It also comes with a new vgui_workaround_debug_spew ConVar to output the URLs that a plugin is handling to the server console (though there's a commit for that from before the protobuf merge).

mlov420 11-22-2017 16:56

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Meant to come here earlier and confirm but this works like a charm in CS:GO. I host the web part myself. Thanks a ton.

nosoop 12-30-2017 04:48

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
3.0.0 has been released, with additional CS:GO changes proposed and tested by Byte.
  • RawGit is now used to host the HTML pages. You can still set the convar to mine or your own hosting, of course.
  • Added some new key/value options for ShowVGUIPanel to control CS:GO popup window sizes. See the new stock functions in the include file for reference.
  • The proxy hash format has changed — the rewritten URL now embeds multiple URL-encoded parameters instead of just the proxied URL. As a result, there is a new version of the proxy page.

If you decide to upgrade, please make sure you've updated the proxy page URL (in particular, check the generated config); if you updated the contents of the page without changing the name, you may want to add a unique query string to the URL (?v=3 for example) to ensure your clients aren't using stale pages.

The updated pages are backwards-compatible, so older versions of the plugin should continue to work fine.

----

An emergency update for backwards compatibility has been pushed out as 3.0.1.
It fixes an issue that referenced an undeclared variable which should've held a URL while in backwards-compatibility mode. Sorry if older plugins were using my hosted proxies and not seeing pages!

8guawong 12-30-2017 04:54

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
hello what is the advantage of using this over https://forums.alliedmods.net/showthread.php?p=2558460
thanks

game is csgo btw

nosoop 12-30-2017 05:16

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Quote:

Originally Posted by 8guawong (Post 2568825)
hello what is the advantage of using this over https://forums.alliedmods.net/showthread.php?p=2558460
thanks

game is csgo btw

This plugin intercepts the usermessage before it's transmitted to clients, meaning the handling is transparent to plugin developers; they don't have to implement the workarounds themselves (recompiling or making CS:GO-specific versions of plugins).

If there's a new breaking change in how (insert game here) handles MOTD / web panels, it can be patched with this plugin instead of recompiling every broken plugin with a new include.

This plugin, by itself, is not a replacement for Web Shortcuts or variations (it doesn't create any triggers to open web pages on its own), though it makes it easier for someone to write a unified version of Web Shortcuts that is compatible with multiple games.

Byte 12-30-2017 06:51

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Quote:

Originally Posted by 8guawong (Post 2568825)
hello what is the advantage of using this over https://forums.alliedmods.net/showthread.php?p=2558460
thanks

game is csgo btw

I'll be updating that plugin to use the stocks from this plugin instead very soon as its a better solution.
EDIT: Done :)

Franc1sco 12-30-2017 06:52

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Quote:

Originally Posted by nosoop (Post 2568831)
This plugin intercepts the usermessage before it's transmitted to clients, meaning the handling is transparent to plugin developers; they don't have to implement the workarounds themselves (recompiling or making CS:GO-specific versions of plugins).

If there's a new breaking change in how (insert game here) handles MOTD / web panels, it can be patched with this plugin instead of recompiling every broken plugin with a new include.

This plugin, by itself, is not a replacement for Web Shortcuts or variations (it doesn't create any triggers to open web pages on its own), though it makes it easier for someone to write a unified version of Web Shortcuts that is compatible with multiple games.

So your plugin fix that sometimes the website doesnt show correctly and its compatible with this? I will add it as requeriment in my plugin. Tell me if I need to do some other modifications to my plugin for adapt it to your fix.

EDIT: ok I see that you have a include, so its needed to use?

nosoop 12-30-2017 08:59

Re: [ANY+CS:GO] VGUI URL Cache Buster
 
Quote:

Originally Posted by Franc1sco (Post 2568842)
So your plugin fix that sometimes the website doesnt show correctly and its compatible with this?

Yes, it fixes both same-domain issues on all games (by forcing the delayed load) and the CS:GO-specific quirk (where the solution is opening the page in a popup window).

The include is only to demonstrate custom popup sizes for CS:GO; you can use ShowMOTDPanel as you would with other games to show your webpage as a popup with a default size (determined through JavaScript as screen.width / screen.height).

For your plugin specifically, I think you'd be able to take out the FixMotdCSGO* functions, and for non-fullscreen webviews, replace ShowMOTDPanel with CSGO_ShowMOTDPanel and set sizing accordingly.

joshtrav 01-01-2018 00:56

Re: [ANY] VGUI URL Cache Buster (3.0.0, 2017-12-30)
 
Not sure if anyone else mentioned this, but it would be nice to see a check for the current state when attempting to modify the motd. For example, when players join it is created a second popup window for the default motd defined in the server. It is difficult to click this sometimes, creating issues for a few.

This is in CSGO.

I was thinking possibly a check to validate they are in the player connect phase, not sure though.

nosoop 01-01-2018 04:37

Re: [ANY] VGUI URL Cache Buster (3.0.0, 2017-12-30)
 
Quote:

Originally Posted by joshtrav (Post 2569128)
Not sure if anyone else mentioned this, but it would be nice to see a check for the current state when attempting to modify the motd. For example, when players join it is created a second popup window for the default motd defined in the server. It is difficult to click this sometimes, creating issues for a few.

Is this a built-in game MOTD or caused by a plugin? Haven't heard of this issue when we were testing CS:GO changes.

You can manually override the behavior for a URL prefix by setting its entry in configs/vgui_cache_buster_urls.cfg to none, which should bypass this plugin's processing step for your MOTD. (Set vgui_workaround_debug_spew to 1 to see the URLs that are being sent to players if you're not sure what it is, and don't include the protocol in the prefix.)

----

I'm testing a new branch of the code that unifies the iframe / popup code into a single HTML page, adds a keyvalue entry that indicates if a page should be displayed as a popup, changes the preinstalled configuration's default handler to delayed load (since iframes are being increasingly blocked), and should make the installation instructions the same for all games including CS:GO.

I've given it a decent amount of testing in TF2, though I could use a few more eyes on it to make sure there aren't any regressions.

A preview release is available here.

PC Gamer 01-01-2018 11:33

Re: [ANY] VGUI URL Cache Buster (3.0.0, 2017-12-30)
 
I get a black motd screen in TF2 when used with MOTD backpack (https://forums.alliedmods.net/showthread.php?t=141963).

Here's what I get when I right-click on the black screen and select 'copy':
https://cdn.rawgit.com/nosoop/SM-VGU...61197968541708

Is there a particular version of TF2 backpack viewer that works with this?

nosoop 01-01-2018 11:42

Re: [ANY] VGUI URL Cache Buster (3.0.0, 2017-12-30)
 
Quote:

Originally Posted by PC Gamer (Post 2569199)
I get a black motd screen in TF2 when used with MOTD backpack (https://forums.alliedmods.net/showthread.php?t=141963).

Add the following line to the url configuration:

"www.tf2outpost.com/" "delayed" (or set "*" to "delayed")

Reload the plugin after that.

Looks like TF2Outpost redirects you to Steam's OpenID login, which doesn't load into iframes. Looks like it also doesn't load into the iframe due to mixed active content warnings (not sure if that happens in CEF, though). TF2B works fine.

A future update will change the configuration to use delayed loads by default to avoid the iframe stuff, since it seems to be more trouble than it's worth for most sites.

PC Gamer 01-01-2018 12:13

Re: [ANY] VGUI URL Cache Buster (3.0.0, 2017-12-30)
 
Setting "*" to "delayed" in the configs\vgui_cache_buster_urls.cfg file worked for me. Thanks!

nosoop 01-05-2018 02:46

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
3.1.2 has been released, with some streamlining:
  • There is now only one proxy page that handles both popups and iframes. The page determines which one to use by checking if it was invoked with an embedded hash parameter.
    • Popups can now be used on games other than CS:GO (tested in TF2 -- I make no guarantees as to if it works in your game of choice).
  • Reverted back to my hosting from RawGit, as serving the proxy page through their servers means HTTPS, and HTTPS means no HTTP frames can be embedded. If HTTPS-only is not a problem for you, you can set the URL to https://rawgit.com/nosoop/SM-VGUICacheBuster/3.1.2/www/motd_proxy.html
  • Delayed loads are now used by default instead of iframes. It Just Works™ (even if it's a little slower)
  • MOTDs are automatically enabled in CS:GO if they are disabled. Remember to set that up in your configuration.
As usual, make sure the proxy page URL is updated if you want to take advantage of new functionality; leaving it unchanged may make clients load an older copy of the page.

See the release page for more information.

_GamerX 01-05-2018 16:51

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
this plugin will open original Motd window as connect motd?

Byte 01-05-2018 20:13

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
Quote:

Originally Posted by _GamerX (Post 2570007)
this plugin will open original Motd window as connect motd?

No I believe the original MOTD is different and doesn't use the VGUIMenu usermessage.
It should work properly though with motd.txt

nosoop 01-07-2018 01:09

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
Quote:

Originally Posted by Byte (Post 2570056)
No I believe the original MOTD is different and doesn't use the VGUIMenu usermessage.
It should work properly though with motd.txt

Turns out the normal MOTD in CS:GO and TF2 (and likely other games) also use VGUIMenu and an info panel; however, they use the MOTDPANEL_TYPE_INDEX type and set the msg to motd.

Quote:

Originally Posted by _GamerX (Post 2570007)
this plugin will open original Motd window as connect motd?

This plugin only affects hooked messages that use the MOTDPANEL_TYPE_URL type, so CS:GO's original MOTD panel isn't used or modified. However, it does toggle sv_disable_motd, so the default MOTD window will also be displayed when players connect.

AwesomeX 04-06-2018 10:23

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
I can confirm this fixed my MOTD/WebShortcuts issues that have been plaguing my TF2 server for more than a year.

Thanks a bunch for making this.

mlov420 04-19-2018 07:16

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
I've been having some strange issues with the latest version. When I upload the web portion to my website (which I've been using with previous versions of this cache buster for months), I get a 404 error. My website does force HTTPS, but even changing http to https on the motd_proxy page in the script doesn't fix it.

All other versions work fine on my website, it's just 3.1.2 where I'm having this issue and it's only with the motd_proxy.html page. Any idea why?

nosoop 04-19-2018 11:17

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
Quote:

Originally Posted by mlov420 (Post 2588463)
I've been having some strange issues with the latest version. [...]

What version were you using previously, and is it for popups or not (i.e., using CS:GO)?

The script's check for http is only to check for URLs in the pre-version 3 $PROXY_PAGE/#$URL format for backwards compatibility reasons; as of version 3 the plugin uses a URL params-style of hash in $PROXY_PAGE/#url=$ENCODED_URL format.

An HTTP 404 (file not found) on the web portion itself suggests it's an issue with your server stack, which I assume shouldn't be an issue given you've had the proxy page on your site before.

Are you sure it's definitely a 404? If so, make sure your permissions are correct on the file and your server configuration is serving that file correctly; that's outside the scope of this plugin.

To double-check, make sure the page is available by using your normal web browser with the following URL:

Code:

https://example.com/path/motd_proxy.html?v=3#url=https%3A%2F%2Fhstspreload.org
Replace the example.com path with the path to your proxy page, obviously. Any other URL-encoded URL will do, this is the first one I could find that isn't iframe-restricted and renders fine on the black background of the iframe.

If you open up your browser's developer tools (F12 on FF / Chrome) and make the request, you should see something like the following:

https://i.imgur.com/3Cv5Maw.png

A status 200 on your proxy page means it's working just fine, and your issue is likely in one of the sites you're trying to access.

Set vgui_workaround_debug_spew to 1; this will print out the URL the plugin is sending to the client whenever it rewrites a page. Check those URLs in your normal browser.

One thing I can think of since you mentioned forcing HTTPS is that mixed active content (attempting to request an HTTP-only page) will display a warning in the console tab and make no request to the page.

You'll have to replace any hardcoded HTTP requests in your own plugin(s) to HTTPS or set up your site to serve the proxy over HTTP; the browser won't do redirects for you for security reasons (because some malicious person could hijack the insecure connection).

Also, check the URL configuration (configs/vgui_cache_buster_urls.cfg; some URL prefixes don't work anymore).

If you're still having issues, I'd be happy to check when I have the time; send me a private message with your proxy URL, a URL that it fails on, and a copy of your URL config. Optionally, send me a copy of the plugin's debug output.

hannes96 05-19-2018 19:28

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
It seems like Valve fixed this bug. At least everything is working fine for me again in TF2 without running this plugin.

nosoop 05-20-2018 00:42

Re: [ANY] VGUI URL Cache Buster (3.1.2, 2018-01-04)
 
Confirmed; looks like the same-domain issue was fixed — maybe with the latest Steam update, considering it affected most games.

If you're using this plugin just for the same-domain fixes, you'll probably want to uninstall it after some time in case people are not up-to-date for some reason (if they ignore Steam's update nags, for example).

If you're using this for pop-ups (CS:GO or opt-in for other games), I'll be pushing out an update shortly to ensure pop-ups can still run even if the plugin is configured to not use proxies for all pages (since the delayed load isn't necessary anymore) and edit this post. The new method will still use the proxy's popup functionality, but will avoid applying iframe / delayed load workarounds.

The current workarounds will remain available for backwards compatibility purposes, even though they're effectively obsolete.

Edit: 3.1.4 has been released, with the following changes:
  • Popups will set the underlying panel's show value to false. This prevents the default panel from being displayed (mainly in non-CS:GO games, but should also prevent it if a CS:GO update enables the built-in MOTD panel again).
  • New URL configuration option: proxy_popups. Only applies the proxy method to popups (implicitly enabled in CS:GO by default, otherwise must specify x-vgui-popup or use the appropriate include function); other pages will be passed through. This is intended as a popup-supported version of the none option, which will never do any processing.
Important note: There is a known issue with the Steam Client beta (with the new chat interface) where opening new popup windows does not work on any game. No known fix at the moment; you'll just have to sit tight until a workaround exists (which I would be happy to implement) or until Valve restores this functionality.

yodog 11-13-2018 17:11

Re: [ANY] VGUI URL Cache Buster (3.1.4, 2018-05-19)
 
Any fix?

nosoop 11-13-2018 20:10

Re: [ANY] VGUI URL Cache Buster (3.1.4, 2018-05-19)
 
Quote:

Originally Posted by yodog (Post 2623909)
Any fix?

  • For CS:GO users: Not that I'm aware of; Valve seems to have done a good job of locking down MOTD panels on the client's side. If anyone happens to discover a workaround I'd be happy to merge in any changes to make it work, but I'm not going out of my way to look for one (CS:GO support was originally a collaborative effort).
  • For other games: You probably don't need this anymore, unless you're using it to implement pop-up panels, in which case that functionality seems to be working with the latest Steam Client (at least in TF2).


All times are GMT -4. The time now is 03:24.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.