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

Apache Web-Server Browser [GUI] [BIG PROJECT]

Started by djblocksaway, 23 July 2012 - 05:22 AM
djblocksaway #1
Posted 23 July 2012 - 07:22 AM
—[]***THE UPDATE IS HERE***[]—

[WE BELIEVE THAT THIS HAS NEVER BEEN DONE BEFORE AND A LOT OF HARD WORK HAS GONE INTO THIS]

Hey,

Me and 1lann have been working on a huge project.
the idea of the project is for it to list files from an apache web server and be able to browse easily and download and some other things :)/>/>
————————————————————-
The Project is out of beta stages and is ready for the public It Is not yet Finished But The Early Versions Have Been Checked Multiple Times For Bugs.
If You Find A Bug Please Tell Us

—————————————————-
On first use you will be greeted with a welcome screen and it will ask you to put in an address.this address must be to an apache webserver or you will probably get an error.
if you look on the internet you can probably find an example apache server!

[FOR THIS PROGRAM TO WORK AN APACHE WEB-SERVER ADDRESS IS NEEDED]

Links
Paste-Bin Link: http://pastebin.com/NLP9WCqW

Demo/Trial Apache Server [ NOT 24/7 ]
demoapache.ddns.me


Features
Fully Functional GUI
Download Support
File/Directory Listing
Scrolling Support
Reported Working On Apache Versions 2.1 - 2.2
Server List [Bookmark Servers/Address'es]
Previous Button [Connect To The Last Address You Connected To!]
And Much More!

IMPORTANT:

An Apache Server Will Look Something Like This And If It Doesn't Then The Address WILL NOT WORK With The Apache Browser!
———
Note:
There Is Still A lot Of Work To Be Done And A lot Of Bugs To Fix!

Spoiler
Or


Change-Log

1.0
First Release

1.1
Fixed Some Bugs [Error With Files/Directorys That Have Spaces]
Removed "Press Q To Exit" Text
Added A Cancel Button In The Actions Menu
Made A Help Screen
Fixed Some Other Small Bugs

1.2
Added An Exit Button To The Welcome Screen!
Added A Server List/Bookmark List
Fixed MANY Bugs
Updated The Welcome Screen
Added Text [If Address Is Invalid It Will Tell You!]
Updated Scrolling Support!
Updated File Listing Order! [Alphabetical]


TO-DO
Add A Check For Updates Button To Welcome Screen

Screen-Shots [Out-Dated!]

Spoiler


Spoiler


Spoiler

Some Notes/Credits!

SpoilerCredit To 1lann For Coding

Check Out Our Server
IP: ccnet.ddns.me:25564


Please Leave A Reply If You Find Any Bugs Or Have Any Suggestions

Feel Free To Edit This Program And Use It To Your Liking. If You Do Please Give Credit To Me And 1lann
© djblocksaway all rights reserved
Noodle #2
Posted 23 July 2012 - 11:08 AM
GLHF
Why is this needed?
Another thing, Are you actually connecting to the site? I'm just curious how you would draw EVERY site.
djblocksaway #3
Posted 23 July 2012 - 12:12 PM
noodles. yes it does actully connect to a site. and it doesnt connect to any site.
it will only connect to apache web servers (google it)
Jan #4
Posted 23 July 2012 - 02:58 PM
Hello, that looks like a nice project :)/>/>
But you do the parsing of the HTML page by yourselves?
You can also use an xml parser:

function parseargs(s)
  local arg = {}
  string.gsub(s, "(%w+)=(["'])(.-)%2", function (w, _, a)
    arg[w] = a
  end)
  return arg
end
   
function collect(s)
  local stack = {}
  local top = {}
  table.insert(stack, top)
  local ni,c,label,xarg, empty
  local i, j = 1, 1
  while true do
    ni,j,c,label,xarg, empty = string.find(s, "<(%/?)([%w:]+)(.-)(%/?)>", i)
    if not ni then break end
    local text = string.sub(s, i, ni-1)
    if not string.find(text, "^%s*$") then
	  table.insert(top, text)
    end
    if empty == "/" then  -- empty element tag
	  table.insert(top, {label=label, xarg=parseargs(xarg), empty=1})
    elseif c == "" then   -- start tag
	  top = {label=label, xarg=parseargs(xarg)}
	  table.insert(stack, top)   -- new level
    else  -- end tag
	  local toclose = table.remove(stack)  -- remove top
	  top = stack[#stack]
	  if #stack < 1 then
	    error("nothing to close with "..label)
	  end
	  if toclose.label ~= label then
	    error("trying to close "..toclose.label.." with "..label)
	  end
	  table.insert(top, toclose)
    end
    i = j+1
  end
  local text = string.sub(s, i)
  if not string.find(text, "^%s*$") then
    table.insert(stack[#stack], text)
  end
  if #stack > 1 then
    error("unclosed "..stack[#stack].label)
  end
  return stack[1]
end
Source: http://lua-users.org/wiki/LuaXml
I used it to parse xml-bibles in my Bible Reader program, i am pretty sure it should work for html as well.

EDIT: Something went wrong with the code-posting, fixed it
1lann #5
Posted 23 July 2012 - 05:17 PM
Hello, that looks like a nice project :)/>/>
But you do the parsing of the HTML page by yourselves?
You can also use an xml parser:

--CODE--
Source: http://lua-users.org/wiki/LuaXml
I used it to parse xml-bibles in my Bible Reader program, i am pretty sure it should work for html as well.

EDIT: Something went wrong with the code-posting, fixed it

Yes I wrote the parsing by myself
Spoiler

local function process()
local f= io.open("/.tmpdata", "r")
f:read("*l")
f:read("*l")
f:read("*l")
f:read("*l")
f:read("*l")
f:read("*l")
local data = f:read("*l")
local titlestart = nil
local derp = nil
titlestart = (string.find(data, "<h1>")+4)
local titleend = (string.find(data, "</h1>")-1)
title = string.sub(data, titlestart, titleend)
items = {}
types = {}
href = {}
local line = f:read("*l")
apachev = 1
if contains(line, "<table><tr><th>") then
apachev = 2
line = f:read("*l")
end
while contains(line, "<li>") or contains(line, "</td><td>") do
rStart = (string.find(line, "<a href=")-4)
lStart = string.find(line, ""> ", rStart)
if apachev == 2 then
lStart = (string.find(line, "">", rStart) + 2)
else
lStart = (string.find(line, ""> ", rStart)+3)
end
lEnd = (string.find(line, "</a>", rStart) - 1)
lData = string.sub(line, lStart, lEnd)
table.insert(items, lData)
hStart = (string.find(line, "<a href="", rStart) + 9)
hEnd = (string.find(line, "">", rStart) - 1)
hData = string.sub(line, hStart, hEnd)
table.insert(href, hData)
if contains(lData, "Parent Directory") then
  lPStart = (string.find(line, "<a href="", rStart) + 9)
  lPEnd = (string.find(line, "">", rStart) - 1)
  lPData = string.sub(line, lPStart, lPEnd)
  table.insert(types, "back")
elseif contains(lData, "/") then
  table.insert(types, "dir")
else
  table.insert(types, "file")
end
line = f:read("*l")
end
return title, items, types
end

Thanks for the XML Parser, however I don't think I'll need it :-/
djblocksaway #6
Posted 24 July 2012 - 04:11 PM
added a demo server for people to test. not always on :)/>/>
djblocksaway #7
Posted 26 July 2012 - 09:03 AM
update coming soon =D
Noodle #8
Posted 26 July 2012 - 10:02 PM
Cool. Its looking good!
Will you be allowed to make custom pages for this or is it strictly Apache only (online)?
djblocksaway #9
Posted 26 July 2012 - 10:46 PM
Cool. Its looking good!
Will you be allowed to make custom pages for this or is it strictly Apache only (online)?
thanks for the feedback.
but can you please give more detail about the custom page thing :)/>/>
thanks
Noodle #10
Posted 27 July 2012 - 12:04 AM
Hmm.. What about wamp? Like, as long as this can get to the Apache site it should work right?
djblocksaway #11
Posted 27 July 2012 - 12:31 AM
yes. i use xampp but you can use wamp and apache monitor etc just as long as it can reach an apache server itll work
rex41043 #12
Posted 27 July 2012 - 01:54 AM
Nice work so far :)/>/>, but this has been done just not in the way you are EG
My "Inet" (working on name) uses a webserver to: download programs, run code with out downloading it has a nice GUI AND it is simple to use :D/>/>

But yours is doing good :(/>/> and i can't wait to c it when its done :D/>/>
Noodle #13
Posted 27 July 2012 - 02:49 AM
This seems great because I could setup the computer files on my wamp dir (I'll find a way) and people will be able to access all the files, aswell as change them and seriously encourage hackers :)/>/>
I'll find a way to make this work 100% where you can make an anti-virus also..
djblocksaway #14
Posted 27 July 2012 - 05:56 AM
Nice work so far :D/>/>, but this has been done just not in the way you are EG
My "Inet" (working on name) uses a webserver to: download programs, run code with out downloading it has a nice GUI AND it is simple to use :(/>/>

But yours is doing good :)/>/> and i can't wait to c it when its done :D/>/>
rex when i say i believe this has not been done before i am saying that as in no one has done it with a GUI.

This seems great because I could setup the computer files on my wamp dir (I'll find a way) and people will be able to access all the files, aswell as change them and seriously encourage hackers :)/>/>
I'll find a way to make this work 100% where you can make an anti-virus also..
yea this is very useful for servers. i use xampp and it seems to work perfect but wamp should work just as good =)
rex41043 #15
Posted 27 July 2012 - 07:44 AM
Nice work so far :D/>/>, but this has been done just not in the way you are EG
My "Inet" (working on name) uses a webserver to: download programs, run code with out downloading it has a nice GUI AND it is simple to use :)/>/>

But yours is doing good :)/>/> and i can't wait to c it when its done :(/>/>
rex when i say i believe this has not been done before i am saying that as in no one has done it with a GUI.

This seems great because I could setup the computer files on my wamp dir (I'll find a way) and people will be able to access all the files, aswell as change them and seriously encourage hackers :)/>/>
I'll find a way to make this work 100% where you can make an anti-virus also..
yea this is very useful for servers. i use xampp and it seems to work perfect but wamp should work just as good =)
you dident read my text fully did you :D/>/> let me quote it for you "run code with out downloading it has a nice GUI AND it is simple to use :)/>/>"
djblocksaway #16
Posted 28 July 2012 - 03:23 AM
Nice work so far :(/>/>, but this has been done just not in the way you are EG
My "Inet" (working on name) uses a webserver to: download programs, run code with out downloading it has a nice GUI AND it is simple to use :)/>/>

But yours is doing good :)/>/> and i can't wait to c it when its done :)/>/>
rex when i say i believe this has not been done before i am saying that as in no one has done it with a GUI.

This seems great because I could setup the computer files on my wamp dir (I'll find a way) and people will be able to access all the files, aswell as change them and seriously encourage hackers :)/>/>
I'll find a way to make this work 100% where you can make an anti-virus also..
yea this is very useful for servers. i use xampp and it seems to work perfect but wamp should work just as good =)
you dident read my text fully did you :D/>/> let me quote it for you "run code with out downloading it has a nice GUI AND it is simple to use :)/>/>"
oh sorry for my misunderstanding :D/>/>
djblocksaway #17
Posted 30 July 2012 - 09:38 AM
UPDATE COMING SOON! VERY SOON!
djblocksaway #18
Posted 30 July 2012 - 10:46 AM
THE UPDATE IS HERE!!!!