Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Announcements
-> Fixed github data
-> Optimized some endpoints
  • Loading branch information
NaysKutzu committed Jan 14, 2025
1 parent 3852301 commit 57491eb
Show file tree
Hide file tree
Showing 16 changed files with 1,174 additions and 53 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ For any inquiries, abuse reports, or violation notices, contact us at [abuse@myt
- The creation, sale, and distribution of third-party addons or plugins for the Software are permitted, provided they comply with this license.
- All third-party addons or plugins must not attempt to bypass, modify, or interfere with the core functionality or licensing requirements of the Software.

### 1.5. Forking
- Forking the Software is allowed, provided that the forked version continues to comply with all terms and conditions outlined in this license. Any modifications made in the fork must respect the original license and maintain all attributions and copyright notices.
- Redistribution of forked versions is subject to the same restrictions as the original Software, requiring explicit authorization from MythicalSystems or Cassian Gherman.
- Forked versions must not attempt to bypass, modify, or interfere with the core functionality or licensing requirements of the Software.
- Unauthorized leaking, sharing, or redistribution of forked versions is illegal and subject to legal action.
- Forked versions must be linked to an active account on our public platform, MythicalSystems.

## 2. Restrictions

### 2.1. Account Requirement
Expand Down
4 changes: 2 additions & 2 deletions backend/app/Api/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@

$appInstance->OK('Dashboard data retrieved successfully.', [
'core' => [
'github_data' => json_decode($github_data, true),
'github_data' => $github_data,
],
'count' => [
'user_count' => $userCount,
Expand All @@ -148,7 +148,7 @@
]);

} catch (Exception $e) {
$appInstance->ServiceUnavailable($e->getMessage(), ['error_code' => 'SERVICE_UNAVAILABLE']);
$appInstance->InternalServerError($e->getMessage(), ['error_code' => 'SERVICE_UNAVAILABLE']);
}
} else {
$appInstance->Unauthorized('You do not have permission to access this endpoint.', ['error_code' => 'NO_PERMISSION']);
Expand Down
117 changes: 117 additions & 0 deletions backend/app/Api/User/Session/Announcements.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php

/*
* This file is part of MythicalClient.
* Please view the LICENSE file that was distributed with this source code.
*
* # MythicalSystems License v2.0
*
* ## Copyright (c) 2021–2025 MythicalSystems and Cassian Gherman
*
* ### Preamble
* This license governs the use, modification, and distribution of the software known as MythicalClient or MythicalDash ("the Software"). By using the Software, you agree to the terms outlined in this document. These terms aim to protect the Software’s integrity, ensure fair use, and establish guidelines for authorized distribution, modification, and commercial use.
*
* For any inquiries, abuse reports, or violation notices, contact us at [[email protected]](mailto:[email protected]).
*
* ## 1. Grant of License
*
* ### 1.1. Usage Rights
* - You are granted a non-exclusive, revocable license to use the Software, provided you comply with the terms herein.
* - The Software must be linked to an active account on our public platform, MythicalSystems.
*
* ### 1.2. Modification Rights
* - You may modify the Software only for personal use and must not distribute modified versions unless explicitly approved by MythicalSystems or Cassian Gherman.
*
* ### 1.3. Redistribution and Commercial Use
* - Redistribution of the Software, whether modified or unmodified, is strictly prohibited unless explicitly authorized in writing by MythicalSystems or Cassian Gherman.
* - Selling the Software or its derivatives is only permitted on authorized marketplaces specified by MythicalSystems.
* - Unauthorized leaking, sharing, or redistribution of the Software or its components is illegal and subject to legal action.
*
* ### 1.4. Third-Party Addons and Plugins
* - The creation, sale, and distribution of third-party addons or plugins for the Software are permitted, provided they comply with this license.
* - All third-party addons or plugins must not attempt to bypass, modify, or interfere with the core functionality or licensing requirements of the Software.
*
* ## 2. Restrictions
*
* ### 2.1. Account Requirement
* - The Software requires an active account on MythicalSystems. Attempts to modify, bypass, or remove this requirement are strictly prohibited.
*
* ### 2.2. Unauthorized Use
* - Use of the Software to perform unauthorized actions, including but not limited to exploiting vulnerabilities, bypassing authentication, or reverse engineering, is prohibited.
*
* ### 2.3. Leaking and Distribution
* - Any unauthorized leaking, sharing, or distribution of the Software is a direct violation of this license. Legal action will be taken against violators.
* - Leaked or pirated copies of the Software are considered illegal, and users found utilizing such versions will face immediate termination of access and potential legal consequences.
*
* ### 2.4. Modification of Terms
* - The terms and conditions of this license may not be modified, replaced, or overridden in any distributed version of the Software.
*
* ## 3. Attribution and Copyright
*
* ### 3.1. Attribution
* - You must retain all copyright notices, attributions, and references to MythicalSystems and Cassian Gherman in all copies, derivatives, or distributions of the Software.
*
* ### 3.2. Copyright Invariance
* - Copyright notices must remain intact and unaltered in all versions of the Software, including modified versions.
*
* ## 4. Legal and Liability Terms
*
* ### 4.1. Disclaimer of Liability
* - The Software is provided "as is," without any warranty, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement.
* - MythicalSystems and Cassian Gherman shall not be held liable for any damages arising from the use, misuse, or inability to use the Software, including but not limited to:
* - Loss of data, profits, or revenue.
* - Security vulnerabilities such as SQL injection, zero-day exploits, or other potential risks.
* - System failures, downtime, or disruptions.
*
* ### 4.2. Enforcement
* - Violations of this license will result in immediate termination of access to the Software and may involve legal action.
* - MythicalSystems reserves the right to suspend or terminate access to any user, client, or hosting provider without prior notice.
*
* ### 4.3. No Guarantees
* - MythicalSystems does not guarantee uninterrupted or error-free operation of the Software.
*
* ## 5. Privacy and Data Sharing
*
* ### 5.1. Public Information
* - Some user information may be shared with third parties or made publicly visible in accordance with our Privacy Policy and Terms of Service. For more details, please visit:
* - [Privacy Policy](https://www.mythical.systems/privacy)
* - [Terms of Service](https://www.mythical.systems/terms)
*
* ### 5.2. Data Collection
* - The Software may collect and transmit anonymized usage data to improve performance and functionality.
*
* ## 6. Governing Law
*
* ### 6.1. Jurisdiction
* - This license shall be governed and construed in accordance with the laws of Austria.
*
* ### 6.2. Dispute Resolution
* - All disputes arising under or in connection with this license shall be subject to the exclusive jurisdiction of the courts in Austria.
*
* ## 7. Termination
*
* ### 7.1. Violation of Terms
* - MythicalSystems reserves the right to terminate access to the Software for any user found in violation of this license.
*
* ### 7.2. Immediate Termination
* - Termination may occur immediately and without prior notice.
*
* ## 8. Contact Information
* For abuse reports, legal inquiries, or support, contact [[email protected]](mailto:[email protected]).
*
* ## 9. Acceptance
* By using, modifying, or distributing the Software, you agree to the terms outlined in this license.
*/

use MythicalClient\App;
use MythicalClient\Chat\Session;
use MythicalClient\Chat\Announcements;

$router->add('/api/user/announcements', function (): void {
App::init();
$appInstance = App::getInstance(true);
$appInstance->allowOnlyGET();
new Session($appInstance);

$appInstance->OK('Here you go, cuz i heard you want some announcements!', ['announcements' => Announcements::getAll()]);
});
12 changes: 0 additions & 12 deletions backend/app/Api/User/Session/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,16 @@
$router->get('/api/user/session/emails', function (): void {
App::init();
$appInstance = App::getInstance(true);
$config = $appInstance->getConfig();

$appInstance->allowOnlyGET();

$session = new Session($appInstance);

$accountToken = $session->SESSION_KEY;

$appInstance->OK('User emails', [
'emails' => Mails::getAll(User::getInfo($accountToken, UserColumns::UUID, false)),
]);
});

$router->get('/api/user/session/emails/(.*)/raw', function (string $id): void {
$appInstance = App::getInstance(true);
$config = $appInstance->getConfig();
if ($id == '') {
exit(header('location: /account'));
}
Expand Down Expand Up @@ -159,22 +153,16 @@

$router->delete('/api/user/session/emails/(.*)/delete', function (string $id): void {
$appInstance = App::getInstance(true);
$config = $appInstance->getConfig();
if ($id == '') {
$appInstance->BadRequest('Email not found!', ['error_code' => 'EMAIL_NOT_FOUND']);
}

if (!is_numeric($id)) {
$appInstance->BadRequest('Email not found!', ['error_code' => 'EMAIL_NOT_FOUND']);
}
$id = (int) $id;

$appInstance->allowOnlyDELETE();

$session = new Session($appInstance);

$accountToken = $session->SESSION_KEY;

if (Mails::exists($id)) {
if (Mails::doesUserOwnEmail(User::getInfo($accountToken, UserColumns::UUID, false), $id)) {
Mails::delete($id, User::getInfo($accountToken, UserColumns::UUID, false));
Expand Down
9 changes: 0 additions & 9 deletions backend/app/Api/User/Session/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,8 @@
$router->get('/api/user/session', function (): void {
App::init();
$appInstance = App::getInstance(true);
$config = $appInstance->getConfig();

$appInstance->allowOnlyGET();

$session = new Session($appInstance);

$accountToken = $session->SESSION_KEY;
try {
$billing = Billing::getBillingData(User::getInfo($accountToken, UserColumns::UUID, false));
Expand Down Expand Up @@ -269,14 +265,9 @@
$router->get('/api/user/session/activities', function (): void {
App::init();
$appInstance = App::getInstance(true);
$config = $appInstance->getConfig();

$appInstance->allowOnlyGET();

$session = new Session($appInstance);

$accountToken = $session->SESSION_KEY;

$appInstance->OK('User activities', [
'activities' => UserActivities::get(User::getInfo($accountToken, UserColumns::UUID, false)),
]);
Expand Down
Loading

0 comments on commit 57491eb

Please sign in to comment.