17,7 → 17,7 |
* limitations under the License. |
*/ |
|
// We do this stuff to avoid that the client includes an externa JavaScript from polyfill.io, |
// We do this stuff to avoid that the client includes an external JavaScript from polyfill.io, |
// since some users might have a problem with that (in regards privacy of their IP address etc.) |
// So, the OIDplus webserver will act as proxy. |
|
30,9 → 30,9 |
'document.currentScript' |
)); |
|
define('MINIFY_POLYFILL', true); |
define('MINIFY_POLYFILL', true); // TODO: put into baseconfig? |
|
define('POLYFILL_CACHE_MAX_AGE', 24*60*60); // 1 day |
define('POLYFILL_CACHE_MAX_AGE', 24*60*60); // 1 day, TODO: put into baseconfig? |
|
# --- |
|
40,7 → 40,7 |
|
if (!isset($_SERVER['HTTP_USER_AGENT'])) { |
$out = '/* ERROR: No User Agent available */'; |
httpOutWithETag($out, 'application/javascript', 'polyfill.js'); |
httpOutWithETag($out, 'application/javascript', 'polyfill'.(MINIFY_POLYFILL ? '.min' : '').'.js'); |
} |
|
$ua = $_SERVER['HTTP_USER_AGENT']; |
78,7 → 78,7 |
touch($cache_file); |
} else { |
$out = '/* ERROR: polyfill.io not available and no cache file exists! */'; |
httpOutWithETag($out, 'application/javascript', 'polyfill.js'); |
httpOutWithETag($out, 'application/javascript', 'polyfill'.(MINIFY_POLYFILL ? '.min' : '').'.js'); |
} |
|
} else { |
86,10 → 86,11 |
$ua = str_replace('*/', '', $ua); |
$cont = '/* Polyfill '.$url.' for '.$ua.' */'.$cont; |
|
if (POLYFILL_CACHE_MAX_AGE > 0) { |
@file_put_contents($cache_file, $cont); |
} |
|
$out = $cont; |
|
} |
|
} else { |
100,4 → 101,4 |
|
# --- |
|
httpOutWithETag($out, 'application/javascript', 'polyfill.js'); |
httpOutWithETag($out, 'application/javascript', 'polyfill'.(MINIFY_POLYFILL ? '.min' : '').'.js'); |