#!/var/www/localhost/ioServer pastedText := CGI parse at("text") pasteName := MD5 clone append(pastedText) md5String fromTo(0,16) pathWithExtension := method(extension, "/var/www/localhost/htdocs/paste" appendPath(pasteName .. "." .. extension)) # Write out file and hardlink .txt .html and .io extensions txtFile := pathWithExtension("txt") File clone setPath(txtFile) open write(pastedText) close System system("ln " .. txtFile .. " " .. pathWithExtension("html")) System system("ln " .. txtFile .. " " .. pathWithExtension("io")) write("Status: 303 See Other\n") write("Content-type: text/plain\n") write("Location: ", "http://", System getenv("SERVER_NAME"), "/paste/", pasteName, ".txt") write("\n\n") #write("Content-type: text/html\n") #write("Cache-Control: no-store, no-cache, must-revalidate\n\n"); # #form := CGI parse # #text := form at("text") # #hashString := MD5 clone append(text) md5String fromTo(0,16) #abspath := "/var/www/localhost/htdocs/paste" # #fileName := hashString .. ".txt" # #pasteFile := method(extension, abspath appendPath(hashString .. "." .. extension)) # #realFile := pasteFile("txt") #File clone setPath(realFile) open write(text) close ##File clone setPath(abspath appendPath(hashString .. ".html")) open write(text) close #System system("ln " .. realFile .. " " .. pasteFile("html")) #System system("ln " .. realFile .. " " .. pasteFile("io")) # #r := """""" # #urlPath := "/paste/" .. fileName #write(r replace("@path@", urlPath))