move big CLIte text to a variable instead of writing it twice

This commit is contained in:
Lisa Milne 2023-11-16 07:58:59 +10:00
parent 6128bc86db
commit d5bb8fd814

View file

@ -290,6 +290,13 @@ data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--`;
clite.io.close(fd);
}
// check cookies for login
var clite_text =`
_____ _ _____ _
/ ____| | |_ _| |
| | | | | | | |_ ___
| | | | | | | __/ _ \\
| |____| |____ _| |_| || __/
\\_____|______|_____|\\__\\___|`;
clite.log.write('Checking for user session');
if (clite.user.init(vfsapi)) {// if logged in:
clite.log.write('found user session?');
@ -299,23 +306,11 @@ data/about.txt:/usr/share/site/about:0:0:-rw-rw-r--`;
// read in /usr/share/introduction and write to shell
if (window.location.protocol == 'file:') {
clite.user.genGuest();
clite.shell.writeLine(`
_____ _ _____ _
/ ____| | |_ _| |
| | | | | | | |_ ___
| | | | | | | __/ _ \\
| |____| |____ _| |_| || __/
\\_____|______|_____|\\__\\___|`);
clite.shell.writeLine(clite_text);
}else{
var fd = clite.io.open('/usr/share/introduction',function(fd) {
clite.user.genGuest();
clite.shell.writeLine(`
_____ _ _____ _
/ ____| | |_ _| |
| | | | | | | |_ ___
| | | | | | | __/ _ \\
| |____| |____ _| |_| || __/
\\_____|______|_____|\\__\\___|`);
clite.shell.writeLine(clite_text);
if (!fd)
return;
var d = clite.io.readAll(fd);