@@ -442,7 +442,9 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
442442 socketpool_socket_send (socket , (const uint8_t * )ok_response , strlen (ok_response ));
443443 _send_chunk (socket , "<!DOCTYPE html><html><head><title>" );
444444 _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>" );
446448 _send_chunk (socket , path );
447449 _send_chunk (socket , "</h1><pre>" );
448450 if (strlen (path ) > 1 ) {
@@ -468,18 +470,15 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
468470 // entry->file_size = file_info.fsize;
469471 // }
470472 // _send_chunk(socket, "<li>");
471- bool editable = false;
472473 if ((file_info .fattrib & AM_DIR ) != 0 ) {
473474 _send_chunk (socket , "🗀\t" );
474475 } else if (_endswith (file_info .fname , ".txt" ) ||
475476 _endswith (file_info .fname , ".py" ) ||
476477 _endswith (file_info .fname , ".js" ) ||
477478 _endswith (file_info .fname , ".json" )) {
478479 _send_chunk (socket , "🖹\t" );
479- editable = true;
480480 } else if (_endswith (file_info .fname , ".html" )) {
481481 _send_chunk (socket , "🌐\t" );
482- editable = true;
483482 } else {
484483 _send_chunk (socket , "⬇\t" );
485484 }
@@ -494,13 +493,15 @@ static void _reply_directory_html(socketpool_socket_obj_t *socket, FF_DIR *dir,
494493
495494 _send_chunk (socket , file_info .fname );
496495 _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/>" );
501499 res = f_readdir (dir , & file_info );
502500 }
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>" );
504505 _send_chunk (socket , "" );
505506}
506507
0 commit comments