Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Format & linting error fix
  • Loading branch information
NaysKutzu committed Dec 8, 2024
1 parent 05ccffc commit 128e4f1
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 36 deletions.
52 changes: 40 additions & 12 deletions backend/app/MythicalSystems/Telemetry.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
<?php

/*
* This file is part of MythicalClient.
* Please view the LICENSE file that was distributed with this source code.
*
* MIT License
*
* (c) MythicalSystems <mythicalsystems.xyz> - All rights reserved
* (c) NaysKutzu <nayskutzu.xyz> - All rights reserved
* (c) Cassian Gherman <nayskutzu.xyz> - All rights reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace MythicalClient\MythicalSystems;

use MythicalClient\App;
Expand All @@ -11,38 +40,37 @@ public static function send(TelemetryCollection|string $telemetryCollection): vo
try {
App::getInstance(true)->getLogger()->debug('Sending telemetry data: ' . $telemetryCollection);
$url = sprintf(
"https://api.mythicalsystems.xyz/telemetry?authKey=%s&project=%s&action=%s&osName=%s&kernelName=%s&cpuArchitecture=%s&osArchitecture=%s",
"AxWTnecj85SI4bG6rIP8bvw2uCF7W5MmkJcQIkrYS80MzeTraQWyICL690XOio8F",
"mythicalclient",
'https://api.mythicalsystems.xyz/telemetry?authKey=%s&project=%s&action=%s&osName=%s&kernelName=%s&cpuArchitecture=%s&osArchitecture=%s',
'AxWTnecj85SI4bG6rIP8bvw2uCF7W5MmkJcQIkrYS80MzeTraQWyICL690XOio8F',
'mythicalclient',
urlencode((string) $telemetryCollection),
urlencode(SYSTEM_OS_NAME),
urlencode(SYSTEM_KERNEL_NAME),
"amd",
"64"
'amd',
'64'
);

$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => '',
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"User-Agent: mythicalclient/" . APP_VERSION
'Content-Type: application/json',
'User-Agent: mythicalclient/' . APP_VERSION,
],
]);

curl_exec($curl);
curl_close($curl);
} catch (\Exception $e) {
App::getInstance(true)->getLogger()->debug("Failed to send telemetry data: ". $e->getMessage());
App::getInstance(true)->getLogger()->debug('Failed to send telemetry data: ' . $e->getMessage());
// No one cares!
}
}
}

40 changes: 35 additions & 5 deletions backend/app/MythicalSystems/TelemetryCollection.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
<?php

/*
* This file is part of MythicalClient.
* Please view the LICENSE file that was distributed with this source code.
*
* MIT License
*
* (c) MythicalSystems <mythicalsystems.xyz> - All rights reserved
* (c) NaysKutzu <nayskutzu.xyz> - All rights reserved
* (c) Cassian Gherman <nayskutzu.xyz> - All rights reserved
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace MythicalClient\MythicalSystems;

interface TelemetryCollection {
public const USER_NEW = "user:new";
public const SERVICE_NEW = "service:new";
public const TICKET_OPEN = "ticket:open";
interface TelemetryCollection
{
public const USER_NEW = 'user:new';
public const SERVICE_NEW = 'service:new';
public const TICKET_OPEN = 'ticket:open';

}
}
6 changes: 3 additions & 3 deletions backend/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
define('APP_SOURCECODE_DIR', APP_DIR . 'app');
define('APP_ROUTES_DIR', APP_SOURCECODE_DIR . '/Api');
define('APP_DEBUG', true);
define('SYSTEM_OS_NAME', gethostname().'/'.PHP_OS_FAMILY);
define('SYSTEM_OS_NAME', gethostname() . '/' . PHP_OS_FAMILY);
define('SYSTEM_KERNEL_NAME', php_uname('s'));
define('APP_VERSION', "dev");
define("TELEMETRY", true);
define('APP_VERSION', 'dev');
define('TELEMETRY', true);
/**
* Require the kernel.
*/
Expand Down
15 changes: 4 additions & 11 deletions frontend/src/components/client/LayoutDashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ import {
User as UserIcon,
Menu as MenuIcon,
X as XIcon,
HelpCircle as HelpIcon,
Users as UsersIcon,
Settings as SettingsIcon,
LogOut as LogOutIcon,
Expand All @@ -240,11 +239,6 @@ import {
Database as DatabaseIcon,
AlertTriangle as AlertTriangleIcon,
Ticket as TicketIcon,
Webhook as ApiKeysIcon,
Scale as ScaleIcon,
Antenna as RssIcon,
Blocks as AddonsIcon,
Logs as LogsIcon,
} from 'lucide-vue-next';
import Settings from '@/mythicalclient/Settings';
import Session from '@/mythicalclient/Session';
Expand Down Expand Up @@ -305,12 +299,11 @@ const menuSections = ref([
active: isActiveRoute(['/ticket']),
},
],
}
},
]);
// Profile Menu
interface ProfileMenuItem {
name: string;
icon: FunctionalComponent;
Expand All @@ -319,8 +312,8 @@ interface ProfileMenuItem {
const profileMenu = ref<ProfileMenuItem[]>([]);
const role = Session.getInfo('role_real_name');
if (["admin", "administrator", "support", "supportbuddy"].includes(role)) {
const role = Session.getInfo('role_real_name');
if (['admin', 'administrator', 'support', 'supportbuddy'].includes(role)) {
profileMenu.value = [
{ name: 'Settings', icon: SettingsIcon, href: '/account' },
{ name: 'Admin Area', icon: UsersIcon, href: '/mc-admin' },
Expand All @@ -332,7 +325,7 @@ if (["admin", "administrator", "support", "supportbuddy"].includes(role)) {
{ name: 'Settings', icon: SettingsIcon, href: '/account' },
{ name: 'Logout', icon: LogOutIcon, href: '/auth/logout' },
];
console.log('User is not Admin:' , role);
console.log('User is not Admin:', role);
}
// Sample Notifications
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/mythicalclient/Permissions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
class Permissions {
class Permissions {}

}

export default Permissions;
export default Permissions;
1 change: 0 additions & 1 deletion frontend/src/views/admin/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,4 @@
<script setup lang="ts">
import { CheckCircle, Heart, HelpCircle } from 'lucide-vue-next';
import LayoutDashboard from '@/components/admin/LayoutDashboard.vue';
</script>

0 comments on commit 128e4f1

Please sign in to comment.