cookie notice, and some about/intro changes

This commit is contained in:
Lisa Milne 2023-12-17 09:42:18 +10:00
parent 99a58594d3
commit ad4815d672
4 changed files with 65 additions and 22 deletions

View file

@ -10,7 +10,7 @@ clite.commands.load('help',function(args,env,io) {
stdio.printf(`
Welcome to CLIte (pronounced like 'site' with an added L).
Various unix-like commands are available for navigating the CLIte shell:
Various common Unix commands are available in the CLIte shell:
ls - list directory contents
cat - concatenate files and print to std output or local file
@ -21,11 +21,10 @@ file - determines the file type
And many more.
Running any command with the argument -? will give you help for that program.
Or you can run help <command> to get the same info.
As a basic guide for guests:
Use ls to see what content is available, eg: ls web
Use view or less to view the content, eg: view web/about
Use less to view the content, eg: less web/about
`);
return 0;
});
@ -516,12 +515,6 @@ Options:
return null;
});
clite.commands.load('view',function(args,env,io) {
var stdio = io.include('stdio');
stdio.printf('view is under development\n');
return 0;
});
clite.commands.load('rm',function(args,env,io) {
var short = null;
var file = null;
@ -2173,7 +2166,9 @@ Options:
clite.commands.load('su',function(args,env,io) {
var stdio = io.include('stdio');
var stdlib = io.include('stdlib');
var clite = io.include('clite');
var auth = io.include('auth');
var term = io.include('term');
var pw = null;
var preserve = true;
@ -2232,6 +2227,7 @@ Options:
}
function doLogin(str) {
term.ttyctrl('echo',true);
if (!auth.checkpassuid(pw.pw_uid,str)) {
stdio.printf('authentication error\n');
io.exit(1);
@ -2241,9 +2237,44 @@ Options:
changeUser();
}
function preLogin(str) {
if (str == 'no') {
io.exit(0);
return;
}
if (str != 'yes') {
cookies();
return;
}
if (stdlib.getuid() != 0) {
stdio.write(io.stdout,'password: ');
term.ttyctrl('echo',false);
if (!stdio.read(io.stdin,doLogin)) {
term.ttyctrl('echo',true);
stdio.write(io.stderr,'authentication error\n');
io.exit(1);
}
return;
}
changeUser();
}
function cookies() {
clite.cookienotice();
stdio.printf("Enter 'yes' to agree, or 'no' to cancel: ");
if (!stdio.read(io.stdin,preLogin)) {
stdio.write(io.stderr,'internal error\n');
io.exit(1);
}
}
function main(args) {
var user = 'root';
var shellnext = false;
var accept = false;
for (var i=1; i<args.length; i++) {
if (shellnext == true) {
shell = args[i];
@ -2266,6 +2297,9 @@ Options:
case 's':
shellnext = true;
break;
case 'c':
accept = true;
break;
default:
stdio.fprintf(io.stderr,'unknown argument: -%c\n',args[i][j]);
}
@ -2296,16 +2330,12 @@ Options:
return 1;
}
if (stdlib.getuid() != 0) {
stdio.write(io.stdout,'password: ');
if (!stdio.read(io.stdin,doLogin)) {
stdio.write(io.stderr,'authentication error\n');
return 1;
}
if (accept || user == 'root' || user == 'guest') {
preLogin('yes');
return null;
}
changeUser();
cookies();
return null;
}

View file

@ -135,6 +135,17 @@ return Object.create({
},
modestr:function(perms) {
return clite.lib.modestr(perms);
},
cookienotice:function() {
clite.io.write(io.pid,io.stdout,`
The CLIte guest login does not use cookies.
However CLIte does use cookies for custom user accounts, to store your
account info, as well as the contents of your home directory.
This way all of your personal data is kept on your own computer, rather
than being uploaded to a random server somewhere.
`);
}
});

View file

@ -1,4 +1,5 @@
Welcome, this site runs on CLIte, the command line site management system.
CLIte works like a Unix terminal, a guest login will be automatically generated for you.
CLIte has many Unix-like commands for navigating the website, simply type in a command and press enter to run it.
Welcome to CLIte, the Unix system in a web page.
A guest login will be automatically generated for you.
CLIte does not use cookies for guest accounts.
CLIte has many common Unix commands for navigating the system, simply type in a command and press enter to run it.
Not sure how this works? Use the `help' command at any time.

View file

@ -1,4 +1,5 @@
Welcome, this site runs on CLIte, the command line site management system.
CLIte works like a Unix terminal, a guest login will be automatically generated for you.
CLIte has many Unix-like commands for navigating the website, simply type in a command and press enter to run it.
Welcome to CLIte, the Unix system in a web page.
A guest login will be automatically generated for you.
CLIte does not use cookies for guest accounts.
CLIte has many common Unix commands for navigating the system, simply type in a command and press enter to run it.
Not sure how this works? Use the `help' command at any time.