diff --git a/app/assets/remote_scripts/client_script.ps1 b/app/assets/remote_scripts/client_script.ps1 index 1ef00a57..3d0ce539 100644 --- a/app/assets/remote_scripts/client_script.ps1 +++ b/app/assets/remote_scripts/client_script.ps1 @@ -1,6 +1,6 @@ # run like this: powershell.exe -noprofile -executionpolicy bypass -file path\to\client_script.ps1 path\to\project_root -# CodeOcean Remote Client v0.4 +# CodeOcean Remote Client v0.5 #file_info format: = (src/frog.java=34) #file_path format: @@ -76,13 +76,15 @@ $file_array = get-content $co_file.fullname $validation_token = $file_array[0] -$files_attributes = get_file_attributes $file_array[1] +$target_url = $file_array[1] -for ($i = 2; $i -lt $file_array.length; $i++){ +$files_attributes = get_file_attributes $file_array[2] + +for ($i = 3; $i -lt $file_array.length; $i++){ $files_attributes += ', ' $files_attributes += get_file_attributes $file_array[$i] } $post_data = "{`"remote_evaluation`": {`"validation_token`": `"$validation_token`",`"files_attributes`": [$files_attributes]}}" -post_web_request 'application/json' $post_data 'http://codeocean.openhpi.de/evaluate' \ No newline at end of file +post_web_request 'application/json' $post_data $target_url diff --git a/app/assets/remote_scripts/client_script.sh b/app/assets/remote_scripts/client_script.sh index 8bde2fd0..8c56f820 100644 --- a/app/assets/remote_scripts/client_script.sh +++ b/app/assets/remote_scripts/client_script.sh @@ -1,6 +1,6 @@ #!/bin/bash -# CodeOcean Remote Client v0.4 +# CodeOcean Remote Client v0.5 #file_info format: = (src/frog.java=34) #file_path format: @@ -46,13 +46,15 @@ mapfile -t file_array < "$co_file_path" validation_token="${file_array[0]}" -files_attributes="$(get_file_attributes "${file_array[1]}")" +target_url="${file_array[1]}" -for ((i = 2; i < ${#file_array[@]}; i++)); do +files_attributes="$(get_file_attributes "${file_array[2]}")" + +for ((i = 3; i < ${#file_array[@]}; i++)); do files_attributes+=", $(get_file_attributes "${file_array[i]}")" done post_data="{\"remote_evaluation\": {\"validation_token\": \"$validation_token\",\"files_attributes\": [$files_attributes]}}" -curl -H 'Content-Type: application/json' --data "$post_data" http://codeocean.openhpi.de/evaluate -echo \ No newline at end of file +curl -H 'Content-Type: application/json' --data "$post_data" "$target_url" +echo diff --git a/app/assets/remote_scripts/client_script_osx.sh b/app/assets/remote_scripts/client_script_osx.sh index 955b03bd..a24fc251 100644 --- a/app/assets/remote_scripts/client_script_osx.sh +++ b/app/assets/remote_scripts/client_script_osx.sh @@ -1,6 +1,6 @@ #!/bin/bash -# CodeOcean Remote Client v0.4 +# CodeOcean Remote Client v0.5 #file_info format: = (src/frog.java=34) #file_path format: @@ -55,14 +55,15 @@ read_file_to_array $co_file_path validation_token="${file_array[0]}" -files_attributes="$(get_file_attributes "${file_array[1]}")" +target_url="${file_array[1]}" -for ((i = 2; i < ${#file_array[@]}; i++)); do +files_attributes="$(get_file_attributes "${file_array[2]}")" + +for ((i = 3; i < ${#file_array[@]}; i++)); do files_attributes+=", $(get_file_attributes "${file_array[i]}")" done post_data="{\"remote_evaluation\": {\"validation_token\": \"$validation_token\",\"files_attributes\": [$files_attributes]}}" -#echo ${post_data} -curl -H 'Content-Type: application/json' --data "$post_data" http://codeocean.openhpi.de/evaluate -echo \ No newline at end of file +curl -H 'Content-Type: application/json' --data "$post_data" "$target_url" +echo diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 182c22c4..d04cfa6f 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -342,7 +342,10 @@ class SubmissionsController < ApplicationController # create id.co file path = "tmp/.co" + # parse validation token content = "#{remote_evaluation_mapping.validation_token}\n" + # parse remote request url + content += "#{request.base_url}/evaluate\n" @submission.files.each do |file| file_path = file.path.to_s == '' ? file.name_with_extension : File.join(file.path, file.name_with_extension) content += "#{file_path}=#{file.id.to_s}\n"