Merge pull request #233 from YunoHost/dont_use_version_for_cache_control

Don't use version for cache control
This commit is contained in:
Alexandre Aubin 2019-04-02 16:18:49 +02:00 committed by GitHub
commit a5e4b8d6d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

6
debian/postinst vendored
View file

@ -10,6 +10,12 @@ do_configure() {
# Set document root permissions
chown -R root:root /usr/share/yunohost/admin
# Replace RANDOMID with a random hash to invalidate
# old cache ... we generate this locally on each machine
# to avoid leaking stuff like the version
RANDOMID=$(openssl rand -hex 4)
sed -i "s/RANDOMID/$RANDOMID/g" /usr/share/yunohost/admin/index.html
}
# summary of how this script can be called:

4
debian/rules vendored
View file

@ -15,10 +15,6 @@ TMPDIR = $$(pwd)/debian/yunohost-admin
dh $@
override_dh_auto_build:
# Replace VERSION with current package version to prevent web browser
# to serve old css/js files
sed -i 's/VERSION/$(DEBVERS)/g' src/index.html
# Run npm/bower/gulp
cd src ; npm --progress false --loglevel warn --color false install
cd src ; node_modules/gulp/bin/gulp.js build

View file

@ -7,9 +7,9 @@
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height" />
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" media="screen" href="dist/css/style.min.css?version=VERSION">
<link rel="stylesheet" media="screen" href="dist/css/style.min.css?version=RANDOMID">
<link rel="shortcut icon" href="dist/img/ynhadmin_icon.png">
<script type="text/javascript" src="dist/js/script.min.js?version=VERSION"></script>
<script type="text/javascript" src="dist/js/script.min.js?version=RANDOMID"></script>
</head>
<body>