[DrScratch] [CONTACT FORM]

Daniel Escobar daniesmor at gsyc.urjc.es
Thu Jul 25 14:01:09 CEST 2024


Hi Bonnie,

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.

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 *curl*
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 *each
session and each user.* 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.

I will tell you the steps you need to follow in order to establish the
connection:

1. Execute this petition, this will create a new session and then save
it: *curl
-c cookies.txt https://www.drscratch.org/ <https://www.drscratch.org/>*
This command will make a request to the website, and thanks to the -c
parameter, it will return the site's cookies. From that TXT file, we can
extract the value of the *csrftoken *(the security token).

2. Establish a temporal environment variable with the csrf token:
*csrf_token=$(grep
csrftoken cookies.txt | cut -f 7)*
>From the file that contains the cookies we are going to select the line
that contains the word "*csrftoken*" and we are going to keep the value of
its seventh position (that contains the token).

3. Do the POST petition and save the HTML: *curl -s -b cookies.txt -F
"csrfmiddlewaretoken=$csrf_token" -F "dashboard_mode=Default" -F
"urlProject=" -F "zipFile=@PATH_OF_YOUR_SB3" -F "_upload=['']"
https://www.drscratch.org/show_dashboard/
<https://www.drscratch.org/show_dashboard/> > temp.html*
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.

4. Render HTML: *lynx temp.html*

And those would be the steps to be able to use the SB3 file with Lynx. As
it is a bit heavy, *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): *
https://github.com/Daniesmor/drscratch-lynx/blob/main/lynx_script.sh

I hope that this works fine for you.
Thanks for use Dr. Scratch

Best.
Daniel.

El jue, 25 jul 2024 a las 5:02, <drscratchplus at gmail.com> escribió:

>
>                 Name: Bonnie,
>                 Email: ttc000922 at gmail.com,
>                 Text: Dear Dr. Scratch Team,
>
> 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.
>
> 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.
>
> 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?
>
> 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.
>
> Best Regards,
> Bonnie.,
>                 Media: None
>
> _______________________________________________
> drscratch mailing list
> drscratch at gsyc.urjc.es
> https://gsyc.urjc.es/cgi-bin/mailman/listinfo/drscratch
>
>

-- 
*Daniel Escobar Morales *
*Researcher Assistant at Northeastern University (Boston, Massachusetts)*
*Student of Telecommunications Technologies Engineering*

Rey Juan Carlos University | ETSIT

email: daniesmor at gsyc.urjc.es
Github: @daniesmor <https://github.com/Daniesmor>
website: https://gsyc.urjc.es/~daniesmor/ <https://daniesmor.github.io/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gsyc.urjc.es/pipermail/drscratch/attachments/20240725/fe7dac88/attachment.htm>


More information about the drscratch mailing list