Skip to content

Commit

Permalink
Merge pull request #13 from msdigital/v1.22.6
Browse files Browse the repository at this point in the history
v1.22.6
  • Loading branch information
msdigital authored Jul 19, 2022
2 parents 8242c97 + 8ac75d5 commit 9ed1c14
Show file tree
Hide file tree
Showing 30 changed files with 1,769 additions and 2,187 deletions.
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.16.0
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ While playing Farming Simulator 19, i was wondering if it's possible to have som
After some quick research (basically clicking through the dedicated server administration, i found some xml files with interesting informations.
And here we are... "Oasis" a Farming Simulator Live Map.

### How-To: Contribute new Translations

1. Create a new branch called "Translation-XX" and replace XX with the corresponding language code (eg. "Translation-DE" for german or "EN" for english)
2. Duplicate one of the existing language files (best "en.json" or "de.json") in the "server/locales" folder and rename it with the same language code (eg "de")
3. Translate :)
4. Commit your translations and create a pull-request and add msdigital as a reviewer
5. Done

Thanks for your contribution! I will check the translations and add them to a release package from time to time.

## Prerequisites

* node > 16.9.1
* npm > 7.24.1
* node > 16.16.0
* npm > 8.11.0
* Farming Simulator 22 Server ;)

Works best on linux hosts ;)
Expand All @@ -35,6 +45,7 @@ This app uses dotenv, just create an `.env` file in the root folder and add the
| WEB_PORT | The port the app will use to run (ex. 3000) |
| SERVER_IP | The game server ip and port (ex. 127.0.0.1:1234) |
| SERVER_KEY | Some kind of secret key, should look something like this "fGL0Dayr" |
| DEFAULT_LANGUAGE | Default language in 2 char iso format. Currently supported: en, de |

You may find your servers IP and key in the Dedicated Server Administration under Settings ->Miscellaneous.
If you, for example, take a look at the Link XML, you will see the IP, Port and the "code" which is used in this project as SERVER_KEY.
Expand All @@ -45,4 +56,4 @@ If you, for example, take a look at the Link XML, you will see the IP, Port and

## Authors

This project is licensed under GNU Lesser General Public License version 3 (GNU LGPLv3) - see the [LICENSE.md](LICENSE.md) file for details.
This project is licensed under GNU Lesser General Public License version 3 (GNU LGPLv3) - see the [LICENSE](LICENSE) file for details.
29 changes: 29 additions & 0 deletions client/economy.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
extends index

block content
.row.justify-content-center
.col-xl-12
.card.mb-3.small.shadow-sm
.card-header=__("Economy")
if economy.prices.length>0
.table-responsive
table.eco-table.table.table-striped.table-sm.eco-table-hover
thead
tr
th=__("Product")
each month in economy.months
th= month
tbody.table-group-divider
each fillType in economy.prices
if fillType.formattedPrices.length>0
tr
td=__("product_"+fillType.name)
- var nextPrice = 0
- var maxValIx = fillType.prices.indexOf(Math.max(...fillType.prices))
- var minValIx = fillType.prices.indexOf(Math.min(...fillType.prices))
each typePrice, ix in fillType.formattedPrices
if ix == 11
- nextPrice = fillType.prices[0]
else
- nextPrice = fillType.prices[ix+1]
td(class=((nextPrice<fillType.prices[ix])?"forecast-down":"forecast-up"), style=((ix==maxValIx)?"background-color:#00800094;font-weight:bolder;":((ix==minValIx)?"color:red;font-weight:bolder;":""))).forecast=typePrice
8 changes: 5 additions & 3 deletions client/error.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
extends index

block content
h1= "Oops something went wrong..."
h2= error.status
pre #{error.message}
.row.justify-content-center
.text-center.mt-5
img(src='/images/construction.png' style='height:75px;').mb-5
h2=__("Oops something went wrong...!")
pre=error.statusCode + ' - ' + error.message
31 changes: 16 additions & 15 deletions client/home.pug
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
extends index

block content
.row
.col-xl-9
#map
.col-xl-3
.row.justify-content-center
.col-xl-2
.card.mb-3.small.shadow-sm
.card-header Currently Online (#{slots.onlineCount}/#{slots.maxCount})
.card-header=__("Currently Online")
| &nbsp;(#{slots.onlineCount}/#{slots.maxCount})
ul.list-group.list-group-flush
if players.length>0
each player in players
Expand All @@ -16,29 +15,31 @@ block content
| admin
span.float-end=player.uptime
else
li.list-group-item No Player online
.card-footer
| Total Money:
li.list-group-item=__("No Player online")
.card-footer=__("Money") + ":"
span.float-end #{game.money}
.col-xl-auto
#map
.col-xl-2
.card.mb-3.small.shadow-sm
.card-header Icon Legend
.card-header=__("Icon Legend")
ul.list-group.list-group-flush
each icon in icons
li.list-group-item
img(src="/images/icons/"+icon.icon height='20').me-3
| #{icon.desc}
=__("entity_" + icon.desc)
.card.mb-3.small.shadow-sm
.card-header="Server Details"
.card-header=__("Server Details")
ul.list-group.list-group-flush
li.list-group-item
b Map
b=__("Map")
span.float-end #{game.mapname}
li.list-group-item
b Time Scale
b=__("Time Scale")
span.float-end #{game.timeScale}
li.list-group-item
b Save Interval
b=__("Save Interval")
span.float-end #{game.saveInterval}
li.list-group-item
b Server-Version
b=__("Server-Version")
span.float-end #{server.version}
6 changes: 3 additions & 3 deletions client/index.pug
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
include layout

doctype html
html(lang="de").h-100
html(lang="en").h-100
head
title #{server.name} - Oasis #{config.VERSION}
title=server.name + " - Oasis " + config.VERSION
meta(charset="utf-8")
meta(name='viewport', content='width=device-width, initial-scale=1, shrink-to-fit=no')
meta(name="description", content=config.DESCRIPTION)
meta(name="description", content=server.name + " - Farming Simulator 22 Server - " + server.version + " - Oasis #{config.VERSION} - Farming Simulator 22 Live Map")
meta(name="author", content="msdigital.ch")
link(rel='shortcut icon', href='/images/Oasis_Favicon.png')
link(rel='icon', type='image/png', href='/images/Oasis_Favicon.png', sizes='32x32')
Expand Down
17 changes: 15 additions & 2 deletions client/layout.pug
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
mixin navigation
nav.navbar.fixed-top.navbar-expand-lg.navbar-dark
.container
a.navbar-brand(href='#')
img.d-inline-block.align-top(src="images/Oasis_Favicon.png", height='30', alt='')
a.navbar-brand(href='/')
img.d-inline-block.align-top(src="/images/Oasis_Favicon.png", height='30', alt='')
span.d-inline-block.ms-2 #{server.name} - Live Map
ul.navbar-nav
li.nav-item
a.nav-link(href='/', class=currentPage==="/"?"active":"")=__("Map")
li.nav-item
a.nav-link(href='/mods', class=currentPage==="/mods"?"active":"")=__("Mods")
li.nav-item
a.nav-link(href='/economy', class=currentPage==="/economy"?"active":"")=__('Economy')
li.nav-item.dropdown
a#navbarDropdown.nav-link.dropdown-toggle(href='#', role='button', data-bs-toggle='dropdown', aria-expanded='false')=locale.toUpperCase()
ul.dropdown-menu(aria-labelledby='navbarDropdown')
each lang in config.SUPPORTED_LANGUAGES
li
a.dropdown-item(href='/lang/'+lang.toLowerCase())=lang.toUpperCase()

mixin scripts()
script(type='text/javascript').
Expand Down
30 changes: 30 additions & 0 deletions client/mods.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
extends index

block content
.row.justify-content-center
.col-xl-8
.card.mb-3.small.shadow-sm
.card-header=__("Server Mods")
span.float-end=__("Download all Mods at once")
a(href='http://' + config.SERVER_IP + '/all_mods_download?onlyActive=true').ms-2
img(src="/images/saveAllIcon.png" height='20')
if server.mods.length>1
.table-responsive
table.table.table-striped.table-sm
thead
tr
th=__("Name")
th=__("Author")
th=__("Filename")
th=__("Download")
tbody.table-group-divider
each mod in server.mods
tr
td=mod.name + ' (' + mod.version + ')'
td=mod.author
td=mod.filename + '.zip'
td
a(href='http://' + config.SERVER_IP + '/mods/' + mod.filename + '.zip').float-end
img(src="/images/saveIcon.png" height='20').me-3
else
li.list-group-item=__("No Mods installed")
8 changes: 5 additions & 3 deletions config.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// AENDERUNGEN AN DIESER DATEI KOENNEN DAZU FUEHREN
// DASS DIE APP NICHT MEHR KORREKT FUNKTIONIERT!
//////////////////////////////////////////////////////
const { exitOnError } = require('./server/lib/logger');
var logger = require('./server/lib/logger');
const logger = require('./server/lib/logger')
, version = require('./server/lib/version.js')()

require('dotenv').config()

Expand All @@ -15,6 +15,7 @@ var errored = false;
config.WEB_PORT = process.env.WEB_PORT;
config.SERVER_IP = process.env.SERVER_IP;
config.SERVER_KEY = process.env.SERVER_KEY;
config.DEFAULT_LANGUAGE = process.env.DEFAULT_LANGUAGE;

// put required parameters befor this check to ensure they are checked
for (const [k,v] of Object.entries(config)){
Expand All @@ -26,6 +27,7 @@ for (const [k,v] of Object.entries(config)){

if (errored) process.exit();

config.VERSION = process.env.npm_package_version ? process.env.npm_package_version : 'V1.22.5';
config.VERSION = version;
config.SUPPORTED_LANGUAGES = ['en','de'];

module.exports = config;
Loading

0 comments on commit 9ed1c14

Please sign in to comment.