-
Notifications
You must be signed in to change notification settings - Fork 81
/
bootstrap.php
71 lines (65 loc) · 2.28 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php declare(strict_types=1);
/**
* Hybula Looking Glass
*
* Provides UI and input for the looking glass backend.
*
* @copyright 2022 Hybula B.V.
* @license Mozilla Public License 2.0
* @version 1.1.0
* @since File available since release 1.1.0
* @link https://github.com/hybula/lookingglass
*/
use Hybula\LookingGlass;
if (!file_exists(__DIR__ . '/config.php')) {
die('config.php is not found, but is required for application to work!');
}
require __DIR__ . '/LookingGlass.php';
require __DIR__ . '/config.php';
LookingGlass::validateConfig();
LookingGlass::startSession();
function exitErrorMessage(string $message): void
{
unset($_SESSION[LookingGlass::SESSION_CALL_BACKEND]);
$_SESSION[LookingGlass::SESSION_ERROR_MESSAGE] = $message;
exitNormal();
}
function exitNormal(): void
{
header("Refresh: 0");
exit;
}
$templateData = [
'title' => LG_TITLE,
'custom_css' => LG_CSS_OVERRIDES,
'custom_head' => LG_CUSTOM_HEAD,
'logo_url' => LG_LOGO_URL,
'logo_data' => LG_LOGO,
'logo_data_dark' => LG_LOGO_DARK,
//
'block_network' => LG_BLOCK_NETWORK,
'block_lookingglass' => LG_BLOCK_LOOKINGGLASS,
'block_speedtest' => LG_BLOCK_SPEEDTEST,
'block_custom' => LG_BLOCK_CUSTOM,
'custom_html' => '',
//
'locations' => LG_LOCATIONS,
'current_location' => LG_LOCATION,
'maps_query' => LG_MAPS_QUERY,
'facility' => LG_FACILITY,
'facility_url' => LG_FACILITY_URL,
'ipv4' => LG_IPV4,
'ipv6' => LG_IPV6,
'methods' => LG_METHODS,
'user_ip' => LookingGlass::detectIpAddress(),
//
'speedtest_iperf' => LG_SPEEDTEST_IPERF,
'speedtest_incoming_label' => LG_SPEEDTEST_LABEL_INCOMING,
'speedtest_incoming_cmd' => LG_SPEEDTEST_CMD_INCOMING,
'speedtest_outgoing_label' => LG_SPEEDTEST_LABEL_OUTGOING,
'speedtest_outgoing_cmd' => LG_SPEEDTEST_CMD_OUTGOING,
'speedtest_files' => LG_SPEEDTEST_FILES,
//
'tos' => LG_TERMS,
'error_message' => false,
];