Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Fix db structure
-> Tickets message
  • Loading branch information
NaysKutzu committed Jan 21, 2025
1 parent c4a2594 commit f239179
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 69 deletions.
1 change: 1 addition & 0 deletions backend/app/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace MythicalClient;

use MythicalClient\MythicalSystems\Telemetry;
use RateLimit\Rate;
use Router\Router as rt;
use RateLimit\RedisRateLimiter;
Expand Down
1 change: 0 additions & 1 deletion backend/app/Logger/LoggerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function warning(string $message, bool $sendTelemetry = false): void
{
$caller = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class'] ?? 'unknown';
if ($sendTelemetry) {

$eventID = \Sentry\captureMessage($message, \Sentry\Severity::warning(), null);
}
$this->appendLog('[WARNING] (' . $eventID . ')[' . $caller . '] ' . $message);
Expand Down
34 changes: 3 additions & 31 deletions backend/app/MythicalSystems/Telemetry.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,14 @@

use MythicalClient\App;

class Telemetry implements TelemetryCollection
class Telemetry
{
public static function send(TelemetryCollection|string $telemetryCollection): void
public static function send(string $telemetryCollection): void
{
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',
urlencode((string) $telemetryCollection),
urlencode(SYSTEM_OS_NAME),
urlencode(SYSTEM_KERNEL_NAME),
'amd',
'64'
);

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

curl_exec($curl);
curl_close($curl);
} catch (\Exception $e) {
} catch (\Exception $e) {
App::getInstance(true)->getLogger()->debug('Failed to send telemetry data: ' . $e->getMessage());
// No one cares!
}
Expand Down
22 changes: 0 additions & 22 deletions backend/app/MythicalSystems/TelemetryCollection.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
CREATE TABLE IF NOT EXISTS
`mythicalclient_services_categories_features` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL ,
`category` int(16) NOT NULL,
`description` TEXT NOT NULL,
`enabled` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`category`) REFERENCES `mythicalclient_services_categories` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
CREATE TABLE
IF NOT EXISTS `mythicalclient_services_categories_features` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`category` int (16) NOT NULL,
`description` TEXT NOT NULL,
`enabled` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`category`) REFERENCES `mythicalclient_services_categories` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CREATE TABLE
`title` TEXT NOT NULL,
`shortDescription` TEXT NOT NULL,
`description` TEXT NOT NULL,
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CREATE TABLE
`id` INT NOT NULL AUTO_INCREMENT,
`announcements` int(16) NOT NULL,
`images` TEXT NOT NULL,
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`announcements`) REFERENCES `mythicalclient_announcements`(`id`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CREATE TABLE
`id` INT NOT NULL AUTO_INCREMENT,
`announcements` int(16) NOT NULL,
`tag` TEXT NOT NULL,
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`announcements`) REFERENCES `mythicalclient_announcements`(`id`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ALTER TABLE `mythicalclient_tickets` ADD `priority` ENUM('low','medium','high','urgent') NOT NULL DEFAULT 'low' AFTER `department`;
ALTER TABLE `mythicalclient_tickets` ADD `priority` ENUM ('low', 'medium', 'high', 'urgent') NOT NULL DEFAULT 'low' AFTER `department`;
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
ALTER TABLE `mythicalclient_tickets` ADD `status` ENUM('open','closed','waiting','replied','inprogress') NOT NULL DEFAULT 'open' AFTER `priority`;
ALTER TABLE `mythicalclient_tickets` ADD `status` ENUM (
'open',
'closed',
'waiting',
'replied',
'inprogress'
) NOT NULL DEFAULT 'open' AFTER `priority`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE
`mythicalclient_tickets_messages` (
`id` INT NOT NULL AUTO_INCREMENT,
`ticket` INT (16) NOT NULL,
`user` varchar(36) NOT NULL,
`message` TEXT NOT NULL,
`deleted` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`locked` ENUM ('false', 'true') NOT NULL DEFAULT 'false',
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`ticket`) REFERENCES `mythicalclient_tickets`(`id`),
FOREIGN KEY (`user`) REFERENCES `mythicalclient_users`(`uuid`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

0 comments on commit f239179

Please sign in to comment.