initial commit

This commit is contained in:
2025-09-17 23:05:25 -04:00
commit ee78eef527
17 changed files with 610 additions and 0 deletions

4
startpage/root/.bin Normal file
View File

@@ -0,0 +1,4 @@
clear.js
fetch.js
gpt.js
man.js

View File

@@ -0,0 +1,12 @@
export async function cmd() {
return ``;
}
export let man = `
<pre>
CLEAR(1)
NAME
\tclear - clear the screen
</pre>
`

View File

@@ -0,0 +1,29 @@
export async function cmd(_) {
return `
<pre>
_____\t\t\tOS: ${navigator.platform}
.-"" ""-.\t\tLang: ${navigator.language}
/(/ _ }\`;\`.\t\tTimezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}
|\`---'/ \` \`;\\\t\tAgent: ${navigator.userAgent}
.' (\`._ ; \`:
: \--' '|\`;,;
| .---' ; | |
: ' \`.__.-. / ; ;
: .----' .' / :
\`. \`----' .' /
\`.\`--. __ .- .'
\`-._ _.-' fsc
\`""""
</pre>
`;
}
export let man = `
<pre>
FETCH(1)
NAME
\tfetch Get information about the browser. This is specific to firefox because
\tthis addon is specific to firefox.
</pre>
`

26
startpage/root/bin/gpt.js Normal file
View File

@@ -0,0 +1,26 @@
export async function cmd(inp, k) {
var search = ""
if (inp.indexOf(" ") > 0) {
search = inp.substring(inp.indexOf(" ") + 1)
}
if (k == 'Enter') {
window.open(`https://chatgpt.com/?q=${search}`, '_self');
}
return `
<pre>
press Enter to search chat.openai.com for: '${search}'
</pre>
`;
}
export let man = `
<pre>
GPT(1)
NAME
\tgpt - search chat.openai.com for something. You'll probably only get slop
\tbut it may have a chance of helping.
</pre>
`

53
startpage/root/bin/man.js Normal file
View File

@@ -0,0 +1,53 @@
var getmanval;
async function getman(path) {
try {
const module = await import("/startpage/" + path);
return module.man;
} catch (error) {
return null;
}
}
/* TODO: update to use the path in the env this can be done once we first
* make the env available to the programs running in the shell
*/
export async function cmd(inp) {
var search = ""
if (inp.indexOf(" ") > 0) {
search = inp.substring(inp.indexOf(" ") + 1)
}
switch (search) {
case "fetch": return getman('/root/bin/fetch.js');
case "gpt": return getman('/root/bin/gpt.js');
case "clear": return getman('/root/bin/clear.js');
case "shell": return manshell;
case "man": default: return man;
}
}
export let man = `
<pre>
MAN(1)
NAME
\tman display manual pages
SEE ALSO
\tfetch(1), gpt(1), shell(1), clear(1)
</pre>
`;
export let manshell = `
<pre>
SHELL(1)
NAME
\tshell command interpreter
DESCRIPTION
\tshell is a shell for my startpage. It's not POSIX nor will it ever be. It's
\tsole job it to interpret text and run a command if a valid one is found.
\tWhile this is quite unintuitive in a standard UNIX shell in my opinion this
\tmakes sense here because of such a limited number of commands.
</pre>
`;