MOTDPlayer v2

Custom Packages that plugins can require for common usages.
User avatar
iPlayer
Developer
Posts: 520
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

MOTDPlayer v2

Postby iPlayer » Mon Apr 10, 2017 6:23 pm

MOTDPlayer v2 Package
by Kirill "iPlayer" Mysnik

GitHub: KirillMysnik/SP-MOTDPlayer2

What's this?
MOTDPlayer is a software for Source-powered games that allows plugin creators to send interactive Message of The Day screens to their players.

MOTDPlayer consists of:
  • Source.Python custom package
  • Flask web-application
  • JavaScript library

MOTDPlayer automatically authorizes the user behind the scenes, so your MoTD web-page will know which of your players exactly is viewing it. All auth details are secured with a SHA-512 hash, so it's impossible to view the page as another player.

MOTDPlayer provides an interface that lets the MoTD page send data to the game server and get something in return.


Examples
Just to make sure you realize how powerful MOTDPlayer is, I give you a link to ArcRPG inventory/stats demo video. That one was actually implemented with MOTDPlayer v1. Version 2 is way more powerful and allows the usage of WebSocket protocol.

Example applications can be found in MOTDPlayer repo.

Installation
Here's the topic which includes a video tutorial.

How to use it in your plugin
API docs can also be found in MOTDPlayer repo here.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots

Hail, Companion. [...] Hands to yourself, sneak thief. Image
Predz
Senior Member
Posts: 142
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Re: MOTDPlayer v2

Postby Predz » Mon Apr 10, 2017 10:40 pm

Does anybody know of a way to sensibly immitate uWSGI on a windows machine? If not looks like I am going to have to work with Ubuntu again :P
User avatar
iPlayer
Developer
Posts: 520
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: MOTDPlayer v2

Postby iPlayer » Mon Apr 10, 2017 10:53 pm

I did it. Sensibly. In a VMWare Workstation Player :)

Well, besides immitating uWSGI on Windows, there're other options:
  • If you don't need WebSocket support, you can use any Windows web-server or even run Flask development server (just run application.py)
  • If you don't need MOTDPlayer *right now*, you can wait til I implement more broad WebSocket support through Flask libraries that support all kinds of WebSocket protocol suppliers. Then we won't be bound to uWSGI. But, as you might guess, that's not my highest priority as I'm working on Source.Python Admin now.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
iPlayer
Developer
Posts: 520
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: MOTDPlayer v2

Postby iPlayer » Mon Apr 10, 2017 11:04 pm

Quoting a question from another thread,
Kill wrote:Edit: is it possible to use this with say, JS server-side or PHP instead of Flask?

MOTDPlayer consists of three parts: SP custom package, Flask application and JS library.

If you drop Flask application and tend to use PHP/NodeJS, you'll have to supply your own replacement for it.

What Flask application basically does:
  • Auth. You should create something that will not only do the auth process basing on URL data, but also connect to SRCDS and tell it the new user-salt;
  • Data delivery from SRCDS to the web-page;
  • Filtered data delivery from the web-page to SRCDS. "Filtered" means that a malicious 1GB of data should be stopped by your web-application, not carefully sent to SRCDS on its Custom Communication Port.

To answer unasked question: No, I don't think I will do it. I mean, of course I'm interested in somebody doing it because that will broaden MOTDPlayer usage, but I run Flask web-servers, I love Python, and I don't like PHP nor JS.

EDIT: Also I'd like to denote that a usual PHP shared hosting won't suffice anyways. Your web-server needs to be in the same network with the SRCDS (for security reasons it's not recommended to expose Custom Communication Port to the internet). So you'll need to rent a VDS anyways, and if that's the case, there's absolutely no reason not to install Flask.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
Doldol
Senior Member
Posts: 163
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Re: MOTDPlayer v2

Postby Doldol » Tue Apr 11, 2017 4:46 pm

Predz wrote:Does anybody know of a way to sensibly immitate uWSGI on a windows machine? If not looks like I am going to have to work with Ubuntu again :P


Well uWSGI can run with Cygwin :3

Or you could try using django-channels instead, but it will require you to rewrite the Flask application into a django project. (I use this setup myself to connect with gameservers and webclients and it works great!)

Channels provides and async server that supports both HTTP and WebSockets and is written in Python.

Return to “Custom Packages”

Who is online

Users browsing this forum: No registered users and 1 guest