From ce2183198df18de81d9df0572e18ce7777beff96 Mon Sep 17 00:00:00 2001 From: Darkelarious Date: Mon, 26 Aug 2019 17:56:30 +0200 Subject: commit to code.blicky.net --- README | 114 -------------------------------------- README.md | 118 +++++++++++++++++++++++++++++++++++++++ util/skingen.pl | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 285 insertions(+), 114 deletions(-) delete mode 100755 README create mode 100755 README.md create mode 100755 util/skingen.pl diff --git a/README b/README deleted file mode 100755 index d5dc115..0000000 --- a/README +++ /dev/null @@ -1,114 +0,0 @@ -========= - -DESCRIPTION - - This repository contains software for a web interface to display information - obtained by the 333networks MasterServer package for the support of various - legacy games. The software was written Darkelarious to soften the effects of - GameSpy (GameSpy Industries, Inc.) shutting down their masterserver service. - - A masterserver is a program that maintains a list of online game servers and - presents this list to clients (gamers, players) who request the list of game - addresses. The 333networks Masterserver is a software framework that allows - gamers/players to browse online games. - - More information about the masterserver and variations on the protocol by - 333networks can be found online at - http://333networks.com/masterserver - http://wiki.333networks.com/index.php/MasterServer - -AUTHOR - Darkelarious - http://333networks.com - darkelarious@333networks.com - -REQUIREMENTS - - Apache/httpd - - Postgresql, MySQL or SQLite3 - - Perl 5.10 or above - - The following CPAN modules: - DBI - DBD::Pg / DBD::SQLite / DBD::mysql - IP::Country::Fast - Image::Size - TUWF (http://dev.yorhel.nl/tuwf) - -INSTALL - - THE MASTER SERVER IS WRITTEN ON LINUX. IF YOU WANT TO RUN THE SOFTWARE IN - MICROSOFT WINDOWS OR APPLE OSX, IT MAY NOT WORK WITHOUT MODIFICATIONS. - - This repository consists of Perl modules and is run by a http deamon. First, - the MasterServer-Perl repository should be installed and configured in order - to run this web interface. The contents of this repository can be extracted - in the same root folder as MasterServer-Perl. - -CONFIGURATION - - The 333networks masterserver interface comes with options. These options are - found in configuration file "data/webinterface-config.pl". Comments in the - file give a brief description. Below, the configuration is discussed in - further detail. - - Database login information - - The masterserver interface supports different database types. This must be the - same database (and type) as you specified in your MasterServer-Perl config. - - # postgresql - db_login => ['dbi:Pg:dbname=masterserver', 'user', 'password'], - - # sqlite - db_login => ["dbi:SQLite:dbname=$ROOT/data/masterserver.db",'',''], - - You also need to (un)comment the right database module in the - masterwebinterface.pl file to load the correct driver. - - Apache settings - - LoadModule rewrite_module modules/mod_rewrite.so - AddHandler cgi-script .cgi .pl - - Vhost configuration for the Web Interface (assuming you extracted it in the - same folder as your MasterServer-Perl installation): - - # - # Master Web Interface - # - - ServerAdmin master@yourdomain.com - ServerName master.yourdomain.com - - DocumentRoot "/server/MasterServer-Perl/s" - AddHandler cgi-script .pl - - RewriteEngine On - RewriteCond "%{DOCUMENT_ROOT}/%{REQUEST_URI}" !-s - RewriteRule ^/ /masterwebinterface.pl - - ErrorLog /server/MasterServer-Perl/log/MasterWebInterface-Error.log - CustomLog /server/MasterServer-Perl/log/MasterWebInterface-Access.log combined - - - Options +FollowSymLinks +ExecCGI - AllowOverride None - Require all granted - - - -KNOWN ISSUES - There are a few known issues that will be resolved in future versions. The - following issues are listed and do not need to be reported. - - This README file does not describe all possible configuration options. There - is an initiative to write the webinterface documentation in a single document - that is focused on all options and recommended values. For now, use your best - guess. - - There are no textures, map thumbnails and/or nice steals included in this - repository. All styles, textures, increasingly growing amounts of map thumbs - and game icons are located at another repository on git.333networks.com and - are available for all supported packages. - -COPYING - See COPYING file diff --git a/README.md b/README.md new file mode 100755 index 0000000..b4fbe0f --- /dev/null +++ b/README.md @@ -0,0 +1,118 @@ +# MasterServer-WebInterface + +Website for the 333networks MasterServer implementation in Perl. + +========= + +# DESCRIPTION + + This repository contains software for a web interface to display information + obtained by the 333networks MasterServer package for the support of various + legacy games. The software was written Darkelarious to soften the effects of + GameSpy (GameSpy Industries, Inc.) shutting down their masterserver service. + + A masterserver is a program that maintains a list of online game servers and + presents this list to clients (gamers, players) who request the list of game + addresses. The 333networks Masterserver is a software framework that allows + gamers/players to browse online games. + + More information about the masterserver and variations on the protocol by + 333networks can be found online at + http://333networks.com/masterserver + http://wiki.333networks.com/index.php/MasterServer + +# AUTHOR + Darkelarious + http://333networks.com + darkelarious@333networks.com + +# REQUIREMENTS + - Apache/httpd + - Postgresql, MySQL or SQLite3 + - Perl 5.10 or above + - The following CPAN modules: + DBI + DBD::Pg / DBD::SQLite / DBD::mysql + IP::Country::Fast + Image::Size + TUWF (http://dev.yorhel.nl/tuwf) + +# INSTALL + + THE MASTER SERVER IS WRITTEN ON LINUX. IF YOU WANT TO RUN THE SOFTWARE IN + MICROSOFT WINDOWS OR APPLE OSX, IT MAY NOT WORK WITHOUT MODIFICATIONS. + + This repository consists of Perl modules and is run by a http deamon. First, + the MasterServer-Perl repository should be installed and configured in order + to run this web interface. The contents of this repository can be extracted + in the same root folder as MasterServer-Perl. + +# CONFIGURATION + + The 333networks masterserver interface comes with options. These options are + found in configuration file "data/webinterface-config.pl". Comments in the + file give a brief description. Below, the configuration is discussed in + further detail. + + Database login information + + The masterserver interface supports different database types. This must be the + same database (and type) as you specified in your MasterServer-Perl config. + + # postgresql + db_login => ['dbi:Pg:dbname=masterserver', 'user', 'password'], + + # sqlite + db_login => ["dbi:SQLite:dbname=$ROOT/data/masterserver.db",'',''], + + You also need to (un)comment the right database module in the + masterwebinterface.pl file to load the correct driver. + + Apache settings + + LoadModule rewrite_module modules/mod_rewrite.so + AddHandler cgi-script .cgi .pl + + Vhost configuration for the Web Interface (assuming you extracted it in the + same folder as your MasterServer-Perl installation): + + # + # Master Web Interface + # + + ServerAdmin master@yourdomain.com + ServerName master.yourdomain.com + + DocumentRoot "/server/MasterServer-Perl/s" + AddHandler cgi-script .pl + + RewriteEngine On + RewriteCond "%{DOCUMENT_ROOT}/%{REQUEST_URI}" !-s + RewriteRule ^/ /masterwebinterface.pl + + ErrorLog /server/MasterServer-Perl/log/MasterWebInterface-Error.log + CustomLog /server/MasterServer-Perl/log/MasterWebInterface-Access.log combined + + + Options +FollowSymLinks +ExecCGI + AllowOverride None + Require all granted + + + +# KNOWN ISSUES + There are a few known issues that will be resolved in future versions. The + following issues are listed and do not need to be reported. + + This README file does not describe all possible configuration options. There + is an initiative to write the webinterface documentation in a single document + that is focused on all options and recommended values. For now, use your best + guess. + + There are no textures, map thumbnails and/or nice steals included in this + repository. All styles, textures, increasingly growing amounts of map thumbs + and game icons are located at another repository on git.333networks.com and + are available for all supported packages. + +# COPYING + See COPYING file diff --git a/util/skingen.pl b/util/skingen.pl new file mode 100755 index 0000000..4e719a3 --- /dev/null +++ b/util/skingen.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Image::Size; +use Cwd 'abs_path'; + +################################################################################ +# CSS "Skin" generator for 333networks web interfaces +# +# Every skin is built in the following way. The SKIN AUTHOR needs to make a +# config file at $ROOT/s/style/SKINNAME/conf +# Here, SKINNAME is a lowercase folder and conf a plaintext file. In this folder +# you can opt to place textures, logos and other pictures used in your skin. +# +# In the conf file you describe the following color codes or textures: +# +# Options: +# +# name example description +# ------------------------------------------------------------------------------ +# bodybg #fff body background (texture) +# bglogo logo.png logo in background (recommended 75 px high max) +# +# boxbg1 boxbg.png box background (texture) +# boxbg2 #aaa menu backgrounds, buttons, thumbnail/image boxes (texture) +# boxbg3 box2.png odd row accents (texture) +# +# glow #f00 glow color (color) +# shadow #c1c1c1 shadow color (color) +# +# textcol1 #000 main text color, server table link (color) +# textcol2 #111 accent color for italic text, focus (color) +# +# headercol #f22 Header text color (color) +# themecol1 #333 primary borders, footnotes (color) +# themecol2 #666 secondary borders, accent text/border, +# secondary textarea, thumbnail border (color) +# themecol3 #444 neutral borders, lines (color) +# +# link #009 link (color) +# linkhover #990 onhover, table link onhover (color) +# +# ------------------------------------------------------------------------------ +# NOTE: some parameters can be colors, textures or both. (texture) can be both +# images and colors, such as #0af, #0af box.png, box.png, but (color) implies +# color ONLY. +# +# To compile a skin, run the command "./skingen.pl SKINNAME" where skinname is +# the lowercase folder name of your skin. The output is a style.css file in your +# folder. This style name can now be used in your webinterface config file under +# the "style => " option. +# +################################################################################ + +our($ROOT, %S); +BEGIN { ($ROOT = abs_path $0) =~ s{/util/skingen\.pl$}{}; } +use lib "$ROOT/lib"; +use SkinFile; + +# read styles to be compiled from commandline +if (scalar @ARGV) { + for my $conf (@ARGV) { + print "Parsing $conf\n"; + writeskin($conf); + } +} +# minimalistic help command +else { + print "Use: ./skingen.pl themename\n"; + print "\t themename is a folder like /s/style/themename\n"; + print "\t and contains a conf file with color codes. See\n"; + print "\t also \"colortypes.txt for more info\".\n"; +} + +# args: theme name +sub writeskin { # $name + my $name = shift; + my $skin = SkinFile->new("$ROOT/s/style", $name); + my %o = map +($_ => $skin->get($_)), $skin->get; + + # body background color / image + my @bg = split ' ', $o{bodybg}; + if (substr($bg[0], 0, 1) eq '#') { + # col + img? + if ($bg[1] && $bg[1] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_bodybg} .= "background: $bg[0] url(/style/$name/$bg[1]) repeat center top fixed;"; + } + else { + $o{_bodybg} = "background: $bg[0];"; + } + } # only img + elsif ($bg[0] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_bodybg} = "background: url(/style/$name/$bg[0]) repeat center top fixed;"; + } + + # box background color / image + @bg = split ' ', $o{boxbg1}; + if (substr($bg[0], 0, 1) eq '#') { + # col + img? + if ($bg[1] && $bg[1] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg1} .= "background: $bg[0] url(/style/$name/$bg[1]) repeat center top;"; + } + else { + $o{_boxbg1} = "background: $bg[0];"; + } + } # only img + elsif ($bg[0] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg1} = "background: url(/style/$name/$bg[0]) repeat center top;"; + } + + # box background color / image boxtype 2 + @bg = split ' ', $o{boxbg2}; + if (substr($bg[0], 0, 1) eq '#') { + # col + img? + if ($bg[1] && $bg[1] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg2} .= "background: $bg[0] url(/style/$name/$bg[1]) repeat center top;"; + } + else { + $o{_boxbg2} = "background: $bg[0];"; + } + } # only img + elsif ($bg[0] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg2} = "background: url(/style/$name/$bg[0]) repeat center top;"; + } + + # box background color / image boxtype 3 + @bg = split ' ', $o{boxbg3}; + if (substr($bg[0], 0, 1) eq '#') { + # col + img? + if ($bg[1] && $bg[1] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg3} .= "background: $bg[0] url(/style/$name/$bg[1]) repeat center top;"; + } + else { + $o{_boxbg3} = "background: $bg[0];"; + } + } # only img + elsif ($bg[0] =~ m/^\w+\.(gif|jpeg|jpg|png)$/i) { + $o{_boxbg3} = "background: url(/style/$name/$bg[0]) repeat center top;"; + } + + # shadow boxes + $o{_glow} = $o{glow} ? "box-shadow: 0px 0px 5px $o{glow};" : ""; + $o{_shadow} = $o{shadow} ? "box-shadow: 10px 10px 5px $o{shadow};" : ""; + + + # background logo + $o{_bglogo} = ""; + $o{_spacer} = "padding-top:95px;"; + if ($o{bglogo} ne "none" && -e "$ROOT/s/style/$name/$o{bglogo}") { + # get height + my ($w, $h) = imgsize("$ROOT/s/style/$name/$o{bglogo}") or die $!; + $o{_bglogo} = "background: url(/style/$name/$o{bglogo}) no-repeat center 35px fixed;"; + $o{_spacer} = "padding-top:".($h+25)."px;"; + } + + # write the CSS + open my $CSS, '<', "$ROOT/data/style.css" or die "$ROOT/util/skingen/style.css $!"; + my $css = join '', <$CSS>; + close $CSS; + $css =~ s/\$$_\$/$o{$_}/g for (keys %o); + + my $f = "$ROOT/s/style/$name/style.css"; + open my $SKIN, '>', "$f~" or die $!; + print $SKIN $css; + close $SKIN; + rename "$f~", $f; +} -- cgit v1.2.3