@@ -442,7 +442,9 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
442
442
socketpool_socket_send (socket , (const uint8_t * )ok_response , strlen (ok_response ));
443
443
_send_chunk (socket , "<!DOCTYPE html><html><head><title>" );
444
444
_send_chunk (socket , path );
445
- _send_chunk (socket , "</title><meta charset=\"UTF-8\"></head><body><h1>" );
445
+ _send_chunk (socket , "</title><meta charset=\"UTF-8\"></head>" );
446
+ _send_chunk (socket , "<script src=\"http://127.0.0.1:8000/circuitpython.js\" defer=true></script>" );
447
+ _send_chunk (socket , "<body><h1>" );
446
448
_send_chunk (socket , path );
447
449
_send_chunk (socket , "</h1><pre>" );
448
450
if (strlen (path ) > 1 ) {
@@ -468,18 +470,15 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
468
470
// entry->file_size = file_info.fsize;
469
471
// }
470
472
// _send_chunk(socket, "<li>");
471
- bool editable = false;
472
473
if ((file_info .fattrib & AM_DIR ) != 0 ) {
473
474
_send_chunk (socket , "🗀\t" );
474
475
} else if (_endswith (file_info .fname , ".txt" ) ||
475
476
_endswith (file_info .fname , ".py" ) ||
476
477
_endswith (file_info .fname , ".js" ) ||
477
478
_endswith (file_info .fname , ".json" )) {
478
479
_send_chunk (socket , "🖹\t" );
479
- editable = true;
480
480
} else if (_endswith (file_info .fname , ".html" )) {
481
481
_send_chunk (socket , "🌐\t" );
482
- editable = true;
483
482
} else {
484
483
_send_chunk (socket , "⬇\t" );
485
484
}
@@ -494,13 +493,15 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
494
493
495
494
_send_chunk (socket , file_info .fname );
496
495
_send_chunk (socket , "</a>" );
497
- if (editable ) {
498
- _send_chunk (socket , "<a>✏️</a>" );
499
- }
500
- _send_chunk (socket , "<a>🗑️</a><br/>" );
496
+ _send_chunk (socket , "<button value=\"" );
497
+ _send_chunk (socket , file_info .fname );
498
+ _send_chunk (socket , "\" class=\"delete\">🗑️</button><br/>" );
501
499
res = f_readdir (dir , & file_info );
502
500
}
503
- _send_chunk (socket , "</pre>Upload:<input type=\"file\" multiple></body></html>" );
501
+ _send_chunk (socket , "</pre><hr><input type=\"file\" id=\"files\" multiple><button type=\"submit\" id=\"upload\">Upload</button>" );
502
+
503
+ _send_chunk (socket , "<hr>+🗀<input type=\"text\" id=\"name\"><button type=\"submit\" id=\"mkdir\">Create Directory</button>" );
504
+ _send_chunk (socket , "</body></html>" );
504
505
_send_chunk (socket , "" );
505
506
}
506
507
0 commit comments