self serve image assets

This commit is contained in:
Smith
2023-08-05 19:26:44 +02:00
parent 37e6625383
commit d14aaa7f5b
15 changed files with 16 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
# <img src="https://i.imgur.com/2Ok3pxv.png" width="40" align="left"> Game Server Watcher
# <img src="https://user-images.githubusercontent.com/14183614/182869472-643f4028-8143-429b-80c2-86c62d9c2de2.png" width="40" align="left"> Game Server Watcher
A simple discord/telegram bot that can be hosted on a free service to monitor your game servers and players in style. 😎
# About the Project
@@ -34,7 +34,7 @@ The project is in a very early stage. More detailed customization options and fe
* github action workflows to deploy to other cloud providers (aws, linode, atlantic, vultr, pikapods, okteto, ibm cloud etc.)
* SQL, JSON or object store database support (postgres, redis etc.)
* run as stateless serverless function (aws lambda, azure function, heroku, vercel, fly.io machines etc.)
* [pterodactyl](https://pterodactyl.io) egg release
* pterodactyl egg release
# Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.

View File

@@ -3,7 +3,7 @@
"description": "A simple discord/telegram bot that can be hosted on a free service to monitor your game servers and players in style. 😎",
"website": "https://github.com/a-sync/game-server-watcher",
"repository": "https://github.com/a-sync/game-server-watcher",
"logo": "https://i.imgur.com/2Ok3pxv.png",
"logo": "https://user-images.githubusercontent.com/14183614/182869472-643f4028-8143-429b-80c2-86c62d9c2de2.png",
"env": {
"SECRET": {
"description": "Admin secret",

BIN
public/bg0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

BIN
public/bg1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
public/bg2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 KiB

BIN
public/bg3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

BIN
public/bg4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

BIN
public/bg5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -1 +0,0 @@
serve imgur images locally

View File

@@ -6,7 +6,7 @@
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://i.imgur.com/2Ok3pxv.png" rel="icon" type="image/png">
<link href="favicon.png" rel="icon" type="image/png">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- <link href="https://cdn.jsdelivr.net/npm/@forevolve/bootstrap-dark@latest/dist/css/toggle-bootstrap-dark.min.css" rel="stylesheet"> -->
@@ -38,7 +38,7 @@
<body>
<nav id="top-menu" class="navbar navbar-expand-lg navbar-dark invisible">
<span class="navbar-brand mb-0 h1">
<img src="https://i.imgur.com/2Ok3pxv.png" width="30" height="30" class="d-inline-block align-middle mr-sm-1 mr-md-2 mr-lg-3" alt="">
<img src="favicon.png" width="30" height="30" class="d-inline-block align-middle mr-sm-1 mr-md-2 mr-lg-3" alt="">
<span>GSW Control Panel</span>
</span>
<ul class="navbar-nav mr-auto">

View File

@@ -12,7 +12,7 @@ body {
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
background-image: url('https://i.imgur.com/lTly23N.png');
background-image: url('bg0.png');
}
body>nav {

View File

@@ -380,11 +380,11 @@ async function generateBearerToken(secret) {
function setRandomBg() {
const bgs = [
'https://i.imgur.com/bDzhwG5.png',
'https://i.imgur.com/rA8JXuI.png',
'https://i.imgur.com/pstAPIw.png',
'https://i.imgur.com/gQD3xfo.png',
'https://i.imgur.com/iKTfM8z.png'
'bg1.png',
'bg2.png',
'bg3.png',
'bg4.png',
'bg5.png'
];
const bgImg = new Image();

View File

@@ -92,7 +92,7 @@ export class GameServer {
if (DBG) console.log('gs.up', this.config.host, this.config.port);
let info = await this.gamedig();
if (DBG) console.log('gs.gamedig', Object.assign({}, info, { players: info?.players.length }));
if (DBG) console.log('gs.gamedig %j', Object.assign({}, info, { players: info?.players.length }));
if (!info && STEAM_WEB_API_KEY && this.config.appId) {
info = await this.steam();
if (DBG) console.log('gs.steam', info);
@@ -100,7 +100,7 @@ export class GameServer {
if (info) {
if (info.players.length > 0 && DBG) {
console.log('gs.players.0', info.players[0]);
console.log('gs.players.0 %j', info.players[0]);
}
this.online = true;

View File

@@ -41,17 +41,18 @@ const EXT_MIME: Record<string, string> = {
createServer(async (req, res) => {
if (DBG) console.log('DBG: %j %j', (new Date()), req.url);
const reqUrl = new URL(req.url || '', 'http://localhost');
const p = reqUrl.pathname === '/' ? 'index.html' : path.normalize(reqUrl.pathname).slice(1);
const ext = path.extname(p).slice(1);
const ext = path.extname(p);
if (ext in EXT_MIME && !p.includes('/') && !p.includes('\\')) {
if (SECRET !== '') {
res.writeHead(200, {
'Content-Type': EXT_MIME[ext] || 'plain/text',
'Cache-Control': 'max-age=' + String(CACHE_MAX_AGE)
});
fs.createReadStream('./public/' + p).pipe(res);
fs.createReadStream(path.resolve('./public/', p)).pipe(res);
} else {
res.end('Configure the `SECRET` env var to enable the web UI!');
}