From 83b1294a07fde3d50d842ae410e6cbe4305fdafd Mon Sep 17 00:00:00 2001 From: Roxy Date: Thu, 25 May 2023 11:17:07 +0200 Subject: [PATCH] tried implementing post function --- furry-sex.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/furry-sex.rb b/furry-sex.rb index 1372ee0..431afae 100755 --- a/furry-sex.rb +++ b/furry-sex.rb @@ -7,7 +7,7 @@ require "uri" $replacements = { "e621.net" => "e621.fuwwy.ch", # Replace this with your domain/subdomain obviously ">e621<" => ">e621.fuwwy.ch<", # This basically just changes the title shown on the main page - "https:" => "http:" # only needed if your nginx backend doesnt have ssl yet + "https:" => "http:" # only needed if your nginx backend doesn't have SSL yet } class MyProxy < WEBrick::HTTPServlet::AbstractServlet @@ -15,12 +15,20 @@ class MyProxy < WEBrick::HTTPServlet::AbstractServlet def do_GET(request, response) uri = request.unparsed_uri + proxy_request(request, response, Net::HTTP::Get.new(uri, {"User-Agent" => "amongus happy meal guys this is crazy i ordered an amogus happy meal at 3am hugy wugy came and sucked my dick this is so scary"})) + end + def do_POST(request, response) + uri = request.unparsed_uri + proxy_request(request, response, Net::HTTP::Post.new(uri, {"User-Agent" => "amongus happy meal guys this is crazy i ordered an amogus happy meal at 3am hugy wugy came and sucked my dick this is so scary"}), request.body) + end + + def proxy_request(request, response, http_request, body = nil) http = Net::HTTP.new(HOST, 443) http.use_ssl = true + http_request.body = body if body - resp = http.request(Net::HTTP::Get.new(uri, {"User-Agent" => "amongus happy meal guys this is crazy i ordered an amogus happy meal at 3am hugy wugy came and sucked my dick this is so scary"})) - # please change this user agent to something unique otherwise e621 will block your request and you might get IP banned + resp = http.request(http_request) body = resp.body response.content_type = resp["content-type"] @@ -36,3 +44,4 @@ server.mount "/", MyProxy trap("INT"){ server.shutdown } server.start +