Compare commits
28 Commits
new-profil
...
main
Author | SHA1 | Date | |
---|---|---|---|
6d752c99d7 | |||
d516d22411 | |||
9833bcc09a | |||
0f2d0bcf44 | |||
35bbbd902c | |||
4b301c9644 | |||
69d174e5c4 | |||
8d2b870d54 | |||
4b6f41a6c7 | |||
b41a0a9127 | |||
418d5122bc | |||
94903146c4 | |||
fb806b0991 | |||
361fc9fb97 | |||
e14399d04b | |||
b19b18da5b | |||
837e3de296 | |||
3cfd4752a1 | |||
b6956bfcfc | |||
1947859e0d | |||
a628ad5d56 | |||
9deb009d82 | |||
2ead40d6ae | |||
9b63300a0a | |||
d51d7d36a8 | |||
f8afea20df | |||
68436020c1 | |||
1e01260e82 |
22
.drone.yml
22
.drone.yml
@ -6,26 +6,44 @@ name: build
|
|||||||
steps:
|
steps:
|
||||||
- name: build-backend
|
- name: build-backend
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
TAG:
|
||||||
|
${DRONE_TAG}
|
||||||
|
COMMIT:
|
||||||
|
${DRONE_COMMIT}
|
||||||
settings:
|
settings:
|
||||||
insecure: true
|
insecure: true
|
||||||
repo: 10.5.0.103:1222/simrail-backend
|
repo: 10.5.0.103:1222/simrail-backend
|
||||||
registry: 10.5.0.103:1222
|
registry: 10.5.0.103:1222
|
||||||
context: './packages/backend'
|
context: './packages/backend'
|
||||||
dockerfile: './packages/backend/Dockerfile'
|
dockerfile: './packages/backend/Dockerfile'
|
||||||
|
build_args_from_env:
|
||||||
|
- TAG
|
||||||
|
- COMMIT
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
|
- ${DRONE_TAG##v}
|
||||||
|
|
||||||
- name: build-frontend
|
- name: build-frontend
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
|
environment:
|
||||||
|
VITE_API_URL:
|
||||||
|
from_secret: VITE_API_URL
|
||||||
|
VITE_STATS_KEY:
|
||||||
|
from_secret: VITE_STATS_KEY
|
||||||
settings:
|
settings:
|
||||||
insecure: true
|
insecure: true
|
||||||
repo: 10.5.0.103:1222/simrail-frontend
|
repo: 10.5.0.103:1222/simrail-frontend
|
||||||
registry: 10.5.0.103:1222
|
registry: 10.5.0.103:1222
|
||||||
context: './packages/frontend'
|
context: './packages/frontend'
|
||||||
dockerfile: './packages/frontend/Dockerfile'
|
dockerfile: './packages/frontend/Dockerfile'
|
||||||
|
build_args_from_env:
|
||||||
|
- VITE_API_URL
|
||||||
|
- VITE_STATS_KEY
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
|
- ${DRONE_TAG##v}
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
event:
|
||||||
- main
|
- tag
|
@ -6,8 +6,12 @@ COPY . .
|
|||||||
RUN yarn add -D typescript
|
RUN yarn add -D typescript
|
||||||
RUN yarn rawbuild
|
RUN yarn rawbuild
|
||||||
|
|
||||||
RUN ls
|
ARG COMMIT
|
||||||
|
ENV COMMIT $COMMIT
|
||||||
|
ARG TAG
|
||||||
|
ENV TAG $TAG
|
||||||
|
|
||||||
|
RUN yarn make-git-info
|
||||||
|
|
||||||
# Install Doppler CLI
|
# Install Doppler CLI
|
||||||
RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/cli@doppler-8004D9FF50437357.rsa.pub && \
|
RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.key' -O /etc/apk/keys/cli@doppler-8004D9FF50437357.rsa.pub && \
|
||||||
@ -17,4 +21,4 @@ RUN wget -q -t3 'https://packages.doppler.com/public/cli/rsa.8004D9FF50437357.ke
|
|||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["doppler", "run", "--"]
|
ENTRYPOINT ["doppler", "run", "--"]
|
||||||
CMD ["node", "/app/dist"]
|
CMD ["node", "/app/dist/src"]
|
4
packages/backend/git.json
Normal file
4
packages/backend/git.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"tag": "",
|
||||||
|
"commit": ""
|
||||||
|
}
|
@ -6,7 +6,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "docker build --progress=plain -t simrailpro:backend .",
|
"build": "docker build --progress=plain -t simrailpro:backend .",
|
||||||
"rawbuild": "yarn tsc",
|
"rawbuild": "yarn tsc",
|
||||||
"start": "yarn rawbuild && node --env-file=.env dist/index.js"
|
"start": "yarn rawbuild && node --env-file=.env dist/index.js",
|
||||||
|
"make-git-info": "node scripts/make-git.js"
|
||||||
},
|
},
|
||||||
"author": "Aleksander <alekswilc> Wilczyński",
|
"author": "Aleksander <alekswilc> Wilczyński",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
24
packages/backend/scripts/make-git.js
Normal file
24
packages/backend/scripts/make-git.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025 Aleksander <alekswilc> Wilczyński (aleks@alekswilc.dev)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published
|
||||||
|
* by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* See LICENSE for more.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fs from 'node:fs/promises';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await fs.writeFile('dist/git.json', JSON.stringify({
|
||||||
|
tag: process.env.TAG ?? "",
|
||||||
|
commit: process.env.COMMIT?.substring(0, 7) ?? "",
|
||||||
|
}))
|
||||||
|
})();
|
@ -14,7 +14,7 @@
|
|||||||
* See LICENSE for more.
|
* See LICENSE for more.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { execSync } from "child_process";
|
import gitInfo from '../../git.json' with { type: "json" };
|
||||||
|
|
||||||
export class GitUtil
|
export class GitUtil
|
||||||
{
|
{
|
||||||
@ -22,28 +22,12 @@ export class GitUtil
|
|||||||
|
|
||||||
private static getLatestVersion()
|
private static getLatestVersion()
|
||||||
{
|
{
|
||||||
return process.env.CURRENT_VERSION;
|
return gitInfo.tag;
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// const data = execSync("git describe --tags --exact-match").toString();
|
|
||||||
// return data.replace("\n", "");
|
|
||||||
// } catch
|
|
||||||
// {
|
|
||||||
// return undefined;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static getLatestCommit()
|
private static getLatestCommit()
|
||||||
{
|
{
|
||||||
return process.env.CURRENT_COMMIT;
|
return gitInfo.commit;
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// const data = execSync("git rev-parse --short HEAD").toString();
|
|
||||||
// return data.replace("\n", "");
|
|
||||||
// } catch
|
|
||||||
// {
|
|
||||||
// return undefined;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
"resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
@ -8,6 +8,12 @@ RUN npm install
|
|||||||
|
|
||||||
RUN npm i -g serve vite
|
RUN npm i -g serve vite
|
||||||
|
|
||||||
|
ARG VITE_API_URL
|
||||||
|
ENV VITE_API_URL $VITE_API_URL
|
||||||
|
|
||||||
|
ARG VITE_STATS_KEY
|
||||||
|
ENV VITE_STATS_KEY $VITE_STATS_KEY
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run rawbuild
|
RUN npm run rawbuild
|
||||||
|
@ -37,8 +37,8 @@ const sortTrainsByList: Record<number, string> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ProfileCard = ({ data, images }: { data: TProfileData, images: TImagesData }) => {
|
export const ProfileCard = ({ data, images }: { data: TProfileData, images: TImagesData }) => {
|
||||||
const [sortTrainsBy, setSortTrainsBy] = useState(0);
|
const [sortTrainsBy, setSortTrainsBy] = useState(2);
|
||||||
const [sortTrainsBy2, setSortTrainsBy2] = useState(2);
|
const [sortTrainsBy2, setSortTrainsBy2] = useState(0);
|
||||||
const [sortStationsBy, setSortStationsBy] = useState(0);
|
const [sortStationsBy, setSortStationsBy] = useState(0);
|
||||||
const [hideLeaderboardStatsModal, setHideLeaderboardStatsModal] = useState(false);
|
const [hideLeaderboardStatsModal, setHideLeaderboardStatsModal] = useState(false);
|
||||||
const [hideProfileModal, setHideProfileModal] = useState(false);
|
const [hideProfileModal, setHideProfileModal] = useState(false);
|
||||||
@ -95,10 +95,10 @@ export const ProfileCard = ({ data, images }: { data: TProfileData, images: TIma
|
|||||||
return data.player.trainStats[b][(sortTrainsByList[sortTrainsBy] ?? 'distance') as 'distance'] - data.player.trainStats[a][(sortTrainsByList[sortTrainsBy] ?? 'distance') as 'distance'];
|
return data.player.trainStats[b][(sortTrainsByList[sortTrainsBy] ?? 'distance') as 'distance'] - data.player.trainStats[a][(sortTrainsByList[sortTrainsBy] ?? 'distance') as 'distance'];
|
||||||
}
|
}
|
||||||
|
|
||||||
const dispatcherStats = [...chunk(Object.keys(data.player.dispatcherStats), 8)];
|
const dispatcherStats = [...chunk(Object.keys(data.player.dispatcherStats).sort(sortStations), 8)];
|
||||||
const [dispatcherPage, setDispatcherPage] = useState(1);
|
const [dispatcherPage, setDispatcherPage] = useState(1);
|
||||||
|
|
||||||
const trainStats = [...chunk(Object.keys(data.player.trainStats), 8)];
|
const trainStats = [...chunk(Object.keys(data.player.trainStats).sort(sortTrains), 8)];
|
||||||
const [trainPage, setTrainPage] = useState(1);
|
const [trainPage, setTrainPage] = useState(1);
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -166,10 +166,10 @@ export const ProfileCard = ({ data, images }: { data: TProfileData, images: TIma
|
|||||||
</p></a>
|
</p></a>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4">
|
<div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4">
|
||||||
{dispatcherStats[dispatcherPage - 1].sort(sortStations).map(stationName => {
|
{dispatcherStats[dispatcherPage - 1].map(stationName => {
|
||||||
const station = data.player.dispatcherStats[stationName];
|
const station = data.player.dispatcherStats[stationName];
|
||||||
|
|
||||||
return <StationStat stationName={stationName} time={station.time} image={images.stations[stationName]} />
|
return <StationStat stationName={stationName} time={station.time} image={images.stations[stationName] ?? images.stations['N/A']} />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col pt-4">
|
<div className="flex flex-col pt-4">
|
||||||
@ -192,9 +192,9 @@ export const ProfileCard = ({ data, images }: { data: TProfileData, images: TIma
|
|||||||
</p></a>
|
</p></a>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4">
|
<div className="grid grid-cols-1 gap-7.5 sm:grid-cols-3 xl:grid-cols-4 pt-4">
|
||||||
{trainStats[trainPage - 1].sort(sortTrains).map(trainName => {
|
{trainStats[trainPage - 1].map(trainName => {
|
||||||
const train = data.player.trainStats[trainName];
|
const train = data.player.trainStats[trainName];
|
||||||
return <TrainStat trainName={trainName} time={train.time} distance={train.distance} score={train.score} image={images.trains[trainName]} />
|
return <TrainStat trainName={trainName} time={train.time} distance={train.distance} score={train.score} image={images.trains[trainName] ?? images.trains['N/A']} />
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col pt-4">
|
<div className="flex flex-col pt-4">
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"footer": {
|
"footer": {
|
||||||
"license": "Licence:",
|
"license": "Licence:",
|
||||||
"powered": "Založeno na:",
|
"powered": "Založeno na:",
|
||||||
"thanks": "Speciální poděkování: <bahu>BAHU.PRO hosting</bahu>, <simrailelite>Simrail ELITE discord</simrailelite>, komunita SimRail a moje přítelkyně",
|
"thanks": "Speciální poděkování: <bahu>BAHU.PRO hosting</bahu>, <simrailelite>Simrail ELITE discord</simrailelite>, komunita SimRail",
|
||||||
"author": "Pro komunitu SimRail vytvořeno s ❤️ uživatelem <anchor>{{author}}</anchor> "
|
"author": "Pro komunitu SimRail vytvořeno s ❤️ uživatelem <anchor>{{author}}</anchor> "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"footer": {
|
"footer": {
|
||||||
"license": "License:",
|
"license": "License:",
|
||||||
"powered": "Based on:",
|
"powered": "Based on:",
|
||||||
"thanks": "Special thanks to <bahu>BAHU.PRO hosting</bahu>, <simrailelite>Simrail ELITE discord</simrailelite>, Simrail community and my girlfriend",
|
"thanks": "Special thanks to <bahu>BAHU.PRO hosting</bahu>, <simrailelite>Simrail ELITE discord</simrailelite> and Simrail community",
|
||||||
"author": "Created by <anchor>{{author}}</anchor> with ❤️ for the Simrail community"
|
"author": "Created by <anchor>{{author}}</anchor> with ❤️ for the Simrail community"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
"footer": {
|
"footer": {
|
||||||
"license": "Licencja:",
|
"license": "Licencja:",
|
||||||
"powered": "Oparte na:",
|
"powered": "Oparte na:",
|
||||||
"thanks": "Specjalne podziękowania dla <bahu>serwerowni BAHU.PRO</bahu>, <simrailelite>discorda Simrail ELITE</simrailelite>, społeczności Simrail i mojej dziewczyny",
|
"thanks": "Specjalne podziękowania dla <bahu>serwerowni BAHU.PRO</bahu>, <simrailelite>discorda Simrail ELITE</simrailelite> i społeczności Simrail",
|
||||||
"author": "Stworzone przez <anchor>{{author}}</anchor> z ❤️ dla społeczności Simrail"
|
"author": "Stworzone przez <anchor>{{author}}</anchor> z ❤️ dla społeczności Simrail"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user