aboutsummaryrefslogtreecommitdiff
path: root/admin/panes/version.php
blob: 10f127479e796b006069fd344f8ab6e944d6ca59 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>

<style>
    ::-webkit-scrollbar {
        width: 5px;
    }

    ::-webkit-scrollbar-track {
        border-radius: 9999px;
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        border-radius: 9999px;
        background-color: rgba(136, 136, 136, 0.5);
        transition: background 200ms;
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: rgba(85, 85, 85, 0.75);
    }

    ::-webkit-scrollbar-thumb:active {
        background-color: #222;
    }

    .list-group-item {
        background: #34373c;
    }
</style>

<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
    <h2 style="text-align:center;">This server is running <?= php_uname('s') ?> version</h2>

    <h4 style="text-align:center;"><?= php_uname('r') . " " . php_uname('v') ?></h4>

    <ul class="list-group" style="margin-top:20px;">
        <li class="list-group-item">PHP <?= PHP_VERSION ?></li>
        <li class="list-group-item">Minteck's Space <?= trim(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/version.txt")) ?></li>
        <li class="list-group-item">UnchainedTech <?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?></li>
        <li class="list-group-item">Neutron Cloud <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/version")) ?></li>
        <li class="list-group-item">Neutron Copper <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/cyclic_version")) ?></li>
        <li class="list-group-item">Neutron Titanium <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/jaw_version")) ?></li>
        <li class="list-group-item">
            <?php

                $osr = [];
                $lines = explode("\n", file_get_contents("/etc/os-release"));

                foreach ($lines as $line) {
                    if (trim($line) !== "") {
                        $parts = explode("=", $line);
                        $osr[$parts[0]] = str_replace("\"", "", $parts[1]);
                    }
                }
                
                echo($osr["NAME"] . " " . $osr["VERSION"]);

                ?>
        </li>
        <li class="list-group-item">Git <?php exec("git --version", $res);$p = explode(" ", $res[0]);array_shift($p);array_shift($p);echo(implode(" ", $p)) ?></li>
        <li class="list-group-item"><?php

            $soft = $_SERVER['SERVER_SOFTWARE'];

            if (strpos(strtolower($soft), "apache") !== false) {
                echo("Apache HTTP Server");
            } else {
                echo("nginx");
            }

            ?> <?php

            $soft = $_SERVER['SERVER_SOFTWARE'];

            if (strpos(strtolower($soft), "apache") !== false) {
                exec("apache2 -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
            } else {
                exec("nginx -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
            }

            ?></li>
    </ul>

    <ul class="list-group" style="margin-top:20px;">
        <li id="checking" class="list-group-item">Checking for updates...</li>
        <li id="checking2" class="list-group-item" style="display:none;"></li>
        <li id="found" class="list-group-item" style="display:none;">
            <b id="updates-count">0</b> package·s have updates available

            <details>
                <summary>View details</summary>
                <ul class="list-group" id="updates-list"></ul>
            </details>
        </li>
    </ul>
    <!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
    <script>
        $.ajax("/admin/api/refreshUpdates.php", {
            success: (data) => {
                document.getElementById("checking").innerText = "Checking for Ubuntu upgrades...";
                $.ajax("/admin/api/getUbuntuUpgrades.php", {
                    success: (data) => {
                        document.getElementById("checking").innerHTML = data;
                        document.getElementById("checking2").style.display = "";
                        document.getElementById("checking2").innerText = "Reading package lists...";
                        $.ajax("/admin/api/getUpdates.php", {
                            success: (data) => {
                                document.getElementById("checking2").innerText = "Please wait...";
                                document.getElementById("updates-count").innerText = data.count;

                                dom = "";
                                for (let index in data.packages) {
                                    item = data.packages[index];
                                    dom += `<li class="list-group-item"><b>${item.name}</b> (<span style="color: orange;">${item.version.local}</span><span style="color: green;">${item.version.remote}</span>)<br>Provided by: <code>${item.repos}</code>, target architecture: <code>${item.architecture}</code></li>`
                                }

                                document.getElementById("updates-list").innerHTML = dom;

                                document.getElementById("checking2").outerHTML = "";
                                document.getElementById("found").style.display = "";
                            },
                            error: () => {
                                document.getElementById("checking2").innerText = "An error occurred while loading this content";
                            }
                        });
                    },
                    error: () => {
                        document.getElementById("checking").innerText = "An error occurred while loading this content";
                    }
                });
            },
            error: () => {
                document.getElementById("checking").innerText = "An error occurred while loading this content";
            }
        });
    </script>
</div>

<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>