jacob614

update.lua

Jan 10th, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. #!/usr/bin/lua
  2. print"Content-type: text/html"
  3. local arg={}
  4. local qs=os.getenv"QUERY_STRING" or ""
  5. for p in qs:gmatch"[^&]*" do                   -- seems to get all of the html arguments passed in
  6.     local k,v=p:match"([^=]*)=(.*)"
  7.     if k then
  8.         arg[k]=v
  9.     else
  10.         table.insert(arg,p)
  11.     end
  12. end
  13. local f=io.open("/var/www/jacob1/log.log","a") -- log request types, ip adresses, and mod versions of all requests
  14. f:write(("%s\t%s\t%s\t%s\t%s\n"):format(arg.Action or "None",arg.Architecture or "None",arg.InstructionSet or "None",os.getenv"REMOTE_ADDR" or "None",os.getenv"HTTP_X_J1Mod_VERSION" or "None"))",os.getenv"HTTP_X_Auth_User" or "None"))
  15. f:close()
  16. if arg.Action=="CheckVersion" then             -- return the changelog, or the default 0 0 0 one if there is no changelog by that name
  17.     local f=io.open(("Changelog_%s_%s.txt"):format(arg.Architecture or "Unknown",arg.InstructionSet or "Unknown")) or io.open"Changelog_Default.txt"
  18.     local d=f:read"*a"
  19.     print(("Content-Length: %d\n"):format(#d))
  20.     io.write(d)
  21. elseif arg.Action=="Download" then             -- return the update
  22.     local d=io.open(("Update_%s_%s"):format(arg.Architecture or "Unknown",arg.InstructionSet or "Unknown")):read"*a"
  23.     print(("Content-Length: %d\n"):format(#d))
  24.     io.write(d)
  25. else
  26.     io.write"\nHello?"                     -- if no args, probably someone just clicked the link from a browser
  27. end
  28.  
  29.  
  30.  
  31. sample changelog:
  32. 4 20 3
  33. tIncrease the speed of the save browser and fix ancient missing thumbnail bug
  34. gCompatibility with tpt++ powder.pref's (won't delete it's settings)
  35. tFix ANIM pause bugs and some editing bugs
  36. gAdd in many tpt++ element fixes
  37. tFix differences in what can destroy elements between this and tpt
  38. gHold ctrl when selecting a stamp to not reorder the list
  39. tVersion 20.3: Fix crash glitch caused by my tpt++ STKM eaten by CONV fix
  40.  
  41.  
  42. this says build 4, version 20.3. Then each line uses tpt's color format, that is what the g's and t's are. They should probably be deleted. This is titled Changelog_Windows32_SSE2.txt. You also need a Changelog_Default.txt that just says "0 0 0"
Advertisement
Add Comment
Please, Sign In to add comment