[COSMIC] Project

Raizer

Active Member
Feb 21, 2019
144
76
Dear devbest members,

Introduction
In February this year I started developping on a Habbo CMS because most of the currently released CMS are deprecated and extremely bad programmed.
The project has stopped for a while because I started working for another retro called LeetHotel. Due to circumstances I quit Leet and decided to myself to continue with this project .

Leet Hotel also uses my framework at this moment but i changed the layout a bit to keep the originality.
I think this is a good start to continue the project, apart from the fact that we all know that retro's is already dying..

Before we start I want to say, thanks Metus for helping with this project and I wish you the best with you and your hotel.

AsteroidCMS
This framework has a total of 400 commit's and has undergone many changes and now we have reached a point where everyone can use it.
The most important part of the framework is of course the routing, I created my own in version 1 what I also announced in the past.
But I chose to user the vendor rounting because it is much more powerful than mine.

We use an MVC structure. Do you have no idea what this means exactly? On Google you can find a lot of information.
AsteroidCMS also uses middlewares for example a authentication, caching class and validation class.

You can add middleware very easy for example:
Code:
class Routes extends Router
{
    public static function init()
    {
     
        Router::PartialGroup('/', function () {
     
            Router::setDefaultNamespace('\App\Controllers');

            Router::get('/', 'Home\Index@index')->setName('index.home')->addMiddleware(CacheMiddleware::class);
            Router::get('/home', 'Home\Index@index')->addMiddleware(CacheMiddleware::class);
            Router::get('/lost', 'Home\Lost@index')->setName('lost');
       
    })->addMiddleware(AuthMiddleware::class);
}

Permission system has also been built with individual rights that you can assign to a specific role. Roles can also be created for your emulator and this is easy to manage in our housekeeping.
There is too much to mention what AsteroidCMS offers. You can find all of this later in a documentation.

Vendors
  • Composer project
  • Simple Validation class
Code:
    public function request()
    {
        $validate = request()->validator->validate([
            'username' => 'required|min:1|max:30',
            'password' => 'required|min:1|max:100',
            'pincode'  => 'max:6'
        ]);

    }
  • Pecee Simple routing
  • Locale systeem (meerdere languages)
  • Twig template parser
  • Helpers
  • Page caching
  • Google 2FA authentication
  • QueryBuilder
Code:
public static function getAccessLogs($player_id, $limit = 100)
{
    return QueryBuilder::table('player_access')->where('player_id', $player_id)->limit($limit)->get();
}

Javascript
Instead of controlling a view in your controller, we have javascript for loading all the post/get requests.
This way it is possible to go in and out of the hotel without having page refresh.

Interfaces
  • Hotelmanager
  • Forms/Links handler
  • Post/Get requests
  • Customforms
  • Dialogmanager
  • Notificationmanager
Housekeeping
  • Permissions (Create: Roles, Add: Permissions)
  • Remote Control (View userdata, ban, alert & reset control) ( )
  • Room control + ban control
  • VPN control (block users based at ASN)
  • Wordfilter
  • Chatlogs
  • Banlogs
  • Stafflogs
  • Help tickets
  • FAQ manage
  • News manage
  • Shop manage
  • Catalog manage (edit your arcturus catalog).
  • Value manage
  • Catalog manage

New updates
Cosmic has alot of updates already but it is too much to write. The best update so far is that you are now able to manage the catalogue from the housekeeping. With a simple, drag & drop system you can order the catalogue in a visual way.




Cosmic is also now compitable with php 8.0.1. and version 3 of cosmic is also under construction with a new layout and framework. Also i'm working on Circinus, frontend project builded with typescript +vue and mobx, which is builded for Ares backend. Follow the thread here:

Get Cosmic here
 

Attachments

  • folder.png
    folder.png
    20.2 KB · Views: 744
Last edited:

Weasel

👄 I'd intercept me
Nov 25, 2011
4,128
2,456
Thread approved. Looks good. Are you using a pre-made theme? It looks slick.

PS. Don't use Versio for hosting. Especially giving out their direct domain isn't the best idea with the amount of scriptkids around. If you get only one attack on it, they'll kick you from your servers.
 

Parsov

Member
May 18, 2016
315
206
They been using it for a few months now on all 6 hotels, Someone from Leet said it was built with ASP though.
I hope to see this being released I like the layout. And I think it supports only Comet Emulator if i'm not wrong as Ryan uses Comet but it's easy to migrate.

Anyway always loved this layout keep up @Raizer! ;)
 

Raizer

Active Member
Feb 21, 2019
144
76
End of January! Oops.. forgot to update our discord invite link.
 
Last edited by a moderator:

Weasel

👄 I'd intercept me
Nov 25, 2011
4,128
2,456
Repo is available!
Had a quick look and it actually seems quite good, the only thing I don't get is why you're making everything a static function. It makes testabililty and maintainability a pure hell.
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,725
1,306
Had a quick look and it actually seems quite good, the only thing I don't get is why you're making everything a static function. It makes testabililty and maintainability a pure hell.
The functionality of the classes using static functions looks limited to the App/ directory from what I can see.

Chances are he's doing it to prevent needing to constantly make a new instance of the class to do the same functionality, when you can just use a static function. They're being used as individual functions served under a collection pretty much.

I would argue that it doesn't have any impact on testing.


You can easily assert that
  1. it finds a ban when it exists for the player
  2. it will exit with a bad status code if ban exists
  3. If staff it will store a log of the action
  4. if ban does not exist it calls both Session and Player with the right data

If you want to move away from static functions everywhere, look into dependency injection which can construct a new instance of the injected dependency for you automatically. Unsure how good PHP DI is, but on TS you can get some pretty good results
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,128
2,456
The functionality of the classes using static functions looks limited to the App/ directory from what I can see.

Chances are he's doing it to prevent needing to constantly make a new instance of the class to do the same functionality, when you can just use a static function. They're being used as individual functions served under a collection pretty much.

I would argue that it doesn't have any impact on testing.


You can easily assert that
  1. it finds a ban when it exists for the player
  2. it will exit with a bad status code if ban exists
  3. If staff it will store a log of the action
  4. if ban does not exist it calls both Session and Player with the right data

If you want to move away from static functions everywhere, look into dependency injection which can construct a new instance of the injected dependency for you automatically. Unsure how good PHP DI is, but on TS you can get some pretty good results
No, you can't easily assert that. I'm talking about unit testing. Static functions called in static functions breaks proper unit testing, besides that, using all those static methods are basically just globals. I know why one would use it, but still, it isn't the best idea. Besides that, I was asking the OP why, because it felt like he misunderstood facades from Laravel and tried to do the same.

Dependency injection is the way to go.

 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,725
1,306
No, you can't easily assert that. I'm talking about unit testing. Static functions called in static functions breaks proper unit testing, besides that, using all those static methods are basically just globals. I know why one would use it, but still, it isn't the best idea. Besides that, I was asking the OP why, because it felt like he misunderstood facades from Laravel and tried to do the same.

Dependency injection is the way to go.

You can easily assert that. I test code all the time. It sounds like you may not like it because you can't test the mock interaction and instead now have to go E2E.

(PS, you can still override a static with a mock if you wanted to)
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,128
2,456
You can easily assert that. I test code all the time. It sounds like you may not like it because you can't test the mock interaction and instead now have to go E2E.

(PS, you can still override a static with a mock if you wanted to)
What...? You want to have proper unit tests besides E2E (integration) tests. Besides that, even the creator of PHPUnit advices against it, but who is he, we have Chris!
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,725
1,306
What...? You want to have proper unit tests besides E2E (integration) tests. Besides that, even the creator of PHPUnit advices against it, but who is he, we have Chris!
Sounds like you're getting a bit personal because you want to verify fake functionality against fake mocks. We do both and don't worry about arbitrary rules if the functionality supports it. If you're concerned about a function having too many side effects, chances are it wouldn't matter if its a static or instance binded function. You have too much responsibility and have made testing actual functionality beyond impossible.

Break it up into more functions instead of mocking the mock, that mocks a mock mocking another mock.
 

Raizer

Active Member
Feb 21, 2019
144
76
Wow haha.. Well DI is the best way to do that but in my opinion DI is not that good if you go for performance. But with this routing I can implement it easily. The reason I use static is because I think it works more efficiently and it keeps your code clean. it is purely based on that. And also, I never work with laravel because I like to discover and realize things by myself. I fully agree with Chris' first reaction, good to receive feedback from you guys, thanks!
 

Users who are viewing this thread

Top