This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dave-ee Jones's profile picture

Shark - A site browser for CC

Started by Dave-ee Jones, 01 November 2017 - 03:42 AM
Dave-ee Jones #1
Posted 01 November 2017 - 04:45 AM
Shark
By Dave-ee Jones



What's Shark?
Shark is a web browser made for CC.
It uses similar methods to a normal browser, however there are a few differences.

Shark Language
No, I will not pretend to be a shark-talking version of Dory.

Shark has it's own language for pages. When you access an external site all the pages will be written in SL. A file that contains SL is called an 'SLS', or Shark Language Sheet. A line of SL is called a 'SLL', or Shark Language Line. Shark Language is quite similar to HTML and (fairly) easy to write and understand.

Shark Language is executed line by line, just like Lua.

Sharkles
URLs are replaced with Sharkles. Sharkles look similar to URLs but their format is a little different. Here's an example of a Sharkle:

local://home/

You may notice that instead of 'http://' it has 'local://'. This part of the Sharkle is known as the 'hostname' (or, more simply, 'id' or 'host'). It tells Shark where to look for the page you are looking for.
'local' and 'localhost' tell Shark to look for pages on your local machine.

External Sites
You can also tell Shark to use a computer ID instead. For example:

2://example/

The above code tells Shark to ask the computer that has the ID 2 for the index page of the site 'example'. Sounds like a mouthful, but it's actually very simple.

Shark also uses a variation of host resolving, and it does so with a file that contains a table. This file is known as the HRF, or Host Resolution File. In this file you can specify what hostnames should go to what computer ID. Here's an example:

{
["jack"] = 2,
["boss"] = 0,
["house"] = 1
}

Using the above table, if I type the following into the Sharkle, Shark can convert this to a computer ID so it can talk to the computer and grab details of the site, like so:

house://example/
--# CONVERTS TO
1://example/

Error Handling
Shark has it's own error codes to deal with Sharkle errors. If it can't find a site, page or host it will let you know by taking you to the error page with relevant information.

It also logs all errors - even if it crashes Shark.

Sites
You can create your own sites, using Shark's own language. Refer to the wiki for more information.

History
Everytime you visit a site it is logged to the history file with the local MC time (useful, I know).





Download and Install


For downloads, look to the Github!


Install instructions are incredibly simple and can be found in the README in the VERSION 1 folder.



MORE INFORMATION AND DETAILS CAN BE FOUND ON THE SHARK GITHUB.
Edited on 01 November 2017 - 04:20 AM
Dave-ee Jones #2
Posted 01 November 2017 - 05:19 AM
Feel free to use the Issues section of the Github to report your issues. Alternatively you can post them here.


Recent fixes:
- Sharkles not resolving page extensions properly. Shark still doesn't resolve them properly but it has been temporarily fixed.
- Typo fixed
- Wireless modems are now automatically opened (only 1, of course)
- Fixed an error with the errors page (ironic, I know)


THIS IS AN UPDATE PLACEHOLDER. JUST IN CASE.
Edited on 01 November 2017 - 10:20 PM
Cross_Sans #3
Posted 21 December 2017 - 04:27 PM
Yeah, another web browser; but seriously, hardly creating a custom URL syntax with a custom language is very impertinent and not useful at all to be honest. If it was supporting requests (and this is possible even if ComputerCraft hasn't many functions for networking) and HTML (even a bit), it would be much more popular and would get more feedback. I mean, you did have made a parser that is XML language like, so why using a custom language ?

Have a nice day,

Alex.
Jummit #4
Posted 21 December 2017 - 06:00 PM
Is this really necessary?