SquadJS/squad-server/utils/print-logo.js

55 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-10-22 17:30:43 -05:00
import axios from 'axios';
2020-10-05 12:52:01 -05:00
import { SQUADJS_VERSION, COPYRIGHT_MESSAGE } from './constants.js';
2020-05-15 12:42:39 -05:00
2020-12-08 11:16:32 -06:00
function versionOutOfDate(current, latest) {
2021-03-07 09:15:34 -06:00
const cMatch = current.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
const lMatch = latest.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/);
2020-10-22 17:30:43 -05:00
2020-12-08 11:16:32 -06:00
cMatch.shift();
lMatch.shift();
2020-10-22 17:30:43 -05:00
2021-03-07 09:15:34 -06:00
const [cMajor, cMinor, cPatch] = cMatch;
const [lMajor, lMinor, lPatch] = lMatch;
2020-10-22 17:30:43 -05:00
2020-12-08 11:16:32 -06:00
return (
2020-10-22 17:30:43 -05:00
cMajor < lMajor ||
(cMajor === lMajor && cMinor < lMinor) ||
2021-03-07 09:15:34 -06:00
(cMajor === lMajor && cMinor === lMinor && cPatch < lPatch)
2020-12-08 11:16:32 -06:00
);
}
export default async function () {
2021-03-07 09:15:34 -06:00
const { data } = await axios.get(
`https://cdn.jsdelivr.net/gh/Team-Silver-Sphere/SquadJS@master/package.json`
2020-12-08 11:16:32 -06:00
);
2021-03-07 09:15:34 -06:00
const outdated = versionOutOfDate(SQUADJS_VERSION, data.version);
2020-10-22 17:30:43 -05:00
console.log(
`
2020-08-26 11:24:07 -05:00
_____ ____ _ _ _____ \x1b[33m_\x1b[0m
/ ____|/ __ \\| | | | /\\ | __ \\ \x1b[33m(_)\x1b[0m
| (___ | | | | | | | / \\ | | | | \x1b[33m_ ___\x1b[0m
\\___ \\| | | | | | |/ /\\ \\ | | | |\x1b[33m| / __|\x1b[0m
____) | |__| | |__| / ____ \\| |__| |\x1b[33m| \\__ \\\x1b[0m
|_____/ \\___\\_\\\\____/_/ \\_\\_____\x1b[33m(_) |___/\x1b[0m
\x1b[33m_/ |\x1b[0m
\x1b[33m|__/\x1b[0m
2020-05-15 12:42:39 -05:00
${COPYRIGHT_MESSAGE}
2022-04-15 07:15:21 -05:00
GitHub: https://github.com/Team-Silver-Sphere/SquadJS
2020-05-15 12:42:39 -05:00
2021-01-07 14:52:55 -06:00
Latest Version: ${outdated ? '\x1b[31m' : '\x1b[32m'}${
2021-03-07 09:15:34 -06:00
data.version
2021-01-07 14:52:55 -06:00
}\x1b[0m, Installed Version: \x1b[32m${SQUADJS_VERSION}\x1b[0m
${
outdated
? '\x1b[31mYour SquadJS version is outdated, please consider updating.'
: '\x1b[32mYour SquadJS version is up to date.'
}\x1b[0m
2021-01-07 10:37:27 -06:00
\x1b[33mLooking for ways to help protect your server from harmful players?
Checkout the Squad Community Ban List: https://communitybanlist.com/\x1b[0m
2020-10-22 17:30:43 -05:00
`
);
2020-05-15 12:42:39 -05:00
}