Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:upside_down_face: Prints sexy ascii title on server start

Alicia Sykes0bb5f2bf557c
diff --git a/services/print-message.js b/services/print-message.js
index a33df99c..d7d19ed0 100644
--- a/services/print-message.js
+++ b/services/print-message.js
@@ -1,14 +1,14 @@
/**
- * A function that prints a welcome message to the user when they start the app
+ * Returns a welcome message, to be printed to the user when they start the app
* Contains essential info about restarting and managing the container or service
- * @param String ip: The users local IP address
- * @param Integer port: the port number the app is running at
+ * @param String ip: The users local IP address or hostname
+ * @param Integer port: the port number that the app is running at
* @param Boolean isDocker: whether or not the app is being run within a container
* @returns A string formatted for the terminal
*/
module.exports = (ip, port, isDocker) => {
- let msg = '';
- const chars = {
+ let msg = ''; // To return
+ const chars = { // Color codes used in the message
RESET: '\x1b[0m',
CYAN: '\x1b[36m',
GREEN: '\x1b[32m',
@@ -16,10 +16,13 @@ module.exports = (ip, port, isDocker) => {
BRIGHT: '\x1b[1m',
BR: '\n',
};
- const stars = (count) => new Array(count).fill('*').join('');
- const line = (count) => new Array(count).fill('━').join('');
- const blanks = (count) => new Array(count).fill(' ').join('');
+ // Functions to insert string of set length of characters
+ const printChars = (count, char) => new Array(count).fill(char).join('');
+ const stars = (count) => printChars(count, '*');
+ const line = (count) => printChars(count, '━');
+ const blanks = (count) => printChars(count, ' ');
if (isDocker) {
+ // Prepare message for Docker users
const containerId = process.env.HOSTNAME || undefined;
msg = `${chars.BLUE}${stars(91)}${chars.BR}${chars.RESET}`
+ `${chars.CYAN}Welcome to Dashy! πŸš€${chars.RESET}${chars.BR}`
@@ -30,6 +33,7 @@ module.exports = (ip, port, isDocker) => {
+ `${chars.RESET}${chars.GREEN}' to rebuild${chars.BR}`
+ `${chars.BLUE}${stars(91)}${chars.BR}${chars.RESET}`;
} else {
+ // Prepare message for users running app on bare metal
msg = `${chars.GREEN}┏${line(75)}β”“${chars.BR}`
+ `┃ ${chars.CYAN}Welcome to Dashy! πŸš€${blanks(55)}${chars.GREEN}┃${chars.BR}`
+ `┃ ${chars.CYAN}Your new dashboard is now up and running at ${chars.BRIGHT}`
@@ -38,5 +42,14 @@ module.exports = (ip, port, isDocker) => {
+ `${chars.RESET}${chars.CYAN}' to rebuild the app${blanks(6)}${chars.GREEN}┃${chars.BR}`
+ `β”—${line(75)}β”›${chars.BR}${chars.BR}${chars.RESET}`;
}
- return msg;
+ // Make some sexy ascii art ;)
+ const ascii = `\x1b[40m${chars.CYAN}\n\n`
+ + ' β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—\n'
+ + ' β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•\n'
+ + ' β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•\n'
+ + ' β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ•”β•\n'
+ + ' β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘\n'
+ + ` β•šβ•β•β•β•β•β• β•šβ•β• β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β• β•šβ•β• β•šβ•β•\n${chars.RESET}\n`;
+
+ return ascii + msg;
};