diff --git a/MythicalDash64 b/MythicalDash64 index 6140955..f3a6351 100755 Binary files a/MythicalDash64 and b/MythicalDash64 differ diff --git a/MythicalDashARM32 b/MythicalDashARM32 index 86bcede..33f3f50 100755 Binary files a/MythicalDashARM32 and b/MythicalDashARM32 differ diff --git a/MythicalDashARM64 b/MythicalDashARM64 index 098dcf7..c235350 100755 Binary files a/MythicalDashARM64 and b/MythicalDashARM64 differ diff --git a/cli/Program.cs b/cli/Program.cs index 8406895..532d6a4 100644 --- a/cli/Program.cs +++ b/cli/Program.cs @@ -259,6 +259,55 @@ public static void Main(string[] args) sh.SetEnglish(); Environment.Exit(0x0); } + else if (args.Contains("-environment:rebuild")) + { + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "THIS COMMAND WILL WIPE YOUR DATABASE AND REBUILD IT!"); + Program.logger.Log(LogType.Warning, "ANY DATA SAVED ON THE DATABASE WILL BE GONE FOREVER!"); + Program.logger.Log(LogType.Warning, "MAKE SURE YOU KNOW WHAT YOU ARE DOING!!"); + Program.logger.Log(LogType.Warning, "DO THIS ONLY IF YOU DO NOT USE ANY SERVER MODULE!"); + Program.logger.Log(LogType.Warning, "ANY LEFT SERVERS/CLIENTS WILL GET ONLY DELETED INSIDE THE DATABASE!"); + Program.logger.Log(LogType.Warning, "MAKE SURE YOU DELETE EVERY USER/SERVER BEFORE YOU RUN THIS!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "WARNING WARNING WARNING!"); + Program.logger.Log(LogType.Warning, "Are you sure you want to proceed? (yes/no)"); +#pragma warning disable CS8602 + string? DBuserResponse = Console.ReadLine().Trim().ToLower(); +#pragma warning restore CS8602 + if (DBuserResponse == "yes") + { + try + { + db.Rebuild(); + Environment.Exit(0x0); + } + catch (Exception ex) + { + Program.logger.Log(LogType.Error, $"Failed rebuild: {ex.Message}"); + + } + } + else if (DBuserResponse == "no") + { + Program.logger.Log(LogType.Info, "Action cancelled."); + Environment.Exit(0x0); + } + else + { + Program.logger.Log(LogType.Info, "Invalid response. Please enter 'yes' or 'no'."); + Environment.Exit(0x0); + } + Environment.Exit(0x0); + } else if (args.Contains("-help")) { Console.Clear(); @@ -272,6 +321,7 @@ public static void Main(string[] args) Console.WriteLine("‖ -environment:up ‖ Exit maintenance mode. ‖"); Console.WriteLine("‖ -environment:setup ‖ This is a command to help you setup your dashboard! ‖"); Console.WriteLine("‖ -environment:lang ‖ Resets the dashboard language to en_US ‖"); + Console.WriteLine("‖ -environment:rebuild ‖ Rebuilds the hole database from scratch. ‖"); Console.WriteLine("‖ -turnstile:disable ‖ Stops turnstile from running! ‖"); Console.WriteLine("‖ -vpn:disable ‖ Stops anti vpn from running! ‖"); Console.WriteLine("‖ -key:generate ‖ Generate a new encryption key for MythicalDash. ‖"); diff --git a/cli/scripts/Database.cs b/cli/scripts/Database.cs index d3f732b..3b1a39f 100644 --- a/cli/scripts/Database.cs +++ b/cli/scripts/Database.cs @@ -28,14 +28,14 @@ private static string ReadPasswordInput() else { password += key.KeyChar; - Console.Write("*"); + Console.Write("*"); } } return password; } public void Configurator() { - #pragma warning disable +#pragma warning disable Program.logger.Log(LogType.Info, "Hi, please fill in your database configuration for MythicalDash."); string defaultHost = "localhost"; string defaultPort = "3306"; @@ -92,7 +92,7 @@ public void Configurator() { dbName = deafultdbName; } - #pragma warning restore +#pragma warning restore if (string.IsNullOrEmpty(host) || string.IsNullOrEmpty(port) || string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(dbName)) { Program.logger.Log(LogType.Error, "Invalid input. Please provide all the required values."); @@ -114,6 +114,22 @@ public void Configurator() Environment.Exit(0x0); } } + public void Rebuild() + { + if (fm.ConfigExists() == true) + { + if (File.Exists("/var/www/mythicaldash/migrates.ini")) { + File.Delete("/var/www/mythicaldash/migrates.ini"); + } + Migrate m = new Migrate(); + m.Now(); + Environment.Exit(0x0); + } + else + { + Program.logger.Log(LogType.Error, "It looks like the config file does not exist!"); + } + } public void UpdateConfig(string host, string port, string username, string password, string dbname) { if (fm.ConfigExists() == true) diff --git a/composer.lock b/composer.lock index 8012a90..12b4f67 100644 --- a/composer.lock +++ b/composer.lock @@ -724,16 +724,16 @@ }, { "name": "stripe/stripe-php", - "version": "v13.9.0", + "version": "v13.12.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "3d9250964c9d0bc9de8c706b16a90a82d9c8ed9d" + "reference": "8052da9058caae10c7297f85821f652b38e31d85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/3d9250964c9d0bc9de8c706b16a90a82d9c8ed9d", - "reference": "3d9250964c9d0bc9de8c706b16a90a82d9c8ed9d", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/8052da9058caae10c7297f85821f652b38e31d85", + "reference": "8052da9058caae10c7297f85821f652b38e31d85", "shasum": "" }, "require": { @@ -777,9 +777,9 @@ ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v13.9.0" + "source": "https://github.com/stripe/stripe-php/tree/v13.12.0" }, - "time": "2024-01-12T18:12:31+00:00" + "time": "2024-02-22T22:19:58+00:00" }, { "name": "symfony/deprecation-contracts", @@ -850,16 +850,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -873,9 +873,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -912,7 +909,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -928,20 +925,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.0", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4f9237a1bb42455d609e6687d2613dde5b41a587" + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4f9237a1bb42455d609e6687d2613dde5b41a587", - "reference": "4f9237a1bb42455d609e6687d2613dde5b41a587", + "url": "https://api.github.com/repos/symfony/yaml/zipball/d75715985f0f94f978e3a8fa42533e10db921b90", + "reference": "d75715985f0f94f978e3a8fa42533e10db921b90", "shasum": "" }, "require": { @@ -984,7 +981,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.0" + "source": "https://github.com/symfony/yaml/tree/v6.4.3" }, "funding": [ { @@ -1000,7 +997,7 @@ "type": "tidelift" } ], - "time": "2023-11-06T11:00:25+00:00" + "time": "2024-01-23T14:51:35+00:00" } ], "packages-dev": [], diff --git a/migrate/1.sql b/migrate/1.sql index 2e13f51..0ef689b 100644 --- a/migrate/1.sql +++ b/migrate/1.sql @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS `mythicaldash_apikeys`; CREATE TABLE `mythicaldash_apikeys` ( `id` int(11) NOT NULL, `name` text NOT NULL, @@ -6,6 +7,7 @@ CREATE TABLE `mythicaldash_apikeys` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_eggs`; CREATE TABLE `mythicaldash_eggs` ( `id` int(11) NOT NULL, `name` text NOT NULL, @@ -15,6 +17,7 @@ CREATE TABLE `mythicaldash_eggs` ( `date` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_locations`; CREATE TABLE `mythicaldash_locations` ( `id` int(11) NOT NULL, `name` text NOT NULL, @@ -24,6 +27,7 @@ CREATE TABLE `mythicaldash_locations` ( `created` date NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_login_logs`; CREATE TABLE `mythicaldash_login_logs` ( `id` int(11) NOT NULL, `ipaddr` text NOT NULL, @@ -31,6 +35,7 @@ CREATE TABLE `mythicaldash_login_logs` ( `date` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_logs`; CREATE TABLE `mythicaldash_logs` ( `id` int(11) NOT NULL, `log` text NOT NULL, @@ -38,6 +43,7 @@ CREATE TABLE `mythicaldash_logs` ( `type` enum('auth','action','error') NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_redeem`; CREATE TABLE `mythicaldash_redeem` ( `id` int(11) NOT NULL, `code` text NOT NULL, @@ -53,6 +59,7 @@ CREATE TABLE `mythicaldash_redeem` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_resetpasswords`; CREATE TABLE `mythicaldash_resetpasswords` ( `id` int(11) NOT NULL, `email` text DEFAULT NULL, @@ -63,6 +70,7 @@ CREATE TABLE `mythicaldash_resetpasswords` ( `dateinfo` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_servers`; CREATE TABLE `mythicaldash_servers` ( `id` int(11) NOT NULL, `pid` text NOT NULL, @@ -71,6 +79,7 @@ CREATE TABLE `mythicaldash_servers` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_servers_queue`; CREATE TABLE `mythicaldash_servers_queue` ( `id` int(11) NOT NULL, `name` text NOT NULL, @@ -88,6 +97,7 @@ CREATE TABLE `mythicaldash_servers_queue` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_settings`; CREATE TABLE `mythicaldash_settings` ( `id` int(11) NOT NULL, `name` text NOT NULL DEFAULT '\'MythicalDash\'', @@ -132,6 +142,7 @@ CREATE TABLE `mythicaldash_settings` ( `version` text NOT NULL DEFAULT '2.0.0' ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_tickets`; CREATE TABLE `mythicaldash_tickets` ( `id` int(11) NOT NULL, `ownerkey` text NOT NULL, @@ -144,6 +155,7 @@ CREATE TABLE `mythicaldash_tickets` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_tickets_messages`; CREATE TABLE `mythicaldash_tickets_messages` ( `id` int(11) NOT NULL, `ticketuuid` text NOT NULL, @@ -153,6 +165,7 @@ CREATE TABLE `mythicaldash_tickets_messages` ( `created` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +DROP TABLE IF EXISTS `mythicaldash_users`; CREATE TABLE `mythicaldash_users` ( `id` int(11) NOT NULL, `panel_id` text NOT NULL, diff --git a/migrate/11.sql b/migrate/11.sql index 76e0b02..75d5ba7 100644 --- a/migrate/11.sql +++ b/migrate/11.sql @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS `mythicaldash_linkvertise`; CREATE TABLE `mythicaldash_linkvertise` ( `id` int(11) NOT NULL, `skey` text NOT NULL, diff --git a/migrate/19.sql b/migrate/19.sql index 6300088..e62fc15 100644 --- a/migrate/19.sql +++ b/migrate/19.sql @@ -1 +1 @@ -DROP TABLE `mythicaldash`.`mythicaldash_logs`; \ No newline at end of file +DROP TABLE `mythicaldash_logs`; \ No newline at end of file diff --git a/migrate/33.sql b/migrate/33.sql index 92d8129..9758300 100644 --- a/migrate/33.sql +++ b/migrate/33.sql @@ -1 +1,2 @@ -CREATE TABLE `mythicaldash`.`mythicaldash_payments` (`id` INT NOT NULL AUTO_INCREMENT , `code` TEXT NOT NULL , `status` ENUM('pending','paid','processing','canceled') NOT NULL DEFAULT 'pending' , `date` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file +DROP TABLE IF EXISTS `mythicaldash_payments`; +CREATE TABLE `mythicaldash_payments` (`id` INT NOT NULL AUTO_INCREMENT , `code` TEXT NOT NULL , `status` ENUM('pending','paid','processing','canceled') NOT NULL DEFAULT 'pending' , `date` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file diff --git a/migrate/38.sql b/migrate/38.sql index a06eeae..ba3aa13 100644 --- a/migrate/38.sql +++ b/migrate/38.sql @@ -1 +1,2 @@ -CREATE TABLE `mythicaldash`.`mythicaldash_eggs_config` (`id` INT NOT NULL AUTO_INCREMENT , `setting_name` TEXT NOT NULL , `setting_value` TEXT NOT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file +DROP TABLE IF EXISTS `mythicaldash_eggs_config`; +CREATE TABLE `mythicaldash_eggs_config` (`id` INT NOT NULL AUTO_INCREMENT , `setting_name` TEXT NOT NULL , `setting_value` TEXT NOT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file diff --git a/migrate/40.sql b/migrate/40.sql index cdfe5be..c106b0d 100644 --- a/migrate/40.sql +++ b/migrate/40.sql @@ -1 +1,2 @@ -CREATE TABLE `mythicaldash`.`mythicaldash_servers_logs` (`id` INT NOT NULL AUTO_INCREMENT , `type` ENUM('error','warning','success','critical') NULL DEFAULT 'warning' , `text` TEXT NOT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file +DROP TABLE IF EXISTS `mythicaldash_servers_logs`; +CREATE TABLE `mythicaldash_servers_logs` (`id` INT NOT NULL AUTO_INCREMENT , `type` ENUM('error','warning','success','critical') NULL DEFAULT 'warning' , `text` TEXT NOT NULL , `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB; \ No newline at end of file diff --git a/view/admin/servers/purge.php b/view/admin/servers/purge.php index e9f4374..83c06b6 100644 --- a/view/admin/servers/purge.php +++ b/view/admin/servers/purge.php @@ -6,7 +6,7 @@ function PurgeServers($dbconn) { - $dbconn->query("TRUNCATE TABLE `mythicaldash`.`mythicaldash_servers_queue`"); + $dbconn->query("TRUNCATE TABLE `mythicaldash_servers_queue`"); $query = "SELECT * FROM mythicaldash_servers WHERE mythicaldash_servers.purge = 'true'"; $resultdb = mysqli_query($dbconn, $query); if ($resultdb) { diff --git a/view/admin/settings/main.php b/view/admin/settings/main.php index cc1f2b3..ddd40cc 100644 --- a/view/admin/settings/main.php +++ b/view/admin/settings/main.php @@ -47,6 +47,8 @@
General

Customize your general settings here.

+

For the language list that you can you use please check your /lang folder!!.

+