[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] auto-X.Y.Z.css



CAUTION: This e-mail originated outside the University of Southampton.

Hi!

 why not using the md5 hash? That would be consistent, not depending on last modified. Also you open the file (stat on it) for every web page view.

The md5 would be calculated on generate_static. Because we run generate_static every time we change the css, then we can use it to create directly the md5 and store the value somewhere.

Also using webpack is another option.

Il 29/04/22 08:43, David R Newman via Eprints-tech ha scritto:

Hi both,

Here is my fix:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints3.4%2Fcommit%2Fd940ee2ff8d3955010988bea8379cf1502eb8cda&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828729782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=asvh25CsfQnrObcAVCvPJ6V0gpQMeEviNSXSFryyDQg%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints3.4%2Fcommit%2Fd940ee2ff8d3955010988bea8379cf1502eb8cda&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828729782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=asvh25CsfQnrObcAVCvPJ6V0gpQMeEviNSXSFryyDQg%3D&amp;reserved=0>

I am not sure if you want to patch.  This will probably need some adaptation if you are running 3.3, as the function in Repository.pm expects an inc file with flavours and ingredients, which is new for 3.4.  I have also noted I took a rather odd approach using a ternary statement to update the $last_modified_time depending on whether the latest timestamp returned for the current directory is more recent.  There is nothing seriously wrong with this but I may fix it for something marginally more efficient.

Regards

David Newman

On 28/04/2022 5:38 pm, David R Newman via Eprints-tech wrote:

Hi John and Yuri,

This is the bane of my life as well, having to tell users to make sure they "hard refresh" the page before complaining something is not appearing/working as expected.  So having a fix for this will save me a lot of back and forth because I can be confident caching is not an issue.

Therefore, I have created this GitHub issue:

https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints3.4%2Fissues%2F220&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828729782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=PHLFAbyJbUHfOxTF5Zl02%2BvFZwiyD8ZjgskOQ7t9KZU%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints3.4%2Fissues%2F220&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828729782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=PHLFAbyJbUHfOxTF5Zl02%2BvFZwiyD8ZjgskOQ7t9KZU%3D&amp;reserved=0>

I have half written this already, it should not take too long to complete but may take a while to test to be confident it will do the job.

Regards

David Newman

On 28/04/2022 5:29 pm, John Salter wrote:
CAUTION: This e-mail originated outside the University of Southampton.
As a (hopefully useful) side note, the Apache Rewrite ruleset will honour URLs for the auto css and javascript that match e.g.
style/auto-3.3.10.css
style/auto-3.3.101.css
style/auto-3.3.10999.css
style/auto-3.3.100000.css
- any amount of digits (but only digits) before the '.css' or '.js'.

This can be used to force newer versions of the auto- files into browsers.

For recent versions of EPrints, I think you can copy lib/cfg.d/template_core.pl into the archive config file.
I would suggest changing this line:
href => $repo->current_url( path => "static", "style/auto-".EPrints->human_version.".css" ),
to:
href => $repo->current_url( path => "static", "style/auto-".EPrints->human_version."1.css" ), #note '1' before '.css'

Next time you need to force a different auto CSS or JS file, update the digit, or remove it!

For older versions of EPrints (3.3.10, possibly beyond), where the loading of config files from various different directories worked a little differently, and overriding files from lib/cfg.d/ wasn't as simple as copying them to the local config, you could make a lovely hack, intercepting the template pins and adding extra digits to them:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fjesusbagpuss%2Fc5ae75d8cbafb902af8299ec57101d8c&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828729782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=BiAPZzYuJWeQ5sV2%2Br9JUgVmfYa%2FMj1RTsi9efvMlGs%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fjesusbagpuss%2Fc5ae75d8cbafb902af8299ec57101d8c&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=5CCF5AA4iWdQufADIyDGRJo8TC7NiI6zh%2FItbFf6dwE%3D&amp;reserved=0>

I'm not /recommending/ the above hack - but we had it running like that without incident on 3.3.10 for a number of years!

Cheers,
John


From: eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk> [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of David R Newman via Eprints-tech
Sent: 28 April 2022 16:50
To: eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>; Yuri <yurj at alfa.it><mailto:yurj at alfa.it>
Subject: Re: [EP-tech] auto-X.Y.Z.css


Hi Yuri,

This is in lib/cfg.d/template_core.pl.  This file may also be in your archive's cfg/cfg.d/ directory or possibly even the flavours/pub_lib/cfg.d/ directory if you are on 3.4.

This is the block of code you need to update (around line 39):

 $head->appendChild( $repo->xml->create_element( "link",
            rel => "stylesheet",
            type => "text/css",
            href => $repo->current_url( path => "static", "style/auto-".EPrints->human_version.".css" ),
        ) );

Regards

David Newman
On 28/04/2022 4:41 pm, Yuri via Eprints-tech wrote:

CAUTION: This e-mail originated outside the University of Southampton.



Hi!



  where's the code/template that generates the link in the head to

auto-X.Y.Z.css? I've modified it, but it is cached in the browser for a

month. I need to change it in order to people to get the changes without

asking them to clear the cache.



Thanks!





*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.ecs.soton.ac.uk%2Fmailman%2Flistinfo%2Feprints-tech&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=Lj%2B3xGejlNs0TSmatWNhLv9wfB9b1paQhFHRy%2FVAlQ0%3D&amp;reserved=0>

*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0!<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0>

 AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=qD%2Bac2q85kHMQ9C%2FngNKXI03jrGh0s52kqxiJefoXQs%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0>

*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0!<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0>

 uMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=Mjmd7ryQW69R5WYd6mS%2FU5JtKGpw%2FU3rB6EXpf8xMKE%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0>



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0>
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0<https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0>



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=YIseytVThm95jPdsXn8NzUYMQCkTAzVmnljruXXEx50%3D&amp;reserved=0
*** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C0727a551301944de40d708da29b0e77f%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637868137828885999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=LOVZFgRpqvN4ChKHXG%2FdO0AGfNEZIrX7M1lq8H7TsbA%3D&amp;reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20220429/7640f1b7/attachment-0001.html