Jump to content




Rednet Explorer 2.4.1 "Browse the Internet(ception)" (Now with google and a search engine API!)


41 replies to this topic

#1 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 12 May 2012 - 05:05 AM

I didn't want to edit the old post then bump it, so I made a new one.

Here is the original post:


Quote

With this program, you can go onto the internetRednet!


To browse websites, use this clientProgram:
Download
http://pastebin.com/CuqtxjvM

Update
You no longer need to download a separate program for hosting websites!

Versions:
Client : 2.4
Server: 2.4 (Now Merged)

Nexus Edition : 2.4


New with 2.0:
  • Merged Server and Client
  • Updated The Server Look
  • Server is now infinite lines
  • Added Shortcuts:
  • - CTRL = Browse
  • - F5 = Refresh
  • Updated API( or added a API xP)
  • Improved Browsing Speeds
  • Added a webpage the only occurs when you didn't connect correctly.
  • You no longer need the HTTP api :)/> (that's why it is faster)
  • The server now loads the webpage off a file, so you have to update your websites to use Lua
New with 2.2:
  • The browser now remembers if it is a server. So if you reboot the PC, it will automatically switch to the server file and host the file you selected.
New with 2.3:
  • After alot of bugs, glitches, and debugging, I have finally re-added the editor from 1.0 :)/>
New with 2.4:
  • Added a search engine API, if you enable searchbots, your site will send you information if you receive rednet.api.ping.searchengine
  • De-Localized Address, so you can now redirect users (See API for more information)
New with 2.4.1:
  • Fixed your web browser crashing if you go to a site with a "/" in it's name


API:
title = "" --Changes "Rednet Explorer 2.2" on the top of the screen to whatever you want.
reDirect("home") --Changes your web address and redirects you to "home"


Custom Servers and User made websites
[2.4+] Google by me :)/>
Spoiler
[2.4+] BrowserUpdater by me
Spoiler

[2.4.1+] bit.ly by me :)/> :D/> :)/> (come on, why isn't anyone submitting?)
Spoiler

[2.0+] GlobalSites "Go to your website anywhere!" by... me... again D:
Spoiler


How to use and make a search engine:
Spoiler
Ugh, the forums broke my post and made it HTML, just try messing with this code until I fix the tutorial:


sleep(0) --So you don't go too fast
rednet.broadcast("rednet.api.ping.searchengine") --Send a message to all listening servers
while true do -- Start the loop
local a, i = rednet.receive(0) --Begin receiving for all servers that received the message
if i then --If you receive a message then...
print("Search: " ..i) --Print the address
else --If you dont receive a message or you received every message then...
break --Stop the searching
end
end--Finish the loop


#2 Vilsol

  • Members
  • 194 posts
  • LocationStudy: United Kingdom Native: Latvia

Posted 12 May 2012 - 12:31 PM

I think that ComputerCraft's rednet.broadcast() function is broken...

#3 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 12 May 2012 - 05:18 PM

View PostVilsol, on 12 May 2012 - 12:31 PM, said:

I think that ComputerCraft's rednet.broadcast() function is broken...

You need a modem

EDIT:
Oops,I only opened the top modem D: put a modem on the top of the pc

#4 Vilsol

  • Members
  • 194 posts
  • LocationStudy: United Kingdom Native: Latvia

Posted 12 May 2012 - 06:00 PM

Not that, I tested even just with basic commands: rednet.receive() and rednet.broadcast("blabla") and the receiver did nothing.... And yes, modems are activated...

#5 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 12 May 2012 - 06:23 PM

View PostVilsol, on 12 May 2012 - 06:00 PM, said:

Not that, I tested even just with basic commands: rednet.receive() and rednet.broadcast("blabla") and the receiver did nothing.... And yes, modems are activated...

You have to have a receiver on before you broadcast

#6 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 12 May 2012 - 07:42 PM

Updated the servers! It will now remember what site you selected and that it was a server. So if you set it up in a server room, the server will go back up after it turns off or reboots :P/>

#7 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 12 May 2012 - 10:08 PM

Updated the servers and client! I added a editor site so you don't have stop the servers. (go to "domainname"/editor at press Ctrl>Save>Exit and refresh)

#8 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 15 May 2012 - 03:39 AM

This program prints the titles BEFORE it is ran/changed. So the API doesn't work

#9 Cyan Crafter

  • New Members
  • 4 posts

Posted 17 May 2012 - 04:36 PM

amazing :D/>
luv it :P/>

#10 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 17 May 2012 - 05:20 PM

View PostCyan Crafter, on 17 May 2012 - 04:36 PM, said:

amazing :D/>
luv it :P/>

Thank, I might post some custom servers that shorten links like bit.ly

#11 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 19 May 2012 - 03:45 AM

Also, type change this to your browser if you want a custom password:
local x,y = term.getSize()
rednet.open("top")
local EditingValue = "";
function rednetV()
return "2.3"
end
title = "Rednet Explorer " ..rednetV() --Add title = "name" to change the webpage's title!
local website = "home";
if fs.exists(".cache") then fs.delete(".cache") end
if fs.exists(".websiteedited") then fs.delete(".websiteedited") end
fs.makeDir(".cache")
local cPrint = function(text)
local x2,y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)

print(text)
end
function createSite(websitename) --OPENNEXISGATES
	 fs.delete("startup")
	 startup = fs.open("startup", "w")
	 startup.writeLine("websitename = "" ..websitename.. """)
	 servercode = [[
	 
	  local password = os.getComputerID() --Change if you want a custom password
	 
	  function record(text)
	   print(text)
	   log = fs.open("rednet.log", "w")
	   log.writeLine(text)
	   log.close()
	  end
	 
	  local x,y = term.getSize()
	  local cPrint = function(text)
	   local x2,y2 = term.getCursorPos()
	   term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
	  
	   print(text)
	  end
	 
	  rednet.open("top")
	  term.clear()
	  cPrint("Hosting " ..websitename.. "...n")
	  cPrint("Go to " ..websitename.. "/editor to edit it! (PASS: " ..os.getComputerID().. ")n")
	  test = fs.open(websitename, "r")
	  fileContents = test:readAll()
	  test.close()
	  while true do
	   sleep(0)
	   id, message = rednet.receive()
	   if message == websitename then
	    record("   [" ..os.time().."] [" ..id.. "] Pinged Website.")
	    rednet.send(id, fileContents)
	    record("   [" ..os.time().."] [" ..id.. "] Received Data")
	   elseif message == websitename.. "/editor" then
	    rednet.send(id, "EditorMode")
	    rednet.send(id, tostring(password))
	    rednet.send(id, fileContents)
	   elseif message == websitename.. "/editor EDITED COMPLED!" then
	    id, message = rednet.receive(0.001)
	    fs.delete(websitename)
	    webpage = fs.open(websitename, "w")
	    webpage.write(message)
	    webpage.close()
	   
	   
	    test = fs.open(websitename, "r")
	    fileContents = test:readAll()
	    test.close()
	    record("   [" ..os.time().."] [" ..id.. "] Updated Website!")
	   end
	  end
	 ]]
	
	 startup.writeLine(servercode)
	 startup.close()
	 os.reboot()
end
local Address = function()
text = "rdnt://"
term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), 2)
term.clearLine()

write("rdnt://")
website = read()
loadWebpage()
end
function done()
term.setCursorPos(1, y)
name = "F5 = Refresh"
write("Press CTRL to travel the web! :P/>/>")
term.setCursorPos(x - name:len(), y)
write(name)

while true do
  sleep(0) -- stop crashing
  e, k = os.pullEvent("key")
  if k == 63 then
   loadWebpage()
   break
  elseif k == 29 then
   Address()
   break
  end
end
end
loadWebpage = function()
term.clear()
term.setCursorPos(1,1)
cPrint(title)
cPrint("rdnt://" ..website.. "n")
if website == "home" then
  print("Welcome to RedNet explorer (2.0)! This requires you to have a wireless modem on your computer.")
  print("Host a website at:			    ")
  print("rdnt://newsite!		    ")
  print("   -ComputerCraftFan11    ")
elseif website == "newsite" then
  print("Are you sure you would like to make this PC a server?")
  cPrint("Y = Yes N = No")
  while true do
   e, k = os.pullEvent("char")
   if k == "y" or k == "n" then
    break
   end
  end
 
  if k == "y" then
   term.clear()
   term.setCursorPos(1,1)
   title = "Rednet Servers " ..rednetV()
   cPrint(title)
   print("Welcome to the Rednet Servers. Please enter the website name: ")
   websitename = read()
   rednet.broadcast(websitename)
   i, me = rednet.receive(0.001)
   if me == nil then
    print("Thank you! This website will be running off of the file:n" ..websitename.. "n")
    write("Are you sure? (Y = Continue, V = Edit)")
    input = read()
    if input == "Y" or input == "y" then
	 if fs.exists(websitename) == false then
	  print("Please create " ..websitename.. " first!")
	  sleep(0.5)
	  shell.run("edit", websitename)
	 end
	 term.clear()
	 term.setCursorPos(1,1)
	 createSite(websitename)
    elseif input == "V" or input == "v" then
	 shell.run("edit", websitename)
	 term.clear()
	 term.setCursorPos(1,1)
	 createSite(websitename)
    end
   else
    print("I'm sorry, this domain name is taken.")
   end
  end
else
  title = "Rednet Explorer " ..rednetV()
  rednet.broadcast(website)
  print("Connecting...")
  id, message = rednet.receive(0.1)
  if message == nil then
   print("Unable to load webpage.")
  elseif message == "EditorMode" then
   id, password = rednet.receive(0.1)
   id, EditingValue = rednet.receive(0.1)
   write("Password: ")
   input = read("*")
   if tostring(password) == input then
    fs.delete(".cache/" ..website)
    editor = fs.open(".websiteedited", "w")
    if editor then
	 editor.writeLine(EditingValue)
    end
    editor.close()
   
    shell.run("edit", ".websiteedited")
   
    edited = fs.open(".websiteedited", "r")
    editwebpage = edited.readAll()
    edited.close()
   
    rednet.broadcast(website.. " EDITED COMPLED!")
    rednet.broadcast(editwebpage)
    website = "home"
    loadWebpage()
   
   else
   
    website = "home"
    loadWebpage()
   
   end
  else
   if fs.exists(".cache/" ..website) then fs.delete(".cache/" ..website) end
   webpage = fs.open(".cache/" ..website, "w")
   webpage.write(message)
   webpage.close()
   term.clear()
   term.setCursorPos(1,1)
   cPrint(title)
   cPrint("rdnt://" ..website.. "n")
   shell.run(".cache/" ..website)
  end
end

done()
end
loadWebpage()
After you make a server, edit startup and change "local password = os.getComputerID()" to "local password = your password here "

#12 Learning_inpaired

  • New Members
  • 77 posts

Posted 23 May 2012 - 01:20 AM

yea ok, im a noob from hell :L, how do i make a basic search engene that can list like lest say 5 website at a time? and how to make a website on lua.OS?
i have some ideas for my small town im working on but im not shure and any onw know the rednet range?

#13 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 23 May 2012 - 01:38 AM

View Postwoodzykiler, on 23 May 2012 - 01:20 AM, said:

yea ok, im a noob from hell :L, how do i make a basic search engene that can list like lest say 5 website at a time? and how to make a website on lua.OS?
The search engine program requires you to edit everyone's server. I'll post a search engine API and instructions later.
i have some ideas for my small town im working on but im not shure and any onw know the rednet range?
Go to your .minecraft/config and find
modem_range=50
Inside of your mod_ComputerCraft


#14 Learning_inpaired

  • New Members
  • 77 posts

Posted 23 May 2012 - 02:01 AM

we are on a tekkit server to be honest and i cant seem to find this file ur talking about...version 1.1/1.2.5

#15 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 24 May 2012 - 01:39 AM

View Postwoodzykiler, on 23 May 2012 - 01:20 AM, said:

yea ok, im a noob from hell :L, how do i make a basic search engene that can list like lest say 5 website at a time? and how to make a website on lua.OS?
i have some ideas for my small town im working on but im not shure and any onw know the rednet range?

Hey, I made a update with a search engine api.
Try messing with this code:

sleep(0) --So you don't go too fast
rednet.broadcast("rednet.api.ping.searchengine") --Send a message to all listening servers
while true do -- Start the loop
local a, i = rednet.receive(0) --Begin receiving for all servers that received the message
if i then --If you receive a message then...
print("Search: " ..i) --Print the address
else --If you dont receive a message or you received every message then...
break --Stop the searching
end
end--Finish the loop


#16 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 25 May 2012 - 02:30 AM

I updated the sites so it won't crash when you have a "/" in the name.

I also added my first custom server, it's bit.ly and it can shorten links!

#17 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 25 May 2012 - 02:32 AM

im working on a program similar to this but the one i have is alot smaller

View Postwoodzykiler, on 23 May 2012 - 02:01 AM, said:

we are on a tekkit server to be honest and i cant seem to find this file ur talking about...version 1.1/1.2.5
tekkit is 1.1, dan added that option in 1.2.3 i think

#18 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 25 May 2012 - 02:56 AM

View Postabc, on 25 May 2012 - 02:32 AM, said:

im working on a program similar to this but the one i have is alot smaller

View Postwoodzykiler, on 23 May 2012 - 02:01 AM, said:

we are on a tekkit server to be honest and i cant seem to find this file ur talking about...version 1.1/1.2.5
tekkit is 1.1, dan added that option in 1.2.3 i think

cuz this one has a built in server and in-browser file editor over rednet without having to download more then 1 file :)/>

#19 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 25 May 2012 - 02:57 AM

View PostComputerCraftFan11, on 25 May 2012 - 02:56 AM, said:

View Postabc, on 25 May 2012 - 02:32 AM, said:

im working on a program similar to this but the one i have is alot smaller

View Postwoodzykiler, on 23 May 2012 - 02:01 AM, said:

we are on a tekkit server to be honest and i cant seem to find this file ur talking about...version 1.1/1.2.5
tekkit is 1.1, dan added that option in 1.2.3 i think

cuz this one has a built in server and in-browser file editor over rednet without having to download more then 1 file :)/>
nice

#20 ComputerCraftFan11

  • Members
  • 771 posts
  • LocationHawaii

Posted 25 May 2012 - 02:59 AM

View Postabc, on 25 May 2012 - 02:57 AM, said:

View PostComputerCraftFan11, on 25 May 2012 - 02:56 AM, said:

View Postabc, on 25 May 2012 - 02:32 AM, said:

im working on a program similar to this but the one i have is alot smaller

View Postwoodzykiler, on 23 May 2012 - 02:01 AM, said:

we are on a tekkit server to be honest and i cant seem to find this file ur talking about...version 1.1/1.2.5
tekkit is 1.1, dan added that option in 1.2.3 i think

cuz this one has a built in server and in-browser file editor over rednet without having to download more then 1 file :)/>
nice

I won't let you take over this forum with your useless 1 word posts that break the rules!

Fixed a bug where your thing errors if the website doesn't exist (kept the version # the same).





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users