...
 
Commits (2)
......@@ -97,22 +97,12 @@ private:
void handleMsgOthers(KruzifiXMLParser parser);
void parseAndStoreFavorites(KruzifiXMLParser parser);
qlonglong parseFavorites_GetFavId(xmlNodePtr node);
QString parseFavorites_GetUsername(xmlNodePtr node);
QPair<qlonglong, QString>
parseFavorites_GetSubmissionInfo(xmlNodePtr node);
QDateTime parseFavorites_GetFavDate(xmlNodePtr node);
void parseFavorites_Persist(const QString &username,
qlonglong submissionId,
const QString &submissionTitle,
qlonglong favId,
const QDateTime &favDate);
static xmlXPathObjectPtr
performXPathQuery(htmlDocPtr doc, const QString &xpath);
static QString getNodeContent(xmlNodePtr node);
RequestOrigin getRequestOriginFromNetworkReply(QNetworkReply *reply);
private slots:
......
# frozen_string_literal: true
require "securerandom"
enable :sessions
get "/" do
"FA Mock Server running."
end
get "/submit/?" do
return halt 401 unless request.cookies["a"] && request.cookies["b"]
erb :submit_1
end
post "/submit/?" do
return halt 401 unless request.cookies["a"] && request.cookies["b"]
puts "======== S U B M I T ========"
pp params
case params["part"].to_i
when 2
session[:submission] = {}
session[:submission][:type] = params["submission_type"]
session[:submission][:key] = SecureRandom.hex(20)
erb :submit_2
when 3
raise ArgumentError, "key does not match" unless session[:submission][:key] == params["key"]
session[:submission][:key] = SecureRandom.hex(20)
session[:submission][:filename] = params["submission"]["filename"]
redirect "/submit/submission/4/", 301
when 5
raise ArgumentError, "key does not match" unless session[:submission][:key] == params["key"]
"Submission uploaded."
else
raise ArgumentError, "unknown part: #{params['part']}"
end
end
get "/submit/submission/4/" do
return halt 401 unless request.cookies["a"] && request.cookies["b"]
erb :submit_4
end
# frozen_string_literal: true
require "bundler"
Bundler.setup :default
require "sinatra"
require_relative "./app.rb"
run Sinatra::Application
GEM
remote: https://rubygems.org/
specs:
mustermann (1.0.3)
nio4r (2.5.2)
puma (4.3.0)
nio4r (~> 2.0)
rack (2.0.7)
rack-protection (2.0.7)
rack
sinatra (2.0.7)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.7)
tilt (~> 2.0)
tilt (2.0.10)
PLATFORMS
ruby
DEPENDENCIES
puma
sinatra
BUNDLED WITH
2.0.2
# frozen_string_literal: true
source "https://rubygems.org"
gem "sinatra"
gem "puma"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.