functions.php: allow json API access from src.openmamba.org

This commit is contained in:
Silvan Calarco 2024-08-11 17:22:04 +02:00
parent ae6269ac58
commit d250402a3c

View File

@ -209,12 +209,13 @@ function openmamba_download_func( $atts ) {
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
$ret .= openmamba_download_link($milestone,$medium,$currarch,$ext,$langs[$outputlang],$outputlang);
}
$out .= "";
foreach ($langs as $l => $lang) {
if ($l == $outputlang) continue;
reset($archname);
foreach($archname as $ey => $currarch) {
if (strpos(";".$a['archs'].";",$currarch) == false) continue;
$out = openmamba_download_link($milestone,$medium,$currarch,$ext,$lang,$l);
$out .= openmamba_download_link($milestone,$medium,$currarch,$ext,$lang,$l);
}
}
$ret .= do_shortcode("[expand title=\"". __("More languages...","responsive") . "\"]". $out ."[/expand]");
@ -437,7 +438,7 @@ add_action('admin_init', 'wpb_imagelink_setup', 10);
/* Security: restrict access to wp-json */
function restrict_rest_api_to_localhost() {
$whitelist = [ '127.0.0.1', "::1" ];
$whitelist = [ '127.0.0.1', "::1", '176.9.120.93', '2a01:4f8:151:7444::1:3' ];
if( ! in_array($_SERVER['REMOTE_ADDR'], $whitelist ) ){
die( 'REST API is disabled.' );