mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Update UI, page actions + functions for basic provider support
This commit is contained in:
parent
5123ab4599
commit
a2394c0742
@ -8,6 +8,7 @@ $defaults = [
|
|||||||
'RASPI_BRAND_TEXT' => 'RaspAP',
|
'RASPI_BRAND_TEXT' => 'RaspAP',
|
||||||
'RASPI_VERSION' => '2.9.6',
|
'RASPI_VERSION' => '2.9.6',
|
||||||
'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json',
|
'RASPI_CONFIG_NETWORK' => RASPI_CONFIG.'/networking/defaults.json',
|
||||||
|
'RASPI_CONFIG_PROVIDERS' => 'config/vpn-providers.json',
|
||||||
'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth',
|
'RASPI_ADMIN_DETAILS' => RASPI_CONFIG.'/raspap.auth',
|
||||||
'RASPI_WIFI_AP_INTERFACE' => 'wlan0',
|
'RASPI_WIFI_AP_INTERFACE' => 'wlan0',
|
||||||
'RASPI_CACHE_PATH' => sys_get_temp_dir() . '/raspap',
|
'RASPI_CACHE_PATH' => sys_get_temp_dir() . '/raspap',
|
||||||
@ -45,6 +46,7 @@ $defaults = [
|
|||||||
'RASPI_DHCP_ENABLED' => true,
|
'RASPI_DHCP_ENABLED' => true,
|
||||||
'RASPI_ADBLOCK_ENABLED' => false,
|
'RASPI_ADBLOCK_ENABLED' => false,
|
||||||
'RASPI_OPENVPN_ENABLED' => false,
|
'RASPI_OPENVPN_ENABLED' => false,
|
||||||
|
'RASPI_VPN_PROVIDER_ENABLED' => false,
|
||||||
'RASPI_WIREGUARD_ENABLED' => false,
|
'RASPI_WIREGUARD_ENABLED' => false,
|
||||||
'RASPI_TORPROXY_ENABLED' => false,
|
'RASPI_TORPROXY_ENABLED' => false,
|
||||||
'RASPI_CONFAUTH_ENABLED' => true,
|
'RASPI_CONFAUTH_ENABLED' => true,
|
||||||
|
@ -169,6 +169,24 @@ function getDefaultNetOpts($svc,$key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value for the specified VPN provider
|
||||||
|
*
|
||||||
|
* @param numeric $id
|
||||||
|
* @param string $key
|
||||||
|
* @return object $json
|
||||||
|
*/
|
||||||
|
function getProviderValue($id,$key)
|
||||||
|
{
|
||||||
|
$obj = json_decode(file_get_contents(RASPI_CONFIG_PROVIDERS), true);
|
||||||
|
if ($obj === null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$id--;
|
||||||
|
return $obj['providers'][$id][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Functions to write ini files */
|
/* Functions to write ini files */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -669,6 +687,7 @@ function initializeApp()
|
|||||||
$_SESSION["theme_url"] = getThemeOpt();
|
$_SESSION["theme_url"] = getThemeOpt();
|
||||||
$_SESSION["toggleState"] = getSidebarState();
|
$_SESSION["toggleState"] = getSidebarState();
|
||||||
$_SESSION["bridgedEnabled"] = getBridgedState();
|
$_SESSION["bridgedEnabled"] = getBridgedState();
|
||||||
|
$_SESSION["providerID"] = getProviderID();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThemeOpt()
|
function getThemeOpt()
|
||||||
@ -709,6 +728,17 @@ function getBridgedState()
|
|||||||
return $arrHostapdConf['BridgedEnable'];
|
return $arrHostapdConf['BridgedEnable'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns VPN provider ID, if defined
|
||||||
|
function getProviderID()
|
||||||
|
{
|
||||||
|
if (RASPI_VPN_PROVIDER_ENABLED) {
|
||||||
|
$arrProvider = parse_ini_file(RASPI_CONFIG.'/provider.ini');
|
||||||
|
if (isset($arrProvider['providerID'])) {
|
||||||
|
return $arrProvider['providerID'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the format of a CIDR notation string
|
* Validates the format of a CIDR notation string
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
case "/wg_conf":
|
case "/wg_conf":
|
||||||
DisplayWireGuardConfig();
|
DisplayWireGuardConfig();
|
||||||
break;
|
break;
|
||||||
|
case "/provider_conf":
|
||||||
|
DisplayProviderConfig();
|
||||||
|
break;
|
||||||
case "/torproxy_conf":
|
case "/torproxy_conf":
|
||||||
DisplayTorProxyConfig();
|
DisplayTorProxyConfig();
|
||||||
break;
|
break;
|
||||||
|
@ -60,6 +60,11 @@
|
|||||||
<a class="nav-link" href="wg_conf"><span class="ra-wireguard mr-2"></span><span class="nav-label"><?php echo _("WireGuard"); ?></a>
|
<a class="nav-link" href="wg_conf"><span class="ra-wireguard mr-2"></span><span class="nav-label"><?php echo _("WireGuard"); ?></a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
<?php if (RASPI_VPN_PROVIDER_ENABLED) : ?>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="provider_conf"><i class="fas fa-shield-alt fa-fw mr-2"></i><span class="nav-label"><?php echo _(getProviderValue($_SESSION["providerID"], "name")); ?></a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
<?php if (RASPI_TORPROXY_ENABLED) : ?>
|
<?php if (RASPI_TORPROXY_ENABLED) : ?>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="torproxy_conf"><i class="fas fa-eye-slash fa-fw mr-2"></i><span class="nav-label"><?php echo _("TOR proxy"); ?></a>
|
<a class="nav-link" href="torproxy_conf"><i class="fas fa-eye-slash fa-fw mr-2"></i><span class="nav-label"><?php echo _("TOR proxy"); ?></a>
|
||||||
|
@ -45,6 +45,7 @@ require_once 'includes/data_usage.php';
|
|||||||
require_once 'includes/about.php';
|
require_once 'includes/about.php';
|
||||||
require_once 'includes/openvpn.php';
|
require_once 'includes/openvpn.php';
|
||||||
require_once 'includes/wireguard.php';
|
require_once 'includes/wireguard.php';
|
||||||
|
require_once 'includes/provider.php';
|
||||||
require_once 'includes/torproxy.php';
|
require_once 'includes/torproxy.php';
|
||||||
|
|
||||||
initializeApp();
|
initializeApp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user