Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additions #196

Merged
merged 17 commits into from
Oct 5, 2023
Merged

Additions #196

merged 17 commits into from
Oct 5, 2023

Conversation

Deadlineem
Copy link
Contributor

Proposed Changes

Contributing Multi-Stat scripts to Minestat main branch, included the powershell file I changed slightly specifically for Multi-stat in Multi-Stat/Powershell/minestat.psm1

The rest of the changes are extensions and updates to the original "Feature" request which allows server status of both bedrock and java at the same time on one page.

This is great for having two servers (Java + Bedrock) and wanting to retrieve status of both at once, OR for a "server list" page showing other servers around the world.

Multi-Stat can be used on a Xampp/Wamp/IIS server easily but is recommended to be used on a windows VPS/Dedicated server platform for security.

Added Multi-Stat server status checker files:
/css/
/images/
/Powershell/minestat.psm1
.htaccess
index.php
settings.php

Minestat powershell module:
Made small (insignificant) changes to the minestat powershell file to "prettify" the outputs on Multi-Stat

* Altered values to make it pretty, not necessary.
"Success" => "Online"
"Unknown" => "Offline"

Removed 'hidden' from most of the output values, changed the ones I did not want showing up to 'hidden' and reordered the values so it outputs in a more appealing order on Multi-Stat

IMPORTANT CHANGE:
formatted_motd is hidden and stripped_motd is in its place.  When outputting the data to PHP, it shows all the color characters as broken/nonexistent symbols, this was very ugly on the web status page.  
THIS IS NOT A NECESSARY CHANGE BUT I'D RECOMMEND IT!!! 


To reference the changes, view the original minestat.psm1 at the link below and search the following:

[Flags()] enum SlpProtocol (changed Unknown to Offline)
class ServerStatus (reordered values, unhid most of them, hid formatted_motd, motd, slp_protocol and favicon)
 
https://github.com/FragLand/minestat/blob/master/PowerShell/MineStat/MineStat.psm1
Edited server address to Localhost
@AppVeyorBot
Copy link

@ldilley ldilley mentioned this pull request Sep 15, 2023
@ldilley ldilley added lang: PowerShell Affects the PowerShell version of minestat lang: PHP Affects the PHP version of minestat enhancement Enhance an existing feature labels Sep 15, 2023
@ldilley
Copy link
Member

ldilley commented Sep 15, 2023

Thank you for the contribution, @Deadlineem. I've included @Ajoro as a reviewer to see if he can review the modifications to minestat.psm1 when he has some time. Would it also be possible to host logo.png on a web server and reference the file as an external resource from index.php? I try to avoid storing binary files in a git repository if it can be avoided. Here is some rationale: https://robinwinslow.uk/dont-ever-commit-binary-files-to-git

@Deadlineem
Copy link
Contributor Author

Thank you for the contribution, @Deadlineem. I've included @Ajoro as a reviewer to see if he can review the modifications to minestat.psm1 when he has some time. Would it also be possible to host logo.png on a web server and reference the file as an external resource from index.php? I try to avoid storing binary files in a git repository if it can be avoided. Here is some rationale: https://robinwinslow.uk/dont-ever-commit-binary-files-to-git

Absolutely, the logo is just a random image i found online its not a necessary piece, but i will make that change and put it as a url to the main image instead.

Changed image source to a URL instead of the logo being added from images/logo.png
@AppVeyorBot
Copy link

No longer needed as the logo is pulled from a URL instead.
@AppVeyorBot
Copy link

@Deadlineem
Copy link
Contributor Author

Deadlineem commented Sep 15, 2023

Thank you for the contribution, @Deadlineem. I've included @Ajoro as a reviewer to see if he can review the modifications to minestat.psm1 when he has some time. Would it also be possible to host logo.png on a web server and reference the file as an external resource from index.php? I try to avoid storing binary files in a git repository if it can be avoided. Here is some rationale: https://robinwinslow.uk/dont-ever-commit-binary-files-to-git

The pull request should have the updates requested @ldilley and I will be updating the index.php and probably the css with some bootstrap eyecandy to reflect what I have done to my actual status page.

https://imgur.com/siurLYP - When all servers are offline
https://imgur.com/V3dodOq - When 1 server is online and the other is off (Bedrock/Java on 1 host)
https://imgur.com/sJwpD63 - When all servers are online.

Each java server in the array list will show under the java servers list and same with bedrock for example:

first 3 results out of 6 (one is offline, 5 active)
https://imgur.com/6y2Vnn1

Last 3:
https://imgur.com/NgmiOa4

Added bootstrap css and matching js files for bootstrap

Modified index.php with updated styling and code for cleaner outputs.  Not a large change, but an efficient one when the results pop up.

Screenshots: 

https://imgur.com/a/dWDxNG5
@AppVeyorBot
Copy link

Forgot to remove the old logo.png as my project commit is slightly different with that, all fixed :)
@AppVeyorBot
Copy link

Updated alert margin to 25px because it was bothering me lol
@AppVeyorBot
Copy link

Added error support for "ConnFail" reply
@AppVeyorBot
Copy link

Added support for different types of errors to be shown when the connection is offline

Offline => Status Type: Offline
Timeout => Status Type: Timed Out
ConnFail => Status Type: Connection Failed
@AppVeyorBot
Copy link

contrib/Multi-Stat/index.php Outdated Show resolved Hide resolved
contrib/Multi-Stat/css/style.css Outdated Show resolved Hide resolved
contrib/Multi-Stat/css/style.css Outdated Show resolved Hide resolved
contrib/Multi-Stat/js/bootstrap.js Outdated Show resolved Hide resolved
contrib/Multi-Stat/js/npm.js Outdated Show resolved Hide resolved
contrib/Multi-Stat/js/bootstrap.min.js Outdated Show resolved Hide resolved
contrib/Multi-Stat/css/bootstrap.css Outdated Show resolved Hide resolved
@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Member

@ldilley ldilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CodeFactor issues can be ignored considering that Bootstrap is a separate project. I would like to have these Bootstrap CSS and JS files referenced externally using a CDN. This would eliminate the requirement to include these files in the PR/repository.

Have a look at their official documentation for how to use their CDN links:
https://getbootstrap.com/docs/5.3/getting-started/introduction/#cdn-links

Example link for a specific version:
https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css

@ldilley
Copy link
Member

ldilley commented Oct 1, 2023

The CodeFactor issues can be ignored considering that Bootstrap is a separate project. I would like to have these Bootstrap CSS and JS files referenced externally using a CDN. This would eliminate the requirement to include these files in the PR/repository.

Have a look at their official documentation for how to use their CDN links: https://getbootstrap.com/docs/5.3/getting-started/introduction/#cdn-links

Example link for a specific version: https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css

It looks like you are already using CDN links for Bootstrap in index.php, @Deadlineem. You can probably remove the unnecessary Bootstrap files in this PR given the output below.

<head>
  <title><?php echo $siteTitle; ?></title>
  <script src="https://kit.fontawesome.com/97c7e13229.js" crossorigin="anonymous"></script>
  <!-- Latest compiled and minified bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <!-- Latest compiled and minified Jquery -->
  <script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
  <!-- Latest compiled and minified bootstrap JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="css/style.css" />
  <link rel="icon" type="image/png" href="">
</head>

@Deadlineem
Copy link
Contributor Author

The CodeFactor issues can be ignored considering that Bootstrap is a separate project. I would like to have these Bootstrap CSS and JS files referenced externally using a CDN. This would eliminate the requirement to include these files in the PR/repository.
Have a look at their official documentation for how to use their CDN links: https://getbootstrap.com/docs/5.3/getting-started/introduction/#cdn-links
Example link for a specific version: https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css

It looks like you are already using CDN links for Bootstrap in index.php, @Deadlineem. You can probably remove the unnecessary Bootstrap files in this PR given the output below.

<head>
  <title><?php echo $siteTitle; ?></title>
  <script src="https://kit.fontawesome.com/97c7e13229.js" crossorigin="anonymous"></script>
  <!-- Latest compiled and minified bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <!-- Latest compiled and minified Jquery -->
  <script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
  <!-- Latest compiled and minified bootstrap JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="css/style.css" />
  <link rel="icon" type="image/png" href="">
</head>

Switching to the bootstrap CDN from them now. I have updated the play url I had sent earlier as well, the page is styled to my personal taste for my main website with the code @Ajoro contributed, thanks again for that, its magnificent.

Added latest bootstrap css/js and popper for styling and functions.
@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@sonarcloud
Copy link

sonarcloud bot commented Oct 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@AppVeyorBot
Copy link

@Deadlineem
Copy link
Contributor Author

Deadlineem commented Oct 3, 2023

Removed JS folder/bootstrap.css file replaced with official latest CDN in index.php.

@ldilley ldilley merged commit d9e204a into FragLand:master Oct 5, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance an existing feature lang: PHP Affects the PHP version of minestat lang: PowerShell Affects the PowerShell version of minestat
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

4 participants