Skip to content

Commit

Permalink
New history command (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C authored May 17, 2024
1 parent 4164320 commit 829babb
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 90 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added
- new example software programs: `demo.exe`, `target.exe`, `artifact`, `decrypt` & `identify`
- new kernel commands: `echo`, `exit`, `history`
- `software` programs logic can now be defined as Javascript code in `software.js`
- `software` programs `messages` can now include **images** 🖼️, with an optional `glitch` / `particule` effect
- `software` programs `messages` can now include text with an optional effects:
`desync`, `shimmer`, `glow` or `hack-reveal`.
- new supported configurations fields in `manifest.json` : `iconSize`, `iconClass`, `headerExtraHTML`
- storing the commands history in the browser `localStorage`
- allowing to configure the initial content of a user commands history
- tab-completion of command names
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ You just need to share the correct link with your players and wait for them to r
This is really a simple terminal emulation, as I've said.
But, there are some things that could be also good to explore, like the creation of some local files or executable programs for the players to interact with.

If you want to, drop some ideas into my Github repository or send me some messages at Reddit (u/jacksonbenete) and we can work out something else.
If you want to, drop some ideas into my Github repository or send me some messages at Reddit ([u/jacksonbenete](https://www.reddit.com/user/jacksonbenete/)) and we can work out something else.

## Customization / what to do with this
This section lists ideas to craft the perfect terminal for your game!
Expand All @@ -420,6 +420,7 @@ This section lists ideas to craft the perfect terminal for your game!
by connecting to them with `telnet SERVERNAME` on [the online terminal](https://krymsonwake.github.io/email_terminal/)
* hide clues in emails to figure other users **logins** & **passwords**, and also what other **servers** exist!
* use [Z̶̡̼̰͎̬̔̂̇͑ą̵̨̩̖̺̠̹̯͉̇̇̿́̔̍̈́͋̄̈́̕͠ͅl̸̩̗͖͕̺̩͎̠̹̥͕̿̔̃̾̊̓̄͋͝͝g̸͙̺̬̰̙̯̹̼̲̦̔̾̐͑̒͘͝ô̷̯̹̣̖̤͎̿̽̏̆̐͗̾̋̐̚͘̕ text](https://en.wikipedia.org/wiki/Zalgo_text), like [@JAMacera](https://github.com/JAMacera/email_terminal/blob/master/config/database.json) did
* usage for a sci-fi ttrpg one-shot: [ParadisPerdu](https://chezsoi.org/lucas/jdr/ParadisPerdu/acte-1/) - [config source](https://github.com/Lucas-C/email_terminal/tree/acte-1) - [scenario (French)](https://github.com/Lucas-C/jdr/tree/master/ParadisPerdu)

Please suggest additions to this list based on your own usage,
through a GitHub issue/PR or by contacting the author on Reddit.
Expand All @@ -437,4 +438,4 @@ through a GitHub issue/PR or by contacting the author on Reddit.
- fbi.png icon by: https://iconscout.com/contributors/icon-mafia

### Icons Acknowledgement (not included)
- (non-free) DNA icon by: https://www.iconfinder.com/icons/378473/dna_icon
- (non-free) DNA icon by: https://www.iconfinder.com/icons/378473/dna_icon
28 changes: 15 additions & 13 deletions src/error.js
Original file line number Diff line number Diff line change
@@ -1,90 +1,92 @@
/* eslint no-unused-vars: 0 */

class CommandNotFoundError extends Error {
class FunctionalError extends Error {}

class CommandNotFoundError extends FunctionalError {
constructor( command ) {
super();
this.message = `${ command }: command not found`;
}
}

class InvalidCommandParameter extends Error {
class InvalidCommandParameter extends FunctionalError {
constructor( command ) {
super();
this.message = `Invalid parameters pased to command ${ command }`;
}
}

class AddressNotFoundError extends Error {
class AddressNotFoundError extends FunctionalError {
constructor( address ) {
super();
this.message = `Error : address ${ address } can't be reached`;
}
}

class AddressIsEmptyError extends Error {
class AddressIsEmptyError extends FunctionalError {
constructor() {
super();
this.message = "Error: You need to specify an address";
}
}

class UsernameIsEmptyError extends Error {
class UsernameIsEmptyError extends FunctionalError {
constructor() {
super();
this.message = "Empty user name provided";
}
}

class InvalidCredsSyntaxError extends Error {
class InvalidCredsSyntaxError extends FunctionalError {
constructor() {
super();
this.message = "Invalid syntax for credentials provided: either provide just a username, or username:password";
}
}

class InvalidPasswordError extends Error {
class InvalidPasswordError extends FunctionalError {
constructor( userName ) {
super();
this.message = `Invalid password provided for ${ userName }`;
}
}

class MailServerIsEmptyError extends Error {
class MailServerIsEmptyError extends FunctionalError {
constructor() {
super();
this.message = "There is no new mail registered.";
}
}

class InvalidMessageKeyError extends Error {
class InvalidMessageKeyError extends FunctionalError {
constructor() {
super();
this.message = "Invalid message key.";
}
}

class AlreadyOnServerError extends Error {
class AlreadyOnServerError extends FunctionalError {
constructor( serverAddress ) {
super();
this.message = `You already are at ${ serverAddress }`;
}
}

class UnknownUserError extends Error {
class UnknownUserError extends FunctionalError {
constructor( userName ) {
super();
this.message = `Unknown user ${ userName }`;
}
}

class ServerRequireUsernameError extends Error {
class ServerRequireUsernameError extends FunctionalError {
constructor( serverAddress ) {
super();
this.message = `Server require a username to be accessed: ssh username@${ serverAddress }`;
}
}

class JsonFetchParseError extends Error {
class JsonFetchParseError extends FunctionalError {
constructor( message ) {
super();
this.message = message;
Expand Down
Loading

0 comments on commit 829babb

Please sign in to comment.