<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif">Hi Bonnie,</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">I am Daniel Escobar, one of the current developers working on Dr. Scratch. First of all, thank you very much for using Dr. Scratch, we are very happy that it helps you.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">The case you mentioned is very interesting for many reasons. On one hand, Lynx is a text-based browser, so as far as I know, it is not possible to attach files. The explanation that comes to mind for why it allowed you to upload the TXT file is that it is actually plain text. For this reason, I believe the best option is to make a POST request manually using the <code><b>curl</b></code> command. The only drawback we have with this approach is that, due to the nature of the web framework itself, there is a security token for <b>each session and each user.</b> Therefore, the plan will be to create a session and extract the cookies from it, and then make the request to the form with the SB3 using this same session, so we can use the same security token that has already been created.<br></div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">I will tell you the steps you need to follow in order to establish the connection:<br></div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style=""><font face="arial, sans-serif">1. Execute this petition, this will create a new session and then save it: </font><font face="monospace" color="#ff00ff"><b style="">curl -c cookies.txt <a href="https://www.drscratch.org/">https://www.drscratch.org/</a></b></font><b style="font-family:monospace"></b></div><div class="gmail_default" style="">This command will make a request to the website, and thanks to the <code>-c</code> parameter, it will return the site's cookies. From that TXT file, we can extract the value of the <code><i style="font-weight:bold">csrftoken </i><font face="arial, sans-serif">(the security token).</font></code><br></div><div class="gmail_default" style=""><font face="arial, sans-serif"><br></font></div><div class="gmail_default" style=""><font face="arial, sans-serif">2. </font><span style="font-family:arial,sans-serif">Establish a temporal environment variable with the csrf token</span><font face="arial, sans-serif">: </font><b><font face="monospace" color="#ff00ff">csrf_token=$(grep csrftoken cookies.txt | cut -f 7)</font></b></div><div class="gmail_default" style="">From the file that contains the cookies we are going to select the line that contains the word "<b><font face="monospace" color="#ff00ff">csrftoken</font></b>" and we are going to keep the value of its seventh position (that contains the token).</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">3. Do the POST petition and save the HTML:<font face="monospace"> <b><font color="#ff00ff">curl -s -b cookies.txt -F "csrfmiddlewaretoken=$csrf_token" -F "dashboard_mode=Default" -F "urlProject=" -F "zipFile=@</font><font color="#0000ff">PATH_OF_YOUR_SB3</font><font color="#ff00ff">" -F "_upload=['']" <a href="https://www.drscratch.org/show_dashboard/">https://www.drscratch.org/show_dashboard/</a> > temp.html</font></b></font></div><div class="gmail_default" style="">You just have to edit what I have marked in blue, indicating the path to your SB3 project. We are going to use curl again to make a POST request and we are going to manually create our form by manually adding the fields necessary for Dr. Scratch to function. The output is redirected to an HTML file, which will be the one we render later with Lynx. Remember that it is necessary to attach the cookies.txt because this file contains the data of the session with which we collected the security token, therefore we must continue using that session.<br></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">4. Render HTML:<font color="#ff00ff"> <font face="monospace"><b>lynx temp.html</b></font></font></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">And those would be the steps to be able to use the SB3 file with Lynx. As it is a bit heavy, <b>I have made a small script (a bit tacky) where you just have to run it and follow the steps, you can find it here (remember to give it execution permissions with chmod +x): </b><a href="https://github.com/Daniesmor/drscratch-lynx/blob/main/lynx_script.sh">https://github.com/Daniesmor/drscratch-lynx/blob/main/lynx_script.sh</a></div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">I hope that this works fine for you.</div><div class="gmail_default" style="">Thanks for use Dr. Scratch</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">Best.</div><div class="gmail_default" style="">Daniel.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue, 25 jul 2024 a las 5:02, <<a href="mailto:drscratchplus@gmail.com">drscratchplus@gmail.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
                Name: Bonnie,<br>
                Email: <a href="mailto:ttc000922@gmail.com" target="_blank">ttc000922@gmail.com</a>,<br>
                Text: Dear Dr. Scratch Team,<br>
<br>
I hope this message finds you well. I would like to begin by expressing my admiration for the Dr. Scratch tool. It has proven to be an invaluable resource for analyzing Scratch projects, and I am thoroughly impressed with its capabilities.<br>
<br>
However, I am reaching out to discuss a challenge I've encountered while using Dr. Scratch. I currently operate on a Linux server and access websites via Lynx, a text-based web browser. Unfortunately, I have been unable to successfully upload .sb3 files to the Dr. Scratch platform. Interestingly, I can upload URLs directly and even upload .txt files containing URLs without any issues, but my attempts to upload .sb3 files directly or within .zip archives have not been successful.<br>
<br>
Could you please inform me if your platform currently supports this functionality, or if there are specific settings or methods I should use to facilitate these uploads using Lynx?<br>
<br>
Thank you for your attention to this matter and for your continued dedication to making Dr. Scratch such a useful tool for the community. I look forward to your guidance and am eager to continue utilizing your excellent service.<br>
<br>
Best Regards,<br>
Bonnie.,<br>
                Media: None<br>
<br>
_______________________________________________<br>
drscratch mailing list<br>
<a href="mailto:drscratch@gsyc.urjc.es" target="_blank">drscratch@gsyc.urjc.es</a><br>
<a href="https://gsyc.urjc.es/cgi-bin/mailman/listinfo/drscratch" rel="noreferrer" target="_blank">https://gsyc.urjc.es/cgi-bin/mailman/listinfo/drscratch</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span style="font-family:"comic sans ms",sans-serif"><span style="color:rgb(204,0,0)"><b>Daniel Escobar Morales </b></span><br><i></i></span><span style="font-family:"comic sans ms",sans-serif"><span style="font-family:arial,sans-serif"></span><i>Researcher Assistant at Northeastern University (Boston, Massachusetts)</i></span><div><i><span style="font-family:"comic sans ms",sans-serif">Student of Telecommunications Technologies Engineering</span></i></div><div><span style="font-family:"comic sans ms",sans-serif"><br></span></div><div><span style="font-family:"comic sans ms",sans-serif">Rey Juan Carlos University | ETSIT<br></span></div><div><br></div><div>email: <a href="mailto:daniesmor@gsyc.urjc.es" target="_blank">daniesmor@gsyc.urjc.es</a></div><div>Github: <a href="https://github.com/Daniesmor" target="_blank">@daniesmor</a></div><div>website: <a href="https://daniesmor.github.io/" target="_blank">https://gsyc.urjc.es/~daniesmor/</a></div></div></div></div>