Jump to content

Inline script - changes


Adlago

Recommended Posts

Posted

In script

<script>
		var ipsDebug = {{if ( \IPS\IN_DEV and \IPS\DEV_DEBUG_JS ) or \IPS\DEBUG_JS}}true{{else}}false{{endif}};		
	{{if \IPS\IN_DEV}}
		var CKEDITOR_BASEPATH = '{url="applications/core/dev/ckeditor" base="none" protocol="\IPS\Http\Url::PROTOCOL_RELATIVE"}/';
	{{else}}
		var CKEDITOR_BASEPATH = '{url="applications/core/interface/ckeditor/ckeditor" base="none" protocol="\IPS\Http\Url::PROTOCOL_RELATIVE"}/';
	{{endif}}
		var ipsSettings = {
			{{if \IPS\Dispatcher::hasInstance() and \IPS\Dispatcher::i()->controllerLocation == 'admin'}}
			adsess: "{expression="\IPS\Request::i()->adsess"}",
			{{endif}}
			{{if \IPS\COOKIE_DOMAIN !== NULL}}
			cookie_domain: "{expression="\IPS\COOKIE_DOMAIN"}",
			{{endif}}
			cookie_path: "{expression="\IPS\Request::getCookiePath()"}",
			{{if \IPS\COOKIE_PREFIX !== NULL}}
			cookie_prefix: "{expression="\IPS\COOKIE_PREFIX"}",
			{{endif}}
			{{if mb_substr( \IPS\Settings::i()->base_url, 0, 5 ) == 'https' AND \IPS\COOKIE_BYPASS_SSLONLY !== TRUE}}
			cookie_ssl: true,
			{{else}}
			cookie_ssl: false,
			{{endif}}
			upload_imgURL: "{resource="notifyIcons/upload.png" location="front"}",
			message_imgURL: "{resource="notifyIcons/message.png" location="front"}",
			notification_imgURL: "{resource="notifyIcons/notification.png" location="front"}",
			baseURL: "{expression="\IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE )"}",
			jsURL: "{expression="rtrim( \IPS\Http\Url::baseUrl( \IPS\Http\Url::PROTOCOL_RELATIVE ), '/' )"}/applications/core/interface/js/js.php",
			csrfKey: "{expression="\IPS\Session::i()->csrfKey"}",
			antiCache: "{expression="\IPS\CACHEBUST_KEY"}",
			disableNotificationSounds: {{if member.members_bitoptions['disable_notification_sounds']}}true{{else}}false{{endif}},
			useCompiledFiles: {{if \IPS\IN_DEV}}false{{else}}true{{endif}},
			links_external: {{if \IPS\Settings::i()->links_external }}true{{else}}false{{endif}},
			memberID: {expression="( \IPS\Member::loggedIn()->member_id ) ? \IPS\Member::loggedIn()->member_id : 0"},
			analyticsProvider: "{expression="\IPS\Settings::i()->ipbseo_ga_provider"}",
			viewProfiles: {{if \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) )}}true{{else}}false{{endif}},
			mapProvider: {{if \IPS\Settings::i()->googlemaps and \IPS\Settings::i()->google_maps_api_key}}'google'{{elseif \IPS\Settings::i()->mapbox and \IPS\Settings::i()->mapbox_api_key}}'mapbox'{{else}}'none'{{endif}},
			mapApiKey: {{if \IPS\Settings::i()->googlemaps and \IPS\Settings::i()->google_maps_api_key}}"{expression="\IPS\Settings::i()->google_maps_api_key"}"{{elseif \IPS\Settings::i()->mapbox and \IPS\Settings::i()->mapbox_api_key}}"{expression="\IPS\Settings::i()->mapbox_api_key"}"{{else}}''{{endif}},
			{{if \IPS\Settings::i()->ipbseo_ga_provider == 'custom' && \IPS\Settings::i()->ipbseo_ga_paginatecode}}
			paginateCode: function () {
				{setting="ipbseo_ga_paginatecode"}
			}
			{{endif}}
		};
	</script>

there are several changes compare to version 4.2.8. Possible changes are in the positive direction.
My question is - why are these changes causing a small cache browser - just 6 minutes causing a loading js.php?
This is from your site, but it exists in every beta 4 installation 4.3.0

Leverage browser caching of static assets

FAILED - (6.0 minutes) - https://invisioncommunity.com/applications/core/interface/js/js.php?

And second question - where is this time set for cache?

Thanks

Posted
$cacheHeaders	= ( \IPS\IN_DEV !== true AND \IPS\Theme::designersModeEnabled() !== true ) ? \IPS\Output::getCacheHeaders( time(), 360 ) : array();

This is in js.php (the 360 there is seconds, so 6 minutes).

What file is being loaded by js.php (i.e. what is the full URL, or at least the query string)? Usually the best solution here is to preload the javascript file on the page we need rather than letting the javascript autoloader do it.

Posted
6 hours ago, bfarber said:

$cacheHeaders	= ( \IPS\IN_DEV !== true AND \IPS\Theme::designersModeEnabled() !== true ) ? \IPS\Output::getCacheHeaders( time(), 360 ) : array();

This is in js.php (the 360 there is seconds, so 6 minutes).

What file is being loaded by js.php (i.e. what is the full URL, or at least the query string)? Usually the best solution here is to preload the javascript file on the page we need rather than letting the javascript autoloader do it.

This is a test of https://invisioncommunity.com/forums/

Full URL and Loaded by

URL: https://invisioncommunity.com/applications/core/interface/js/js.php?src=core%2Finterface%2Fhowler%2Fhowler.core.min.js&csrfKey=c04685c040cb102b6d7678f8ed182a38&antiCache=d815db9321
Loaded By: https://dne4i5cb88590.cloudfront.net/invisionpower-com/javascript_global/root_library.js.8a7c430a475b141760dd18267295e9c2.js.gz:1

Request

:path: /applications/core/interface/js/js.php?src=core%2Finterface%2Fhowler%2Fhowler.core.min.js&csrfKey=77134868ae1b66648b656157078041e8&antiCache=d815db9321
accept-language: en-US,en;q=0.9
accept-encoding: gzip, deflate, br
referer: https://invisioncommunity.com/forums/
accept: text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 PTST/180416.160447
:scheme: https
x-requested-with: XMLHttpRequest
:method: GET
cookie: ips4_IPSSessionFront=sinqdmebh26vjp1qs3m2nkbg43; ips4_ipsTimezone=America/New_York; ips4_hasJS=true
:authority: invisioncommunity.com

Response

status: 200
content-length: 7135
via: 1.1 33ea49e9d525be4d0ab838be605fd6d0.cloudfront.net (CloudFront)
x-cache: Miss from cloudfront
content-encoding: gzip
x-powered-by: PHP/7.0.29
expires: Mon, 16 Apr 2018 20:22:04 GMT
server: Apache/2.4.27 (Amazon) OpenSSL/1.0.2k-fips PHP/7.0.29
last-modified: Mon, 16 Apr 2018 20:16:04 GMT
x-amz-cf-id: Xf0GJ7mnmp46mP49OazsR0poWF6WTtJaHo8pd_6Mimf73rQHwkPETQ==
pragma: public
cache-control: max-age=360, public
date: Mon, 16 Apr 2018 20:16:04 GMT
content-type: text/javascript;charset=UTF-8

PP. The same is for my test site

URL: https://nophelet.com/consults/applications/core/interface/js/js.php?src=core%2Finterface%2Fhowler%2Fhowler.core.min.js&csrfKey=4f3de21667b5b71ba6e44fb4b994b6be&antiCache=4c97270d59
Loaded By: https://nophelet.com/consults/uploads/javascript_global/root_library.js.41a6675939092e634a64356f48c2b002.js?v=4c97270d59:1

 

Posted

Time = 2592000 solved issue.

Also, for anyone who cares, there is also a notification.mp3 file, which is also a small cache - just 1 week. This issue is solved with an add-in to the htaccess file

ExpiresByType audio/mpeg "access plus 1 month"

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...