Jump to content




[CCC] ComputerCraft Cloud!

media utility

20 replies to this topic

#1 DarkenedEvil

  • Members
  • 59 posts

Posted 29 May 2013 - 09:06 PM

ComputerCraft Cloud

by

DarkenedEvil


Overview:
Welcome one and welcome all to my newest CC invention! Its called the CC Cloud or CCC for short! Currently in the development stage this program aims to add a cloud to MC with the use of CC and a website!

Disclaimer:
Before I post anything related to the program I must note: Don't upload passwords and usernames!(until I incorporate some sort of encryption to protect files!)

Description:
CCC or ComputerCraft Cloud will have a computer program that communicates with a web page after a file is uploaded or downloaded. The web page (coded in PHP) will receive and distribute all requests all on one page so no files can be found by just checking the source. When downloading something the computer will send the request with the file name, then the web page will find that page (if it exists) and send back the page URL for the computer to download. When uploading something the computer sends a request to the web page with the file and the web page then puts the file in its correct location to be downloaded later. Also after sending the file to where it needs to be the webpage responds to the computer telling it whether things went ok or not.

Uses:
  • Creating a file or text on one server and easily downloading and using it on another.
  • Easily have private and public files for multiple computers or servers
  • Create an account and safely store files!
  • Many other uses!
What is done currently:
There is a brand new version since I just got back from something. It is almost all re-written. It makes it 10x better and more efficient with each person getting a username defined by themselves(Soon to have a login system). Also soon to come is the ability to delete a file.
What I have done so far for the uploading.
http://pastebin.com/rFcLkAWc
What I have done for the downloading.
http://pastebin.com/Jcqdv9xG


ToDo:
1) Create login function to allow users to have their own files
2) Have shared files(anyone can download the file)
3) Create installer
4) Make a create user function
5) Encrypt passwords(Most important)
6) Store things in a database(First thing to be done. If I can figure it out.)
7) Be able to delete files

Other Notes:
AGAIN this is in development meaning no releases only programs released AS IS so please give feedback and be patient.

I am also looking for a person who can help me with encryption and/or databases.

Please question/comment/give feedback!


#2 1lann

  • Members
  • 516 posts
  • LocationAustralia

Posted 29 May 2013 - 11:48 PM

os.pullEvent = os.pullEventRaw
_G.shell = shell
Why is that necessary? O_o. Makes it look malicious.

#3 ElvishJerricco

  • Members
  • 803 posts

Posted 30 May 2013 - 12:45 AM

Line 17:

if #tArgs == 0 or 1 then

Won't work as I assume you mean it to. Lua will split this into the following boolean logic:

if (#tArgs is equal to 0) or (1 is a non-nil, non-false value).

Because 1 is always a non-nil, non-false value, this logic will always return true. You might imagine a solution would be

if #tArgs == (0 or 1) then

but that won't work either. "or" statements returns the first value to be non-nil and non-false. So this is really saying

if #tArgs is equal to (0, or if that's nil or false, check 1)

And since 0 is not false or nil, it will check if #tArgs is 0, all the time. The only solution is to do two different equality checks.

if #tArgs == 0 or #tArgs == 1 then

The logic translates to

if #tArgs is equal to 0, or if #tArgs is equal to 1

I only wrote so much because it's a rookie mistake and a commonly recurring one if you don't learn about it. So I hope this cleared that up.


#4 DarkenedEvil

  • Members
  • 59 posts

Posted 30 May 2013 - 01:35 PM

View Post1lann, on 29 May 2013 - 11:48 PM, said:

os.pullEvent = os.pullEventRaw
_G.shell = shell
Why is that necessary? O_o. Makes it look malicious.
That was necessary because for some reason it wouldn't run shell.run so I had to use that(before I took out shell.run)

#5 DarkenedEvil

  • Members
  • 59 posts

Posted 30 May 2013 - 01:37 PM

View PostElvishJerricco, on 30 May 2013 - 12:45 AM, said:

Line 17:

if #tArgs == 0 or 1 then

Won't work as I assume you mean it to. Lua will split this into the following boolean logic:

if (#tArgs is equal to 0) or (1 is a non-nil, non-false value).

Because 1 is always a non-nil, non-false value, this logic will always return true. You might imagine a solution would be

if #tArgs == (0 or 1) then

but that won't work either. "or" statements returns the first value to be non-nil and non-false. So this is really saying

if #tArgs is equal to (0, or if that's nil or false, check 1)

And since 0 is not false or nil, it will check if #tArgs is 0, all the time. The only solution is to do two different equality checks.

if #tArgs == 0 or #tArgs == 1 then

The logic translates to

if #tArgs is equal to 0, or if #tArgs is equal to 1

I only wrote so much because it's a rookie mistake and a commonly recurring one if you don't learn about it. So I hope this cleared that up.
Thank you for the help. I did find it useful but as I said in the OP it is not close to being done I only posted that here to make it official. Bug testing and adding a login begins today!

#6 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 01 June 2013 - 04:37 PM

No one uses shell.run() :P <-- Kidding

Do:
local function run(path)
  pcall(loadfile(path))
end


Note: It will not work with CraftOS programs.

#7 DarkenedEvil

  • Members
  • 59 posts

Posted 01 June 2013 - 05:34 PM

View Postjesusthekiller, on 01 June 2013 - 04:37 PM, said:

No one uses shell.run() :P <-- Kidding

Do:
local function run(path)
  pcall(loadfile(path))
end


Note: It will not work with CraftOS programs.

I don't use any external programs now so its all within one program so i dont need it any more but thanks:D

#8 1lann

  • Members
  • 516 posts
  • LocationAustralia

Posted 01 June 2013 - 10:33 PM

View PostDarkenedEvil, on 30 May 2013 - 01:35 PM, said:

View Post1lann, on 29 May 2013 - 11:48 PM, said:

os.pullEvent = os.pullEventRaw
_G.shell = shell
Why is that necessary? O_o. Makes it look malicious.
That was necessary because for some reason it wouldn't run shell.run so I had to use that(before I took out shell.run)
Why is the os.pullEvent = os.pullEventRaw necessary then?

#9 DarkenedEvil

  • Members
  • 59 posts

Posted 01 June 2013 - 10:59 PM

View Post1lann, on 01 June 2013 - 10:33 PM, said:

View PostDarkenedEvil, on 30 May 2013 - 01:35 PM, said:

View Post1lann, on 29 May 2013 - 11:48 PM, said:

os.pullEvent = os.pullEventRaw
_G.shell = shell
Why is that necessary? O_o. Makes it look malicious.
That was necessary because for some reason it wouldn't run shell.run so I had to use that(before I took out shell.run)
Why is the os.pullEvent = os.pullEventRaw necessary then?
To be honest i just put it in there. but next update both will be in one program so I'm going to need it

#10 Mads

  • Members
  • 604 posts
  • LocationCopenhagen, Denmark

Posted 02 June 2013 - 03:41 AM

View Postjesusthekiller, on 01 June 2013 - 04:37 PM, said:

No one uses shell.run() :P/&gt;/&gt; &lt;-- Kidding Do:
 local function run(path) pcall(loadfile(path)) end
Note: It will not work with CraftOS programs.

pcall(loadstring(io.open(path, "r"):read("*a")))


#11 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 02 June 2013 - 06:16 AM

View PostMads, on 02 June 2013 - 03:41 AM, said:

pcall(loadstring(io.open(path, "r"):read("*a")))

io is slower than fs (io is wrapper around fs).
And loadfile() is shorter

#12 DarkenedEvil

  • Members
  • 59 posts

Posted 13 August 2013 - 01:33 AM

Brand new update that added a whole new rewrite of the programs. This also adds per-user saving and downloading of files. As of now anyone can access the files but in the next update. Things will require a password to download and hopefully be on a database.

#13 DarkEspeon

  • Members
  • 57 posts

Posted 13 August 2013 - 01:39 AM

View Postjesusthekiller, on 02 June 2013 - 06:16 AM, said:

View PostMads, on 02 June 2013 - 03:41 AM, said:

pcall(loadstring(io.open(path, "r"):read("*a")))

io is slower than fs (io is wrapper around fs).
And loadfile() is shorter

.... you got that backwords... fs is the wrapper around io, io is the base that needed to be coded in java, and is thus faster......

#14 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 13 August 2013 - 08:15 AM

Also, one thing: why is it called "cloud"? It's just web storage, not cloud.

#15 Sxw

  • Members
  • 306 posts
  • LocationWhenever, Wherever!

Posted 13 August 2013 - 04:33 PM

View PostDarkEspeon, on 13 August 2013 - 01:39 AM, said:

View Postjesusthekiller, on 02 June 2013 - 06:16 AM, said:

View PostMads, on 02 June 2013 - 03:41 AM, said:

pcall(loadstring(io.open(path, "r"):read("*a")))

io is slower than fs (io is wrapper around fs).
And loadfile() is shorter

.... you got that backwords... fs is the wrapper around io, io is the base that needed to be coded in java, and is thus faster......

No it's not. Go look at the io api in computercraft. /rom/Apis/io
In normal lua fs would be a wrapper but this is computercraft.

#16 DarkenedEvil

  • Members
  • 59 posts

Posted 13 August 2013 - 07:17 PM

View Postjesusthekiller, on 13 August 2013 - 08:15 AM, said:

Also, one thing: why is it called "cloud"? It's just web storage, not cloud.

wikipedia said:

IaaS clouds often offer additional resources such as a virtual-machine disk image library, raw (block) and file-based storage, firewalls, load balancers, IP addresses,virtual local area networks (VLANs), and software bundles

This can technically be called a cloud because it is on a webserver and it offers file-based storage. If you want me to change the name I will, but I just think that it is correct.

#17 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 14 August 2013 - 06:03 AM

I get your point, but it is not *real* cloud :P

#18 MudkipTheEpic

  • Members
  • 639 posts
  • LocationWhere you'd least expect it.

Posted 14 August 2013 - 09:57 PM

View Postjesusthekiller, on 14 August 2013 - 06:03 AM, said:

I get your point, but it is not *real* cloud :P
The following is a smartarse remark.

A *real* cloud is made of vapors, therefore cannot hold any computer data.

#19 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 15 August 2013 - 05:09 AM

So you agree with me that it is not real cloud? :3

#20 DarkenedEvil

  • Members
  • 59 posts

Posted 15 August 2013 - 04:58 PM

View PostMudkipTheEpic, on 14 August 2013 - 09:57 PM, said:

View Postjesusthekiller, on 14 August 2013 - 06:03 AM, said:

I get your point, but it is not *real* cloud :P
The following is a smartarse remark.

A *real* cloud is made of vapors, therefore cannot hold any computer data.

Now we're getting serious....but, it can still be called a real cloud because those vapors have electrons and electrons move from one atom to another creating a charge. That charge can then be used to power the internet!(Yah thats right, the internet is powered by clouds)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users