Skip to content

Commit

Permalink
Remove Bulk file uploads in favor of File Reader
Browse files Browse the repository at this point in the history
* consistent with the other textareas
* client side, no uploads
  • Loading branch information
Stoyan Stefanov committed Jan 10, 2023
1 parent b0f59d2 commit 92518a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions www/assets/js/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function ValidateInput(form, remainingRuns) {
if (
(form.url.value == "" || form.url.value == "Enter a Website URL") &&
form.script.value == "" &&
(form["bulkurls"] == undefined || form.bulkurls.value == "") &&
(form["bulkfile"] == undefined || form.bulkfile.value == "")
(form["bulkurls"] == undefined || form.bulkurls.value == "")
) {
alert("Please enter an URL to test.");
form.url.focus();
Expand Down
10 changes: 8 additions & 2 deletions www/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,15 @@ function enableDisableLHSimple(){
<label for="bulkurls" class="full_width">
List of URLs to test (one URL per line)...
</label>
<small>
Type in or read <label for="bulkurls_file" class="linklike">from a text file</label>
</small>
<input type="file" id="bulkurls_file" accept="text/*" class="a11y-hidden">
<script>
document.addEventListener('DOMContentLoaded', () => initFileReader('bulkurls_file', 'bulkurls'));
</script>
</p>
<textarea class="large" name="bulkurls" id="bulkurls" cols="0" rows="0"></textarea><br>
<b>or</b><br>
upload list of URLs (one per line): <input type="file" name="bulkfile" size="40">
</div>
<?php } ?>
</div>
Expand Down Expand Up @@ -1131,6 +1136,7 @@ function LoadLocations()
// Determine if bulk testing should be shown
function ShowBulk()
{
return true;
global $admin;
global $USER_EMAIL;
global $request_context;
Expand Down
6 changes: 1 addition & 5 deletions www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,7 @@
// see if it is a batch test
$test['batch'] = 0;
if (
(isset($req_bulkurls) && strlen($req_bulkurls)) ||
(isset($_FILES['bulkfile']) && isset($_FILES['bulkfile']['tmp_name']) && strlen($_FILES['bulkfile']['tmp_name']))
isset($req_bulkurls) && strlen($req_bulkurls)
) {
$test['batch'] = 1;
$is_bulk_test = true;
Expand Down Expand Up @@ -1158,9 +1157,6 @@ function buildSelfHost($hosts)
if (isset($req_bulkurls) && strlen($req_bulkurls)) {
$bulkUrls = $req_bulkurls . "\n";
}
if (isset($_FILES['bulkfile']) && isset($_FILES['bulkfile']['tmp_name']) && strlen($_FILES['bulkfile']['tmp_name'])) {
$bulkUrls .= file_get_contents($_FILES['bulkfile']['tmp_name']);
}

$current_mode = 'urls';
if (strlen($bulkUrls)) {
Expand Down

0 comments on commit 92518a5

Please sign in to comment.