1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-30 17:13:20 +00:00
Commit Graph

20 Commits

Author SHA1 Message Date
Wilma456
e9cea7d0f5 Add more Checks 2017-08-21 15:20:32 +02:00
Daniel Ratcliffe
123a0158af Merge pull request #313 from SquidDev-CC/feature/http-blacklist
HTTP blacklist and IP address support
2017-06-28 22:36:14 +01:00
Wojbie
bf533dd00a Reverting requested changes. Take 1
Reverting rewrites to painutils, paint and edit - keept the paste logic change in edit.
Changed and removed misc parts as requested in PR.
2017-06-28 22:58:57 +02:00
Wojbie
6255314ba8 Fir error in http.request _post error cheacking code and add package.config to shell require code to support standard better. 2017-06-24 14:33:29 +02:00
Wojbie
fc93ee474f Merge branch 'master' into Mixed-lua-side-improvements 2017-06-24 14:29:19 +02:00
Wojbie
6df22235ae Add forgotten settings.set in bios. 2017-06-20 02:09:28 +02:00
Wilma456
c70acbb05a Add Checks to Bios 2017-06-18 17:48:07 +02:00
Wojbie
3acbdb2f90 Merge branch 'master' into Mixed-lua-side-improvements 2017-06-17 22:21:25 +02:00
Wilma456
2445a5b5d5 Add Default to read() 2017-06-15 14:50:47 +02:00
Wojbie
76a3562d58 Multiple fixes and feature fixes for lua side of CC
In no particular order:
bios.lua - added missing test for ensure turtle folder exists.
paintutils.lua - added drawLineHorizontal() to reduce most (not all) cases of running multiple writes on same horizontal line that can be solved with one write.
textutils.lua - Added exception to complete function - will not complete if provided with LuaKeyword - solves do->dofile problem and removes other LuaKeyword related ones in advance.
edit.lua - Changed logic in handling the paste event - if paste event is received when menu is open it automatically closed said menu and lets it paste - resolves ctrl+ctrl+v annoyance. Added Jump to Menu functions - allows for fast jump to needed line - must for bigger files and a nice feature to have.
set.lua - Switched set to use pagedPrint - this will ensure that even if there are more settings than lines on screen the set command will show you all of them.
startup.lua - Added autocompletition for turtle programs go, turn, equip, unequip and command program exec.
lua.lua - Changed return function to print returned stuff correctly -
will print all returned variables even if there are any nils in there.
2017-06-13 11:00:07 +02:00
SquidDev
585c769c2a Restructure the HTTP API
- Adds support for blacklisting domains
 - Adds support for blacklisting & whitelisting IP addresses and
   IP ranges.
 - Reuse threads for HTTP requests

AddressPredicate will parse a series of patterns and convert them into
regexes or CIDR ranges. When checking whether an address is accessible,
we first ensure the domain is whitelisted and isn't blacklisted.

If everything is OK, then we start create a new thread for the HTTP
request and resolve the IP, ensuring that is whitelisted & not
blacklisted. Then the normal HTTP request is continued.

However, http.checkURL also needs to resolve the IP address. In order to
avoid blocking the Lua thread, this method will return instantly and
create a new thread which will queue an event.

As both http.request and http.checkURL are now creating threads and
queuing events, some logic is abstracted into a separate HTTPTask class
- this allows us to share the thread creation, finishing and cancelling
logic.
2017-06-12 19:22:02 +01:00
Wilma456
07ae332c24 Add fileextension for Paint (#260)
* Add fileextension for Paint

* Change extension to .nfp

* Add setting
2017-05-29 14:05:19 +01:00
Wilma456
99b5534099 Add setting for .lua extension (#278)
* Add setting for .lua extension

* Feedback  from SquidDev

* Feedback from dan200

* All requested changes are done

* Better description

* Cleaner check
2017-05-29 13:21:27 +01:00
Daniel Ratcliffe
6e6b8e7eef Made os.loadAPI handle .lua files. Renamed all builtin APIs to .lua 2017-05-17 22:47:13 +01:00
Wilma456
1d905963e9 Add .lua extension to all programs and startup 2017-05-17 16:28:43 +02:00
SquidDev
6ccffe9742 Refactor the filesystem and HTTP code
- Move the encoding/decoding from the Filesystem implementation to the
   individual handles.
 - Move each handle into an core.apis.handles package from the main fs
   API.
 - Move the HTTP response to inherit from these handles.
 - Allow binary handles' read function to accept a number, specifying
   how many characters to read - these will be returned as a Lua string.
 - Add readAll to binary handles
 - Allow binary handles' write function to accept a string which is
   decoded into the individual bytes.
 - Add "binary" argument to http.request and friends in order to return
   a binary handle.
 - Ensure file handles are open when reading from/writing to them.
 - Return the error message when opening a file fails.
2017-05-13 22:47:28 +01:00
Lignum
2c7ee1d7e7
Bump CraftOS version to 1.8 2017-05-06 23:26:45 +02:00
SquidDev
bd14223ea8 Manually specify the number of values to unpack
table.unpack will often stop at the first nil value, meaning some event
arguments may be discarded. By storing the number of arguments through
table.pack, and then using that count when unpacking, we can ensure all
values are returned/resumed with.
2017-05-04 10:49:41 +01:00
SquidDev
29952d5b4f Various extensions to the HTTP API
- A response is returned on the event of a HTTP error (such as 404).
 - Responses include the response headers.
2017-05-01 17:35:06 +01:00
Daniel Ratcliffe
e85cdacbc5 ComputerCraft 1.79 initial upload
Added the complete source code to ComputerCraft 1.79 for Minecraft
1.8.9, plus newly written README and LICENSE files for the open source
release.
2017-05-01 14:32:39 +01:00